16 #ifndef dealii_data_out_dof_data_h 17 #define dealii_data_out_dof_data_h 21 #include <deal.II/base/config.h> 23 #include <deal.II/base/data_out_base.h> 24 #include <deal.II/base/smartpointer.h> 26 #include <deal.II/dofs/dof_handler.h> 28 #include <deal.II/fe/mapping.h> 30 #include <deal.II/grid/tria.h> 32 #include <deal.II/hp/fe_collection.h> 33 #include <deal.II/hp/fe_values.h> 34 #include <deal.II/hp/mapping_collection.h> 35 #include <deal.II/hp/q_collection.h> 37 #include <deal.II/numerics/data_component_interpretation.h> 38 #include <deal.II/numerics/data_postprocessor.h> 42 DEAL_II_NAMESPACE_OPEN
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.");
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.");
85 <<
"The vector has size " << arg1
86 <<
" but the DoFHandler object says that there are " << arg2
87 <<
" degrees of freedom and there are " << arg3
88 <<
" active cells. The size of your vector needs to be" 89 <<
" either equal to the number of degrees of freedom, or" 90 <<
" equal to the number of active cells.");
98 <<
"Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
99 <<
"description strings since some graphics formats will only accept these." 101 <<
"The string you gave was <" << arg1
102 <<
">, within which the invalid character is <" << arg1[arg2] <<
">." 109 "When attaching a triangulation or DoFHandler object, it is " 110 "not allowed if old data vectors are still referenced. If " 111 "you want to reuse an object of the current type, you first " 112 "need to call the 'clear_data_vector()' function.");
119 <<
"You have to give one name per component in your " 120 <<
"data vector. The number you gave was " << arg1
121 <<
", but the number of components is " << arg2 <<
".");
126 "While merging sets of patches, the two sets to be merged " 127 "need to refer to data that agrees on the names of the " 128 "various variables represented. In other words, you " 129 "cannot merge sets of patches that originate from " 130 "entirely unrelated simulations.");
135 "While merging sets of patches, the two sets to be merged " 136 "need to refer to data that agrees on the number of " 137 "subdivisions and other properties. In other words, you " 138 "cannot merge sets of patches that originate from " 139 "entirely unrelated simulations.");
144 <<
"When declaring that a number of components in a data " 145 <<
"set to be output logically form a vector instead of " 146 <<
"simply a set of scalar fields, you need to specify " 147 <<
"this for all relevant components. Furthermore, " 148 <<
"vectors must always consist of exactly <dim> " 149 <<
"components. However, the vector component at " 150 <<
"position " << arg1 <<
" with name <" << arg2
151 <<
"> does not satisfy these conditions.");
156 <<
"When declaring that a number of components in a data " 157 <<
"set to be output logically form a tensor instead of " 158 <<
"simply a set of scalar fields, you need to specify " 159 <<
"this for all relevant components. Furthermore, " 160 <<
"tensors must always consist of exactly <dim*dim> " 161 <<
"components. However, the tensor component at " 162 <<
"position " << arg1 <<
" with name <" << arg2
163 <<
"> does not satisfy these conditions.");
171 namespace DataOutImplementation
196 enum class ComponentExtractor
216 template <
typename DoFHandlerType>
226 const std::vector<std::string> &names,
229 &data_component_interpretation);
238 *data_postprocessor);
250 get_cell_data_value(
const unsigned int cell_number,
251 const ComponentExtractor extract_component)
const = 0;
260 DoFHandlerType::space_dimension> &fe_patch_values,
261 const ComponentExtractor extract_component,
262 std::vector<double> &patch_values)
const = 0;
272 DoFHandlerType::space_dimension> &fe_patch_values,
273 const ComponentExtractor extract_component,
281 get_function_gradients(
283 DoFHandlerType::space_dimension> &fe_patch_values,
284 const ComponentExtractor extract_component,
286 &patch_gradients)
const = 0;
294 get_function_gradients(
296 DoFHandlerType::space_dimension> &fe_patch_values,
297 const ComponentExtractor extract_component,
299 &patch_gradients_system)
const = 0;
306 get_function_hessians(
308 DoFHandlerType::space_dimension> &fe_patch_values,
309 const ComponentExtractor extract_component,
319 get_function_hessians(
321 DoFHandlerType::space_dimension> &fe_patch_values,
322 const ComponentExtractor extract_component,
324 &patch_hessians_system)
const = 0;
331 is_complex_valued()
const = 0;
344 memory_consumption()
const = 0;
354 const std::vector<std::string>
names;
370 const ::DataPostprocessor<DoFHandlerType::space_dimension>>
399 template <
int dim,
int spacedim>
403 const unsigned int n_datasets,
404 const unsigned int n_subdivisions,
405 const std::vector<unsigned int> &n_postprocessor_outputs,
411 const bool use_face_values);
415 template <
typename DoFHandlerType>
417 reinit_all_fe_values(
419 const typename ::Triangulation<dim, spacedim>::cell_iterator
424 get_present_fe_values(
const unsigned int dataset)
const;
427 resize_system_vectors(
const unsigned int n_components);
429 const unsigned int n_datasets;
430 const unsigned int n_subdivisions;
434 std::vector<std::vector<::Vector<double>>> postprocessed_values;
436 const ::hp::MappingCollection<dim, spacedim> mapping_collection;
438 std::shared_ptr<::hp::FECollection<dim, spacedim>>>
442 std::vector<std::shared_ptr<::hp::FEValues<dim, spacedim>>>
444 std::vector<std::shared_ptr<::hp::FEFaceValues<dim, spacedim>>>
594 template <
typename DoFHandlerType,
596 int patch_space_dim = patch_dim>
608 DoFHandlerType::dimension,
609 DoFHandlerType::space_dimension>::active_cell_iterator;
657 attach_dof_handler(
const DoFHandlerType &);
669 attach_triangulation(
const Triangulation<DoFHandlerType::dimension,
670 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<
787 template <
class VectorType>
790 const DoFHandlerType & dof_handler,
791 const VectorType & data,
792 const std::vector<std::string> &names,
793 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
794 &data_component_interpretation = std::vector<
802 template <
class VectorType>
805 const DoFHandlerType &dof_handler,
806 const VectorType & data,
807 const std::string & name,
808 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
809 &data_component_interpretation = std::vector<
840 template <
class VectorType>
842 add_data_vector(
const VectorType &data,
844 &data_postprocessor);
852 template <
class VectorType>
854 add_data_vector(
const DoFHandlerType &dof_handler,
855 const VectorType & data,
857 &data_postprocessor);
866 clear_data_vectors();
879 clear_input_data_references();
904 template <
typename DoFHandlerType2>
924 memory_consumption()
const;
936 DoFHandlerType::space_dimension>>
947 std::vector<std::shared_ptr<
954 std::vector<std::shared_ptr<
969 virtual const std::vector<Patch> &
970 get_patches()
const override;
976 virtual std::vector<std::string>
977 get_dataset_names()
const override;
985 DoFHandlerType::space_dimension>>>
993 std::tuple<
unsigned int,
997 get_nonscalar_data_ranges()
const override;
1003 template <
class,
int,
int>
1010 template <
class VectorType>
1013 const DoFHandlerType * dof_handler,
1014 const VectorType & data,
1015 const std::vector<std::string> &names,
1017 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1018 & data_component_interpretation,
1019 const bool deduce_output_names);
1025 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1026 template <
typename VectorType>
1029 const VectorType & vec,
1030 const std::string & name,
1032 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1033 &data_component_interpretation)
1037 std::vector<std::string> names(1, name);
1039 dofs, vec, names, type, data_component_interpretation,
true);
1044 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1045 template <
typename VectorType>
1048 const VectorType & vec,
1049 const std::vector<std::string> &names,
1051 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1052 &data_component_interpretation)
1057 dofs, vec, names, type, data_component_interpretation,
false);
1062 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1063 template <
typename VectorType>
1066 const DoFHandlerType &dof_handler,
1067 const VectorType & data,
1068 const std::string & name,
1069 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1070 &data_component_interpretation)
1072 std::vector<std::string> names(1, name);
1077 data_component_interpretation,
1083 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1084 template <
typename VectorType>
1087 const DoFHandlerType & dof_handler,
1088 const VectorType & data,
1089 const std::vector<std::string> &names,
1090 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1091 &data_component_interpretation)
1097 data_component_interpretation,
1103 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1104 template <
typename VectorType>
1107 const VectorType & vec,
1117 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1118 template <
typename DoFHandlerType2>
1124 const std::vector<Patch> &source_patches = source.
get_patches();
1125 Assert((
patches.size() != 0) && (source_patches.size() != 0),
1126 ExcMessage(
"When calling this function, both the current " 1127 "object and the one being merged need to have a " 1128 "nonzero number of patches associated with it. " 1129 "Either you called this function on objects that " 1130 "are empty, or you may have forgotten to call " 1131 "the 'build_patches()' function."));
1140 Assert(
patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1142 Assert(
patches[0].data.n_rows() == source_patches[0].data.n_rows(),
1144 Assert(
patches[0].data.n_cols() == source_patches[0].data.n_cols(),
1151 ExcMessage(
"Both sources need to declare the same components " 1157 ExcMessage(
"Both sources need to declare the same components " 1161 ExcMessage(
"Both sources need to declare the same components " 1165 ExcMessage(
"Both sources need to declare the same components " 1173 const unsigned int old_n_patches =
patches.size();
1174 patches.insert(
patches.end(), source_patches.begin(), source_patches.end());
1178 for (
unsigned int i = old_n_patches; i <
patches.size(); ++i)
1179 for (
unsigned int v = 0; v < GeometryInfo<patch_dim>::vertices_per_cell;
1181 patches[i].vertices[v] += shift;
1184 for (
unsigned int i = old_n_patches; i <
patches.size(); ++i)
1185 patches[i].patch_index += old_n_patches;
1188 for (
unsigned int i = old_n_patches; i <
patches.size(); ++i)
1189 for (
unsigned int n = 0; n < GeometryInfo<patch_dim>::faces_per_cell; ++n)
1191 patches[i].neighbors[n] += old_n_patches;
1195 DEAL_II_NAMESPACE_CLOSE
void merge_patches(const DataOut_DoFData< DoFHandlerType2, patch_dim, patch_space_dim > &source, const Point< patch_space_dim > &shift=Point< patch_space_dim >())
static const unsigned int invalid_unsigned_int
static::ExceptionBase & ExcNoTriangulationSelected()
static::ExceptionBase & ExcIncompatiblePatchLists()
#define DeclException2(Exception2, type1, type2, outsequence)
virtual std::vector< std::string > get_dataset_names() const override
unsigned int n_output_variables
static::ExceptionBase & ExcOldDataStillPresent()
static::ExceptionBase & ExcInvalidVectorSize(int arg1, int arg2, int arg3)
static::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
typename Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension >::cell_iterator cell_iterator
static::ExceptionBase & ExcIncompatibleDatasetNames()
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< DoFHandlerType > > > dof_data
static::ExceptionBase & ExcMessage(std::string arg1)
static::ExceptionBase & ExcNoDoFHandlerSelected()
#define DeclException1(Exception1, type1, outsequence)
#define Assert(cond, exc)
Abstract base class for mapping classes.
static::ExceptionBase & ExcInvalidNumberOfNames(int arg1, int arg2)
static::ExceptionBase & ExcInvalidVectorDeclaration(int arg1, std::string arg2)
#define DeclExceptionMsg(Exception, defaulttext)
static::ExceptionBase & ExcInvalidCharacter(std::string arg1, size_t arg2)
std::vector< Patch > patches
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 >())
SmartPointer< const ::DataPostprocessor< DoFHandlerType::space_dimension > > postprocessor
virtual const std::vector< Patch > & get_patches() const override
static::ExceptionBase & ExcInvalidTensorDeclaration(int arg1, std::string arg2)
DataComponentInterpretation
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
static const unsigned int no_neighbor
SmartPointer< const DoFHandlerType > dof_handler
const std::vector< std::string > names
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)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
SmartPointer< const Triangulation< DoFHandlerType::dimension, DoFHandlerType::space_dimension > > triangulation
std::vector< std::shared_ptr< internal::DataOutImplementation::DataEntryBase< DoFHandlerType > > > cell_data
const std::vector< DataComponentInterpretation::DataComponentInterpretation > data_component_interpretation
SmartPointer< const DoFHandlerType > dofs