44 const unsigned int n_subdivisions)
46 this->mapping = &mapping;
47 this->point_to_local_vector_indices.clear();
50 std::max<unsigned int>(1, n_subdivisions));
51 patch_dof_handler.distribute_dofs(fe);
53 std::vector<std::pair<types::global_dof_index, Point<spacedim>>> points_all;
64 partitioner = std::make_shared<Utilities::MPI::Partitioner>(
65 patch_dof_handler.locally_owned_dofs(),
67 patch_dof_handler.get_mpi_communicator());
69 for (
const auto &cell : patch_dof_handler.active_cell_iterators() |
74 cell->get_dof_indices(dof_indices);
76 for (
unsigned int i = 0; i < dof_indices.size(); ++i)
77 points_all.emplace_back(partitioner->global_to_local(dof_indices[i]),
81 std::sort(points_all.begin(),
83 [](
const auto &a,
const auto &b) { return a.first < b.first; });
84 points_all.erase(std::unique(points_all.begin(),
86 [](
const auto &a,
const auto &b) {
87 return a.first == b.first;
91 std::vector<Point<spacedim>> points;
93 for (
const auto &i : points_all)
95 point_to_local_vector_indices.push_back(i.first);
96 points.push_back(i.second);
99 rpe.reinit(points, *this->triangulation, *this->mapping);
122 patch_data_out.clear();
124 if (rpe.is_ready() ==
false)
129 "Mapping is not valid anymore! Please register a new mapping via "
130 "update_mapping() or the other build_patches() function."));
131 update_mapping(*this->mapping, patch_dof_handler.get_fe().degree);
134 std::vector<std::shared_ptr<LinearAlgebra::distributed::Vector<double>>>
137 patch_data_out.attach_dof_handler(patch_dof_handler);
139 unsigned int counter = 0;
141 for (
const auto &
data : this->dof_data)
143 const auto data_ptr =
dynamic_cast<
144 internal::DataOutImplementation::DataEntry<dim, spacedim, double> *
>(
149 const auto &dh = *data_ptr->dof_handler;
153 for (
const auto &fe : dh.get_fe_collection())
155 fe.n_base_elements() == 1,
157 "This class currently only supports scalar elements and elements "
158 "with a single base element."));
161 for (
unsigned int comp = 0; comp < dh.get_fe_collection().n_components();
164 const auto values = VectorTools::point_values<1>(
167 vectors.emplace_back(
171 for (
unsigned int j = 0; j < values.size(); ++j)
172 vectors.back()->local_element(point_to_local_vector_indices[j]) =
175 vectors.back()->set_ghost_state(
true);
180 patch_data_out.add_data_vector(
182 std::string(
"temp_" + std::to_string(counter)),
184 DataVectorType::type_dof_data);
190 patch_data_out.build_patches(*patch_mapping,
191 patch_dof_handler.get_fe().degree,
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)