15#ifndef dealii_data_out_dof_data_h
16#define dealii_data_out_dof_data_h
50 namespace DataOutImplementation
57 <<
"The number of subdivisions per patch, " << arg1
58 <<
", is not valid. It needs to be greater or equal to "
59 "one, or zero if you want it to be determined "
66 "For the operation you are attempting, you first need to "
67 "tell the DataOut or related object which DoFHandler or "
68 "triangulation you would like to work on. This is "
69 "generally done using the 'attach_dof_handler()' or "
70 "'attach_triangulation()' member functions.");
76 "For the operation you are attempting, you first need to "
77 "tell the DataOut or related object which DoFHandler "
78 "you would like to work on. This is "
79 "generally done using the 'attach_dof_handler()' "
89 <<
"The vector has size " << arg1
90 <<
" but the DoFHandler object says that there are " << arg2
91 <<
" degrees of freedom and there are " << arg3
92 <<
" active cells. The size of your vector needs to be"
93 <<
" either equal to the number of degrees of freedom (when"
94 <<
" the data is of type type_dof_data), or equal to the"
95 <<
" number of active cells (when the data is of type "
96 <<
" type_cell_data).");
104 <<
"Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
105 <<
"description strings since some graphics formats will only accept these."
107 <<
"The string you gave was <" << arg1
108 <<
">, within which the invalid character is <" << arg1[arg2] <<
">."
115 "When attaching a triangulation or DoFHandler object, it is "
116 "not allowed if old data vectors are still referenced. If "
117 "you want to reuse an object of the current type, you first "
118 "need to call the 'clear_data_vector()' function.");
125 <<
"You have to give one name per component in your "
126 <<
"data vector. The number you gave was " << arg1
127 <<
", but the number of components is " << arg2 <<
'.');
132 "While merging sets of patches, the two sets to be merged "
133 "need to refer to data that agrees on the names of the "
134 "various variables represented. In other words, you "
135 "cannot merge sets of patches that originate from "
136 "entirely unrelated simulations.");
141 "While merging sets of patches, the two sets to be merged "
142 "need to refer to data that agrees on the number of "
143 "subdivisions and other properties. In other words, you "
144 "cannot merge sets of patches that originate from "
145 "entirely unrelated simulations.");
150 <<
"When declaring that a number of components in a data "
151 <<
"set to be output logically form a vector instead of "
152 <<
"simply a set of scalar fields, you need to specify "
153 <<
"this for all relevant components. Furthermore, "
154 <<
"vectors must always consist of exactly <dim> "
155 <<
"components. However, the vector component at "
156 <<
"position " << arg1 <<
" with name <" << arg2
157 <<
"> does not satisfy these conditions.");
162 <<
"When declaring that a number of components in a data "
163 <<
"set to be output logically form a tensor instead of "
164 <<
"simply a set of scalar fields, you need to specify "
165 <<
"this for all relevant components. Furthermore, "
166 <<
"tensors must always consist of exactly <dim*dim> "
167 <<
"components. However, the tensor component at "
168 <<
"position " << arg1 <<
" with name <" << arg2
169 <<
"> does not satisfy these conditions.");
177 namespace DataOutImplementation
224 template <
int dim,
int spacedim>
234 const std::vector<std::string> &
names,
267 std::vector<double> &patch_values)
const = 0;
299 &patch_gradients_system)
const = 0;
320 &patch_hessians_system)
const = 0;
350 const std::vector<std::string>
names;
393 template <
int dim,
int spacedim>
399 const std::vector<unsigned int> &n_postprocessor_outputs,
405 const bool use_face_values);
410 const std::vector<unsigned int> &n_postprocessor_outputs,
411 const ::hp::MappingCollection<dim, spacedim> &mapping,
416 const bool use_face_values);
423 const typename ::Triangulation<dim, spacedim>::cell_iterator
442 std::shared_ptr<::hp::FECollection<dim, spacedim>>>
446 std::vector<std::shared_ptr<::hp::FEValues<dim, spacedim>>>
448 std::vector<std::shared_ptr<::hp::FEFaceValues<dim, spacedim>>>
595 int patch_spacedim = patch_dim>
728 template <
typename VectorType>
731 const VectorType &
data,
732 const std::vector<std::string> &names,
734 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
735 &data_component_interpretation = {});
753 template <
typename VectorType>
756 const VectorType &
data,
757 const std::string &name,
759 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
760 &data_component_interpretation = {});
777 template <
typename VectorType>
781 const VectorType &
data,
782 const std::vector<std::string> &names,
783 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
784 &data_component_interpretation = {});
791 template <
typename VectorType>
795 const VectorType &
data,
796 const std::string &name,
797 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
798 &data_component_interpretation = {});
826 template <
typename VectorType>
837 template <
typename VectorType>
840 const VectorType &
data,
860 template <
typename VectorType>
865 const std::vector<std::string> &names,
866 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
867 &data_component_interpretation = std::vector<
873 template <
typename VectorType>
877 const std::string &name);
924 template <
int dim2,
int spacedim2>
965 std::vector<std::shared_ptr<
972 std::vector<std::shared_ptr<
988 virtual const std::vector<Patch> &
996 virtual std::vector<std::string>
1003 virtual std::vector<
1004 std::tuple<
unsigned int,
1015 std::vector<std::shared_ptr<::hp::FECollection<dim, spacedim>>>
1020 template <
int,
int,
int,
int>
1025 template <
int,
class>
1032 template <
typename VectorType>
1036 const VectorType &
data,
1037 const std::vector<std::string> &names,
1039 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1040 &data_component_interpretation,
1041 const bool deduce_output_names);
1047template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1048template <
typename VectorType>
1051 const VectorType &vec,
1052 const std::string &name,
1054 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1055 &data_component_interpretation)
1059 std::vector<std::string> names(1, name);
1060 add_data_vector_internal(
1061 dofs, vec, names, type, data_component_interpretation,
true);
1066template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1067template <
typename VectorType>
1070 const VectorType &vec,
1071 const std::vector<std::string> &names,
1073 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1074 &data_component_interpretation)
1078 add_data_vector_internal(
1079 dofs, vec, names, type, data_component_interpretation,
false);
1084template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1085template <
typename VectorType>
1089 const VectorType &
data,
1090 const std::string &name,
1091 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1092 &data_component_interpretation)
1094 std::vector<std::string> names(1, name);
1095 add_data_vector_internal(&dof_handler,
1099 data_component_interpretation,
1105template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1106template <
typename VectorType>
1110 const VectorType &
data,
1111 const std::vector<std::string> &names,
1112 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1113 &data_component_interpretation)
1115 add_data_vector_internal(&dof_handler,
1119 data_component_interpretation,
1125template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1126template <
typename VectorType>
1129 const VectorType &vec,
1134 add_data_vector(*dofs, vec, data_postprocessor);
1139template <
int dim,
int patch_dim,
int spacedim,
int patch_spacedim>
1140template <
int dim2,
int spacedim2>
1146 const std::vector<Patch> &source_patches = source.
get_patches();
1147 Assert((patches.size() != 0) && (source_patches.size() != 0),
1148 ExcMessage(
"When calling this function, both the current "
1149 "object and the one being merged need to have a "
1150 "nonzero number of patches associated with it. "
1151 "Either you called this function on objects that "
1152 "are empty, or you may have forgotten to call "
1153 "the 'build_patches()' function."));
1172 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1174 Assert(patches[0].
data.n_cols() == source_patches[0].data.n_cols(),
1177 (patches[0].points_are_available ? 0 : patch_spacedim)) ==
1178 (source_patches[0].data.n_rows() +
1179 (source_patches[0].points_are_available ? 0 : patch_spacedim)),
1186 ExcMessage(
"Both sources need to declare the same components "
1188 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
1190 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
1192 ExcMessage(
"Both sources need to declare the same components "
1194 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
1196 ExcMessage(
"Both sources need to declare the same components "
1198 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
1200 ExcMessage(
"Both sources need to declare the same components "
1208 const unsigned int old_n_patches = patches.size();
1209 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
1213 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1215 patches[i].vertices[v] += shift;
1218 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1219 patches[i].patch_index += old_n_patches;
1222 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1224 if (patches[i].neighbors[n] != Patch::no_neighbor)
1225 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 & 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)
std::vector< index_type > data
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)