46 const unsigned int n_subdivisions)
48 this->mapping = &mapping;
49 this->point_to_local_vector_indices.clear();
52 std::max<unsigned int>(1, n_subdivisions));
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);
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();
165 const auto values = VectorTools::point_values<1>(
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,
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)