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,
238 *data_postprocessor);
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,
283 DoFHandlerType::space_dimension> &fe_patch_values,
284 const ComponentExtractor extract_component,
286 &patch_gradients)
const = 0;
296 DoFHandlerType::space_dimension> &fe_patch_values,
297 const ComponentExtractor extract_component,
299 &patch_gradients_system)
const = 0;
308 DoFHandlerType::space_dimension> &fe_patch_values,
309 const ComponentExtractor extract_component,
321 DoFHandlerType::space_dimension> &fe_patch_values,
322 const ComponentExtractor extract_component,
324 &patch_hessians_system)
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,
410 const UpdateFlags update_flags,
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>>>
440 const UpdateFlags update_flags;
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;
670 DoFHandlerType::space_dimension> &);
735 template <
class VectorType>
738 const VectorType & data,
739 const std::vector<std::string> &names,
741 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
742 &data_component_interpretation = std::vector<
761 template <
class VectorType>
764 const VectorType & data,
765 const std::string & name,
767 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
768 &data_component_interpretation = std::vector<
785 template <
class VectorType>
788 const DoFHandlerType & dof_handler,
789 const VectorType & data,
790 const std::vector<std::string> &names,
791 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
792 &data_component_interpretation = std::vector<
800 template <
class VectorType>
803 const DoFHandlerType &dof_handler,
804 const VectorType & data,
805 const std::string & name,
806 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
807 &data_component_interpretation = std::vector<
836 template <
class VectorType>
840 &data_postprocessor);
848 template <
class VectorType>
851 const VectorType & data,
853 &data_postprocessor);
900 template <
typename DoFHandlerType2>
932 DoFHandlerType::space_dimension>>
943 std::vector<std::shared_ptr<
950 std::vector<std::shared_ptr<
965 virtual const std::vector<Patch> &
972 virtual std::vector<std::string>
981 DoFHandlerType::space_dimension>>>
989 std::tuple<
unsigned int,
999 template <
class,
int,
int>
1006 template <
class VectorType>
1009 const DoFHandlerType * dof_handler,
1010 const VectorType & data,
1011 const std::vector<std::string> &names,
1013 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1014 & data_component_interpretation,
1015 const bool deduce_output_names);
1021 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1022 template <
typename VectorType>
1025 const VectorType & vec,
1026 const std::string & name,
1028 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1029 &data_component_interpretation)
1033 std::vector<std::string> names(1, name);
1035 dofs, vec, names, type, data_component_interpretation,
true);
1040 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1041 template <
typename VectorType>
1044 const VectorType & vec,
1045 const std::vector<std::string> &names,
1047 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1048 &data_component_interpretation)
1053 dofs, vec, names, type, data_component_interpretation,
false);
1058 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1059 template <
typename VectorType>
1062 const DoFHandlerType &dof_handler,
1063 const VectorType & data,
1064 const std::string & name,
1065 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1066 &data_component_interpretation)
1068 std::vector<std::string> names(1, name);
1073 data_component_interpretation,
1079 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1080 template <
typename VectorType>
1083 const DoFHandlerType & dof_handler,
1084 const VectorType & data,
1085 const std::vector<std::string> &names,
1086 const std::vector<DataComponentInterpretation::DataComponentInterpretation>
1087 &data_component_interpretation)
1093 data_component_interpretation,
1099 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1100 template <
typename VectorType>
1103 const VectorType & vec,
1113 template <
typename DoFHandlerType,
int patch_dim,
int patch_space_dim>
1114 template <
typename DoFHandlerType2>
1120 const std::vector<Patch> &source_patches = source.
get_patches();
1121 Assert((
patches.size() != 0) && (source_patches.size() != 0),
1122 ExcMessage(
"When calling this function, both the current "
1123 "object and the one being merged need to have a "
1124 "nonzero number of patches associated with it. "
1125 "Either you called this function on objects that "
1126 "are empty, or you may have forgotten to call "
1127 "the 'build_patches()' function."));
1136 Assert(
patches[0].n_subdivisions == source_patches[0].n_subdivisions,
1138 Assert(
patches[0].data.n_rows() == source_patches[0].data.n_rows(),
1140 Assert(
patches[0].data.n_cols() == source_patches[0].data.n_cols(),
1147 ExcMessage(
"Both sources need to declare the same components "
1153 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 "
1169 const unsigned int old_n_patches =
patches.size();
1170 patches.insert(
patches.end(), source_patches.begin(), source_patches.end());
1174 for (
unsigned int i = old_n_patches; i <
patches.size(); ++i)
1175 for (
unsigned int v = 0; v < GeometryInfo<patch_dim>::vertices_per_cell;
1177 patches[i].vertices[v] += shift;
1180 for (
unsigned int i = old_n_patches; i <
patches.size(); ++i)
1181 patches[i].patch_index += old_n_patches;
1184 for (
unsigned int i = old_n_patches; i <
patches.size(); ++i)
1185 for (
unsigned int n = 0; n < GeometryInfo<patch_dim>::faces_per_cell; ++n)
1187 patches[i].neighbors[n] += old_n_patches;
1191 DEAL_II_NAMESPACE_CLOSE