489 std::sort(is_ghost_vector.begin(), is_ghost_vector.end());
490 IndexSet is_ghost(this->n_global_active_cells());
491 is_ghost.add_indices(is_ghost_vector.begin(), is_ghost_vector.end());
493 number_cache.active_cell_index_partitioner =
494 std::make_shared<const Utilities::MPI::Partitioner>(
495 is_local, is_ghost, this->mpi_communicator);
498 if (this->is_multilevel_hierarchy_constructed() ==
true)
501 std::vector<types::global_cell_index> n_cells_level(
502 this->n_global_levels(), 0);
504 for (
auto cell : this->cell_iterators())
505 if (cell->level_subdomain_id() == this->locally_owned_subdomain())
506 n_cells_level[cell->
level()]++;
509 std::vector<types::global_cell_index>
cell_index(
510 this->n_global_levels(), 0);
512 int ierr = MPI_Exscan(
513 n_cells_level.data(),
515 this->n_global_levels(),
518 this->mpi_communicator);
523 this->mpi_communicator,
529 std::pair<types::global_cell_index, types::global_cell_index>>
530 my_ranges(this->n_global_levels());
531 for (
unsigned int l = 0; l < this->n_global_levels(); ++l)
534 for (
auto cell : this->cell_iterators())
535 if (cell->level_subdomain_id() == this->locally_owned_subdomain())
540 for (
unsigned int l = 0; l < this->n_global_levels(); ++l)
544 std::vector<std::vector<types::global_dof_index>> is_ghost_vectors(
545 this->n_global_levels());
550 [](
const auto &cell) {
return cell->global_level_cell_index(); },
551 [&is_ghost_vectors](
const auto &cell,
const auto &id) {
552 cell->set_global_level_cell_index(
id);
553 is_ghost_vectors[cell->level()].push_back(
id);
556 number_cache.level_cell_index_partitioners.resize(
557 this->n_global_levels());
560 for (
unsigned int l = 0; l < this->n_global_levels(); ++l)
562 IndexSet is_local(n_cells_level[l]);
563 is_local.add_range(my_ranges[l].
first, my_ranges[l].
second);
565 IndexSet is_ghost(n_cells_level[l]);
566 std::sort(is_ghost_vectors[l].begin(), is_ghost_vectors[l].end());
567 is_ghost.add_indices(is_ghost_vectors[l].begin(),
568 is_ghost_vectors[l].end());
570 number_cache.level_cell_index_partitioners[l] =
571 std::make_shared<const Utilities::MPI::Partitioner>(
572 is_local, is_ghost, this->mpi_communicator);
581 template <
int dim,
int spacedim>
584 const
std::vector<
bool> &vertex_locally_moved)
590 const std::vector<bool> locally_owned_vertices =
592 for (
unsigned int i = 0; i < locally_owned_vertices.size(); ++i)
593 Assert((vertex_locally_moved[i] ==
false) ||
594 (locally_owned_vertices[i] ==
true),
595 ExcMessage(
"The vertex_locally_moved argument must not "
596 "contain vertices that are not locally owned"));
601 for (
unsigned int d = 0; d < spacedim; ++d)
602 invalid_point[d] = std::numeric_limits<double>::quiet_NaN();
604 const auto pack = [&](
const auto &cell) {
605 std::vector<Point<spacedim>> vertices(cell->n_vertices());
607 for (
const auto v : cell->vertex_indices())
608 if (vertex_locally_moved[cell->vertex_index(v)])
609 vertices[v] = cell->vertex(v);
611 vertices[v] = invalid_point;
616 const auto unpack = [&](
const auto &cell,
const auto &vertices) {
617 for (
const auto v : cell->vertex_indices())
619 cell->vertex(v) = vertices[v];
622 if (this->is_multilevel_hierarchy_constructed())
629 GridTools::exchange_cell_data_to_ghosts<std::vector<Point<spacedim>>>(
637 template <
int dim,
int spacedim>
641 spacedim>::global_active_cell_index_partitioner()
const
643 return number_cache.active_cell_index_partitioner;
641 spacedim>::global_active_cell_index_partitioner()
const {
…}
648 template <
int dim,
int spacedim>
652 global_level_cell_index_partitioner(
const unsigned int level)
const
657 return number_cache.level_cell_index_partitioners[
level];
662 template <
int dim,
int spacedim>
667 return number_cache.number_of_global_coarse_cells;
672 template <
int dim,
int spacedim>
678 const
bool check_for_distorted_cells)
682 check_for_distorted_cells)
687 template <
int dim,
int spacedim>
698 template <
int dim,
int spacedim>
702 if (this->n_global_levels() <= 1)
711 const bool have_coarser_cell =
712 std::any_of(this->begin_active(this->n_global_levels() - 2),
713 this->end_active(this->n_global_levels() - 2),
720 this->mpi_communicator) != 0;