15#ifndef dealii_grid_tools_h
16#define dealii_grid_tools_h
48#include <boost/archive/binary_iarchive.hpp>
49#include <boost/archive/binary_oarchive.hpp>
50#include <boost/random/mersenne_twister.hpp>
51#include <boost/serialization/array.hpp>
52#include <boost/serialization/vector.hpp>
54#ifdef DEAL_II_WITH_ZLIB
55# include <boost/iostreams/device/back_inserter.hpp>
56# include <boost/iostreams/filter/gzip.hpp>
57# include <boost/iostreams/filtering_stream.hpp>
58# include <boost/iostreams/stream.hpp>
64#ifdef DEAL_II_HAVE_CXX20
77 template <
int dim,
int spacedim>
86 class MappingCollection;
93 template <
int dim,
int spacedim>
100 template <
int dim,
int spacedim,
typename MeshType>
106 using type =
typename MeshType::active_cell_iterator;
113 template <
int dim,
int spacedim>
219 template <
int dim,
typename Transformation,
int spacedim>
222 std::assignable_from<
234 template <
int dim,
int spacedim>
250 template <
int dim,
int spacedim>
333 const
Function<dim,
double> *coefficient =
nullptr,
334 const
bool solve_for_absolute_positions = false);
343 template <
int dim,
int spacedim>
345 scale(const
double scaling_factor,
377 template <
int dim,
int spacedim>
382 const
bool keep_boundary = true,
383 const
unsigned int seed =
boost::random::mt19937::default_seed);
474 template <
int dim,
int spacedim>
477 const
double limit_angle_fraction = .75);
542 template <
int dim,
int spacedim>
545 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
546 std::vector<std::vector<Point<dim>>>,
547 std::vector<std::vector<unsigned int>>>
591 template <
int dim,
int spacedim>
594 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
595 std::vector<std::vector<Point<dim>>>,
596 std::vector<std::vector<unsigned int>>,
597 std::vector<unsigned int>>
687 template <
int dim,
int spacedim>
690 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
691 std::vector<std::vector<Point<dim>>>,
692 std::vector<std::vector<unsigned int>>,
693 std::vector<std::vector<Point<spacedim>>>,
694 std::vector<std::vector<unsigned int>>>
702 const double tolerance = 1e-10,
703 const std::vector<bool> &marked_vertices = {},
704 const bool enforce_unique_mapping =
true);
722 template <
int dim,
int spacedim>
747 std::vector<std::tuple<std::pair<int, int>,
777 std::vector<std::tuple<unsigned int, unsigned int, unsigned int>>
802 template <
int dim,
int spacedim>
808 const std::vector<bool> &marked_vertices,
809 const double tolerance,
810 const bool perform_handshake,
811 const bool enforce_unique_mapping =
false);
821 template <
int structdim,
int spacedim>
828 std::array<::Point<spacedim>, structdim + 1>;
838 std::vector<std::tuple<std::pair<int, int>,
852 std::vector<std::tuple<unsigned int, unsigned int, IntersectionType>>
884 const unsigned int n_points_1D,
889 const bool consistent_numbering_of_sender_and_receiver =
false)
const;
899 std::map<unsigned int, std::vector<unsigned int>>
901 const std::vector<std::tuple<unsigned int, unsigned int, unsigned int>>
902 &point_recv_components,
913 template <
int structdim,
int dim,
int spacedim>
917 const std::vector<std::vector<
Point<spacedim>>> &intersection_requests,
919 const std::vector<bool> &marked_vertices,
920 const double tolerance);
933 template <
int spacedim>
964 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
968 const MeshType<dim, spacedim> &mesh,
969 const
Point<spacedim> &p,
970 const
std::vector<
bool> &marked_vertices = {});
998 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1002 const
Mapping<dim, spacedim> &mapping,
1003 const MeshType<dim, spacedim> &mesh,
1004 const
Point<spacedim> &p,
1005 const
std::vector<
bool> &marked_vertices = {});
1030 template <
typename MeshType>
1033 std::vector<typename MeshType::active_cell_iterator>
1036 typename ::internal::ActiveCellIterator<MeshType::dimension,
1037 MeshType::space_dimension,
1041 const unsigned int vertex_index);
1108 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1112 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>
1114 std::pair<typename ::internal::
1115 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1119 const MeshType<dim, spacedim> &mesh,
1121 const std::vector<bool> &marked_vertices = {},
1122 const double tolerance = 1.e-10);
1134 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1138 typename MeshType<dim, spacedim>::active_cell_iterator
1140 typename ::internal::
1141 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type
1145 const std::vector<bool> &marked_vertices = {},
1146 const double tolerance = 1.e-10);
1154 template <
int dim,
int spacedim>
1155 std::pair<typename DoFHandler<dim, spacedim>::active_cell_iterator,
1161 const double tolerance = 1.e-10);
1214 template <
int dim,
int spacedim>
1215 std::pair<typename Triangulation<dim, spacedim>::active_cell_iterator,
1218 const Cache<dim, spacedim> &cache,
1222 const std::vector<bool> &marked_vertices = {},
1223 const double tolerance = 1.e-10);
1241 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1245 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>
1247 std::pair<typename ::internal::
1248 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1253 const MeshType<dim, spacedim> &mesh,
1256 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>>
1259 &vertex_to_cell_centers,
1260 const typename MeshType<dim, spacedim>::active_cell_iterator &cell_hint =
1261 typename MeshType<dim, spacedim>::active_cell_iterator(),
1262 const std::vector<bool> &marked_vertices = {},
1265 const double tolerance = 1.e-10,
1267 std::pair<BoundingBox<spacedim>,
1269 *relevant_cell_bounding_boxes_rtree =
nullptr);
1300 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1304 std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
1307 std::vector<std::pair<
1308 typename ::internal::
1309 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1314 const MeshType<dim, spacedim> &mesh,
1316 const double tolerance,
1317 const std::pair<
typename MeshType<dim, spacedim>::active_cell_iterator,
1320 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>>
1321 *vertex_to_cells =
nullptr);
1332 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1336 std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
1339 std::vector<std::pair<
1340 typename ::internal::
1341 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1346 const MeshType<dim, spacedim> &mesh,
1348 const double tolerance = 1e-10,
1349 const std::vector<bool> &marked_vertices = {});
1374 template <
typename MeshType>
1377 const typename MeshType::cell_iterator &cell);
1405 template <typename MeshType>
1408 const typename MeshType::active_cell_iterator &cell,
1409 std::vector<typename MeshType::active_cell_iterator> &active_neighbors);
1462 template <typename MeshType>
1466 const MeshType &mesh,
1467 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1480 template <typename MeshType>
1484 const MeshType &mesh,
1485 const
std::function<
bool(const typename MeshType::cell_iterator &)>
1487 const
unsigned int level);
1504 template <typename MeshType>
1560 template <typename MeshType>
1564 const MeshType &mesh,
1565 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1567 const
double layer_thickness);
1593 template <typename MeshType>
1597 const MeshType &mesh,
1598 const
double layer_thickness);
1672 template <typename MeshType>
1676 const MeshType &mesh,
1677 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1679 const
unsigned int refinement_level = 0,
1680 const
bool allow_merge = false,
1681 const
unsigned int max_boxes =
numbers::invalid_unsigned_int);
1710 template <
int spacedim>
1712 std::tuple<std::vector<std::vector<unsigned int>>,
1713 std::map<unsigned int, unsigned int>,
1714 std::map<unsigned int, std::vector<unsigned int>>>
1757 template <
int spacedim>
1759 std::tuple<std::map<unsigned int, std::vector<unsigned int>>,
1760 std::map<unsigned int, unsigned int>,
1761 std::map<unsigned int, std::vector<unsigned int>>>
1781 template <
int dim,
int spacedim>
1782 std::vector<std::vector<Tensor<1, spacedim>>>
1797 template <
int dim,
int spacedim>
1803 (ReferenceCells::get_hypercube<dim>()
1805 .
template get_default_linear_mapping<dim, spacedim>()
1807 .ReferenceCell::get_default_linear_mapping<dim, spacedim>()
1822 template <
int dim,
int spacedim>
1823 std::map<unsigned int, types::global_vertex_index>
1853 template <
int dim,
int spacedim>
1870 template <
int dim,
int spacedim>
1873 const std::vector<unsigned int> &cell_weights,
1923 template <
int dim,
int spacedim>
1941 template <
int dim,
int spacedim>
1944 const std::vector<unsigned int> &cell_weights,
1964 template <
int dim,
int spacedim>
1968 const bool group_siblings =
true);
1981 template <
int dim,
int spacedim>
1992 template <
int dim,
int spacedim>
1993 std::vector<types::subdomain_id>
1995 const std::vector<CellId> &cell_ids);
2007 template <
int dim,
int spacedim>
2010 std::vector<types::subdomain_id> &subdomain);
2026 template <
int dim,
int spacedim>
2061 template <
int dim,
int spacedim>
2091 template <
int dim,
int spacedim>
2149 template <
typename MeshType>
2152 const typename MeshType::active_cell_iterator &cell);
2176 template <
class Container>
2177 std::vector<typename Container::cell_iterator>
2179 const std::vector<typename Container::active_cell_iterator> &patch_cells);
2247 template <
class Container>
2250 const std::vector<typename Container::active_cell_iterator> &patch,
2252 &local_triangulation,
2255 Container::space_dimension>::active_cell_iterator,
2256 typename Container::active_cell_iterator> &patch_to_global_tria_map);
2289 template <
int dim,
int spacedim>
2292 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>>
2310 template <
typename CellIterator>
2376 template <
typename FaceIterator>
2377 std::optional<types::geometric_orientation>
2379 const FaceIterator &face1,
2380 const FaceIterator &face2,
2381 const unsigned int direction,
2385 const double abs_tol = 1e-10);
2446 template <
typename MeshType>
2449 const MeshType &mesh,
2452 const unsigned int direction,
2458 const double abs_tol = 1e-10);
2481 template <
typename MeshType>
2484 const MeshType &mesh,
2485 const
types::boundary_id b_id,
2486 const
unsigned int direction,
2489 const ::
Tensor<1, MeshType::space_dimension> &offset =
2490 ::
Tensor<1, MeshType::space_dimension>(),
2492 const
double abs_tol = 1e-10);
2520 template <
int dim,
int spacedim>
2523 const
bool reset_boundary_ids = false);
2546 template <
int dim,
int spacedim>
2549 const
std::vector<
types::boundary_id> &src_boundary_ids,
2550 const
std::vector<
types::manifold_id> &dst_manifold_ids,
2552 const
std::vector<
types::boundary_id> &reset_boundary_ids = {});
2583 template <
int dim,
int spacedim>
2586 const bool compute_face_ids =
false);
2612 template <
int dim,
int spacedim>
2617 const std::set<types::manifold_id> &)> &disambiguation_function =
2618 [](
const std::set<types::manifold_id> &manifold_ids) {
2619 if (manifold_ids.size() == 1)
2620 return *manifold_ids.begin();
2624 bool overwrite_only_flat_manifold_ids =
true);
2713 template <
typename DataType,
typename MeshType>
2716 const MeshType &mesh,
2717 const
std::function<
std::optional<DataType>(
2718 const typename MeshType::active_cell_iterator &)> &pack,
2719 const
std::function<
void(const typename MeshType::active_cell_iterator &,
2720 const DataType &)> &unpack,
2721 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
2723 always_return<typename MeshType::active_cell_iterator,
bool>{
true});
2737 template <
typename DataType,
typename MeshType>
2740 const MeshType &mesh,
2741 const
std::function<
std::optional<DataType>(
2742 const typename MeshType::level_cell_iterator &)> &pack,
2743 const
std::function<
void(const typename MeshType::level_cell_iterator &,
2744 const DataType &)> &unpack,
2745 const
std::function<
bool(const typename MeshType::level_cell_iterator &)> &
2746 cell_filter =
always_return<typename MeshType::level_cell_iterator,
bool>{
2760 template <
int spacedim>
2761 std::vector<std::vector<BoundingBox<spacedim>>>
2798 template <
int spacedim>
2821 template <
int dim,
int spacedim>
2825 std::map<
unsigned int, std::vector<unsigned int>> &coinciding_vertex_groups,
2826 std::map<unsigned int, unsigned int> &vertex_to_coinciding_vertex_group);
2847 template <
int dim,
int spacedim>
2848 std::map<unsigned int, std::set<::types::subdomain_id>>
2872 template <
int dim,
typename VectorType>
2901 const VectorType &ls_vector,
2902 const double iso_level,
2912 const VectorType &ls_vector,
2913 const double iso_level,
2927 const VectorType &ls_vector,
2928 const double iso_level,
2938 const VectorType &ls_vector,
2939 const double iso_level,
2956 const double iso_level,
2959 const bool write_back_cell_data =
true)
const;
2967 const std::vector<unsigned int> &,
2984 const std::vector<
Point<2>> &points,
2985 const std::vector<unsigned int> &mask,
2986 const double iso_level,
2989 const bool write_back_cell_data)
const;
2996 const std::vector<
Point<3>> &points,
2997 const std::vector<unsigned int> &mask,
2998 const double iso_level,
3001 const bool write_back_cell_data)
const;
3034 <<
"The number of partitions you gave is " << arg1
3035 <<
", but must be greater than zero.");
3041 <<
"The subdomain id " << arg1
3042 <<
" has no cells associated with it.");
3053 <<
"The scaling factor must be positive, but it is " << arg1
3061 <<
"The given vertex with index " << arg1
3062 <<
" is not used in the given triangulation.");
3101 template <
int dim,
typename Transformation,
int spacedim>
3104 std::assignable_from<
3107 void
transform(const Transformation &transformation,
3110 std::vector<bool> treated_vertices(
triangulation.n_vertices(),
false);
3121 for (; cell != endc; ++cell)
3123 if (treated_vertices[cell->vertex_index(v)] == false)
3126 cell->vertex(v) = transformation(cell->vertex(v));
3128 treated_vertices[cell->vertex_index(v)] =
true;
3138 for (; cell != endc; ++cell)
3139 for (
const unsigned int face : cell->face_indices())
3140 if (cell->face(face)->has_children() &&
3141 !cell->face(face)->at_boundary())
3143 Assert(cell->reference_cell() ==
3144 ReferenceCells::get_hypercube<dim>(),
3148 cell->face(face)->child(0)->vertex(1) =
3149 (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)) /
3158 for (; cell != endc; ++cell)
3159 for (
const unsigned int face : cell->face_indices())
3160 if (cell->face(face)->has_children() &&
3161 !cell->face(face)->at_boundary())
3163 if (
static_cast<std::uint8_t
>(
3164 cell->face(face)->refinement_case()) ==
3167 Assert(cell->reference_cell() ==
3168 ReferenceCells::get_hypercube<dim>(),
3172 cell->face(face)->child(0)->vertex(1) =
3173 (cell->face(face)->vertex(0) +
3174 cell->face(face)->vertex(1)) /
3176 cell->face(face)->child(0)->vertex(2) =
3177 (cell->face(face)->vertex(0) +
3178 cell->face(face)->vertex(2)) /
3180 cell->face(face)->child(1)->vertex(3) =
3181 (cell->face(face)->vertex(1) +
3182 cell->face(face)->vertex(3)) /
3184 cell->face(face)->child(2)->vertex(3) =
3185 (cell->face(face)->vertex(2) +
3186 cell->face(face)->vertex(3)) /
3190 cell->face(face)->child(0)->vertex(3) =
3191 (cell->face(face)->vertex(0) +
3192 cell->face(face)->vertex(1) +
3193 cell->face(face)->vertex(2) +
3194 cell->face(face)->vertex(3)) /
3200 for (
unsigned int line = 0;
3203 if (cell->face(face)->line(line)->has_children())
3204 cell->face(face)->line(line)->child(0)->vertex(1) =
3205 (cell->face(face)->line(line)->vertex(0) +
3206 cell->face(face)->line(line)->vertex(1)) /
3218 template <
typename MeshType>
3221 const typename MeshType::cell_iterator &cell)
3223 std::vector<typename MeshType::active_cell_iterator> child_cells;
3225 if (cell->has_children())
3227 for (
unsigned int child = 0; child < cell->n_children(); ++child)
3228 if (cell->child(child)->has_children())
3230 const std::vector<typename MeshType::active_cell_iterator>
3231 children = get_active_child_cells<MeshType>(cell->child(child));
3232 child_cells.insert(child_cells.end(),
3237 child_cells.push_back(cell->child(child));
3245 template <
typename MeshType>
3248 const typename MeshType::active_cell_iterator &cell,
3249 std::vector<typename MeshType::active_cell_iterator> &active_neighbors)
3251 active_neighbors.clear();
3252 for (
const unsigned int n : cell->face_indices())
3253 if (!cell->at_boundary(n))
3255 if (MeshType::dimension == 1)
3262 typename MeshType::cell_iterator neighbor_child =
3264 if (!neighbor_child->is_active())
3266 while (neighbor_child->has_children())
3267 neighbor_child = neighbor_child->child(n == 0 ? 1 : 0);
3269 Assert(neighbor_child->neighbor(n == 0 ? 1 : 0) == cell,
3272 active_neighbors.push_back(neighbor_child);
3276 if (cell->face(n)->has_children())
3280 for (
unsigned int c = 0;
3281 c < cell->face(n)->n_active_descendants();
3283 active_neighbors.push_back(
3284 cell->neighbor_child_on_subface(n, c));
3290 active_neighbors.push_back(cell->neighbor(n));
3298 template <
typename CellIterator>
3302 return sizeof(*this) +
matrix.memory_consumption();
3309 template <
typename DataType,
3311 typename MeshCellIteratorType>
3313 inline void exchange_cell_data(
3314 const MeshType &mesh,
3315 const std::function<std::optional<DataType>(
const MeshCellIteratorType &)>
3317 const std::function<
void(
const MeshCellIteratorType &,
const DataType &)>
3319 const std::function<
bool(
const MeshCellIteratorType &)> &cell_filter,
3320 const std::function<
void(
3321 const std::function<
void(
const MeshCellIteratorType &,
3323 const std::function<std::set<types::subdomain_id>(
3325 MeshType::space_dimension> &)>
3326 &compute_ghost_owners)
3328# ifndef DEAL_II_WITH_MPI
3333 (void)process_cells;
3334 (void)compute_ghost_owners;
3337 constexpr int dim = MeshType::dimension;
3338 constexpr int spacedim = MeshType::space_dimension;
3341 &mesh.get_triangulation());
3345 "The function exchange_cell_data_to_ghosts() only works with parallel triangulations."));
3347 if (
const auto tria =
dynamic_cast<
3349 &mesh.get_triangulation()))
3352 tria->with_artificial_cells(),
3354 "The functions GridTools::exchange_cell_data_to_ghosts() and "
3355 "GridTools::exchange_cell_data_to_level_ghosts() can only "
3356 "operate on a single layer of ghost cells. However, you have "
3357 "given a Triangulation object of type "
3358 "parallel::shared::Triangulation without artificial cells "
3359 "resulting in an arbitrary number of ghost layers. "
3360 "To use this function for a Triangulation object of type "
3361 "parallel::shared::Triangulation, make sure to create the "
3362 "Triangulation object with allow_artificial_cells set to true. "
3363 "This results in a parallel::shared::Triangulation with only "
3364 "a single layer of ghost cells."));
3368 std::set<::types::subdomain_id> ghost_owners =
3369 compute_ghost_owners(*tria);
3371 std::vector<typename CellId::binary_type>>
3374 for (
const auto ghost_owner : ghost_owners)
3375 neighbor_cell_list[ghost_owner] = {};
3377 process_cells([&](
const auto &cell,
const auto key) ->
void {
3378 if (cell_filter(cell))
3380 constexpr int spacedim = MeshType::space_dimension;
3381 neighbor_cell_list[key].emplace_back(
3382 cell->id().template to_binary<spacedim>());
3386 Assert(ghost_owners.size() == neighbor_cell_list.size(),
3398 const int mpi_tag_reply =
3402 std::vector<MPI_Request> requests(ghost_owners.size());
3404 unsigned int idx = 0;
3405 for (
const auto &it : neighbor_cell_list)
3408 const int ierr = MPI_Isend(it.second.data(),
3409 it.second.size() *
sizeof(it.second[0]),
3421 std::vector<MPI_Request> reply_requests(ghost_owners.size());
3422 std::vector<std::vector<char>> sendbuffers(ghost_owners.size());
3424 for (
unsigned int idx = 0; idx < ghost_owners.size(); ++idx)
3427 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3434 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3441 std::vector<typename CellId::binary_type> cells_with_requests(
3443 std::vector<DataType> data_to_send;
3444 data_to_send.reserve(n_cells);
3445 std::vector<bool> cell_carries_data(n_cells,
false);
3447 ierr = MPI_Recv(cells_with_requests.data(),
3457 for (
unsigned int c = 0; c < static_cast<unsigned int>(n_cells); ++c)
3462 MeshCellIteratorType mesh_it(tria,
3467 const std::optional<DataType>
data =
pack(mesh_it);
3470 data_to_send.emplace_back(*
data);
3471 cell_carries_data[c] =
true;
3479 sendbuffers[idx].resize(
sizeof(std::size_t));
3484 std::size_t size_of_send =
3488 std::memcpy(sendbuffers[idx].
data(),
3490 sizeof(std::size_t));
3494 if (data_to_send.size() < n_cells)
3500 ierr = MPI_Isend(sendbuffers[idx].
data(),
3501 sendbuffers[idx].
size(),
3506 &reply_requests[idx]);
3511 std::vector<char> receive;
3512 for (
unsigned int id = 0;
id < neighbor_cell_list.size(); ++id)
3515 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3522 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3525 receive.resize(len);
3527 ierr = MPI_Recv(receive.data(),
3538 auto data_iterator = receive.begin();
3539 std::size_t size_of_received_data =
3540 Utilities::unpack<std::size_t>(data_iterator,
3541 data_iterator +
sizeof(std::size_t));
3542 data_iterator +=
sizeof(std::size_t);
3545 auto received_data = Utilities::unpack<std::vector<DataType>>(
3547 data_iterator + size_of_received_data,
3549 data_iterator += size_of_received_data;
3554 const std::vector<typename CellId::binary_type> &this_cell_list =
3555 neighbor_cell_list[status.MPI_SOURCE];
3557 std::vector<bool> cells_with_data;
3558 if (received_data.size() < this_cell_list.size())
3560 cells_with_data = Utilities::unpack<std::vector<bool>>(
3561 data_iterator, receive.end(),
false);
3567 auto received_data_iterator = received_data.begin();
3568 for (
unsigned int c = 0; c < this_cell_list.size(); ++c)
3569 if (cells_with_data.empty() || cells_with_data[c])
3574 MeshCellIteratorType cell(tria,
3579 unpack(cell, *received_data_iterator);
3580 ++received_data_iterator;
3586 if (requests.size() > 0)
3589 MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
3592 if (reply_requests.size() > 0)
3594 const int ierr = MPI_Waitall(reply_requests.size(),
3595 reply_requests.data(),
3596 MPI_STATUSES_IGNORE);
3606 template <
typename DataType,
typename MeshType>
3609 const MeshType &mesh,
3610 const std::function<std::optional<DataType>(
3611 const typename MeshType::active_cell_iterator &)> &pack,
3612 const std::function<
void(
const typename MeshType::active_cell_iterator &,
3613 const DataType &)> &unpack,
3614 const std::function<
bool(
const typename MeshType::active_cell_iterator &)>
3617# ifndef DEAL_II_WITH_MPI
3624 internal::exchange_cell_data<DataType,
3626 typename MeshType::active_cell_iterator>(
3631 [&](
const auto &process) {
3632 for (
const auto &cell : mesh.active_cell_iterators())
3633 if (cell->is_ghost())
3636 [](
const auto &tria) {
return tria.ghost_owners(); });
3642 template <
typename DataType,
typename MeshType>
3645 const MeshType &mesh,
3646 const std::function<std::optional<DataType>(
3647 const typename MeshType::level_cell_iterator &)> &pack,
3648 const std::function<
void(
const typename MeshType::level_cell_iterator &,
3649 const DataType &)> &unpack,
3650 const std::function<
bool(
const typename MeshType::level_cell_iterator &)>
3653# ifndef DEAL_II_WITH_MPI
3660 internal::exchange_cell_data<DataType,
3662 typename MeshType::level_cell_iterator>(
3667 [&](
const auto &process) {
3668 for (
const auto &cell : mesh.cell_iterators())
3669 if (cell->is_ghost_on_level())
3670 process(cell, cell->level_subdomain_id());
3672 [](
const auto &tria) {
return tria.level_ghost_owners(); });
std::array< unsigned int, 4 > binary_type
Abstract base class for mapping classes.
cell_iterator create_cell_iterator(const CellId &cell_id) const
virtual MPI_Comm get_mpi_communicator() const
typename MeshType::active_cell_iterator type
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define DeclException0(Exception0)
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcNeedsMPI()
static ::ExceptionBase & ExcNonExistentSubdomain(int arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcVertexNotUsed(unsigned int arg1)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcTriangulationHasBeenRefined()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcInvalidNumberOfPartitions(int arg1)
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcScalingFactorNotPositive(double arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::active_cell_iterator active_cell_iterator
void copy_boundary_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool reset_boundary_ids=false)
void copy_material_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool compute_face_ids=false)
void map_boundary_to_manifold_ids(const std::vector< types::boundary_id > &src_boundary_ids, const std::vector< types::manifold_id > &dst_manifold_ids, Triangulation< dim, spacedim > &tria, const std::vector< types::boundary_id > &reset_boundary_ids={})
void assign_co_dimensional_manifold_indicators(Triangulation< dim, spacedim > &tria, const std::function< types::manifold_id(const std::set< types::manifold_id > &)> &disambiguation_function=[](const std::set< types::manifold_id > &manifold_ids) { if(manifold_ids.size()==1) return *manifold_ids.begin();else return numbers::flat_manifold_id;}, bool overwrite_only_flat_manifold_ids=true)
std::vector< index_type > data
@ matrix
Contents is actually a matrix.
std::size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
constexpr types::manifold_id flat_manifold_id
unsigned int global_dof_index
unsigned int subdomain_id
unsigned char geometric_orientation
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
boost::geometry::index::rtree< LeafType, IndexType, IndexableGetter > RTree