Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
point_value_history.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_point_value_history_h
18 #define dealii_point_value_history_h
19 
20 #include <deal.II/base/config.h>
21 
23 #include <deal.II/base/point.h>
26 #include <deal.II/base/utilities.h>
27 
30 
32 #include <deal.II/fe/fe_q.h>
33 #include <deal.II/fe/fe_values.h>
34 #include <deal.II/fe/mapping.h>
35 #include <deal.II/fe/mapping_q1.h>
36 
38 
39 #include <deal.II/lac/vector.h>
40 
42 
43 #include <fstream>
44 #include <iostream>
45 #include <map>
46 #include <sstream>
47 #include <string>
48 #include <vector>
49 
51 
52 namespace internal
53 {
54  namespace PointValueHistoryImplementation
55  {
60  template <int dim>
62  {
63  public:
65  const Point<dim> & new_requested_location,
66  const std::vector<Point<dim>> & new_locations,
67  const std::vector<types::global_dof_index> &new_sol_indices);
69  std::vector<Point<dim>> support_point_locations;
70  std::vector<types::global_dof_index> solution_indices;
71  };
72  } // namespace PointValueHistoryImplementation
73 } // namespace internal
74 
75 
76 
213 template <int dim>
215 {
216 public:
222  PointValueHistory(const unsigned int n_independent_variables = 0);
223 
239  const unsigned int n_independent_variables = 0);
240 
246  PointValueHistory(const PointValueHistory &point_value_history);
247 
256  operator=(const PointValueHistory &point_value_history);
257 
262 
270  void
271  add_point(const Point<dim> &location);
272 
283  void
284  add_points(const std::vector<Point<dim>> &locations);
285 
286 
287 
295  void
296  add_field_name(const std::string & vector_name,
298 
307  void
308  add_field_name(const std::string &vector_name,
309  const unsigned int n_components);
310 
315  void
316  add_component_names(const std::string & vector_name,
317  const std::vector<std::string> &component_names);
318 
323  void
324  add_independent_names(const std::vector<std::string> &independent_names);
325 
326 
327 
336  template <class VectorType>
337  void
338  evaluate_field(const std::string &name, const VectorType &solution);
339 
340 
358  template <class VectorType>
359  void
360  evaluate_field(const std::vector<std::string> &names,
361  const VectorType & solution,
362  const DataPostprocessor<dim> & data_postprocessor,
363  const Quadrature<dim> & quadrature);
364 
370  template <class VectorType>
371  void
372  evaluate_field(const std::string & name,
373  const VectorType & solution,
374  const DataPostprocessor<dim> &data_postprocessor,
375  const Quadrature<dim> & quadrature);
376 
377 
390  template <class VectorType>
391  void
392  evaluate_field_at_requested_location(const std::string &name,
393  const VectorType & solution);
394 
395 
404  void
405  start_new_dataset(const double key);
406 
413  void
414  push_back_independent(const std::vector<double> &independent_values);
415 
416 
435  void
436  write_gnuplot(const std::string & base_name,
437  const std::vector<Point<dim>> &postprocessor_locations =
438  std::vector<Point<dim>>());
439 
440 
466 
474  void
475  get_support_locations(std::vector<std::vector<Point<dim>>> &locations);
476 
486  void
487  get_points(std::vector<std::vector<Point<dim>>> &locations);
488 
498  void
499  get_postprocessor_locations(const Quadrature<dim> & quadrature,
500  std::vector<Point<dim>> &locations);
501 
513  void
514  close();
515 
516 
526  void
527  clear();
528 
534  void
535  status(std::ostream &out);
536 
537 
546  bool
547  deep_check(const bool strict);
548 
553  "A call has been made to push_back_independent() when "
554  "no independent values were requested.");
555 
561  "This error is thrown to indicate that the data sets appear to be out of "
562  "sync. The class requires that the number of dataset keys is the same as "
563  "the number of independent values sets and mesh linked value sets. The "
564  "number of each of these is allowed to differ by one to allow new values "
565  "to be added with out restricting the order the user choses to do so. "
566  "Special cases of no FHandler and no independent values should not "
567  "trigger this error.");
568 
569 
575  "A method which requires access to a @p DoFHandler to be meaningful has "
576  "been called when have_dof_handler is false (most likely due to default "
577  "constructor being called). Only independent variables may be logged with "
578  "no DoFHandler.");
579 
585  "The triangulation has been refined or coarsened in some way. This "
586  "suggests that the internal DoF indices stored by the current "
587  "object are no longer meaningful.");
588 
589 private:
594  std::vector<double> dataset_key;
595 
599  std::vector<std::vector<double>> independent_values;
600 
606  std::vector<std::string> indep_names;
607 
615  std::map<std::string, std::vector<std::vector<double>>> data_store;
616 
620  std::map<std::string, ComponentMask> component_mask;
621 
622 
627  std::map<std::string, std::vector<std::string>> component_names_map;
628 
632  std::vector<internal::PointValueHistoryImplementation::PointGeometryData<dim>>
634 
635 
639  bool closed;
640 
644  bool cleared;
645 
646 
652 
653 
660 
666 
670  boost::signals2::connection tria_listener;
671 
675  unsigned int n_indep;
676 
677 
685  void
687 };
688 
689 
691 #endif /* dealii_point_value_history_h */
PointValueHistory::cleared
bool cleared
Definition: point_value_history.h:644
DeclExceptionMsg
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
DataPostprocessor
Definition: data_postprocessor.h:502
fe_values.h
PointValueHistory::PointValueHistory
PointValueHistory(const unsigned int n_independent_variables=0)
Definition: point_value_history.cc:58
PointValueHistory::ExcNoIndependent
static ::ExceptionBase & ExcNoIndependent()
PointValueHistory::independent_values
std::vector< std::vector< double > > independent_values
Definition: point_value_history.h:599
PointValueHistory::dataset_key
std::vector< double > dataset_key
Definition: point_value_history.h:594
PointValueHistory::add_points
void add_points(const std::vector< Point< dim >> &locations)
Definition: point_value_history.cc:321
internal::PointValueHistoryImplementation::PointGeometryData::solution_indices
std::vector< types::global_dof_index > solution_indices
Definition: point_value_history.h:70
utilities.h
mapping_q1.h
internal::PointValueHistoryImplementation::PointGeometryData::support_point_locations
std::vector< Point< dim > > support_point_locations
Definition: point_value_history.h:69
VectorType
PointValueHistory::indep_names
std::vector< std::string > indep_names
Definition: point_value_history.h:606
PointValueHistory::add_field_name
void add_field_name(const std::string &vector_name, const ComponentMask &component_mask=ComponentMask())
Definition: point_value_history.cc:458
PointValueHistory::get_support_locations
void get_support_locations(std::vector< std::vector< Point< dim >>> &locations)
Definition: point_value_history.cc:1229
ComponentMask
Definition: component_mask.h:83
PointValueHistory::have_dof_handler
bool have_dof_handler
Definition: point_value_history.h:665
PointValueHistory::ExcDoFHandlerRequired
static ::ExceptionBase & ExcDoFHandlerRequired()
DoFTools::n_components
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
DoFHandler< dim >
quadrature_lib.h
PointValueHistory
Definition: point_value_history.h:214
PointValueHistory::evaluate_field
void evaluate_field(const std::string &name, const VectorType &solution)
Definition: point_value_history.cc:580
PointValueHistory::start_new_dataset
void start_new_dataset(const double key)
Definition: point_value_history.cc:960
PointValueHistory::dof_handler
SmartPointer< const DoFHandler< dim >, PointValueHistory< dim > > dof_handler
Definition: point_value_history.h:651
PointValueHistory::ExcDoFHandlerChanged
static ::ExceptionBase & ExcDoFHandlerChanged()
PointValueHistory::closed
bool closed
Definition: point_value_history.h:639
grid_tools.h
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
PointValueHistory::operator=
PointValueHistory & operator=(const PointValueHistory &point_value_history)
Definition: point_value_history.cc:139
PointValueHistory::add_component_names
void add_component_names(const std::string &vector_name, const std::vector< std::string > &component_names)
Definition: point_value_history.cc:514
PointValueHistory::add_independent_names
void add_independent_names(const std::vector< std::string > &independent_names)
Definition: point_value_history.cc:537
PointValueHistory::clear
void clear()
Definition: point_value_history.cc:558
PointValueHistory::tria_listener
boost::signals2::connection tria_listener
Definition: point_value_history.h:670
PointValueHistory::evaluate_field_at_requested_location
void evaluate_field_at_requested_location(const std::string &name, const VectorType &solution)
Definition: point_value_history.cc:891
PointValueHistory::mark_support_locations
Vector< double > mark_support_locations()
Definition: point_value_history.cc:1201
DEAL_II_DEPRECATED
#define DEAL_II_DEPRECATED
Definition: config.h:98
PointValueHistory::get_postprocessor_locations
void get_postprocessor_locations(const Quadrature< dim > &quadrature, std::vector< Point< dim >> &locations)
Definition: point_value_history.cc:1260
PointValueHistory::ExcDataLostSync
static ::ExceptionBase & ExcDataLostSync()
smartpointer.h
fe_q.h
component_mask.h
PointValueHistory::write_gnuplot
void write_gnuplot(const std::string &base_name, const std::vector< Point< dim >> &postprocessor_locations=std::vector< Point< dim >>())
Definition: point_value_history.cc:997
exceptions.h
data_postprocessor.h
SmartPointer
Definition: smartpointer.h:68
PointValueHistory::close
void close()
Definition: point_value_history.cc:549
PointValueHistory::data_store
std::map< std::string, std::vector< std::vector< double > > > data_store
Definition: point_value_history.h:615
mapping.h
PointValueHistory::triangulation_changed
bool triangulation_changed
Definition: point_value_history.h:659
PointValueHistory::component_mask
std::map< std::string, ComponentMask > component_mask
Definition: point_value_history.h:620
vector.h
dof_handler.h
dof_accessor.h
PointValueHistory::add_point
void add_point(const Point< dim > &location)
Definition: point_value_history.cc:185
PointValueHistory::tria_change_listener
void tria_change_listener()
Definition: point_value_history.cc:1489
PointValueHistory::status
void status(std::ostream &out)
Definition: point_value_history.cc:1314
Point< dim >
config.h
PointValueHistory::~PointValueHistory
~PointValueHistory()
Definition: point_value_history.cc:173
internal
Definition: aligned_vector.h:369
PointValueHistory::get_points
void get_points(std::vector< std::vector< Point< dim >>> &locations)
Definition: point_value_history.cc:1251
PointValueHistory::component_names_map
std::map< std::string, std::vector< std::string > > component_names_map
Definition: point_value_history.h:627
internal::PointValueHistoryImplementation::PointGeometryData::PointGeometryData
PointGeometryData(const Point< dim > &new_requested_location, const std::vector< Point< dim >> &new_locations, const std::vector< types::global_dof_index > &new_sol_indices)
Only a constructor needed for this class (a struct really)
Definition: point_value_history.cc:43
internal::PointValueHistoryImplementation::PointGeometryData
Definition: point_value_history.h:61
PointValueHistory::deep_check
bool deep_check(const bool strict)
Definition: point_value_history.cc:1427
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Quadrature
Definition: quadrature.h:85
internal::PointValueHistoryImplementation::PointGeometryData::requested_location
Point< dim > requested_location
Definition: point_value_history.h:68
Vector< double >
PointValueHistory::n_indep
unsigned int n_indep
Definition: point_value_history.h:675
PointValueHistory::push_back_independent
void push_back_independent(const std::vector< double > &independent_values)
Definition: point_value_history.cc:975
PointValueHistory::point_geometry_data
std::vector< internal::PointValueHistoryImplementation::PointGeometryData< dim > > point_geometry_data
Definition: point_value_history.h:633
point.h