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.");
75 "For the operation you are attempting, you first need to "
76 "tell the DataOut or related object which DoFHandler "
77 "you would like to work on.");
86 <<
"The vector has size " << arg1
87 <<
" but the DoFHandler object says that there are " << arg2
88 <<
" degrees of freedom and there are " << arg3
89 <<
" active cells. The size of your vector needs to be"
90 <<
" either equal to the number of degrees of freedom (when"
91 <<
" the data is of type type_dof_data), or equal to the"
92 <<
" number of active cells (when the data is of type "
93 <<
" type_cell_data).");
101 <<
"Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
102 <<
"description strings since some graphics formats will only accept these."
104 <<
"The string you gave was <" << arg1
105 <<
">, within which the invalid character is <" << arg1[arg2] <<
">."
112 "When attaching a triangulation or DoFHandler object, it is "
113 "not allowed if old data vectors are still referenced. If "
114 "you want to reuse an object of the current type, you first "
115 "need to call the 'clear_data_vector()' function.");
122 <<
"You have to give one name per component in your "
123 <<
"data vector. The number you gave was " << arg1
124 <<
", but the number of components is " << arg2 <<
".");
129 "While merging sets of patches, the two sets to be merged "
130 "need to refer to data that agrees on the names of the "
131 "various variables represented. In other words, you "
132 "cannot merge sets of patches that originate from "
133 "entirely unrelated simulations.");
138 "While merging sets of patches, the two sets to be merged "
139 "need to refer to data that agrees on the number of "
140 "subdivisions and other properties. In other words, you "
141 "cannot merge sets of patches that originate from "
142 "entirely unrelated simulations.");
147 <<
"When declaring that a number of components in a data "
148 <<
"set to be output logically form a vector instead of "
149 <<
"simply a set of scalar fields, you need to specify "
150 <<
"this for all relevant components. Furthermore, "
151 <<
"vectors must always consist of exactly <dim> "
152 <<
"components. However, the vector component at "
153 <<
"position " << arg1 <<
" with name <" << arg2
154 <<
"> does not satisfy these conditions.");
159 <<
"When declaring that a number of components in a data "
160 <<
"set to be output logically form a tensor instead of "
161 <<
"simply a set of scalar fields, you need to specify "
162 <<
"this for all relevant components. Furthermore, "
163 <<
"tensors must always consist of exactly <dim*dim> "
164 <<
"components. However, the tensor component at "
165 <<
"position " << arg1 <<
" with name <" << arg2
166 <<
"> does not satisfy these conditions.");
174 namespace DataOutImplementation
221 template <
int dim,
int spacedim>
231 const std::vector<std::string> &
names,
264 std::vector<double> &patch_values)
const = 0;
296 &patch_gradients_system)
const = 0;
317 &patch_hessians_system)
const = 0;
347 const std::vector<std::string>
names;
390 template <
int dim,
int spacedim>
396 const std::vector<unsigned int> &n_postprocessor_outputs,
402 const bool use_face_values);
407 const std::vector<unsigned int> &n_postprocessor_outputs,
408 const ::hp::MappingCollection<dim, spacedim> &mapping,
413 const bool use_face_values);
420 const typename ::Triangulation<dim, spacedim>::cell_iterator
439 std::shared_ptr<::hp::FECollection<dim, spacedim>>>
443 std::vector<std::shared_ptr<::hp::FEValues<dim, spacedim>>>
445 std::vector<std::shared_ptr<::hp::FEFaceValues<dim, spacedim>>>
594template <
typename DoFHandlerType,
596 int patch_space_dim = patch_dim>
667 DoFHandlerType::space_dimension> &);
737 template <
class VectorType>
740 const VectorType & data,
741 const std::vector<std::string> &names,
743 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
744 &data_component_interpretation = std::vector<
763 template <
class VectorType>
766 const VectorType & data,
767 const std::string & name,
769 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
770 &data_component_interpretation = std::vector<
788 template <
class VectorType>
791 const DoFHandlerType & dof_handler,
792 const VectorType & data,
793 const std::vector<std::string> &names,
794 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
795 &data_component_interpretation = std::vector<
803 template <
class VectorType>
806 const DoFHandlerType &dof_handler,
807 const VectorType & data,
808 const std::string & name,
809 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
810 &data_component_interpretation = std::vector<
839 template <
class VectorType>
843 &data_postprocessor);
851 template <
class VectorType>
854 const VectorType & data,
856 &data_postprocessor);
875 template <
class VectorType>
878 const DoFHandlerType & dof_handler,
880 const std::vector<std::string> & names,
881 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
882 &data_component_interpretation = std::vector<
888 template <
class VectorType>
892 const std::string & name);
939 template <
typename DoFHandlerType2>
971 DoFHandlerType::space_dimension>>
983 DoFHandlerType::dimension,
984 DoFHandlerType::space_dimension>>>
991 DoFHandlerType::dimension,
992 DoFHandlerType::space_dimension>>>
1006 virtual const std::vector<Patch> &
1013 virtual std::vector<std::string>
1022 DoFHandlerType::space_dimension>>>
1029 virtual std::vector<
1030 std::tuple<
unsigned int,
1038 template <
class,
int,
int>
1043 template <
int,
class>
1050 template <
class VectorType>
1053 const DoFHandlerType * dof_handler,
1054 const VectorType & data,
1055 const std::vector<std::string> &names,
1057 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1058 & data_component_interpretation,
1059 const bool deduce_output_names);
1065template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1066template <
typename VectorType>
1069 const VectorType & vec,
1070 const std::string & name,
1072 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1073 &data_component_interpretation)
1077 std::vector<std::string> names(1, name);
1078 add_data_vector_internal(
1079 dofs, vec, names, type, data_component_interpretation,
true);
1084template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1085template <
typename VectorType>
1088 const VectorType & vec,
1089 const std::vector<std::string> &names,
1091 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1092 &data_component_interpretation)
1096 add_data_vector_internal(
1097 dofs, vec, names, type, data_component_interpretation,
false);
1102template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1103template <
typename VectorType>
1106 const DoFHandlerType &dof_handler,
1107 const VectorType & data,
1108 const std::string & name,
1109 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1110 &data_component_interpretation)
1112 std::vector<std::string> names(1, name);
1113 add_data_vector_internal(&dof_handler,
1117 data_component_interpretation,
1123template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1124template <
typename VectorType>
1127 const DoFHandlerType & dof_handler,
1128 const VectorType & data,
1129 const std::vector<std::string> &names,
1130 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1131 &data_component_interpretation)
1133 add_data_vector_internal(&dof_handler,
1137 data_component_interpretation,
1143template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1144template <
typename VectorType>
1147 const VectorType & vec,
1152 add_data_vector(*dofs, vec, data_postprocessor);
1157template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1158template <
typename DoFHandlerType2>
1164 const std::vector<Patch> &source_patches = source.
get_patches();
1165 Assert((patches.size() != 0) && (source_patches.size() != 0),
1166 ExcMessage(
"When calling this function, both the current "
1167 "object and the one being merged need to have a "
1168 "nonzero number of patches associated with it. "
1169 "Either you called this function on objects that "
1170 "are empty, or you may have forgotten to call "
1171 "the 'build_patches()' function."));
1190 Assert(patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1192 Assert(patches[0].data.n_cols() == source_patches[0].data.n_cols(),
1194 Assert((patches[0].data.n_rows() +
1195 (patches[0].points_are_available ? 0 : patch_space_dim)) ==
1196 (source_patches[0].data.n_rows() +
1197 (source_patches[0].points_are_available ? 0 : patch_space_dim)),
1202 Assert(get_nonscalar_data_ranges().size() ==
1204 ExcMessage(
"Both sources need to declare the same components "
1206 for (
unsigned int i = 0; i < get_nonscalar_data_ranges().size(); ++i)
1208 Assert(std::get<0>(get_nonscalar_data_ranges()[i]) ==
1210 ExcMessage(
"Both sources need to declare the same components "
1212 Assert(std::get<1>(get_nonscalar_data_ranges()[i]) ==
1214 ExcMessage(
"Both sources need to declare the same components "
1216 Assert(std::get<2>(get_nonscalar_data_ranges()[i]) ==
1218 ExcMessage(
"Both sources need to declare the same components "
1226 const unsigned int old_n_patches = patches.size();
1227 patches.insert(patches.end(), source_patches.begin(), source_patches.end());
1231 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1233 patches[i].vertices[v] +=
shift;
1236 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1237 patches[i].patch_index += old_n_patches;
1240 for (
unsigned int i = old_n_patches; i < patches.size(); ++i)
1242 if (patches[i].neighbors[n] != Patch::no_neighbor)
1243 patches[i].neighbors[n] += old_n_patches;
1254 template <
typename DoFHandlerType,
1256 int patch_space_dim = patch_dim>
typename Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension >::cell_iterator cell_iterator
void attach_triangulation(const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &)
virtual std::vector< std::string > get_dataset_names() const override
void clear_input_data_references()
void clear_data_vectors()
void add_data_vector(const DoFHandlerType &dof_handler, const VectorType &data, const DataPostprocessor< DoFHandlerType::space_dimension > &data_postprocessor)
void add_data_vector(const DoFHandlerType &dof_handler, const VectorType &data, const std::vector< std::string > &names, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation=std::vector< DataComponentInterpretation::DataComponentInterpretation >())
void merge_patches(const DataOut_DoFData< DoFHandlerType2, patch_dim, patch_space_dim > &source, const Point< patch_space_dim > &shift=Point< patch_space_dim >())
void add_data_vector(const VectorType &data, const DataPostprocessor< DoFHandlerType::space_dimension > &data_postprocessor)
void add_data_vector(const DoFHandlerType &dof_handler, const VectorType &data, const std::string &name, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation=std::vector< DataComponentInterpretation::DataComponentInterpretation >())
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< DataComponentInterpretation::DataComponentInterpretation >())
SmartPointer< const DoFHandlerType > dofs
virtual const std::vector< Patch > & get_patches() const override
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > > cell_data
void add_mg_data_vector(const DoFHandlerType &dof_handler, const MGLevelObject< VectorType > &data, const std::string &name)
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)
void add_mg_data_vector(const DoFHandlerType &dof_handler, const MGLevelObject< VectorType > &data, const std::vector< std::string > &names, const std::vector< DataComponentInterpretation::DataComponentInterpretation > &data_component_interpretation=std::vector< DataComponentInterpretation::DataComponentInterpretation >())
virtual ~DataOut_DoFData() override
SmartPointer< const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > triangulation
void attach_dof_handler(const DoFHandlerType &)
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > > dof_data
std::vector< std::shared_ptr<::hp::FECollection< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > > get_fes() 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 >())
std::vector< Patch > patches
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
std::size_t memory_consumption() const
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
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)