16#ifndef dealii_data_out_dof_data_h
17#define dealii_data_out_dof_data_h
51 namespace DataOutImplementation
58 <<
"The number of subdivisions per patch, " << arg1
59 <<
", is not valid. It needs to be greater or equal to "
60 "one, or zero if you want it to be determined "
67 "For the operation you are attempting, you first need to "
68 "tell the DataOut or related object which DoFHandler or "
69 "triangulation you would like to work on. This is "
70 "generally done using the 'attach_dof_handler()' or "
71 "'attach_triangulation()' member functions.");
77 "For the operation you are attempting, you first need to "
78 "tell the DataOut or related object which DoFHandler "
79 "you would like to work on. This is "
80 "generally done using the 'attach_dof_handler()' "
90 <<
"The vector has size " << arg1
91 <<
" but the DoFHandler object says that there are " << arg2
92 <<
" degrees of freedom and there are " << arg3
93 <<
" active cells. The size of your vector needs to be"
94 <<
" either equal to the number of degrees of freedom (when"
95 <<
" the data is of type type_dof_data), or equal to the"
96 <<
" number of active cells (when the data is of type "
97 <<
" type_cell_data).");
105 <<
"Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
106 <<
"description strings since some graphics formats will only accept these."
108 <<
"The string you gave was <" << arg1
109 <<
">, within which the invalid character is <" << arg1[arg2] <<
">."
116 "When attaching a triangulation or DoFHandler object, it is "
117 "not allowed if old data vectors are still referenced. If "
118 "you want to reuse an object of the current type, you first "
119 "need to call the 'clear_data_vector()' function.");
126 <<
"You have to give one name per component in your "
127 <<
"data vector. The number you gave was " << arg1
128 <<
", but the number of components is " << arg2 <<
'.');
133 "While merging sets of patches, the two sets to be merged "
134 "need to refer to data that agrees on the names of the "
135 "various variables represented. In other words, you "
136 "cannot merge sets of patches that originate from "
137 "entirely unrelated simulations.");
142 "While merging sets of patches, the two sets to be merged "
143 "need to refer to data that agrees on the number of "
144 "subdivisions and other properties. In other words, you "
145 "cannot merge sets of patches that originate from "
146 "entirely unrelated simulations.");
151 <<
"When declaring that a number of components in a data "
152 <<
"set to be output logically form a vector instead of "
153 <<
"simply a set of scalar fields, you need to specify "
154 <<
"this for all relevant components. Furthermore, "
155 <<
"vectors must always consist of exactly <dim> "
156 <<
"components. However, the vector component at "
157 <<
"position " << arg1 <<
" with name <" << arg2
158 <<
"> does not satisfy these conditions.");
163 <<
"When declaring that a number of components in a data "
164 <<
"set to be output logically form a tensor instead of "
165 <<
"simply a set of scalar fields, you need to specify "
166 <<
"this for all relevant components. Furthermore, "
167 <<
"tensors must always consist of exactly <dim*dim> "
168 <<
"components. However, the tensor component at "
169 <<
"position " << arg1 <<
" with name <" << arg2
170 <<
"> does not satisfy these conditions.");
178 namespace DataOutImplementation
225 template <
int dim,
int spacedim>
235 const std::vector<std::string> &
names,
268 std::vector<double> &patch_values)
const = 0;
300 &patch_gradients_system)
const = 0;
321 &patch_hessians_system)
const = 0;
351 const std::vector<std::string>
names;
394 template <
int dim,
int spacedim>
400 const std::vector<unsigned int> &n_postprocessor_outputs,
406 const bool use_face_values);
411 const std::vector<unsigned int> &n_postprocessor_outputs,
412 const ::hp::MappingCollection<dim, spacedim> &mapping,
417 const bool use_face_values);
424 const typename ::Triangulation<dim, spacedim>::cell_iterator
443 std::shared_ptr<::hp::FECollection<dim, spacedim>>>
447 std::vector<std::shared_ptr<::hp::FEValues<dim, spacedim>>>
449 std::vector<std::shared_ptr<::hp::FEFaceValues<dim, spacedim>>>
596 int patch_spacedim = patch_dim>
729 template <
class VectorType>
732 const VectorType & data,
733 const std::vector<std::string> &names,
735 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
736 &data_component_interpretation = {});
754 template <
class VectorType>
757 const VectorType & data,
758 const std::string & name,
760 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
761 &data_component_interpretation = {});
778 template <
class VectorType>
782 const VectorType & data,
783 const std::vector<std::string> & names,
784 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
785 &data_component_interpretation = {});
792 template <
class VectorType>
796 const VectorType & data,
797 const std::string & name,
798 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
799 &data_component_interpretation = {});
827 template <
class VectorType>
838 template <
class VectorType>
841 const VectorType & data,
861 template <
class VectorType>
866 const std::vector<std::string> & names,
867 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
868 &data_component_interpretation = std::vector<
874 template <
class VectorType>
878 const std::string & name);
925 template <
int dim2,
int spacedim2>
935 template <
typename DoFHandlerType2>
939 DoFHandlerType2::space_dimension,
940 patch_spacedim> &source,
978 std::vector<std::shared_ptr<
985 std::vector<std::shared_ptr<
1001 virtual const std::vector<Patch> &
1009 virtual std::vector<std::string>
1016 virtual std::vector<
1017 std::tuple<
unsigned int,
1028 std::vector<std::shared_ptr<::hp::FECollection<dim, spacedim>>>
1033 template <
int,
int,
int,
int>
1038 template <
int,
class>
1045 template <
class VectorType>
1049 const VectorType & data,
1050 const std::vector<std::string> & names,
1052 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1053 & data_component_interpretation,
1054 const bool deduce_output_names);
1060template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1061template <
typename VectorType>
1064 const VectorType & vec,
1065 const std::string & name,
1067 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1068 &data_component_interpretation)
1072 std::vector<std::string> names(1, name);
1073 add_data_vector_internal(
1074 dofs, vec, names, type, data_component_interpretation,
true);
1079template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1080template <
typename VectorType>
1083 const VectorType & vec,
1084 const std::vector<std::string> &names,
1086 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1087 &data_component_interpretation)
1091 add_data_vector_internal(
1092 dofs, vec, names, type, data_component_interpretation,
false);
1097template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1098template <
typename VectorType>
1102 const VectorType & data,
1103 const std::string & name,
1104 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1105 &data_component_interpretation)
1107 std::vector<std::string> names(1, name);
1108 add_data_vector_internal(&dof_handler,
1112 data_component_interpretation,
1118template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1119template <
typename VectorType>
1123 const VectorType & data,
1124 const std::vector<std::string> & names,
1125 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1126 &data_component_interpretation)
1128 add_data_vector_internal(&dof_handler,
1132 data_component_interpretation,
1138template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1139template <
typename VectorType>
1142 const VectorType & vec,
1147 add_data_vector(*dofs, vec, data_postprocessor);
1152template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1153template <
int dim2,
int spacedim2>
1159 const std::vector<Patch> &source_patches = source.
get_patches();
1160 Assert((patches.size() != 0) && (source_patches.size() != 0),
1161 ExcMessage(
"When calling this function, both the current "
1162 "object and the one being merged need to have a "
1163 "nonzero number of patches associated with it. "
1164 "Either you called this function on objects that "
1165 "are empty, or you may have forgotten to call "
1166 "the 'build_patches()' function."));
1185 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1187 Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(),
1189 Assert((patches[0].data.n_rows() +
1190 (patches[0].points_are_available ? 0 : patch_spacedim)) ==
1191 (source_patches[0].data.n_rows() +
1192 (source_patches[0].points_are_available ? 0 : patch_spacedim)),
1197 Assert(get_nonscalar_data_ranges().size() ==
1199 ExcMessage(
"Both sources need to declare the same components "
1201 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
1203 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
1205 ExcMessage(
"Both sources need to declare the same components "
1207 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
1209 ExcMessage(
"Both sources need to declare the same components "
1211 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
1213 ExcMessage(
"Both sources need to declare the same components "
1221 const unsigned int old_n_patches = patches.size();
1222 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
1226 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1228 patches[i].vertices[v] += shift;
1231 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1232 patches[i].patch_index += old_n_patches;
1235 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1237 if (patches[i].neighbors[n] != Patch::no_neighbor)
1238 patches[i].neighbors[n] += old_n_patches;
1243template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1244template <
typename DoFHandlerType2>
1249 DoFHandlerType2::space_dimension,
1250 patch_spacedim> &source,
1253 this->merge_patches<DoFHandlerType2::dimension,
1254 DoFHandlerType2::space_dimension>(source, shift);
1265 template <
typename DoFHandlerType,
1267 int patch_space_dim = patch_dim>
1271 DoFHandlerType::space_dimension,
void add_data_vector(const VectorType &data, const std::string &name, const DataVectorType type=type_automatic, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation={})
std::vector< std::shared_ptr<::hp::FECollection< dim, spacedim > > > get_fes() const
virtual std::vector< std::string > get_dataset_names() const override
void clear_data_vectors()
void add_data_vector(const DoFHandler< dim, spacedim > &dof_handler, const VectorType &data, const std::string &name, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation={})
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< dim, spacedim > > > cell_data
std::vector< Patch > patches
void add_data_vector(const DoFHandler< dim, spacedim > &dof_handler, const VectorType &data, const DataPostprocessor< spacedim > &data_postprocessor)
void merge_patches(const DataOut_DoFData< dim2, patch_dim, spacedim2, patch_spacedim > &source, const Point< patch_spacedim > &shift=Point< patch_spacedim >())
void add_data_vector_internal(const DoFHandler< dim, spacedim > *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)
void add_data_vector(const VectorType &data, const DataPostprocessor< spacedim > &data_postprocessor)
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< dim, spacedim > > > dof_data
SmartPointer< const DoFHandler< dim, spacedim > > dofs
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
virtual const std::vector< Patch > & get_patches() const override
void attach_dof_handler(const DoFHandler< dim, spacedim > &)
void add_data_vector(const DoFHandler< dim, spacedim > &dof_handler, const VectorType &data, const std::vector< std::string > &names, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation={})
std::size_t memory_consumption() const
void add_mg_data_vector(const DoFHandler< dim, spacedim > &dof_handler, const MGLevelObject< VectorType > &data, const std::vector< std::string > &names, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation=std::vector< DataComponentInterpretation::DataComponentInterpretation >())
void clear_input_data_references()
typename Triangulation< dim, spacedim >::cell_iterator cell_iterator
void add_mg_data_vector(const DoFHandler< dim, spacedim > &dof_handler, const MGLevelObject< VectorType > &data, const std::string &name)
void merge_patches(const DataOut_DoFData< DoFHandlerType2::dimension, patch_dim, DoFHandlerType2::space_dimension, patch_spacedim > &source, const Point< patch_spacedim > &shift=Point< patch_spacedim >())
void attach_triangulation(const Triangulation< dim, spacedim > &)
SmartPointer< const Triangulation< dim, spacedim > > triangulation
virtual ~DataOut_DoFData() override
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={})
Abstract base class for mapping classes.
const std::vector< DataComponentInterpretation::DataComponentInterpretation > data_component_interpretation
virtual void get_function_gradients(const FEValuesBase< dim, spacedim > &fe_patch_values, const ComponentExtractor extract_component, std::vector< std::vector< Tensor< 1, spacedim > > > &patch_gradients_system) const =0
virtual void get_function_gradients(const FEValuesBase< dim, spacedim > &fe_patch_values, const ComponentExtractor extract_component, std::vector< Tensor< 1, spacedim > > &patch_gradients) const =0
virtual void get_function_values(const FEValuesBase< dim, spacedim > &fe_patch_values, const ComponentExtractor extract_component, std::vector< double > &patch_values) const =0
SmartPointer< const DoFHandler< dim, spacedim > > dof_handler
virtual bool is_complex_valued() const =0
virtual double get_cell_data_value(const unsigned int cell_number, const ComponentExtractor extract_component) const =0
virtual void get_function_hessians(const FEValuesBase< dim, spacedim > &fe_patch_values, const ComponentExtractor extract_component, std::vector< Tensor< 2, spacedim > > &patch_hessians) const =0
virtual std::size_t memory_consumption() const =0
unsigned int n_output_variables
const std::vector< std::string > names
virtual void get_function_hessians(const FEValuesBase< dim, spacedim > &fe_patch_values, const ComponentExtractor extract_component, std::vector< std::vector< Tensor< 2, spacedim > > > &patch_hessians_system) const =0
virtual ~DataEntryBase()=default
SmartPointer< const ::DataPostprocessor< spacedim > > postprocessor
DataEntryBase(const DoFHandler< dim, spacedim > *dofs, const std::vector< std::string > &names, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation)
virtual void get_function_values(const FEValuesBase< dim, spacedim > &fe_patch_values, const ComponentExtractor extract_component, std::vector<::Vector< double > > &patch_values_system) const =0
DataEntryBase(const DoFHandler< dim, spacedim > *dofs, const DataPostprocessor< spacedim > *data_postprocessor)
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIncompatiblePatchLists()
static ::ExceptionBase & ExcInvalidCharacter(std::string arg1, size_t arg2)
static ::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
static ::ExceptionBase & ExcInvalidNumberOfNames(int arg1, int arg2)
static ::ExceptionBase & ExcIncompatibleDatasetNames()
#define Assert(cond, exc)
static ::ExceptionBase & ExcNoDoFHandlerSelected()
static ::ExceptionBase & ExcOldDataStillPresent()
static ::ExceptionBase & ExcInvalidTensorDeclaration(int arg1, std::string arg2)
#define DeclException2(Exception2, type1, type2, outsequence)
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcInvalidVectorDeclaration(int arg1, std::string arg2)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
static ::ExceptionBase & ExcNoTriangulationSelected()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcInvalidVectorSize(int arg1, int arg2, int arg3)
static ::ExceptionBase & ExcMessage(std::string arg1)
DataComponentInterpretation
static const unsigned int invalid_unsigned_int
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
const FEValuesBase< dim, spacedim > & get_present_fe_values(const unsigned int dataset) const
std::vector< std::shared_ptr<::hp::FEFaceValues< dim, spacedim > > > x_fe_face_values
ParallelDataBase(const unsigned int n_datasets, const unsigned int n_subdivisions, const std::vector< unsigned int > &n_postprocessor_outputs, const ::hp::MappingCollection< dim, spacedim > &mapping, const std::vector< std::shared_ptr<::hp::FECollection< dim, spacedim > > > &finite_elements, const UpdateFlags update_flags, const bool use_face_values)
const unsigned int n_datasets
DataPostprocessorInputs::Scalar< spacedim > patch_values_scalar
ParallelDataBase(const unsigned int n_datasets, const unsigned int n_subdivisions, const std::vector< unsigned int > &n_postprocessor_outputs, const Mapping< dim, spacedim > &mapping, const std::vector< std::shared_ptr<::hp::FECollection< dim, spacedim > > > &finite_elements, const UpdateFlags update_flags, const bool use_face_values)
const unsigned int n_subdivisions
const std::vector< std::shared_ptr<::hp::FECollection< dim, spacedim > > > finite_elements
std::vector< std::vector<::Vector< double > > > postprocessed_values
const ::hp::MappingCollection< dim, spacedim > mapping_collection
std::vector< std::shared_ptr<::hp::FEValues< dim, spacedim > > > x_fe_values
DataPostprocessorInputs::Vector< spacedim > patch_values_system
ParallelDataBase(const ParallelDataBase &data)
void reinit_all_fe_values(std::vector< std::shared_ptr< DataEntryBase< dim, spacedim > > > &dof_data, const typename ::Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face=numbers::invalid_unsigned_int)
const UpdateFlags update_flags
void resize_system_vectors(const unsigned int n_components)