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>
966 std::vector<std::shared_ptr<
973 std::vector<std::shared_ptr<
989 virtual const std::vector<Patch> &
997 virtual std::vector<std::string>
1004 virtual std::vector<
1005 std::tuple<
unsigned int,
1016 std::vector<std::shared_ptr<::hp::FECollection<dim, spacedim>>>
1021 template <
int,
int,
int,
int>
1026 template <
int,
class>
1033 template <
class VectorType>
1037 const VectorType & data,
1038 const std::vector<std::string> & names,
1040 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1041 & data_component_interpretation,
1042 const bool deduce_output_names);
1048template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1049template <
typename VectorType>
1052 const VectorType & vec,
1053 const std::string & name,
1055 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1056 &data_component_interpretation)
1060 std::vector<std::string> names(1, name);
1061 add_data_vector_internal(
1062 dofs, vec, names, type, data_component_interpretation,
true);
1067template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1068template <
typename VectorType>
1071 const VectorType & vec,
1072 const std::vector<std::string> &names,
1074 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1075 &data_component_interpretation)
1079 add_data_vector_internal(
1080 dofs, vec, names, type, data_component_interpretation,
false);
1085template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1086template <
typename VectorType>
1090 const VectorType & data,
1091 const std::string & name,
1092 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1093 &data_component_interpretation)
1095 std::vector<std::string> names(1, name);
1096 add_data_vector_internal(&dof_handler,
1100 data_component_interpretation,
1106template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1107template <
typename VectorType>
1111 const VectorType & data,
1112 const std::vector<std::string> & names,
1113 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1114 &data_component_interpretation)
1116 add_data_vector_internal(&dof_handler,
1120 data_component_interpretation,
1126template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1127template <
typename VectorType>
1130 const VectorType & vec,
1135 add_data_vector(*dofs, vec, data_postprocessor);
1140template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1141template <
int dim2,
int spacedim2>
1147 const std::vector<Patch> &source_patches = source.
get_patches();
1148 Assert((patches.size() != 0) && (source_patches.size() != 0),
1149 ExcMessage(
"When calling this function, both the current "
1150 "object and the one being merged need to have a "
1151 "nonzero number of patches associated with it. "
1152 "Either you called this function on objects that "
1153 "are empty, or you may have forgotten to call "
1154 "the 'build_patches()' function."));
1173 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1175 Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(),
1177 Assert((patches[0].data.n_rows() +
1178 (patches[0].points_are_available ? 0 : patch_spacedim)) ==
1179 (source_patches[0].data.n_rows() +
1180 (source_patches[0].points_are_available ? 0 : patch_spacedim)),
1185 Assert(get_nonscalar_data_ranges().size() ==
1187 ExcMessage(
"Both sources need to declare the same components "
1189 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
1191 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
1193 ExcMessage(
"Both sources need to declare the same components "
1195 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
1197 ExcMessage(
"Both sources need to declare the same components "
1199 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
1201 ExcMessage(
"Both sources need to declare the same components "
1209 const unsigned int old_n_patches = patches.size();
1210 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
1214 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1219 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1220 patches[i].patch_index += old_n_patches;
1223 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1225 if (patches[i].neighbors[n] != Patch::no_neighbor)
1226 patches[i].neighbors[n] += old_n_patches;
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 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_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
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices()
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)