16 #ifndef dealii_data_out_dof_data_h 17 #define dealii_data_out_dof_data_h 21 #include <deal.II/base/config.h> 22 #include <deal.II/base/smartpointer.h> 23 #include <deal.II/base/data_out_base.h> 24 #include <deal.II/dofs/dof_handler.h> 25 #include <deal.II/grid/tria.h> 26 #include <deal.II/fe/mapping.h> 27 #include <deal.II/hp/q_collection.h> 28 #include <deal.II/hp/fe_collection.h> 29 #include <deal.II/hp/mapping_collection.h> 30 #include <deal.II/hp/fe_values.h> 31 #include <deal.II/numerics/data_postprocessor.h> 32 #include <deal.II/numerics/data_component_interpretation.h> 36 DEAL_II_NAMESPACE_OPEN
44 namespace DataOutImplementation
51 <<
"The number of subdivisions per patch, " << arg1
52 <<
", is not valid. It needs to be greater or equal to " 53 "one, or zero if you want it to be determined " 60 "For the operation you are attempting, you first need to " 61 "tell the DataOut or related object which DoFHandler or " 62 "triangulation you would like to work on.");
68 "For the operation you are attempting, you first need to " 69 "tell the DataOut or related object which DoFHandler " 70 "you would like to work on.");
77 <<
"The vector has size " << arg1
78 <<
" but the DoFHandler object says that there are " << arg2
79 <<
" degrees of freedom and there are " << arg3
80 <<
" active cells. The size of your vector needs to be" 81 <<
" either equal to the number of degrees of freedom, or" 82 <<
" equal to the number of active cells.");
88 <<
"Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
89 <<
"description strings since some graphics formats will only accept these." 91 <<
"The string you gave was <" << arg1
92 <<
">, within which the invalid character is <" << arg1[arg2]
93 <<
">." << std::endl);
98 "When attaching a triangulation or DoFHandler object, it is " 99 "not allowed if old data vectors are still referenced. If " 100 "you want to reuse an object of the current type, you first " 101 "need to call the 'clear_data_vector()' function.");
107 <<
"You have to give one name per component in your " 108 <<
"data vector. The number you gave was " << arg1
109 <<
", but the number of components is " << arg2
115 "While merging sets of patches, the two sets to be merged " 116 "need to refer to data that agrees on the names of the " 117 "various variables represented. In other words, you " 118 "cannot merge sets of patches that originate from " 119 "entirely unrelated simulations.");
124 "While merging sets of patches, the two sets to be merged " 125 "need to refer to data that agrees on the number of " 126 "subdivisions and other properties. In other words, you " 127 "cannot merge sets of patches that originate from " 128 "entirely unrelated simulations.");
132 <<
"When declaring that a number of components in a data " 133 <<
"set to be output logically form a vector instead of " 134 <<
"simply a set of scalar fields, you need to specify " 135 <<
"this for all relevant components. Furthermore, " 136 <<
"vectors must always consist of exactly <dim> " 137 <<
"components. However, the vector component at " 138 <<
"position " << arg1 <<
" with name <" << arg2
139 <<
"> does not satisfy these conditions.");
146 namespace DataOutImplementation
170 enum class ComponentExtractor
190 template <
typename DoFHandlerType>
200 const std::vector<std::string> &
names,
223 const ComponentExtractor extract_component)
const = 0;
233 const ComponentExtractor extract_component,
234 std::vector<double> &patch_values)
const = 0;
245 const ComponentExtractor extract_component,
256 const ComponentExtractor extract_component,
268 const ComponentExtractor extract_component,
279 const ComponentExtractor extract_component,
291 const ComponentExtractor extract_component,
303 virtual void clear () = 0;
319 const std::vector<std::string>
names;
326 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
361 template <
int dim,
int spacedim>
365 const unsigned int n_subdivisions,
366 const std::vector<unsigned int> &n_postprocessor_outputs,
370 const bool use_face_values);
374 template <
typename DoFHandlerType>
376 const typename ::Triangulation<dim,spacedim>::cell_iterator &cell,
380 get_present_fe_values(
const unsigned int dataset)
const;
382 void resize_system_vectors(
const unsigned int n_components);
384 const unsigned int n_datasets;
385 const unsigned int n_subdivisions;
389 std::vector<std::vector<::Vector<double> > > postprocessed_values;
391 const ::hp::MappingCollection<dim,spacedim> mapping_collection;
392 const std::vector<std::shared_ptr<::hp::FECollection<dim,spacedim> > > finite_elements;
395 std::vector<std::shared_ptr<::hp::FEValues<dim,spacedim> > > x_fe_values;
396 std::vector<std::shared_ptr<::hp::FEFaceValues<dim,spacedim> > > x_fe_face_values;
545 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim=patch_dim>
615 DoFHandlerType::space_dimension> &);
682 template <
class VectorType>
684 const std::vector<std::string> &names,
686 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation
687 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
705 template <
class VectorType>
707 const std::string &name,
709 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation
710 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
726 template <
class VectorType>
728 const VectorType &data,
729 const std::vector<std::string> &names,
730 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation
731 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
738 template <
class VectorType>
740 const VectorType &data,
741 const std::string &name,
742 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation
743 = std::vector<DataComponentInterpretation::DataComponentInterpretation>());
773 template <
class VectorType>
783 template <
class VectorType>
785 const VectorType &data,
831 template <
typename DoFHandlerType2>
841 virtual void clear ();
853 typedef ::DataOutBase::Patch<patch_dim,patch_space_dim>
Patch;
868 std::vector<std::shared_ptr<internal::DataOutImplementation::DataEntryBase<DoFHandlerType> > >
dof_data;
873 std::vector<std::shared_ptr<internal::DataOutImplementation::DataEntryBase<DoFHandlerType> > >
cell_data;
900 std::vector<std::shared_ptr<::hp::FECollection<DoFHandlerType::dimension,DoFHandlerType::space_dimension> > >
908 std::vector<std::tuple<unsigned int, unsigned int, std::string> >
915 template <
class,
int,
int>
921 template <
class VectorType>
924 (
const DoFHandlerType *dof_handler,
925 const VectorType &data,
926 const std::vector<std::string> &names,
928 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation,
929 const bool deduce_output_names);
935 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
936 template <
typename VectorType>
940 (
const VectorType &vec,
941 const std::string &name,
943 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
946 std::vector<std::string> names(1, name);
952 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
953 template <
typename VectorType>
957 (
const VectorType &vec,
958 const std::vector<std::string> &names,
960 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
968 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
969 template <
typename VectorType>
973 (
const DoFHandlerType &dof_handler,
974 const VectorType &data,
975 const std::string &name,
976 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
978 std::vector<std::string> names(1, name);
984 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
985 template <
typename VectorType>
989 (
const DoFHandlerType &dof_handler,
990 const VectorType &data,
991 const std::vector<std::string> &names,
992 const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
999 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1000 template <
typename VectorType>
1012 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1013 template <
typename DoFHandlerType2>
1019 const std::vector<Patch> &source_patches = source.
get_patches ();
1021 (source_patches.size () != 0),
1022 ExcMessage (
"When calling this function, both the current " 1023 "object and the one being merged need to have a " 1024 "nonzero number of patches associated with it. " 1025 "Either you called this function on objects that " 1026 "are empty, or you may have forgotten to call " 1027 "the 'build_patches()' function."));
1036 Assert (
patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1038 Assert (
patches[0].data.n_rows() == source_patches[0].data.n_rows(),
1040 Assert (
patches[0].data.n_cols() == source_patches[0].data.n_cols(),
1047 ExcMessage (
"Both sources need to declare the same components " 1053 ExcMessage (
"Both sources need to declare the same components " 1057 ExcMessage (
"Both sources need to declare the same components " 1061 ExcMessage (
"Both sources need to declare the same components " 1069 const unsigned int old_n_patches =
patches.size();
1071 source_patches.begin(),
1072 source_patches.end());
1076 for (
unsigned int i=old_n_patches; i<
patches.size(); ++i)
1077 for (
unsigned int v=0; v<GeometryInfo<patch_dim>::vertices_per_cell; ++v)
1078 patches[i].vertices[v] += shift;
1081 for (
unsigned int i=old_n_patches; i<
patches.size(); ++i)
1082 patches[i].patch_index += old_n_patches;
1085 for (
unsigned int i=old_n_patches; i<
patches.size(); ++i)
1086 for (
unsigned int n=0; n<GeometryInfo<patch_dim>::faces_per_cell; ++n)
1088 patches[i].neighbors[n] += old_n_patches;
1092 DEAL_II_NAMESPACE_CLOSE
void clear_input_data_references()
void merge_patches(const DataOut_DoFData< DoFHandlerType2, patch_dim, patch_space_dim > &source, const Point< patch_space_dim > &shift=Point< patch_space_dim >())
static const unsigned int invalid_unsigned_int
static ::ExceptionBase & ExcNoTriangulationSelected()
static ::ExceptionBase & ExcIncompatiblePatchLists()
::DataOutBase::Patch< patch_dim, patch_space_dim > Patch
#define DeclException2(Exception2, type1, type2, outsequence)
void attach_triangulation(const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &)
unsigned int n_output_variables
std::vector< std::shared_ptr<::hp::FECollection< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > > get_fes() const
static ::ExceptionBase & ExcOldDataStillPresent()
const std::vector< DataComponentInterpretation::DataComponentInterpretation > data_component_interpretation
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges() const
void attach_dof_handler(const DoFHandlerType &)
static ::ExceptionBase & ExcInvalidVectorSize(int arg1, int arg2, int arg3)
SmartPointer< const ::DataPostprocessor< DoFHandlerType::space_dimension > > postprocessor
Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension >::cell_iterator cell_iterator
virtual std::vector< std::string > get_dataset_names() const
static ::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
static ::ExceptionBase & ExcIncompatibleDatasetNames()
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcNoDoFHandlerSelected()
#define DeclException1(Exception1, type1, outsequence)
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< DoFHandlerType > > > dof_data
DataEntryBase(const DoFHandlerType *dofs, const std::vector< std::string > &names, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation)
#define Assert(cond, exc)
virtual ~DataOut_DoFData()
virtual void get_function_values(const FEValuesBase< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &fe_patch_values, const ComponentExtractor extract_component, std::vector< double > &patch_values) const =0
Abstract base class for mapping classes.
static ::ExceptionBase & ExcInvalidNumberOfNames(int arg1, int arg2)
virtual void get_function_gradients(const FEValuesBase< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &fe_patch_values, const ComponentExtractor extract_component, std::vector< Tensor< 1, DoFHandlerType::space_dimension > > &patch_gradients) const =0
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< DoFHandlerType > > > cell_data
static ::ExceptionBase & ExcInvalidVectorDeclaration(int arg1, std::string arg2)
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcInvalidCharacter(std::string arg1, size_t arg2)
std::vector< Patch > patches
virtual const std::vector< Patch > & get_patches() const
void add_data_vector(const VectorType &data, const std::vector< std::string > &names, const DataVectorType type=type_automatic, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation=std::vector< DataComponentInterpretation::DataComponentInterpretation >())
virtual bool is_complex_valued() const =0
std::size_t memory_consumption() const
static const unsigned int no_neighbor
SmartPointer< const DoFHandlerType > dof_handler
virtual void get_function_hessians(const FEValuesBase< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &fe_patch_values, const ComponentExtractor extract_component, std::vector< Tensor< 2, DoFHandlerType::space_dimension > > &patch_hessians) const =0
SmartPointer< const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > triangulation
const std::vector< std::string > names
virtual std::size_t memory_consumption() const =0
void add_data_vector_internal(const DoFHandlerType *dof_handler, const VectorType &data, const std::vector< std::string > &names, const DataVectorType type, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation, const bool deduce_output_names)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
void clear_data_vectors()
SmartPointer< const DoFHandlerType > dofs
virtual ~DataEntryBase()=default
virtual double get_cell_data_value(const unsigned int cell_number, const ComponentExtractor extract_component) const =0