13#ifndef dealii_grid_tools_h
14#define dealii_grid_tools_h
46#include <boost/archive/binary_iarchive.hpp>
47#include <boost/archive/binary_oarchive.hpp>
48#include <boost/random/mersenne_twister.hpp>
49#include <boost/serialization/array.hpp>
50#include <boost/serialization/vector.hpp>
52#ifdef DEAL_II_WITH_ZLIB
53# include <boost/iostreams/device/back_inserter.hpp>
54# include <boost/iostreams/filter/gzip.hpp>
55# include <boost/iostreams/filtering_stream.hpp>
56# include <boost/iostreams/stream.hpp>
62#ifdef DEAL_II_HAVE_CXX20
75 template <
int dim,
int spacedim>
84 class MappingCollection;
91 template <
int dim,
int spacedim>
98 template <
int dim,
int spacedim,
typename MeshType>
104 using type =
typename MeshType::active_cell_iterator;
111 template <
int dim,
int spacedim>
217 template <
int dim,
typename Transformation,
int spacedim>
220 std::assignable_from<
232 template <
int dim,
int spacedim>
248 template <
int dim,
int spacedim>
331 const
Function<dim,
double> *coefficient =
nullptr,
332 const
bool solve_for_absolute_positions = false);
341 template <
int dim,
int spacedim>
343 scale(const
double scaling_factor,
375 template <
int dim,
int spacedim>
380 const
bool keep_boundary = true,
381 const
unsigned int seed =
boost::random::mt19937::default_seed);
472 template <
int dim,
int spacedim>
475 const
double limit_angle_fraction = .75);
540 template <
int dim,
int spacedim>
543 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
544 std::vector<std::vector<Point<dim>>>,
545 std::vector<std::vector<unsigned int>>>
589 template <
int dim,
int spacedim>
592 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
593 std::vector<std::vector<Point<dim>>>,
594 std::vector<std::vector<unsigned int>>,
595 std::vector<unsigned int>>
694 template <
int dim,
int spacedim>
697 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
698 std::vector<std::vector<Point<dim>>>,
699 std::vector<std::vector<unsigned int>>,
700 std::vector<std::vector<Point<spacedim>>>,
701 std::vector<std::vector<unsigned int>>>
709 const double tolerance = 1e-10,
710 const std::vector<bool> &marked_vertices = {},
711 const bool enforce_unique_mapping =
true);
729 template <
int dim,
int spacedim>
754 std::vector<std::tuple<std::pair<int, int>,
784 std::vector<std::tuple<unsigned int, unsigned int, unsigned int>>
809 template <
int dim,
int spacedim>
815 const std::vector<bool> &marked_vertices,
816 const double tolerance,
817 const bool perform_handshake,
818 const bool enforce_unique_mapping =
false);
828 template <
int structdim,
int spacedim>
835 std::array<::Point<spacedim>, structdim + 1>;
845 std::vector<std::tuple<std::pair<int, int>,
859 std::vector<std::tuple<unsigned int, unsigned int, IntersectionType>>
891 const unsigned int n_points_1D,
896 const bool consistent_numbering_of_sender_and_receiver =
false)
const;
906 std::map<unsigned int, std::vector<unsigned int>>
908 const std::vector<std::tuple<unsigned int, unsigned int, unsigned int>>
909 &point_recv_components,
920 template <
int structdim,
int dim,
int spacedim>
924 const std::vector<std::vector<
Point<spacedim>>> &intersection_requests,
926 const std::vector<bool> &marked_vertices,
927 const double tolerance);
940 template <
int spacedim>
971 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
975 const MeshType<dim, spacedim> &mesh,
976 const
Point<spacedim> &p,
977 const
std::vector<
bool> &marked_vertices = {});
1005 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1009 const
Mapping<dim, spacedim> &mapping,
1010 const MeshType<dim, spacedim> &mesh,
1011 const
Point<spacedim> &p,
1012 const
std::vector<
bool> &marked_vertices = {});
1037 template <
typename MeshType>
1040 std::vector<typename MeshType::active_cell_iterator>
1043 typename ::internal::ActiveCellIterator<MeshType::dimension,
1044 MeshType::space_dimension,
1048 const unsigned int vertex_index);
1115 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1119 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>
1121 std::pair<typename ::internal::
1122 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1126 const MeshType<dim, spacedim> &mesh,
1128 const std::vector<bool> &marked_vertices = {},
1129 const double tolerance = 1.e-10);
1141 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1145 typename MeshType<dim, spacedim>::active_cell_iterator
1147 typename ::internal::
1148 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type
1152 const std::vector<bool> &marked_vertices = {},
1153 const double tolerance = 1.e-10);
1161 template <
int dim,
int spacedim>
1162 std::pair<typename DoFHandler<dim, spacedim>::active_cell_iterator,
1168 const double tolerance = 1.e-10);
1221 template <
int dim,
int spacedim>
1222 std::pair<typename Triangulation<dim, spacedim>::active_cell_iterator,
1225 const Cache<dim, spacedim> &cache,
1229 const std::vector<bool> &marked_vertices = {},
1230 const double tolerance = 1.e-10);
1248 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1252 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>
1254 std::pair<typename ::internal::
1255 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1260 const MeshType<dim, spacedim> &mesh,
1263 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>>
1266 &vertex_to_cell_centers,
1267 const typename MeshType<dim, spacedim>::active_cell_iterator &cell_hint =
1268 typename MeshType<dim, spacedim>::active_cell_iterator(),
1269 const std::vector<bool> &marked_vertices = {},
1272 const double tolerance = 1.e-10,
1274 std::pair<BoundingBox<spacedim>,
1276 *relevant_cell_bounding_boxes_rtree =
nullptr);
1307 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1311 std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
1314 std::vector<std::pair<
1315 typename ::internal::
1316 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1321 const MeshType<dim, spacedim> &mesh,
1323 const double tolerance,
1324 const std::pair<
typename MeshType<dim, spacedim>::active_cell_iterator,
1327 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>>
1328 *vertex_to_cells =
nullptr);
1339 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1343 std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
1346 std::vector<std::pair<
1347 typename ::internal::
1348 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1353 const MeshType<dim, spacedim> &mesh,
1355 const double tolerance = 1e-10,
1356 const std::vector<bool> &marked_vertices = {});
1381 template <
typename MeshType>
1384 const typename MeshType::cell_iterator &cell);
1412 template <typename MeshType>
1415 const typename MeshType::active_cell_iterator &cell,
1416 std::vector<typename MeshType::active_cell_iterator> &active_neighbors);
1469 template <typename MeshType>
1473 const MeshType &mesh,
1474 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1487 template <typename MeshType>
1491 const MeshType &mesh,
1492 const
std::function<
bool(const typename MeshType::cell_iterator &)>
1494 const
unsigned int level);
1511 template <typename MeshType>
1567 template <typename MeshType>
1571 const MeshType &mesh,
1572 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1574 const
double layer_thickness);
1600 template <typename MeshType>
1604 const MeshType &mesh,
1605 const
double layer_thickness);
1679 template <typename MeshType>
1683 const MeshType &mesh,
1684 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1686 const
unsigned int refinement_level = 0,
1687 const
bool allow_merge = false,
1688 const
unsigned int max_boxes =
numbers::invalid_unsigned_int);
1717 template <
int spacedim>
1719 std::tuple<std::vector<std::vector<unsigned int>>,
1720 std::map<unsigned int, unsigned int>,
1721 std::map<unsigned int, std::vector<unsigned int>>>
1764 template <
int spacedim>
1766 std::tuple<std::map<unsigned int, std::vector<unsigned int>>,
1767 std::map<unsigned int, unsigned int>,
1768 std::map<unsigned int, std::vector<unsigned int>>>
1788 template <
int dim,
int spacedim>
1789 std::vector<std::vector<Tensor<1, spacedim>>>
1804 template <
int dim,
int spacedim>
1810 (ReferenceCells::get_hypercube<dim>()
1812 .
template get_default_linear_mapping<spacedim>()
1829 template <
int dim,
int spacedim>
1830 std::map<unsigned int, types::global_vertex_index>
1862 template <
int dim,
int spacedim>
1863 std::vector<types::global_vertex_index>
1894 template <
int dim,
int spacedim>
1911 template <
int dim,
int spacedim>
1914 const std::vector<unsigned int> &cell_weights,
1964 template <
int dim,
int spacedim>
1982 template <
int dim,
int spacedim>
1985 const std::vector<unsigned int> &cell_weights,
2005 template <
int dim,
int spacedim>
2009 const bool group_siblings =
true);
2022 template <
int dim,
int spacedim>
2033 template <
int dim,
int spacedim>
2034 std::vector<types::subdomain_id>
2036 const std::vector<CellId> &cell_ids);
2048 template <
int dim,
int spacedim>
2051 std::vector<types::subdomain_id> &subdomain);
2067 template <
int dim,
int spacedim>
2102 template <
int dim,
int spacedim>
2155 template <
typename MeshType>
2158 const typename MeshType::active_cell_iterator &cell);
2182 template <
class Container>
2183 std::vector<typename Container::cell_iterator>
2185 const std::vector<typename Container::active_cell_iterator> &patch_cells);
2253 template <
class Container>
2256 const std::vector<typename Container::active_cell_iterator> &patch,
2258 &local_triangulation,
2261 Container::space_dimension>::active_cell_iterator,
2262 typename Container::active_cell_iterator> &patch_to_global_tria_map);
2295 template <
int dim,
int spacedim>
2298 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>>
2316 template <
typename CellIterator>
2382 template <
typename FaceIterator>
2383 std::optional<types::geometric_orientation>
2385 const FaceIterator &face1,
2386 const FaceIterator &face2,
2387 const unsigned int direction,
2391 const double abs_tol = 1e-10);
2452 template <
typename MeshType>
2455 const MeshType &mesh,
2458 const unsigned int direction,
2464 const double abs_tol = 1e-10);
2492 template <
typename MeshType>
2495 const MeshType &mesh,
2496 const
types::boundary_id b_id,
2497 const
unsigned int direction,
2500 const ::
Tensor<1, MeshType::space_dimension> &offset =
2501 ::
Tensor<1, MeshType::space_dimension>(),
2503 const
double abs_tol = 1e-10);
2531 template <
int dim,
int spacedim>
2534 const
bool reset_boundary_ids = false);
2557 template <
int dim,
int spacedim>
2560 const
std::vector<
types::boundary_id> &src_boundary_ids,
2561 const
std::vector<
types::manifold_id> &dst_manifold_ids,
2563 const
std::vector<
types::boundary_id> &reset_boundary_ids = {});
2594 template <
int dim,
int spacedim>
2597 const bool compute_face_ids =
false);
2623 template <
int dim,
int spacedim>
2628 const std::set<types::manifold_id> &)> &disambiguation_function =
2629 [](
const std::set<types::manifold_id> &manifold_ids) {
2630 if (manifold_ids.size() == 1)
2631 return *manifold_ids.begin();
2635 bool overwrite_only_flat_manifold_ids =
true);
2724 template <
typename DataType,
typename MeshType>
2727 const MeshType &mesh,
2728 const
std::function<
std::optional<DataType>(
2729 const typename MeshType::active_cell_iterator &)> &pack,
2730 const
std::function<
void(const typename MeshType::active_cell_iterator &,
2731 const DataType &)> &unpack,
2732 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
2734 always_return<typename MeshType::active_cell_iterator,
bool>{
true});
2748 template <
typename DataType,
typename MeshType>
2751 const MeshType &mesh,
2752 const
std::function<
std::optional<DataType>(
2753 const typename MeshType::level_cell_iterator &)> &pack,
2754 const
std::function<
void(const typename MeshType::level_cell_iterator &,
2755 const DataType &)> &unpack,
2756 const
std::function<
bool(const typename MeshType::level_cell_iterator &)> &
2757 cell_filter =
always_return<typename MeshType::level_cell_iterator,
bool>{
2771 template <
int spacedim>
2772 std::vector<std::vector<BoundingBox<spacedim>>>
2809 template <
int spacedim>
2832 template <
int dim,
int spacedim>
2836 std::map<
unsigned int, std::vector<unsigned int>> &coinciding_vertex_groups,
2837 std::map<unsigned int, unsigned int> &vertex_to_coinciding_vertex_group);
2858 template <
int dim,
int spacedim>
2859 std::map<unsigned int, std::set<::types::subdomain_id>>
2883 template <
int dim,
typename VectorType>
2912 const VectorType &ls_vector,
2913 const double iso_level,
2923 const VectorType &ls_vector,
2924 const double iso_level,
2938 const VectorType &ls_vector,
2939 const double iso_level,
2949 const VectorType &ls_vector,
2950 const double iso_level,
2967 const double iso_level,
2970 const bool write_back_cell_data =
true)
const;
2978 const std::vector<unsigned int> &,
2995 const std::vector<
Point<2>> &points,
2996 const std::vector<unsigned int> &mask,
2997 const double iso_level,
3000 const bool write_back_cell_data)
const;
3007 const std::vector<
Point<3>> &points,
3008 const std::vector<unsigned int> &mask,
3009 const double iso_level,
3012 const bool write_back_cell_data)
const;
3045 <<
"The number of partitions you gave is " << arg1
3046 <<
", but must be greater than zero.");
3052 <<
"The subdomain id " << arg1
3053 <<
" has no cells associated with it.");
3064 <<
"The scaling factor must be positive, but it is " << arg1
3072 <<
"The given vertex with index " << arg1
3073 <<
" is not used in the given triangulation.");
3099 template <
int dim,
typename Transformation,
int spacedim>
3102 std::assignable_from<
3105 void
transform(const Transformation &transformation,
3108 std::vector<bool> treated_vertices(triangulation.n_vertices(),
false);
3117 cell = triangulation.begin_active(),
3118 endc = triangulation.end();
3119 for (; cell != endc; ++cell)
3121 if (treated_vertices[cell->vertex_index(v)] == false)
3124 cell->vertex(v) = transformation(cell->vertex(v));
3126 treated_vertices[cell->vertex_index(v)] =
true;
3134 cell = triangulation.begin_active(),
3135 endc = triangulation.end();
3136 for (; cell != endc; ++cell)
3137 for (
const unsigned int face : cell->face_indices())
3138 if (cell->face(face)->has_children() &&
3139 !cell->face(face)->at_boundary())
3141 Assert(cell->reference_cell() ==
3142 ReferenceCells::get_hypercube<dim>(),
3146 cell->face(face)->child(0)->vertex(1) =
3147 (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)) /
3154 cell = triangulation.begin_active(),
3155 endc = triangulation.end();
3156 for (; cell != endc; ++cell)
3157 for (
const unsigned int face : cell->face_indices())
3158 if (cell->face(face)->has_children() &&
3159 !cell->face(face)->at_boundary())
3161 if (
static_cast<std::uint8_t
>(
3162 cell->face(face)->refinement_case()) ==
3165 Assert(cell->reference_cell() ==
3166 ReferenceCells::get_hypercube<dim>(),
3170 cell->face(face)->child(0)->vertex(1) =
3171 (cell->face(face)->vertex(0) +
3172 cell->face(face)->vertex(1)) /
3174 cell->face(face)->child(0)->vertex(2) =
3175 (cell->face(face)->vertex(0) +
3176 cell->face(face)->vertex(2)) /
3178 cell->face(face)->child(1)->vertex(3) =
3179 (cell->face(face)->vertex(1) +
3180 cell->face(face)->vertex(3)) /
3182 cell->face(face)->child(2)->vertex(3) =
3183 (cell->face(face)->vertex(2) +
3184 cell->face(face)->vertex(3)) /
3188 cell->face(face)->child(0)->vertex(3) =
3189 (cell->face(face)->vertex(0) +
3190 cell->face(face)->vertex(1) +
3191 cell->face(face)->vertex(2) +
3192 cell->face(face)->vertex(3)) /
3198 for (
unsigned int line = 0;
3201 if (cell->face(face)->line(line)->has_children())
3202 cell->face(face)->line(line)->child(0)->vertex(1) =
3203 (cell->face(face)->line(line)->vertex(0) +
3204 cell->face(face)->line(line)->vertex(1)) /
3211 triangulation.signals.mesh_movement();
3216 template <
typename MeshType>
3219 const typename MeshType::cell_iterator &cell)
3221 std::vector<typename MeshType::active_cell_iterator> child_cells;
3223 if (cell->has_children())
3225 for (
unsigned int child = 0; child < cell->n_children(); ++child)
3226 if (cell->child(child)->has_children())
3228 const std::vector<typename MeshType::active_cell_iterator>
3229 children = get_active_child_cells<MeshType>(cell->child(child));
3230 child_cells.insert(child_cells.end(),
3235 child_cells.push_back(cell->child(child));
3243 template <
typename MeshType>
3246 const typename MeshType::active_cell_iterator &cell,
3247 std::vector<typename MeshType::active_cell_iterator> &active_neighbors)
3249 active_neighbors.clear();
3250 for (
const unsigned int n : cell->face_indices())
3251 if (!cell->at_boundary(n))
3253 if (MeshType::dimension == 1)
3260 typename MeshType::cell_iterator neighbor_child =
3262 if (!neighbor_child->is_active())
3264 while (neighbor_child->has_children())
3265 neighbor_child = neighbor_child->child(n == 0 ? 1 : 0);
3267 Assert(neighbor_child->neighbor(n == 0 ? 1 : 0) == cell,
3270 active_neighbors.push_back(neighbor_child);
3274 if (cell->face(n)->has_children())
3278 for (
unsigned int c = 0;
3279 c < cell->face(n)->n_active_descendants();
3281 active_neighbors.push_back(
3282 cell->neighbor_child_on_subface(n, c));
3288 active_neighbors.push_back(cell->neighbor(n));
3296 template <
typename CellIterator>
3300 return sizeof(*this) +
matrix.memory_consumption();
3307 template <
typename DataType,
3309 typename MeshCellIteratorType>
3311 inline void exchange_cell_data(
3312 const MeshType &mesh,
3313 const std::function<std::optional<DataType>(
const MeshCellIteratorType &)>
3315 const std::function<
void(
const MeshCellIteratorType &,
const DataType &)>
3317 const std::function<
bool(
const MeshCellIteratorType &)> &cell_filter,
3318 const std::function<
void(
3319 const std::function<
void(
const MeshCellIteratorType &,
3321 const std::function<std::set<types::subdomain_id>(
3323 MeshType::space_dimension> &)>
3324 &compute_ghost_owners)
3326# ifndef DEAL_II_WITH_MPI
3331 (void)process_cells;
3332 (void)compute_ghost_owners;
3335 constexpr int dim = MeshType::dimension;
3336 constexpr int spacedim = MeshType::space_dimension;
3339 &mesh.get_triangulation());
3343 "The function exchange_cell_data_to_ghosts() only works with parallel triangulations."));
3345 if (
const auto tria =
dynamic_cast<
3347 &mesh.get_triangulation()))
3350 tria->with_artificial_cells(),
3352 "The functions GridTools::exchange_cell_data_to_ghosts() and "
3353 "GridTools::exchange_cell_data_to_level_ghosts() can only "
3354 "operate on a single layer of ghost cells. However, you have "
3355 "given a Triangulation object of type "
3356 "parallel::shared::Triangulation without artificial cells "
3357 "resulting in an arbitrary number of ghost layers. "
3358 "To use this function for a Triangulation object of type "
3359 "parallel::shared::Triangulation, make sure to create the "
3360 "Triangulation object with allow_artificial_cells set to true. "
3361 "This results in a parallel::shared::Triangulation with only "
3362 "a single layer of ghost cells."));
3366 std::set<types::subdomain_id> ghost_owners = compute_ghost_owners(*tria);
3367 std::map<types::subdomain_id, std::vector<CellId::binary_type>>
3370 for (
const auto ghost_owner : ghost_owners)
3371 neighbor_cell_list[ghost_owner] = {};
3373 process_cells([&](
const auto &cell,
const auto key) ->
void {
3374 if (cell_filter(cell))
3376 neighbor_cell_list[key].emplace_back(
3377 cell->id().template to_binary<spacedim>());
3381 Assert(ghost_owners.size() == neighbor_cell_list.size(),
3393 const int mpi_tag_reply =
3397 std::vector<MPI_Request> requests(ghost_owners.size());
3399 unsigned int idx = 0;
3400 for (
const auto &it : neighbor_cell_list)
3403 const int ierr = MPI_Isend(it.second.data(),
3404 it.second.size() *
sizeof(it.second[0]),
3416 std::vector<MPI_Request> reply_requests(ghost_owners.size());
3417 std::vector<std::vector<char>> sendbuffers(ghost_owners.size());
3419 for (
unsigned int idx = 0; idx < ghost_owners.size(); ++idx)
3422 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3429 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3435 std::vector<CellId::binary_type> cells_with_requests(n_cells);
3436 std::vector<DataType> data_to_send;
3437 data_to_send.reserve(n_cells);
3438 std::vector<bool> cell_carries_data(n_cells,
false);
3440 ierr = MPI_Recv(cells_with_requests.data(),
3450 for (
unsigned int c = 0; c <
n_cells; ++c)
3455 MeshCellIteratorType mesh_it(tria,
3460 std::optional<DataType>
data =
pack(mesh_it);
3463 data_to_send.emplace_back(std::move(*
data));
3464 cell_carries_data[c] =
true;
3472 sendbuffers[idx].resize(
sizeof(std::size_t));
3477 std::size_t size_of_send =
3481 std::memcpy(sendbuffers[idx].
data(),
3483 sizeof(std::size_t));
3487 if (data_to_send.size() < n_cells)
3493 ierr = MPI_Isend(sendbuffers[idx].
data(),
3494 sendbuffers[idx].
size(),
3499 &reply_requests[idx]);
3504 std::vector<char> receive;
3505 for (
unsigned int id = 0;
id < neighbor_cell_list.size(); ++id)
3508 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3515 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3518 receive.resize(len);
3520 ierr = MPI_Recv(receive.data(),
3531 auto data_iterator = receive.begin();
3532 std::size_t size_of_received_data =
3533 Utilities::unpack<std::size_t>(data_iterator,
3534 data_iterator +
sizeof(std::size_t));
3535 data_iterator +=
sizeof(std::size_t);
3538 auto received_data = Utilities::unpack<std::vector<DataType>>(
3540 data_iterator + size_of_received_data,
3542 data_iterator += size_of_received_data;
3547 const std::vector<CellId::binary_type> &this_cell_list =
3548 neighbor_cell_list[status.MPI_SOURCE];
3550 std::vector<bool> cells_with_data;
3551 if (received_data.size() < this_cell_list.size())
3553 cells_with_data = Utilities::unpack<std::vector<bool>>(
3554 data_iterator, receive.end(),
false);
3560 auto received_data_iterator = received_data.begin();
3561 for (
unsigned int c = 0; c < this_cell_list.size(); ++c)
3562 if (cells_with_data.empty() || cells_with_data[c])
3567 MeshCellIteratorType cell(tria,
3572 unpack(cell, *received_data_iterator);
3573 ++received_data_iterator;
3579 if (requests.size() > 0)
3582 MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
3585 if (reply_requests.size() > 0)
3587 const int ierr = MPI_Waitall(reply_requests.size(),
3588 reply_requests.data(),
3589 MPI_STATUSES_IGNORE);
3599 template <
typename DataType,
typename MeshType>
3602 const MeshType &mesh,
3603 const std::function<std::optional<DataType>(
3604 const typename MeshType::active_cell_iterator &)> &pack,
3605 const std::function<
void(
const typename MeshType::active_cell_iterator &,
3606 const DataType &)> &unpack,
3607 const std::function<
bool(
const typename MeshType::active_cell_iterator &)>
3610# ifndef DEAL_II_WITH_MPI
3617 internal::exchange_cell_data<DataType,
3619 typename MeshType::active_cell_iterator>(
3624 [&](
const auto &process) {
3625 for (
const auto &cell : mesh.active_cell_iterators())
3626 if (cell->is_ghost())
3629 [](
const auto &tria) {
return tria.ghost_owners(); });
3635 template <
typename DataType,
typename MeshType>
3638 const MeshType &mesh,
3639 const std::function<std::optional<DataType>(
3640 const typename MeshType::level_cell_iterator &)> &pack,
3641 const std::function<
void(
const typename MeshType::level_cell_iterator &,
3642 const DataType &)> &unpack,
3643 const std::function<
bool(
const typename MeshType::level_cell_iterator &)>
3646# ifndef DEAL_II_WITH_MPI
3653 internal::exchange_cell_data<DataType,
3655 typename MeshType::level_cell_iterator>(
3660 [&](
const auto &process) {
3661 for (
const auto &cell : mesh.cell_iterators())
3662 if (cell->is_ghost_on_level())
3663 process(cell, cell->level_subdomain_id());
3665 [](
const auto &tria) {
return tria.level_ghost_owners(); });
std::array< std::uint64_t, 3 > 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_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.
* * if(update_pressure &update_flags) * compute_pressure(constitutive_request
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
std::uint8_t geometric_orientation
boost::geometry::index::rtree< LeafType, IndexType, IndexableGetter > RTree