23#include <deal.II/numerics/data_out_dof_data.templates.h>
32template <
int dim,
int patch_dim,
int spacedim>
36 : patch_dof_handler(patch_tria)
37 , patch_mapping(&patch_mapping)
42template <
int dim,
int patch_dim,
int spacedim>
46 const unsigned int n_subdivisions)
48 this->mapping = &mapping;
49 this->point_to_local_vector_indices.clear();
53 patch_dof_handler.distribute_dofs(fe);
55 std::vector<std::pair<types::global_dof_index, Point<spacedim>>> points_all;
68 partitioner = std::make_shared<Utilities::MPI::Partitioner>(
69 patch_dof_handler.locally_owned_dofs(), active_dofs, MPI_COMM_WORLD);
71 for (
const auto &cell : patch_dof_handler.active_cell_iterators() |
76 cell->get_dof_indices(dof_indices);
78 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
79 points_all.emplace_back(partitioner->global_to_local(dof_indices[i]),
83 std::sort(points_all.begin(),
85 [](
const auto &a,
const auto &b) { return a.first < b.first; });
86 points_all.erase(std::unique(points_all.begin(),
88 [](
const auto &a,
const auto &b) {
89 return a.first == b.first;
93 std::vector<Point<spacedim>> points;
95 for (
const auto &i : points_all)
97 point_to_local_vector_indices.push_back(i.first);
98 points.push_back(i.second);
106template <
int dim,
int patch_dim,
int spacedim>
110 const unsigned int n_subdivisions,
114 this->build_patches(curved_region);
119template <
int dim,
int patch_dim,
int spacedim>
124 patch_data_out.clear();
126 if (rpe.is_ready() ==
false)
131 "Mapping is not valid anymore! Please register a new mapping via "
132 "update_mapping() or the other build_patches() function."));
133 update_mapping(*this->mapping, patch_dof_handler.get_fe().degree);
136 std::vector<std::shared_ptr<LinearAlgebra::distributed::Vector<double>>>
139 patch_data_out.attach_dof_handler(patch_dof_handler);
141 unsigned int counter = 0;
143 for (
const auto &data : this->dof_data)
145 const auto data_ptr =
dynamic_cast<
146 internal::DataOutImplementation::DataEntry<dim, spacedim, double> *
>(
151 const auto &dh = *data_ptr->dof_handler;
154 for (
const auto &fe : dh.get_fe_collection())
156 fe.n_base_elements() == 1,
158 "This class currently only supports scalar elements and elements "
159 "with a single base element."));
162 for (
unsigned int comp = 0; comp < dh.get_fe_collection().n_components();
168 vectors.emplace_back(
172 for (
unsigned int j = 0; j < values.size(); ++j)
173 vectors.back()->local_element(point_to_local_vector_indices[j]) =
176 vectors.back()->set_ghost_state(
true);
181 patch_data_out.add_data_vector(
183 std::string(
"temp_" + std::to_string(counter)),
185 DataVectorType::type_dof_data);
191 patch_data_out.build_patches(*patch_mapping,
192 patch_dof_handler.get_fe().degree,
198template <
int dim,
int patch_dim,
int spacedim>
199const std::vector<typename DataOutBase::Patch<patch_dim, spacedim>> &
202 return patch_data_out.get_patches();
207#include "data_out_resample.inst"
virtual const std::vector< typename DataOutBase::Patch< patch_dim, spacedim > > & get_patches() const override
DataOutResample(const Triangulation< patch_dim, spacedim > &patch_tria, const Mapping< patch_dim, spacedim > &patch_mapping)
void build_patches(const Mapping< dim, spacedim > &mapping, const unsigned int n_subdivisions=0, const typename DataOut< patch_dim, spacedim >::CurvedCellRegion curved_region=DataOut< patch_dim, spacedim >::CurvedCellRegion::curved_boundary)
void update_mapping(const Mapping< dim, spacedim > &mapping, const unsigned int n_subdivisions=0)
const Point< spacedim > & quadrature_point(const unsigned int q_point) const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell)
unsigned int n_dofs_per_cell() const
const std::vector< Point< dim > > & get_unit_support_points() const
Abstract base class for mapping classes.
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
@ update_quadrature_points
Transformed quadrature points.
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation