39 namespace DataOutImplementation
41 template <
int dim,
int spacedim>
43 const unsigned int n_datasets,
44 const unsigned int n_subdivisions,
46 const ::hp::MappingCollection<dim, spacedim> &mapping,
51 const std::vector<std::vector<unsigned int>> &cell_to_patch_index_map)
59 , cell_to_patch_index_map(&cell_to_patch_index_map)
66template <
int dim,
int spacedim>
76 while ((cell != this->
triangulation->end()) && !cell->is_locally_owned())
85 while ((cell != this->
triangulation->end()) && !cell->is_locally_owned())
93template <
int dim,
int spacedim>
98 const unsigned int n_subdivisions,
104 patch.n_subdivisions = n_subdivisions;
113 const auto vertices =
115 std::copy(vertices.begin(), vertices.end(), std::begin(
patch.vertices));
146 ReferenceCells::get_hypercube<dim>()))
152 patch.points_are_available =
true;
156 const std::vector<Point<spacedim>> &q_points =
160 for (
unsigned int i = 0; i < spacedim; ++i)
161 for (
unsigned int q = 0;
q < n_q_points; ++
q)
162 patch.data(
patch.data.size(0) - spacedim + i,
q) = q_points[
q][i];
167 patch.points_are_available =
false;
175 unsigned int offset = 0;
179 for (
const auto &
dataset : this->dof_data)
183 const unsigned int n_components =
189 if (postprocessor !=
nullptr)
194 postprocessor->get_needed_update_flags();
196 if ((n_components == 1) &&
197 (
dataset->is_complex_valued() ==
false))
213 dataset->get_function_gradients(
220 dataset->get_function_hessians(
224 scratch_data.patch_values_scalar.solution_hessians);
242 postprocessor->evaluate_scalar_field(
257 if (
dataset->is_complex_valued() ==
false)
266 scratch_data.patch_values_system.solution_values);
269 dataset->get_function_gradients(
273 scratch_data.patch_values_system.solution_gradients);
276 dataset->get_function_hessians(
280 scratch_data.patch_values_system.solution_hessians);
288 if (n_components == 1)
300 ComponentExtractor::real_part,
304 for (
unsigned int i = 0;
306 .solution_values.size();
315 .solution_values[i][0] =
323 dataset->get_function_gradients(
326 ComponentExtractor::real_part,
328 .solution_gradients);
330 for (
unsigned int i = 0;
332 .solution_gradients.size();
341 .solution_gradients[i][0] =
343 .solution_gradients[i];
349 dataset->get_function_hessians(
353 scratch_data.patch_values_scalar
356 for (
unsigned int i = 0;
358 .solution_hessians.size();
363 .solution_hessians[i]
367 .solution_hessians[i][0] =
369 .solution_hessians[i];
383 ComponentExtractor::imaginary_part,
387 for (
unsigned int i = 0;
389 .solution_values.size();
398 .solution_values[i][1] =
406 dataset->get_function_gradients(
409 ComponentExtractor::imaginary_part,
410 scratch_data.patch_values_scalar
411 .solution_gradients);
413 for (
unsigned int i = 0;
415 .solution_gradients.size();
424 .solution_gradients[i][1] =
426 .solution_gradients[i];
432 dataset->get_function_hessians(
436 scratch_data.patch_values_scalar
439 for (
unsigned int i = 0;
441 .solution_hessians.size();
446 .solution_hessians[i]
450 .solution_hessians[i][1] =
452 .solution_hessians[i];
487 std::vector<Vector<double>> tmp(
501 for (
unsigned int i = 0;
503 .solution_values.size();
511 for (
unsigned int j = 0;
j < n_components;
514 .solution_values[i][
j] = tmp[i][
j];
526 for (
unsigned int i = 0;
528 .solution_values.size();
531 for (
unsigned int j = 0;
j < n_components;
534 .solution_values[i][
j + n_components] =
542 std::vector<std::vector<Tensor<1, spacedim>>> tmp(
544 .solution_gradients.size(),
548 dataset->get_function_gradients(
554 for (
unsigned int i = 0;
556 .solution_gradients.size();
561 .solution_gradients[i]
564 for (
unsigned int j = 0;
j < n_components;
567 .solution_gradients[i][
j] = tmp[i][
j];
571 dataset->get_function_gradients(
577 for (
unsigned int i = 0;
579 .solution_gradients.size();
582 for (
unsigned int j = 0;
j < n_components;
585 .solution_gradients[i][
j + n_components] =
593 std::vector<std::vector<Tensor<2, spacedim>>> tmp(
595 .solution_gradients.size(),
599 dataset->get_function_hessians(
605 for (
unsigned int i = 0;
607 .solution_hessians.size();
612 .solution_hessians[i]
615 for (
unsigned int j = 0;
j < n_components;
618 .solution_hessians[i][
j] = tmp[i][
j];
622 dataset->get_function_hessians(
628 for (
unsigned int i = 0;
630 .solution_hessians.size();
633 for (
unsigned int j = 0;
j < n_components;
636 .solution_hessians[i][
j + n_components] =
660 postprocessor->evaluate_vector_field(
668 for (
unsigned int q = 0;
q < n_q_points; ++
q)
669 for (
unsigned int component = 0;
670 component <
dataset->n_output_variables;
672 patch.data(offset + component,
q) =
678 offset +=
dataset->n_output_variables;
685 if (n_components == 1)
694 scratch_data.patch_values_scalar.solution_values);
695 for (
unsigned int q = 0;
q < n_q_points; ++
q)
705 if (
dataset->is_complex_valued() ==
true)
711 scratch_data.patch_values_scalar.solution_values);
712 for (
unsigned int q = 0;
q < n_q_points; ++
q)
727 if (
dataset->is_complex_valued() ==
false)
733 scratch_data.patch_values_system.solution_values);
734 for (
unsigned int component = 0; component < n_components;
736 for (
unsigned int q = 0;
q < n_q_points; ++
q)
737 patch.data(offset + component,
q) =
742 offset +=
dataset->n_output_variables;
778 scratch_data.patch_values_system.solution_values);
789 for (
unsigned int component = 0;
790 component < n_components;
794 dataset->data_component_interpretation[component])
807 for (
unsigned int q = 0;
q < n_q_points;
811 .solution_values[
q](component);
833 const unsigned int size = spacedim;
834 for (
unsigned int c = 0; c <
size; ++c)
835 for (
unsigned int q = 0;
q < n_q_points;
839 .solution_values[
q](component + c);
851 const unsigned int size =
853 for (
unsigned int c = 0; c <
size; ++c)
854 for (
unsigned int q = 0;
q < n_q_points;
858 .solution_values[
q](component + c);
879 scratch_data.patch_values_system.solution_values);
882 for (
unsigned int component = 0;
883 component < n_components;
887 dataset->data_component_interpretation[component])
896 for (
unsigned int q = 0;
q < n_q_points;
900 .solution_values[
q](component);
916 const unsigned int size = spacedim;
917 for (
unsigned int c = 0; c <
size; ++c)
918 for (
unsigned int q = 0;
q < n_q_points;
922 .solution_values[
q](component + c);
934 const unsigned int size =
936 for (
unsigned int c = 0; c <
size; ++c)
937 for (
unsigned int q = 0;
q < n_q_points;
941 .solution_values[
q](component + c);
959 offset +=
dataset->n_output_variables * 2;
971 if (this->cell_data.size() != 0)
983 for (
unsigned int q = 0;
q < n_q_points; ++
q)
988 if (
dataset->is_complex_valued() ==
true)
994 for (
unsigned int q = 0;
q < n_q_points; ++
q)
998 offset += (
dataset->is_complex_valued() ? 2 : 1);
1024 const cell_iterator neighbor =
cell_and_index->first->neighbor(f);
1025 Assert(
static_cast<unsigned int>(neighbor->level()) <
1028 if ((
static_cast<unsigned int>(neighbor->index()) >=
1031 [neighbor->index()] ==
1040 patch.neighbors[f] =
1060template <
int dim,
int spacedim>
1074template <
int dim,
int spacedim>
1087template <
int dim,
int spacedim>
1100 const unsigned int n_subdivisions =
1102 Assert(n_subdivisions >= 1,
1106 this->validate_dataset_names();
1124 std::vector<std::vector<unsigned int>> cell_to_patch_index_map;
1125 cell_to_patch_index_map.resize(this->
triangulation->n_levels());
1126 for (
unsigned int l = 0; l < this->
triangulation->n_levels(); ++l)
1129 unsigned int max_index = 0;
1133 if (
static_cast<unsigned int>(cell->level()) == l)
1135 std::max(max_index,
static_cast<unsigned int>(cell->index()));
1137 cell_to_patch_index_map[l].resize(
1142 std::vector<std::pair<cell_iterator, unsigned int>>
all_cells;
1164 Assert(
static_cast<unsigned int>(cell->level()) <
1165 cell_to_patch_index_map.size(),
1167 Assert(
static_cast<unsigned int>(cell->index()) <
1168 cell_to_patch_index_map[cell->level()].size(),
1172 cell_to_patch_index_map[cell->level()][cell->index()] =
1179 this->patches.
clear();
1188 unsigned int n_datasets = 0;
1189 for (
unsigned int i = 0; i < this->cell_data.size(); ++i)
1190 n_datasets += (this->cell_data[i]->is_complex_valued() &&
1191 (this->cell_data[i]->postprocessor ==
nullptr) ?
1194 for (
unsigned int i = 0; i < this->dof_data.size(); ++i)
1195 n_datasets += (this->dof_data[i]->n_output_variables *
1196 (this->dof_data[i]->is_complex_valued() &&
1197 (this->dof_data[i]->postprocessor ==
nullptr) ?
1203 if (this->dof_data[
dataset]->postprocessor)
1205 this->dof_data[
dataset]->n_output_variables;
1216 for (
unsigned int i = 0; i < this->dof_data.size(); ++i)
1217 if (this->dof_data[i]->postprocessor)
1219 this->dof_data[i]->postprocessor->get_needed_update_flags();
1225 "The update of normal vectors may not be requested for evaluation of "
1226 "data on cells via DataPostprocessor."));
1235 cell_to_patch_index_map);
1256 std::function<
void(
const int)>(),
1271template <
int dim,
int spacedim>
1279 first_cell_function = first_cell;
1280 next_cell_function = next_cell;
1285template <
int dim,
int spacedim>
1290 const auto first_cell =
1301 const auto next_cell =
1313 x.set_to_next_positive(cell);
1321 set_cell_selection(first_cell, next_cell);
1326template <
int dim,
int spacedim>
1327std::pair<typename DataOut<dim, spacedim>::FirstCellFunctionType,
1331 return std::make_pair(first_cell_function, next_cell_function);
1337#include "data_out.inst"
virtual void build_patches(const unsigned int n_subdivisions=0)
typename std::function< cell_iterator(const Triangulation< dim, spacedim > &, const cell_iterator &)> NextCellFunctionType
void build_one_patch(const std::pair< cell_iterator, unsigned int > *cell_and_index, internal::DataOutImplementation::ParallelData< dim, spacedim > &scratch_data, const unsigned int n_subdivisions, const CurvedCellRegion curved_cell_region)
typename DataOut_DoFData< dim, dim, spacedim, spacedim >::cell_iterator cell_iterator
void set_cell_selection(const std::function< cell_iterator(const Triangulation< dim, spacedim > &)> &first_cell, const std::function< cell_iterator(const Triangulation< dim, spacedim > &, const cell_iterator &)> &next_cell)
std::pair< FirstCellFunctionType, NextCellFunctionType > get_cell_selection() const
static unsigned int n_threads()
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInvalidNumberOfSubdivisions(int arg1)
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNoTriangulationSelected()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
@ update_hessians
Second derivatives of shape functions.
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
#define DEAL_II_NOT_IMPLEMENTED()
@ component_is_part_of_tensor
@ component_is_part_of_vector
void run(const std::vector< std::vector< Iterator > > &colored_iterators, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length=2 *MultithreadInfo::n_threads(), const unsigned int chunk_size=8)
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
const FEValuesBase< dim, spacedim > & get_present_fe_values(const unsigned int dataset) const
const unsigned int n_datasets
DataPostprocessorInputs::Scalar< spacedim > patch_values_scalar
std::vector< std::vector<::Vector< double > > > postprocessed_values
DataPostprocessorInputs::Vector< spacedim > patch_values_system
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)
void resize_system_vectors(const unsigned int n_components)
const std::vector< std::vector< unsigned int > > * cell_to_patch_index_map
ParallelData(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 std::vector< std::vector< unsigned int > > &cell_to_patch_index_map)