13#ifndef dealii_data_out_dof_data_h
14#define dealii_data_out_dof_data_h
48 namespace DataOutImplementation
55 <<
"The number of subdivisions per patch, " << arg1
56 <<
", is not valid. It needs to be greater or equal to "
57 "one, or zero if you want it to be determined "
64 "For the operation you are attempting, you first need to "
65 "tell the DataOut or related object which DoFHandler or "
66 "triangulation you would like to work on. This is "
67 "generally done using the 'attach_dof_handler()' or "
68 "'attach_triangulation()' member functions.");
74 "For the operation you are attempting, you first need to "
75 "tell the DataOut or related object which DoFHandler "
76 "you would like to work on. This is "
77 "generally done using the 'attach_dof_handler()' "
87 <<
"The vector has size " << arg1
88 <<
" but the DoFHandler object says that there are " << arg2
89 <<
" degrees of freedom and there are " << arg3
90 <<
" active cells. The size of your vector needs to be"
91 <<
" either equal to the number of degrees of freedom (when"
92 <<
" the data is of type type_dof_data), or equal to the"
93 <<
" number of active cells (when the data is of type "
94 <<
" type_cell_data).");
102 <<
"Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
103 <<
"description strings since some graphics formats will only accept these."
105 <<
"The string you gave was <" << arg1
106 <<
">, within which the invalid character is <" << arg1[arg2] <<
">."
113 "When attaching a triangulation or DoFHandler object, it is "
114 "not allowed if old data vectors are still referenced. If "
115 "you want to reuse an object of the current type, you first "
116 "need to call the 'clear_data_vector()' function.");
123 <<
"You have to give one name per component in your "
124 <<
"data vector. The number you gave was " << arg1
125 <<
", but the number of components is " << arg2 <<
'.');
130 "While merging sets of patches, the two sets to be merged "
131 "need to refer to data that agrees on the names of the "
132 "various variables represented. In other words, you "
133 "cannot merge sets of patches that originate from "
134 "entirely unrelated simulations.");
139 "While merging sets of patches, the two sets to be merged "
140 "need to refer to data that agrees on the number of "
141 "subdivisions and other properties. In other words, you "
142 "cannot merge sets of patches that originate from "
143 "entirely unrelated simulations.");
148 <<
"When declaring that a number of components in a data "
149 <<
"set to be output logically form a vector instead of "
150 <<
"simply a set of scalar fields, you need to specify "
151 <<
"this for all relevant components. Furthermore, "
152 <<
"vectors must always consist of exactly <dim> "
153 <<
"components. However, the vector component at "
154 <<
"position " << arg1 <<
" with name <" << arg2
155 <<
"> does not satisfy these conditions.");
160 <<
"When declaring that a number of components in a data "
161 <<
"set to be output logically form a tensor instead of "
162 <<
"simply a set of scalar fields, you need to specify "
163 <<
"this for all relevant components. Furthermore, "
164 <<
"tensors must always consist of exactly <dim*dim> "
165 <<
"components. However, the tensor component at "
166 <<
"position " << arg1 <<
" with name <" << arg2
167 <<
"> does not satisfy these conditions.");
175 namespace DataOutImplementation
222 template <
int dim,
int spacedim>
232 const std::vector<std::string> &
names,
265 std::vector<double> &patch_values)
const = 0;
297 &patch_gradients_system)
const = 0;
318 &patch_hessians_system)
const = 0;
348 const std::vector<std::string>
names;
391 template <
int dim,
int spacedim>
397 const std::vector<unsigned int> &n_postprocessor_outputs,
403 const bool use_face_values);
408 const std::vector<unsigned int> &n_postprocessor_outputs,
409 const ::hp::MappingCollection<dim, spacedim> &mapping,
414 const bool use_face_values);
421 const typename ::Triangulation<dim, spacedim>::cell_iterator
440 std::shared_ptr<::hp::FECollection<dim, spacedim>>>
444 std::vector<std::shared_ptr<::hp::FEValues<dim, spacedim>>>
446 std::vector<std::shared_ptr<::hp::FEFaceValues<dim, spacedim>>>
593 int patch_spacedim = patch_dim>
726 template <
typename VectorType>
729 const VectorType &
data,
730 const std::vector<std::string> &names,
732 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
733 &data_component_interpretation = {});
751 template <
typename VectorType>
754 const VectorType &
data,
755 const std::string &name,
757 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
758 &data_component_interpretation = {});
775 template <
typename VectorType>
779 const VectorType &
data,
780 const std::vector<std::string> &names,
781 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
782 &data_component_interpretation = {});
789 template <
typename VectorType>
793 const VectorType &
data,
794 const std::string &name,
795 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
796 &data_component_interpretation = {});
824 template <
typename VectorType>
835 template <
typename VectorType>
838 const VectorType &
data,
858 template <
typename VectorType>
863 const std::vector<std::string> &names,
864 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
865 &data_component_interpretation = std::vector<
871 template <
typename VectorType>
875 const std::string &name);
922 template <
int dim2,
int spacedim2>
963 std::vector<std::shared_ptr<
970 std::vector<std::shared_ptr<
986 virtual const std::vector<Patch> &
994 virtual std::vector<std::string>
1001 virtual std::vector<
1002 std::tuple<
unsigned int,
1013 std::vector<std::shared_ptr<::hp::FECollection<dim, spacedim>>>
1018 template <
int,
int,
int,
int>
1023 template <
int,
class>
1030 template <
typename VectorType>
1034 const VectorType &
data,
1035 const std::vector<std::string> &names,
1037 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1038 &data_component_interpretation,
1039 const bool deduce_output_names);
1045template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1046template <
typename VectorType>
1049 const VectorType &vec,
1050 const std::string &name,
1052 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1053 &data_component_interpretation)
1055 Assert(triangulation !=
nullptr,
1057 std::vector<std::string> names(1, name);
1058 add_data_vector_internal(
1059 dofs, vec, names, type, data_component_interpretation,
true);
1064template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1065template <
typename VectorType>
1068 const VectorType &vec,
1069 const std::vector<std::string> &names,
1071 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1072 &data_component_interpretation)
1074 Assert(triangulation !=
nullptr,
1076 add_data_vector_internal(
1077 dofs, vec, names, type, data_component_interpretation,
false);
1082template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1083template <
typename VectorType>
1087 const VectorType &
data,
1088 const std::string &name,
1089 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1090 &data_component_interpretation)
1092 std::vector<std::string> names(1, name);
1093 add_data_vector_internal(&dof_handler,
1097 data_component_interpretation,
1103template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1104template <
typename VectorType>
1108 const VectorType &
data,
1109 const std::vector<std::string> &names,
1110 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1111 &data_component_interpretation)
1113 add_data_vector_internal(&dof_handler,
1117 data_component_interpretation,
1123template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1124template <
typename VectorType>
1127 const VectorType &vec,
1132 add_data_vector(*dofs, vec, data_postprocessor);
1137template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1138template <
int dim2,
int spacedim2>
1144 const std::vector<Patch> &source_patches = source.
get_patches();
1145 Assert((patches.size() != 0) && (source_patches.size() != 0),
1146 ExcMessage(
"When calling this function, both the current "
1147 "object and the one being merged need to have a "
1148 "nonzero number of patches associated with it. "
1149 "Either you called this function on objects that "
1150 "are empty, or you may have forgotten to call "
1151 "the 'build_patches()' function."));
1170 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1172 Assert(patches[0].
data.n_cols() == source_patches[0].data.n_cols(),
1175 (patches[0].points_are_available ? 0 : patch_spacedim)) ==
1176 (source_patches[0].data.n_rows() +
1177 (source_patches[0].points_are_available ? 0 : patch_spacedim)),
1184 ExcMessage(
"Both sources need to declare the same components "
1186 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
1188 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
1190 ExcMessage(
"Both sources need to declare the same components "
1192 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
1194 ExcMessage(
"Both sources need to declare the same components "
1196 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
1198 ExcMessage(
"Both sources need to declare the same components "
1206 const unsigned int old_n_patches = patches.size();
1207 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
1211 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1213 patches[i].vertices[v] += shift;
1216 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1217 patches[i].patch_index += old_n_patches;
1220 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1222 if (patches[i].neighbors[n] != Patch::no_neighbor)
1223 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
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 > &)
ObserverPointer< const Triangulation< dim, spacedim > > triangulation
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)
ObserverPointer< const DoFHandler< dim, spacedim > > dofs
void attach_triangulation(const Triangulation< dim, spacedim > &)
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
ObserverPointer< const DoFHandler< dim, spacedim > > dof_handler
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
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
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)
ObserverPointer< const ::DataPostprocessor< spacedim > > postprocessor
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIncompatiblePatchLists()
static ::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
static ::ExceptionBase & ExcInvalidCharacter(std::string arg1, std::size_t arg2)
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)
std::vector< index_type > data
DataComponentInterpretation
constexpr unsigned int invalid_unsigned_int
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)