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);
2487 template <
typename MeshType>
2490 const MeshType &mesh,
2491 const
types::boundary_id b_id,
2492 const
unsigned int direction,
2495 const ::
Tensor<1, MeshType::space_dimension> &offset =
2496 ::
Tensor<1, MeshType::space_dimension>(),
2498 const
double abs_tol = 1e-10);
2526 template <
int dim,
int spacedim>
2529 const
bool reset_boundary_ids = false);
2552 template <
int dim,
int spacedim>
2555 const
std::vector<
types::boundary_id> &src_boundary_ids,
2556 const
std::vector<
types::manifold_id> &dst_manifold_ids,
2558 const
std::vector<
types::boundary_id> &reset_boundary_ids = {});
2589 template <
int dim,
int spacedim>
2592 const bool compute_face_ids =
false);
2618 template <
int dim,
int spacedim>
2623 const std::set<types::manifold_id> &)> &disambiguation_function =
2624 [](
const std::set<types::manifold_id> &manifold_ids) {
2625 if (manifold_ids.size() == 1)
2626 return *manifold_ids.begin();
2630 bool overwrite_only_flat_manifold_ids =
true);
2719 template <
typename DataType,
typename MeshType>
2722 const MeshType &mesh,
2723 const
std::function<
std::optional<DataType>(
2724 const typename MeshType::active_cell_iterator &)> &pack,
2725 const
std::function<
void(const typename MeshType::active_cell_iterator &,
2726 const DataType &)> &unpack,
2727 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
2729 always_return<typename MeshType::active_cell_iterator,
bool>{
true});
2743 template <
typename DataType,
typename MeshType>
2746 const MeshType &mesh,
2747 const
std::function<
std::optional<DataType>(
2748 const typename MeshType::level_cell_iterator &)> &pack,
2749 const
std::function<
void(const typename MeshType::level_cell_iterator &,
2750 const DataType &)> &unpack,
2751 const
std::function<
bool(const typename MeshType::level_cell_iterator &)> &
2752 cell_filter =
always_return<typename MeshType::level_cell_iterator,
bool>{
2766 template <
int spacedim>
2767 std::vector<std::vector<BoundingBox<spacedim>>>
2804 template <
int spacedim>
2827 template <
int dim,
int spacedim>
2831 std::map<
unsigned int, std::vector<unsigned int>> &coinciding_vertex_groups,
2832 std::map<unsigned int, unsigned int> &vertex_to_coinciding_vertex_group);
2853 template <
int dim,
int spacedim>
2854 std::map<unsigned int, std::set<::types::subdomain_id>>
2878 template <
int dim,
typename VectorType>
2907 const VectorType &ls_vector,
2908 const double iso_level,
2918 const VectorType &ls_vector,
2919 const double iso_level,
2933 const VectorType &ls_vector,
2934 const double iso_level,
2944 const VectorType &ls_vector,
2945 const double iso_level,
2962 const double iso_level,
2965 const bool write_back_cell_data =
true)
const;
2973 const std::vector<unsigned int> &,
2990 const std::vector<
Point<2>> &points,
2991 const std::vector<unsigned int> &mask,
2992 const double iso_level,
2995 const bool write_back_cell_data)
const;
3002 const std::vector<
Point<3>> &points,
3003 const std::vector<unsigned int> &mask,
3004 const double iso_level,
3007 const bool write_back_cell_data)
const;
3040 <<
"The number of partitions you gave is " << arg1
3041 <<
", but must be greater than zero.");
3047 <<
"The subdomain id " << arg1
3048 <<
" has no cells associated with it.");
3059 <<
"The scaling factor must be positive, but it is " << arg1
3067 <<
"The given vertex with index " << arg1
3068 <<
" is not used in the given triangulation.");
3094 template <
int dim,
typename Transformation,
int spacedim>
3097 std::assignable_from<
3100 void
transform(const Transformation &transformation,
3103 std::vector<bool> treated_vertices(triangulation.n_vertices(),
false);
3112 cell = triangulation.begin_active(),
3113 endc = triangulation.end();
3114 for (; cell != endc; ++cell)
3116 if (treated_vertices[cell->vertex_index(v)] == false)
3119 cell->vertex(v) = transformation(cell->vertex(v));
3121 treated_vertices[cell->vertex_index(v)] =
true;
3129 cell = triangulation.begin_active(),
3130 endc = triangulation.end();
3131 for (; cell != endc; ++cell)
3132 for (
const unsigned int face : cell->face_indices())
3133 if (cell->face(face)->has_children() &&
3134 !cell->face(face)->at_boundary())
3136 Assert(cell->reference_cell() ==
3137 ReferenceCells::get_hypercube<dim>(),
3141 cell->face(face)->child(0)->vertex(1) =
3142 (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)) /
3149 cell = triangulation.begin_active(),
3150 endc = triangulation.end();
3151 for (; cell != endc; ++cell)
3152 for (
const unsigned int face : cell->face_indices())
3153 if (cell->face(face)->has_children() &&
3154 !cell->face(face)->at_boundary())
3156 if (
static_cast<std::uint8_t
>(
3157 cell->face(face)->refinement_case()) ==
3160 Assert(cell->reference_cell() ==
3161 ReferenceCells::get_hypercube<dim>(),
3165 cell->face(face)->child(0)->vertex(1) =
3166 (cell->face(face)->vertex(0) +
3167 cell->face(face)->vertex(1)) /
3169 cell->face(face)->child(0)->vertex(2) =
3170 (cell->face(face)->vertex(0) +
3171 cell->face(face)->vertex(2)) /
3173 cell->face(face)->child(1)->vertex(3) =
3174 (cell->face(face)->vertex(1) +
3175 cell->face(face)->vertex(3)) /
3177 cell->face(face)->child(2)->vertex(3) =
3178 (cell->face(face)->vertex(2) +
3179 cell->face(face)->vertex(3)) /
3183 cell->face(face)->child(0)->vertex(3) =
3184 (cell->face(face)->vertex(0) +
3185 cell->face(face)->vertex(1) +
3186 cell->face(face)->vertex(2) +
3187 cell->face(face)->vertex(3)) /
3193 for (
unsigned int line = 0;
3196 if (cell->face(face)->line(line)->has_children())
3197 cell->face(face)->line(line)->child(0)->vertex(1) =
3198 (cell->face(face)->line(line)->vertex(0) +
3199 cell->face(face)->line(line)->vertex(1)) /
3206 triangulation.signals.mesh_movement();
3211 template <
typename MeshType>
3214 const typename MeshType::cell_iterator &cell)
3216 std::vector<typename MeshType::active_cell_iterator> child_cells;
3218 if (cell->has_children())
3220 for (
unsigned int child = 0; child < cell->n_children(); ++child)
3221 if (cell->child(child)->has_children())
3223 const std::vector<typename MeshType::active_cell_iterator>
3224 children = get_active_child_cells<MeshType>(cell->child(child));
3225 child_cells.insert(child_cells.end(),
3230 child_cells.push_back(cell->child(child));
3238 template <
typename MeshType>
3241 const typename MeshType::active_cell_iterator &cell,
3242 std::vector<typename MeshType::active_cell_iterator> &active_neighbors)
3244 active_neighbors.clear();
3245 for (
const unsigned int n : cell->face_indices())
3246 if (!cell->at_boundary(n))
3248 if (MeshType::dimension == 1)
3255 typename MeshType::cell_iterator neighbor_child =
3257 if (!neighbor_child->is_active())
3259 while (neighbor_child->has_children())
3260 neighbor_child = neighbor_child->child(n == 0 ? 1 : 0);
3262 Assert(neighbor_child->neighbor(n == 0 ? 1 : 0) == cell,
3265 active_neighbors.push_back(neighbor_child);
3269 if (cell->face(n)->has_children())
3273 for (
unsigned int c = 0;
3274 c < cell->face(n)->n_active_descendants();
3276 active_neighbors.push_back(
3277 cell->neighbor_child_on_subface(n, c));
3283 active_neighbors.push_back(cell->neighbor(n));
3291 template <
typename CellIterator>
3295 return sizeof(*this) +
matrix.memory_consumption();
3302 template <
typename DataType,
3304 typename MeshCellIteratorType>
3306 inline void exchange_cell_data(
3307 const MeshType &mesh,
3308 const std::function<std::optional<DataType>(
const MeshCellIteratorType &)>
3310 const std::function<
void(
const MeshCellIteratorType &,
const DataType &)>
3312 const std::function<
bool(
const MeshCellIteratorType &)> &cell_filter,
3313 const std::function<
void(
3314 const std::function<
void(
const MeshCellIteratorType &,
3316 const std::function<std::set<types::subdomain_id>(
3318 MeshType::space_dimension> &)>
3319 &compute_ghost_owners)
3321# ifndef DEAL_II_WITH_MPI
3326 (void)process_cells;
3327 (void)compute_ghost_owners;
3330 constexpr int dim = MeshType::dimension;
3331 constexpr int spacedim = MeshType::space_dimension;
3334 &mesh.get_triangulation());
3338 "The function exchange_cell_data_to_ghosts() only works with parallel triangulations."));
3340 if (
const auto tria =
dynamic_cast<
3342 &mesh.get_triangulation()))
3345 tria->with_artificial_cells(),
3347 "The functions GridTools::exchange_cell_data_to_ghosts() and "
3348 "GridTools::exchange_cell_data_to_level_ghosts() can only "
3349 "operate on a single layer of ghost cells. However, you have "
3350 "given a Triangulation object of type "
3351 "parallel::shared::Triangulation without artificial cells "
3352 "resulting in an arbitrary number of ghost layers. "
3353 "To use this function for a Triangulation object of type "
3354 "parallel::shared::Triangulation, make sure to create the "
3355 "Triangulation object with allow_artificial_cells set to true. "
3356 "This results in a parallel::shared::Triangulation with only "
3357 "a single layer of ghost cells."));
3361 std::set<types::subdomain_id> ghost_owners = compute_ghost_owners(*tria);
3362 std::map<types::subdomain_id, std::vector<CellId::binary_type>>
3365 for (
const auto ghost_owner : ghost_owners)
3366 neighbor_cell_list[ghost_owner] = {};
3368 process_cells([&](
const auto &cell,
const auto key) ->
void {
3369 if (cell_filter(cell))
3371 neighbor_cell_list[key].emplace_back(
3372 cell->id().template to_binary<spacedim>());
3376 Assert(ghost_owners.size() == neighbor_cell_list.size(),
3388 const int mpi_tag_reply =
3392 std::vector<MPI_Request> requests(ghost_owners.size());
3394 unsigned int idx = 0;
3395 for (
const auto &it : neighbor_cell_list)
3398 const int ierr = MPI_Isend(it.second.data(),
3399 it.second.size() *
sizeof(it.second[0]),
3411 std::vector<MPI_Request> reply_requests(ghost_owners.size());
3412 std::vector<std::vector<char>> sendbuffers(ghost_owners.size());
3414 for (
unsigned int idx = 0; idx < ghost_owners.size(); ++idx)
3417 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3424 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3430 std::vector<CellId::binary_type> cells_with_requests(n_cells);
3431 std::vector<DataType> data_to_send;
3432 data_to_send.reserve(n_cells);
3433 std::vector<bool> cell_carries_data(n_cells,
false);
3435 ierr = MPI_Recv(cells_with_requests.data(),
3445 for (
unsigned int c = 0; c <
n_cells; ++c)
3450 MeshCellIteratorType mesh_it(tria,
3455 std::optional<DataType>
data =
pack(mesh_it);
3458 data_to_send.emplace_back(std::move(*
data));
3459 cell_carries_data[c] =
true;
3467 sendbuffers[idx].resize(
sizeof(std::size_t));
3472 std::size_t size_of_send =
3476 std::memcpy(sendbuffers[idx].
data(),
3478 sizeof(std::size_t));
3482 if (data_to_send.size() < n_cells)
3488 ierr = MPI_Isend(sendbuffers[idx].
data(),
3489 sendbuffers[idx].
size(),
3494 &reply_requests[idx]);
3499 std::vector<char> receive;
3500 for (
unsigned int id = 0;
id < neighbor_cell_list.size(); ++id)
3503 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3510 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3513 receive.resize(len);
3515 ierr = MPI_Recv(receive.data(),
3526 auto data_iterator = receive.begin();
3527 std::size_t size_of_received_data =
3528 Utilities::unpack<std::size_t>(data_iterator,
3529 data_iterator +
sizeof(std::size_t));
3530 data_iterator +=
sizeof(std::size_t);
3533 auto received_data = Utilities::unpack<std::vector<DataType>>(
3535 data_iterator + size_of_received_data,
3537 data_iterator += size_of_received_data;
3542 const std::vector<CellId::binary_type> &this_cell_list =
3543 neighbor_cell_list[status.MPI_SOURCE];
3545 std::vector<bool> cells_with_data;
3546 if (received_data.size() < this_cell_list.size())
3548 cells_with_data = Utilities::unpack<std::vector<bool>>(
3549 data_iterator, receive.end(),
false);
3555 auto received_data_iterator = received_data.begin();
3556 for (
unsigned int c = 0; c < this_cell_list.size(); ++c)
3557 if (cells_with_data.empty() || cells_with_data[c])
3562 MeshCellIteratorType cell(tria,
3567 unpack(cell, *received_data_iterator);
3568 ++received_data_iterator;
3574 if (requests.size() > 0)
3577 MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
3580 if (reply_requests.size() > 0)
3582 const int ierr = MPI_Waitall(reply_requests.size(),
3583 reply_requests.data(),
3584 MPI_STATUSES_IGNORE);
3594 template <
typename DataType,
typename MeshType>
3597 const MeshType &mesh,
3598 const std::function<std::optional<DataType>(
3599 const typename MeshType::active_cell_iterator &)> &pack,
3600 const std::function<
void(
const typename MeshType::active_cell_iterator &,
3601 const DataType &)> &unpack,
3602 const std::function<
bool(
const typename MeshType::active_cell_iterator &)>
3605# ifndef DEAL_II_WITH_MPI
3612 internal::exchange_cell_data<DataType,
3614 typename MeshType::active_cell_iterator>(
3619 [&](
const auto &process) {
3620 for (
const auto &cell : mesh.active_cell_iterators())
3621 if (cell->is_ghost())
3624 [](
const auto &tria) {
return tria.ghost_owners(); });
3630 template <
typename DataType,
typename MeshType>
3633 const MeshType &mesh,
3634 const std::function<std::optional<DataType>(
3635 const typename MeshType::level_cell_iterator &)> &pack,
3636 const std::function<
void(
const typename MeshType::level_cell_iterator &,
3637 const DataType &)> &unpack,
3638 const std::function<
bool(
const typename MeshType::level_cell_iterator &)>
3641# ifndef DEAL_II_WITH_MPI
3648 internal::exchange_cell_data<DataType,
3650 typename MeshType::level_cell_iterator>(
3655 [&](
const auto &process) {
3656 for (
const auto &cell : mesh.cell_iterators())
3657 if (cell->is_ghost_on_level())
3658 process(cell, cell->level_subdomain_id());
3660 [](
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