58 std::vector<unsigned int> &,
70 std::vector<unsigned int> &,
83 std::vector<unsigned int> &,
94 std::vector<unsigned int> &,
104 template <
int dim,
int spacedim>
107 const unsigned int level,
108 std::vector<unsigned int> &row_lengths,
116 std::fill(row_lengths.begin(), row_lengths.end(), 0);
118 std::vector<bool> face_touched(dim == 2 ?
122 std::vector<types::global_dof_index> cell_indices;
123 std::vector<types::global_dof_index> neighbor_indices;
136 cell->get_mg_dof_indices(cell_indices);
160 const unsigned int face_no = 0;
165 unsigned int increment =
168 row_lengths[cell_indices[i++]] += increment;
185 row_lengths[cell_indices[i++]] += increment;
194 row_lengths[cell_indices[i++]] += increment;
199 row_lengths[cell_indices[i++]] += increment;
214 bool level_boundary = cell->at_boundary(iface);
218 neighbor = cell->neighbor(iface);
219 if (
static_cast<unsigned int>(neighbor->level()) !=
level)
220 level_boundary =
true;
225 for (
unsigned int local_dof = 0;
228 row_lengths[cell_indices[local_dof]] +=
247 const unsigned int dof_increment =
249 for (
unsigned int local_dof = 0;
252 row_lengths[cell_indices[local_dof]] += dof_increment;
257 if (face_touched[face->index()])
259 face_touched[face->index()] =
true;
274 neighbor->get_mg_dof_indices(neighbor_indices);
277 row_lengths[cell_indices[local_dof]] +=
281 row_lengths[neighbor_indices[local_dof]] +=
289 template <
int dim,
int spacedim>
292 const unsigned int level,
293 std::vector<unsigned int> &row_lengths,
302 std::fill(row_lengths.begin(), row_lengths.end(), 0);
304 std::vector<bool> face_touched(dim == 2 ?
308 std::vector<types::global_dof_index> cell_indices;
309 std::vector<types::global_dof_index> neighbor_indices;
315 std::vector<Table<2, DoFTools::Coupling>> couple_cell;
316 std::vector<Table<2, DoFTools::Coupling>> couple_face;
330 const unsigned int fe_index = cell->active_fe_index();
334 const unsigned int face_no = 0;
350 cell->get_mg_dof_indices(cell_indices);
373 unsigned int increment;
386 row_lengths[cell_indices[i]] += increment;
411 ((dim > 1) ? (dim - 1) :
414 row_lengths[cell_indices[i]] += increment;
431 ((dim > 2) ? (dim - 2) :
434 row_lengths[cell_indices[i]] += increment;
453 row_lengths[cell_indices[i]] += increment;
471 bool level_boundary = cell->at_boundary(iface);
475 neighbor = cell->neighbor(iface);
476 if (
static_cast<unsigned int>(neighbor->level()) !=
level)
477 level_boundary =
true;
482 for (
unsigned int local_dof = 0;
485 row_lengths[cell_indices[local_dof]] +=
505 for (
unsigned int local_dof = 0;
508 if (couple_face[fe_index](
512 const unsigned int dof_increment =
515 row_lengths[cell_indices[local_dof]] += dof_increment;
519 if (face_touched[face->index()])
521 face_touched[face->index()] =
true;
544 neighbor->get_mg_dof_indices(neighbor_indices);
548 for (
unsigned int local_dof = 0;
551 if (couple_cell[fe_index](
554 row_lengths[cell_indices[local_dof]] +=
559 for (
unsigned int local_dof = 0;
562 if (couple_cell[fe_index](
565 row_lengths[neighbor_indices[local_dof]] +=
573 template <
int dim,
int spacedim,
typename number>
577 const unsigned int level,
579 const bool keep_constrained_dofs)
589 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
591 if (cell->is_locally_owned_on_level())
593 cell->get_mg_dof_indices(dofs_on_this_cell);
596 keep_constrained_dofs);
602 template <
int dim,
int spacedim,
typename number>
606 const unsigned int level,
608 const bool keep_constrained_dofs)
618 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
619 std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell);
622 if (!cell->is_locally_owned_on_level())
625 cell->get_mg_dof_indices(dofs_on_this_cell);
629 keep_constrained_dofs);
634 bool use_face =
false;
635 if ((!cell->at_boundary(face)) &&
636 (
static_cast<unsigned int>(cell->neighbor_level(face)) ==
639 else if (cell->has_periodic_neighbor(face) &&
640 (
static_cast<unsigned int>(
641 cell->periodic_neighbor_level(face)) ==
level))
647 cell->neighbor_or_periodic_neighbor(face);
648 neighbor->get_mg_dof_indices(dofs_on_other_cell);
655 keep_constrained_dofs);
657 if (neighbor->is_locally_owned_on_level() ==
false)
660 dofs_on_other_cell, sparsity, keep_constrained_dofs);
666 keep_constrained_dofs);
675 template <
int dim,
int spacedim>
679 const unsigned int level)
694 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
695 std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell);
698 if (!cell->is_locally_owned_on_level())
701 cell->get_mg_dof_indices(dofs_on_this_cell);
706 bool use_face =
false;
707 if ((!cell->at_boundary(face)) &&
708 (
static_cast<unsigned int>(cell->neighbor_level(face)) !=
711 else if (cell->has_periodic_neighbor(face) &&
712 (
static_cast<unsigned int>(
713 cell->periodic_neighbor_level(face)) !=
level))
719 cell->neighbor_or_periodic_neighbor(face);
720 neighbor->get_mg_dof_indices(dofs_on_other_cell);
722 std::sort(dofs_on_this_cell.begin(), dofs_on_this_cell.end());
723 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
734 template <
int dim,
int spacedim>
738 const unsigned int level,
750 Assert(int_mask.n_rows() == n_comp,
752 Assert(int_mask.n_cols() == n_comp,
754 Assert(flux_mask.n_rows() == n_comp,
756 Assert(flux_mask.n_cols() == n_comp,
760 std::vector<types::global_dof_index> dofs_on_this_cell(total_dofs);
761 std::vector<types::global_dof_index> dofs_on_other_cell(total_dofs);
762 std::vector<std::pair<types::global_dof_index, types::global_dof_index>>
774 for (
unsigned int i = 0; i < total_dofs; ++i)
778 std::vector<bool> face_touched(dim == 2 ?
784 if (!cell->is_locally_owned_on_level())
787 cell->get_mg_dof_indices(dofs_on_this_cell);
789 for (
unsigned int i = 0; i < total_dofs; ++i)
790 for (
unsigned int j = 0; j < total_dofs; ++j)
792 cell_entries.emplace_back(dofs_on_this_cell[i],
793 dofs_on_this_cell[j]);
800 if (face_touched[cell_face->index()])
803 if (cell->at_boundary(face) && !cell->has_periodic_neighbor(face))
805 for (
unsigned int i = 0; i < total_dofs; ++i)
807 const bool i_non_zero_i = support_on_face(i, face);
808 for (
unsigned int j = 0; j < total_dofs; ++j)
810 const bool j_non_zero_i = support_on_face(j, face);
813 cell_entries.emplace_back(dofs_on_this_cell[i],
814 dofs_on_this_cell[j]);
816 i_non_zero_i && j_non_zero_i)
817 cell_entries.emplace_back(dofs_on_this_cell[i],
818 dofs_on_this_cell[j]);
825 cell->neighbor_or_periodic_neighbor(face);
827 if (neighbor->level() < cell->level())
830 unsigned int neighbor_face =
831 cell->has_periodic_neighbor(face) ?
832 cell->periodic_neighbor_of_periodic_neighbor(face) :
833 cell->neighbor_of_neighbor(face);
835 neighbor->get_mg_dof_indices(dofs_on_other_cell);
836 for (
unsigned int i = 0; i < total_dofs; ++i)
838 const bool i_non_zero_i = support_on_face(i, face);
839 const bool i_non_zero_e = support_on_face(i, neighbor_face);
840 for (
unsigned int j = 0; j < total_dofs; ++j)
842 const bool j_non_zero_i = support_on_face(j, face);
843 const bool j_non_zero_e =
844 support_on_face(j, neighbor_face);
847 cell_entries.emplace_back(dofs_on_this_cell[i],
848 dofs_on_other_cell[j]);
849 cell_entries.emplace_back(dofs_on_other_cell[i],
850 dofs_on_this_cell[j]);
851 cell_entries.emplace_back(dofs_on_this_cell[i],
852 dofs_on_this_cell[j]);
853 cell_entries.emplace_back(dofs_on_other_cell[i],
854 dofs_on_other_cell[j]);
858 if (i_non_zero_i && j_non_zero_e)
859 cell_entries.emplace_back(dofs_on_this_cell[i],
860 dofs_on_other_cell[j]);
861 if (i_non_zero_e && j_non_zero_i)
862 cell_entries.emplace_back(dofs_on_other_cell[i],
863 dofs_on_this_cell[j]);
864 if (i_non_zero_i && j_non_zero_i)
865 cell_entries.emplace_back(dofs_on_this_cell[i],
866 dofs_on_this_cell[j]);
867 if (i_non_zero_e && j_non_zero_e)
868 cell_entries.emplace_back(dofs_on_other_cell[i],
869 dofs_on_other_cell[j]);
874 cell_entries.emplace_back(dofs_on_this_cell[j],
875 dofs_on_other_cell[i]);
876 cell_entries.emplace_back(dofs_on_other_cell[j],
877 dofs_on_this_cell[i]);
878 cell_entries.emplace_back(dofs_on_this_cell[j],
879 dofs_on_this_cell[i]);
880 cell_entries.emplace_back(dofs_on_other_cell[j],
881 dofs_on_other_cell[i]);
885 if (j_non_zero_i && i_non_zero_e)
886 cell_entries.emplace_back(dofs_on_this_cell[j],
887 dofs_on_other_cell[i]);
888 if (j_non_zero_e && i_non_zero_i)
889 cell_entries.emplace_back(dofs_on_other_cell[j],
890 dofs_on_this_cell[i]);
891 if (j_non_zero_i && i_non_zero_i)
892 cell_entries.emplace_back(dofs_on_this_cell[j],
893 dofs_on_this_cell[i]);
894 if (j_non_zero_e && i_non_zero_e)
895 cell_entries.emplace_back(dofs_on_other_cell[j],
896 dofs_on_other_cell[i]);
900 face_touched[neighbor->face(neighbor_face)->index()] =
true;
904 cell_entries.clear();
910 template <
int dim,
int spacedim>
914 const unsigned int level,
932 Assert(flux_mask.n_rows() == n_comp,
934 Assert(flux_mask.n_cols() == n_comp,
938 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
939 std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell);
940 std::vector<std::pair<types::global_dof_index, types::global_dof_index>>
949 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
955 if (!cell->is_locally_owned_on_level())
958 cell->get_mg_dof_indices(dofs_on_this_cell);
963 bool use_face =
false;
964 if ((!cell->at_boundary(face)) &&
965 (
static_cast<unsigned int>(cell->neighbor_level(face)) !=
968 else if (cell->has_periodic_neighbor(face) &&
969 (
static_cast<unsigned int>(
970 cell->periodic_neighbor_level(face)) !=
level))
976 cell->neighbor_or_periodic_neighbor(face);
977 neighbor->get_mg_dof_indices(dofs_on_other_cell);
979 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
981 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
985 cell_entries.emplace_back(dofs_on_other_cell[i],
986 dofs_on_this_cell[j]);
987 cell_entries.emplace_back(dofs_on_other_cell[j],
988 dofs_on_this_cell[i]);
995 cell_entries.clear();
1001 template <
int dim,
int spacedim>
1006 const unsigned int level)
1015 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
1016 std::vector<types::global_dof_index> cols;
1017 cols.reserve(dofs_per_cell);
1020 if (cell->is_locally_owned_on_level())
1022 cell->get_mg_dof_indices(dofs_on_this_cell);
1023 std::sort(dofs_on_this_cell.begin(), dofs_on_this_cell.end());
1024 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1026 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
1028 level, dofs_on_this_cell[i], dofs_on_this_cell[j]))
1029 cols.push_back(dofs_on_this_cell[j]);
1040 template <
int dim,
int spacedim>
1044 std::vector<std::vector<types::global_dof_index>> &result,
1046 std::vector<unsigned int> target_component)
1050 const unsigned int nlevels =
1053 Assert(result.size() == nlevels,
1056 if (target_component.empty())
1058 target_component.resize(n_components);
1059 for (
unsigned int i = 0; i < n_components; ++i)
1060 target_component[i] = i;
1063 Assert(target_component.size() == n_components,
1066 for (
unsigned int l = 0; l < nlevels; ++l)
1068 result[l].resize(n_components);
1069 std::fill(result[l].
begin(), result[l].
end(), 0U);
1075 if (n_components == 1)
1077 result[l][0] = dof_handler.
n_dofs(l);
1084 std::vector<std::vector<bool>> dofs_in_component(
1085 n_components, std::vector<bool>(dof_handler.
n_dofs(l),
false));
1086 std::vector<ComponentMask> component_select(n_components);
1088 for (
unsigned int i = 0; i < n_components; ++i)
1090 void (*fun_ptr)(
const unsigned int level,
1093 std::vector<bool> &) =
1094 &DoFTools::extract_level_dofs<dim, spacedim>;
1096 std::vector<bool> tmp(n_components,
false);
1103 component_select[i],
1104 dofs_in_component[i]);
1109 unsigned int component = 0;
1118 for (
unsigned int dd = 0; dd < d; ++dd)
1121 result[l][target_component[component]] +=
1122 std::count(dofs_in_component[component].
begin(),
1123 dofs_in_component[component].
end(),
1131 std::accumulate(result[l].begin(),
1142 template <
int dim,
int spacedim>
1146 std::vector<std::vector<types::global_dof_index>> &dofs_per_block,
1147 std::vector<unsigned int> target_block)
1150 const unsigned int n_blocks = fe.
n_blocks();
1151 const unsigned int n_levels =
1156 for (
unsigned int l = 0; l < n_levels; ++l)
1157 std::fill(dofs_per_block[l].
begin(), dofs_per_block[l].
end(), 0U);
1161 if (target_block.empty())
1163 target_block.resize(n_blocks);
1164 for (
unsigned int i = 0; i < n_blocks; ++i)
1165 target_block[i] = i;
1167 Assert(target_block.size() == n_blocks,
1170 const unsigned int max_block =
1171 *std::max_element(target_block.begin(), target_block.end());
1172 const unsigned int n_target_blocks = max_block + 1;
1173 (void)n_target_blocks;
1175 for (
unsigned int l = 0; l < n_levels; ++l)
1184 for (
unsigned int l = 0; l < n_levels; ++l)
1185 dofs_per_block[l][0] = dof_handler.
n_dofs(l);
1191 for (
unsigned int l = 0; l < n_levels; ++l)
1193 std::vector<std::vector<bool>> dofs_in_block(
1194 n_blocks, std::vector<bool>(dof_handler.
n_dofs(l),
false));
1195 std::vector<BlockMask> block_select(n_blocks);
1197 for (
unsigned int i = 0; i < n_blocks; ++i)
1199 void (*fun_ptr)(
const unsigned int level,
1202 std::vector<bool> &) =
1203 &DoFTools::extract_level_dofs<dim, spacedim>;
1205 std::vector<bool> tmp(n_blocks,
false);
1210 fun_ptr, l, dof_handler, block_select[i], dofs_in_block[i]);
1215 for (
unsigned int block = 0; block < fe.
n_blocks(); ++block)
1216 dofs_per_block[l][target_block[block]] +=
1217 std::count(dofs_in_block[block].
begin(),
1218 dofs_in_block[block].
end(),
1225 template <
int dim,
int spacedim>
1231 std::vector<std::set<types::global_dof_index>> &boundary_indices,
1238 std::set<types::boundary_id> boundary_ids;
1239 for (
const auto &boundary_function : function_map)
1240 boundary_ids.insert(boundary_function.first);
1242 std::vector<IndexSet> boundary_indexset;
1245 boundary_indices[i].insert(boundary_indexset[i].
begin(),
1246 boundary_indexset[i].
end());
1250 template <
int dim,
int spacedim>
1255 std::vector<IndexSet> &boundary_indices,
1262 std::set<types::boundary_id> boundary_ids;
1263 for (
const auto &boundary_function : function_map)
1264 boundary_ids.insert(boundary_function.first);
1271 template <
int dim,
int spacedim>
1274 const std::set<types::boundary_id> &boundary_ids,
1275 std::vector<IndexSet> &boundary_indices,
1281 if (boundary_ids.empty())
1285 if (boundary_indices[i].
size() == 0)
1289 const bool fe_is_system = (n_components != 1);
1291 std::vector<types::global_dof_index> local_dofs;
1295 std::vector<std::vector<types::global_dof_index>> dofs_by_level(
1304 if (cell->is_artificial_on_level())
1307 const unsigned int level = cell->level();
1310 if (cell->at_boundary(face_no) ==
true)
1313 cell->face(face_no);
1316 if (boundary_ids.find(bi) != boundary_ids.end())
1319 face->get_mg_dof_indices(
level, local_dofs);
1331 "It's probably worthwhile to select at least one component."));
1334 if (!cell->is_artificial_on_level())
1337 if (cell->at_boundary(face_no) ==
false)
1341 const unsigned int level = cell->level();
1344 cell->face(face_no);
1346 face->boundary_id();
1347 if (boundary_ids.find(boundary_component) != boundary_ids.end())
1350 for (
unsigned int i = 0;
1351 i < cell->get_fe().n_dofs_per_cell();
1355 cell->get_fe().get_nonzero_components(i);
1359 bool selected =
false;
1360 for (
unsigned int c = 0; c < n_components; ++c)
1361 if (nonzero_component_array[c] ==
true &&
1362 component_mask[c] ==
true)
1368 for (
unsigned int c = 0; c < n_components; ++c)
1370 nonzero_component_array[c] ==
false ||
1371 component_mask[c] ==
true,
1373 "You are using a non-primitive FiniteElement "
1374 "and try to constrain just some of its components!"));
1380 face->get_mg_dof_indices(
level, local_dofs);
1383 for (
unsigned int i = 0; i < local_dofs.size(); ++i)
1385 unsigned int component =
1397 cell->get_fe().get_nonzero_components(i);
1398 for (
unsigned int c = 0; c < n_components; ++c)
1399 if (nonzero_component_array[c] ==
true)
1407 if (component_mask[component] ==
true)
1408 dofs_by_level[
level].push_back(local_dofs[i]);
1429 template <
int dim,
int spacedim>
1432 std::vector<IndexSet> &interface_dofs)
1434 Assert(interface_dofs.size() ==
1437 interface_dofs.size(),
1440 std::vector<std::vector<types::global_dof_index>> tmp_interface_dofs(
1441 interface_dofs.size());
1447 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
1449 std::vector<bool> cell_dofs(dofs_per_cell,
false);
1455 if (cell->is_artificial_on_level())
1458 bool has_coarser_neighbor =
false;
1460 std::fill(cell_dofs.begin(), cell_dofs.end(),
false);
1465 cell->face(face_nr);
1466 if (!face->at_boundary() || cell->has_periodic_neighbor(face_nr))
1470 cell->neighbor_or_periodic_neighbor(face_nr);
1474 if (neighbor->is_artificial_on_level())
1478 if (neighbor->level() < cell->level())
1484 has_coarser_neighbor =
true;
1489 if (has_coarser_neighbor ==
false)
1492 const unsigned int level = cell->level();
1493 cell->get_mg_dof_indices(local_dof_indices);
1495 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1498 tmp_interface_dofs[
level].push_back(local_dof_indices[i]);
1502 for (
unsigned int l = 0;
1506 interface_dofs[l].clear();
1507 std::sort(tmp_interface_dofs[l].
begin(), tmp_interface_dofs[l].
end());
1508 interface_dofs[l].add_indices(tmp_interface_dofs[l].
begin(),
1509 tmp_interface_dofs[l].
end());
1510 interface_dofs[l].compress();
1516 template <
int dim,
int spacedim>
1527 if (cell->is_locally_owned())
1529 min_level = cell->level();
1533 unsigned int global_min = min_level;
1552 const std::vector<types::global_dof_index> &n_cells_on_levels,
1555 std::vector<types::global_dof_index> n_cells_on_levels_max(
1556 n_cells_on_levels.size());
1557 std::vector<types::global_dof_index> n_cells_on_levels_sum(
1558 n_cells_on_levels.size());
1565 const double ideal_work = std::accumulate(n_cells_on_levels_sum.begin(),
1566 n_cells_on_levels_sum.end(),
1568 static_cast<double>(n_proc);
1570 std::accumulate(n_cells_on_levels_max.begin(),
1571 n_cells_on_levels_max.end(),
1583 std::pair<types::global_dof_index, types::global_dof_index>> &cells,
1586 std::vector<types::global_dof_index> cells_local(cells.size());
1587 std::vector<types::global_dof_index> cells_remote(cells.size());
1589 for (
unsigned int i = 0; i < cells.size(); ++i)
1591 cells_local[i] = cells[i].first;
1592 cells_remote[i] = cells[i].second;
1595 std::vector<types::global_dof_index> cells_local_sum(cells_local.size());
1598 std::vector<types::global_dof_index> cells_remote_sum(
1599 cells_remote.size());
1602 const auto n_cells_local =
1603 std::accumulate(cells_local_sum.begin(), cells_local_sum.end(), 0);
1604 const auto n_cells_remote =
1605 std::accumulate(cells_remote_sum.begin(), cells_remote_sum.end(), 0);
1607 return static_cast<double>(n_cells_local) /
1608 (n_cells_local + n_cells_remote);
1614 template <
int dim,
int spacedim>
1615 std::vector<types::global_dof_index>
1622 tr->is_multilevel_hierarchy_constructed(),
1624 "We can only compute the workload imbalance if the multilevel hierarchy has been constructed!"));
1628 std::vector<types::global_dof_index> n_cells_on_levels(n_global_levels);
1630 for (
unsigned int lvl = 0; lvl < n_global_levels; ++lvl)
1632 if (cell->is_locally_owned_on_level())
1633 ++n_cells_on_levels[lvl];
1635 return n_cells_on_levels;
1640 template <
int dim,
int spacedim>
1641 std::vector<types::global_dof_index>
1646 const unsigned int n_global_levels = trias.size();
1648 std::vector<types::global_dof_index> n_cells_on_levels(n_global_levels);
1650 for (
unsigned int lvl = 0; lvl < n_global_levels; ++lvl)
1651 for (
const auto &cell : trias[lvl]->active_cell_iterators())
1652 if (cell->is_locally_owned())
1653 ++n_cells_on_levels[lvl];
1655 return n_cells_on_levels;
1660 template <
int dim,
int spacedim>
1670 template <
int dim,
int spacedim>
1677 trias.back()->get_mpi_communicator());
1682 template <
int dim,
int spacedim>
1683 std::vector<std::pair<types::global_dof_index, types::global_dof_index>>
1688 std::vector<std::pair<types::global_dof_index, types::global_dof_index>>
1689 cells(n_global_levels);
1695 for (
unsigned int lvl = 0; lvl < n_global_levels - 1; ++lvl)
1697 if (cell->is_locally_owned_on_level() && cell->has_children())
1698 for (
unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_cell;
1701 const auto level_subdomain_id =
1702 cell->child(i)->level_subdomain_id();
1703 if (level_subdomain_id ==
my_rank)
1704 ++cells[lvl + 1].first;
1706 ++cells[lvl + 1].second;
1716 template <
int dim,
int spacedim>
1717 std::vector<std::pair<types::global_dof_index, types::global_dof_index>>
1722 const unsigned int n_global_levels = trias.size();
1724 std::vector<std::pair<types::global_dof_index, types::global_dof_index>>
1725 cells(n_global_levels);
1727 const MPI_Comm communicator = trias.back()->get_mpi_communicator();
1731 for (
unsigned int lvl = 0; lvl < n_global_levels - 1; ++lvl)
1733 const auto &tria_coarse = *trias[lvl];
1734 const auto &tria_fine = *trias[lvl + 1];
1736 const ::internal::CellIDTranslator<dim> cell_id_translator(
1739 IndexSet is_fine_owned(cell_id_translator.size());
1740 IndexSet is_fine_required(cell_id_translator.size());
1742 for (
const auto &cell : tria_fine.active_cell_iterators())
1743 if (!cell->is_artificial() && cell->is_locally_owned())
1744 is_fine_owned.
add_index(cell_id_translator.translate(cell));
1746 for (
const auto &cell : tria_coarse.active_cell_iterators())
1747 if (!cell->is_artificial() && cell->is_locally_owned())
1749 if (cell->level() + 1u == tria_fine.n_global_levels())
1752 for (
unsigned int i = 0;
1753 i < GeometryInfo<dim>::max_children_per_cell;
1756 cell_id_translator.translate(cell, i));
1759 const std::vector<unsigned int> is_fine_required_ranks =
1764 for (
unsigned i = 0; i < is_fine_required.
n_elements(); ++i)
1765 if (is_fine_required_ranks[i] ==
my_rank)
1766 ++cells[lvl + 1].first;
1768 ++cells[lvl + 1].second;
1776 template <
int dim,
int spacedim>
1786 template <
int dim,
int spacedim>
1794 trias.back()->get_mpi_communicator());
1801#include "multigrid/mg_tools.inst"
ArrayView< std::remove_reference_t< typename std::iterator_traits< Iterator >::reference >, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
void add_entries_local_to_global(const std::vector< size_type > &local_dof_indices, SparsityPatternBase &sparsity_pattern, const bool keep_constrained_entries=true, const Table< 2, bool > &dof_mask=Table< 2, bool >()) const
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
const Triangulation< dim, spacedim > & get_triangulation() const
types::global_dof_index n_dofs() const
unsigned int get_first_line_index() const
unsigned int n_dofs_per_cell() const
unsigned int get_first_quad_index(const unsigned int quad_no=0) const
unsigned int n_dofs_per_face(unsigned int face_no=0, unsigned int child=0) const
unsigned int n_blocks() const
unsigned int n_components() const
ReferenceCell< dim > reference_cell() const
unsigned int get_first_hex_index() const
std::pair< unsigned int, types::global_dof_index > system_to_block_index(const unsigned int component) const
virtual const FiniteElement< dim, spacedim > & base_element(const unsigned int index) const
bool is_primitive() const
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
unsigned int element_multiplicity(const unsigned int index) const
virtual unsigned int face_to_cell_index(const unsigned int face_dof_index, const unsigned int face, const types::geometric_orientation combined_orientation=numbers::default_geometric_orientation) const
unsigned int n_base_elements() const
std::pair< unsigned int, unsigned int > face_system_to_component_index(const unsigned int index, const unsigned int face_no=0) const
types::global_dof_index first_block_of_base(const unsigned int b) const
size_type n_elements() const
void add_index(const size_type index)
bool is_interface_matrix_entry(const unsigned int level, const types::global_dof_index i, const types::global_dof_index j) const
virtual void add_entries(const ArrayView< const std::pair< size_type, size_type > > &entries)
virtual void add_row_entries(const size_type &row, const ArrayView< const size_type > &columns, const bool indices_are_sorted=false)=0
virtual MPI_Comm get_mpi_communicator() const
unsigned int n_raw_lines() const
unsigned int n_levels() const
virtual unsigned int n_global_levels() const
unsigned int n_raw_quads() const
unsigned int max_dofs_per_face() const
unsigned int n_components() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NOT_IMPLEMENTED()
IteratorRange< cell_iterator > cell_iterators_on_level(const unsigned int level) const
IteratorRange< cell_iterator > cell_iterators() const
IteratorRange< active_cell_iterator > active_cell_iterators() const
IteratorRange< cell_iterator > cell_iterators_on_level(const unsigned int level) const
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::cell_iterator cell_iterator
typename ActiveSelector::face_iterator face_iterator
Task< RT > new_task(const std::function< RT()> &function)
const unsigned int my_rank
T sum(const T &t, const MPI_Comm mpi_communicator)
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
T max(const T &t, const MPI_Comm mpi_communicator)
T min(const T &t, const MPI_Comm mpi_communicator)
std::vector< unsigned int > compute_index_owner(const IndexSet &owned_indices, const IndexSet &indices_to_look_up, const MPI_Comm comm)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
constexpr types::global_dof_index invalid_dof_index
constexpr unsigned int invalid_unsigned_int
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()