57 std::vector<unsigned int> &,
69 std::vector<unsigned int> &,
82 std::vector<unsigned int> &,
93 std::vector<unsigned int> &,
103 template <
int dim,
int spacedim>
106 const unsigned int level,
107 std::vector<unsigned int> & row_lengths,
115 std::fill(row_lengths.begin(), row_lengths.end(), 0);
118 std::vector<bool> old_flags;
128 std::vector<types::global_dof_index> cell_indices;
129 std::vector<types::global_dof_index> neighbor_indices;
142 cell->get_mg_dof_indices(cell_indices);
169 row_lengths[cell_indices[i++]] += increment;
180 increment = (dim > 1) ?
185 row_lengths[cell_indices[i++]] += increment;
188 increment = (dim > 2) ?
193 row_lengths[cell_indices[i++]] += increment;
198 row_lengths[cell_indices[i++]] += increment;
213 bool level_boundary = cell->at_boundary(iface);
217 neighbor = cell->neighbor(iface);
218 if (
static_cast<unsigned int>(neighbor->level()) !=
level)
219 level_boundary =
true;
224 for (
unsigned int local_dof = 0; local_dof < fe.
dofs_per_cell;
244 const unsigned int dof_increment =
246 for (
unsigned int local_dof = 0; local_dof < fe.
dofs_per_cell;
248 row_lengths[cell_indices[local_dof]] += dof_increment;
253 if (face->user_flag_set())
255 face->set_user_flag();
269 neighbor->get_mg_dof_indices(neighbor_indices);
270 for (
unsigned int local_dof = 0; local_dof < fe.
dofs_per_cell;
273 for (
unsigned int local_dof = 0; local_dof < nfe.
dofs_per_cell;
275 row_lengths[neighbor_indices[local_dof]] += fe.
dofs_per_face;
283 template <
int dim,
int spacedim>
286 const unsigned int level,
287 std::vector<unsigned int> & row_lengths,
296 std::fill(row_lengths.begin(), row_lengths.end(), 0);
299 std::vector<bool> old_flags;
309 std::vector<types::global_dof_index> cell_indices;
310 std::vector<types::global_dof_index> neighbor_indices;
316 std::vector<Table<2, DoFTools::Coupling>> couple_cell;
317 std::vector<Table<2, DoFTools::Coupling>> couple_face;
331 const unsigned int fe_index = cell->active_fe_index();
345 cell->get_mg_dof_indices(cell_indices);
368 unsigned int increment;
380 row_lengths[cell_indices[i]] += increment;
405 ((dim > 1) ? (dim - 1) :
408 row_lengths[cell_indices[i]] += increment;
425 ((dim > 2) ? (dim - 2) :
428 row_lengths[cell_indices[i]] += increment;
446 row_lengths[cell_indices[i]] += increment;
464 bool level_boundary = cell->at_boundary(iface);
468 neighbor = cell->neighbor(iface);
469 if (
static_cast<unsigned int>(neighbor->level()) !=
level)
470 level_boundary =
true;
475 for (
unsigned int local_dof = 0; local_dof < fe.
dofs_per_cell;
496 for (
unsigned int local_dof = 0; local_dof < fe.
dofs_per_cell;
498 if (couple_face[fe_index](
502 const unsigned int dof_increment =
505 row_lengths[cell_indices[local_dof]] += dof_increment;
511 if (face->user_flag_set())
513 face->set_user_flag();
535 neighbor->get_mg_dof_indices(neighbor_indices);
539 for (
unsigned int local_dof = 0; local_dof < fe.
dofs_per_cell;
541 if (couple_cell[fe_index](
544 row_lengths[cell_indices[local_dof]] +=
549 for (
unsigned int local_dof = 0; local_dof < nfe.
dofs_per_cell;
551 if (couple_cell[fe_index](
554 row_lengths[neighbor_indices[local_dof]] +=
563 template <
typename DoFHandlerType,
typename SparsityPatternType>
566 SparsityPatternType & sparsity,
567 const unsigned int level)
572 Assert(sparsity.n_rows() == n_dofs,
574 Assert(sparsity.n_cols() == n_dofs,
577 const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
578 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
579 typename DoFHandlerType::cell_iterator cell = dof.begin(
level),
580 endc = dof.end(
level);
581 for (; cell != endc; ++cell)
582 if (dof.get_triangulation().locally_owned_subdomain() ==
584 cell->level_subdomain_id() ==
585 dof.get_triangulation().locally_owned_subdomain())
587 cell->get_mg_dof_indices(dofs_on_this_cell);
589 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
590 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
591 sparsity.add(dofs_on_this_cell[i], dofs_on_this_cell[j]);
597 template <
int dim,
typename SparsityPatternType,
int spacedim>
600 SparsityPatternType & sparsity,
601 const unsigned int level)
606 Assert(sparsity.n_rows() == n_dofs,
608 Assert(sparsity.n_cols() == n_dofs,
611 const unsigned int dofs_per_cell = dof.
get_fe().dofs_per_cell;
612 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
613 std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell);
616 for (; cell != endc; ++cell)
618 if (!cell->is_locally_owned_on_level())
621 cell->get_mg_dof_indices(dofs_on_this_cell);
623 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
624 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
625 sparsity.add(dofs_on_this_cell[i], dofs_on_this_cell[j]);
630 bool use_face =
false;
631 if ((!cell->at_boundary(face)) &&
632 (
static_cast<unsigned int>(cell->neighbor_level(face)) ==
635 else if (cell->has_periodic_neighbor(face) &&
636 (
static_cast<unsigned int>(
637 cell->periodic_neighbor_level(face)) ==
level))
643 cell->neighbor_or_periodic_neighbor(face);
644 neighbor->get_mg_dof_indices(dofs_on_other_cell);
648 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
650 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
652 sparsity.add(dofs_on_this_cell[i],
653 dofs_on_other_cell[j]);
656 if (neighbor->is_locally_owned_on_level() ==
false)
657 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
658 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
660 sparsity.add(dofs_on_other_cell[i],
661 dofs_on_other_cell[j]);
662 sparsity.add(dofs_on_other_cell[i],
663 dofs_on_this_cell[j]);
672 template <
int dim,
typename SparsityPatternType,
int spacedim>
675 SparsityPatternType & sparsity,
676 const unsigned int level)
688 Assert(sparsity.n_rows() == coarse_dofs,
690 Assert(sparsity.n_cols() == fine_dofs,
693 const unsigned int dofs_per_cell = dof.
get_fe().dofs_per_cell;
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 for (; cell != endc; ++cell)
700 if (!cell->is_locally_owned_on_level())
703 cell->get_mg_dof_indices(dofs_on_this_cell);
708 bool use_face =
false;
709 if ((!cell->at_boundary(face)) &&
710 (
static_cast<unsigned int>(cell->neighbor_level(face)) !=
713 else if (cell->has_periodic_neighbor(face) &&
714 (
static_cast<unsigned int>(
715 cell->periodic_neighbor_level(face)) !=
level))
721 cell->neighbor_or_periodic_neighbor(face);
722 neighbor->get_mg_dof_indices(dofs_on_other_cell);
724 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
726 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
728 sparsity.add(dofs_on_other_cell[i],
729 dofs_on_this_cell[j]);
730 sparsity.add(dofs_on_other_cell[j],
731 dofs_on_this_cell[i]);
741 template <
int dim,
typename SparsityPatternType,
int spacedim>
744 SparsityPatternType & sparsity,
745 const unsigned int level,
755 Assert(sparsity.n_rows() == n_dofs,
757 Assert(sparsity.n_cols() == n_dofs,
759 Assert(int_mask.n_rows() == n_comp,
761 Assert(int_mask.n_cols() == n_comp,
763 Assert(flux_mask.n_rows() == n_comp,
765 Assert(flux_mask.n_cols() == n_comp,
769 std::vector<types::global_dof_index> dofs_on_this_cell(total_dofs);
770 std::vector<types::global_dof_index> dofs_on_other_cell(total_dofs);
783 for (
unsigned int i = 0; i < total_dofs; ++i)
795 std::vector<bool> user_flags;
800 for (; cell != endc; ++cell)
802 if (!cell->is_locally_owned_on_level())
805 cell->get_mg_dof_indices(dofs_on_this_cell);
807 for (
unsigned int i = 0; i < total_dofs; ++i)
808 for (
unsigned int j = 0; j < total_dofs; ++j)
810 sparsity.add(dofs_on_this_cell[i], dofs_on_this_cell[j]);
817 if (cell_face->user_flag_set())
820 if (cell->at_boundary(face) && !cell->has_periodic_neighbor(face))
822 for (
unsigned int i = 0; i < total_dofs; ++i)
824 const bool i_non_zero_i = support_on_face(i, face);
825 for (
unsigned int j = 0; j < total_dofs; ++j)
827 const bool j_non_zero_i = support_on_face(j, face);
830 sparsity.add(dofs_on_this_cell[i],
831 dofs_on_this_cell[j]);
833 i_non_zero_i && j_non_zero_i)
834 sparsity.add(dofs_on_this_cell[i],
835 dofs_on_this_cell[j]);
842 cell->neighbor_or_periodic_neighbor(face);
844 if (neighbor->level() < cell->level())
847 unsigned int neighbor_face =
848 cell->has_periodic_neighbor(face) ?
849 cell->periodic_neighbor_of_periodic_neighbor(face) :
850 cell->neighbor_of_neighbor(face);
852 neighbor->get_mg_dof_indices(dofs_on_other_cell);
853 for (
unsigned int i = 0; i < total_dofs; ++i)
855 const bool i_non_zero_i = support_on_face(i, face);
856 const bool i_non_zero_e = support_on_face(i, neighbor_face);
857 for (
unsigned int j = 0; j < total_dofs; ++j)
859 const bool j_non_zero_i = support_on_face(j, face);
860 const bool j_non_zero_e =
861 support_on_face(j, neighbor_face);
864 sparsity.add(dofs_on_this_cell[i],
865 dofs_on_other_cell[j]);
866 sparsity.add(dofs_on_other_cell[i],
867 dofs_on_this_cell[j]);
868 sparsity.add(dofs_on_this_cell[i],
869 dofs_on_this_cell[j]);
870 sparsity.add(dofs_on_other_cell[i],
871 dofs_on_other_cell[j]);
875 if (i_non_zero_i && j_non_zero_e)
876 sparsity.add(dofs_on_this_cell[i],
877 dofs_on_other_cell[j]);
878 if (i_non_zero_e && j_non_zero_i)
879 sparsity.add(dofs_on_other_cell[i],
880 dofs_on_this_cell[j]);
881 if (i_non_zero_i && j_non_zero_i)
882 sparsity.add(dofs_on_this_cell[i],
883 dofs_on_this_cell[j]);
884 if (i_non_zero_e && j_non_zero_e)
885 sparsity.add(dofs_on_other_cell[i],
886 dofs_on_other_cell[j]);
891 sparsity.add(dofs_on_this_cell[j],
892 dofs_on_other_cell[i]);
893 sparsity.add(dofs_on_other_cell[j],
894 dofs_on_this_cell[i]);
895 sparsity.add(dofs_on_this_cell[j],
896 dofs_on_this_cell[i]);
897 sparsity.add(dofs_on_other_cell[j],
898 dofs_on_other_cell[i]);
902 if (j_non_zero_i && i_non_zero_e)
903 sparsity.add(dofs_on_this_cell[j],
904 dofs_on_other_cell[i]);
905 if (j_non_zero_e && i_non_zero_i)
906 sparsity.add(dofs_on_other_cell[j],
907 dofs_on_this_cell[i]);
908 if (j_non_zero_i && i_non_zero_i)
909 sparsity.add(dofs_on_this_cell[j],
910 dofs_on_this_cell[i]);
911 if (j_non_zero_e && i_non_zero_e)
912 sparsity.add(dofs_on_other_cell[j],
913 dofs_on_other_cell[i]);
917 neighbor->face(neighbor_face)->set_user_flag();
924 .load_user_flags(user_flags);
929 template <
int dim,
typename SparsityPatternType,
int spacedim>
932 SparsityPatternType & sparsity,
933 const unsigned int level,
950 Assert(sparsity.n_rows() == coarse_dofs,
952 Assert(sparsity.n_cols() == fine_dofs,
954 Assert(flux_mask.n_rows() == n_comp,
956 Assert(flux_mask.n_cols() == n_comp,
959 const unsigned int dofs_per_cell = dof.
get_fe().dofs_per_cell;
960 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
961 std::vector<types::global_dof_index> dofs_on_other_cell(dofs_per_cell);
971 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
975 for (; cell != endc; ++cell)
977 if (!cell->is_locally_owned_on_level())
980 cell->get_mg_dof_indices(dofs_on_this_cell);
985 bool use_face =
false;
986 if ((!cell->at_boundary(face)) &&
987 (
static_cast<unsigned int>(cell->neighbor_level(face)) !=
990 else if (cell->has_periodic_neighbor(face) &&
991 (
static_cast<unsigned int>(
992 cell->periodic_neighbor_level(face)) !=
level))
998 cell->neighbor_or_periodic_neighbor(face);
999 neighbor->get_mg_dof_indices(dofs_on_other_cell);
1001 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1003 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
1007 sparsity.add(dofs_on_other_cell[i],
1008 dofs_on_this_cell[j]);
1009 sparsity.add(dofs_on_other_cell[j],
1010 dofs_on_this_cell[i]);
1021 template <
typename DoFHandlerType,
typename SparsityPatternType>
1025 SparsityPatternType & sparsity,
1026 const unsigned int level)
1031 Assert(sparsity.n_rows() == n_dofs,
1033 Assert(sparsity.n_cols() == n_dofs,
1036 const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
1037 std::vector<types::global_dof_index> dofs_on_this_cell(dofs_per_cell);
1038 typename DoFHandlerType::cell_iterator cell = dof.begin(
level),
1039 endc = dof.end(
level);
1040 for (; cell != endc; ++cell)
1041 if (cell->is_locally_owned_on_level())
1043 cell->get_mg_dof_indices(dofs_on_this_cell);
1044 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1045 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
1047 level, dofs_on_this_cell[i], dofs_on_this_cell[j]))
1048 sparsity.add(dofs_on_this_cell[i], dofs_on_this_cell[j]);
1054 template <
int dim,
int spacedim>
1058 std::vector<std::vector<types::global_dof_index>> &result,
1060 std::vector<unsigned int> target_component)
1064 const unsigned int nlevels =
1067 Assert(result.size() == nlevels,
1070 if (target_component.size() == 0)
1074 target_component[i] = i;
1080 for (
unsigned int l = 0;
l < nlevels; ++
l)
1083 std::fill(result[
l].
begin(), result[
l].
end(), 0
U);
1091 result[
l][0] = dof_handler.
n_dofs(
l);
1098 std::vector<std::vector<bool>> dofs_in_component(
1100 std::vector<ComponentMask> component_select(
n_components);
1104 void (*fun_ptr)(
const unsigned int level,
1107 std::vector<bool> &) =
1117 component_select[i],
1118 dofs_in_component[i]);
1123 unsigned int component = 0;
1132 for (
unsigned int dd = 0; dd <
d; ++dd)
1135 result[
l][target_component[component]] +=
1136 std::count(dofs_in_component[component].
begin(),
1137 dofs_in_component[component].
end(),
1145 std::accumulate(result[
l].begin(),
1156 template <
typename DoFHandlerType>
1159 const DoFHandlerType & dof_handler,
1160 std::vector<std::vector<types::global_dof_index>> &dofs_per_block,
1161 std::vector<unsigned int> target_block)
1164 DoFHandlerType::space_dimension> &fe =
1165 dof_handler.get_fe();
1166 const unsigned int n_blocks = fe.n_blocks();
1167 const unsigned int n_levels =
1168 dof_handler.get_triangulation().n_global_levels();
1172 for (
unsigned int l = 0;
l < n_levels; ++
l)
1173 std::fill(dofs_per_block[
l].
begin(), dofs_per_block[
l].
end(), 0
U);
1177 if (target_block.size() == 0)
1180 for (
unsigned int i = 0; i <
n_blocks; ++i)
1181 target_block[i] = i;
1186 const unsigned int max_block =
1187 *std::max_element(target_block.begin(), target_block.end());
1188 const unsigned int n_target_blocks = max_block + 1;
1189 (void)n_target_blocks;
1191 for (
unsigned int l = 0;
l < n_levels; ++
l)
1200 for (
unsigned int l = 0;
l < n_levels; ++
l)
1201 dofs_per_block[
l][0] = dof_handler.n_dofs(
l);
1207 for (
unsigned int l = 0;
l < n_levels; ++
l)
1209 std::vector<std::vector<bool>> dofs_in_block(
1210 n_blocks, std::vector<bool>(dof_handler.n_dofs(
l),
false));
1211 std::vector<BlockMask> block_select(
n_blocks);
1213 for (
unsigned int i = 0; i <
n_blocks; ++i)
1215 void (*fun_ptr)(
const unsigned int level,
1216 const DoFHandlerType &,
1218 std::vector<bool> &) =
1219 &DoFTools::extract_level_dofs<DoFHandlerType>;
1221 std::vector<bool> tmp(
n_blocks,
false);
1223 block_select[i] = tmp;
1226 fun_ptr,
l, dof_handler, block_select[i], dofs_in_block[i]);
1231 for (
unsigned int block = 0; block < fe.n_blocks(); ++block)
1232 dofs_per_block[
l][target_block[block]] +=
1233 std::count(dofs_in_block[block].
begin(),
1234 dofs_in_block[block].
end(),
1241 template <
int dim,
int spacedim>
1247 std::vector<std::set<types::global_dof_index>> &boundary_indices,
1254 std::set<types::boundary_id> boundary_ids;
1255 for (
const auto &boundary_function : function_map)
1256 boundary_ids.insert(boundary_function.first);
1258 std::vector<IndexSet> boundary_indexset;
1261 boundary_indices[i].insert(boundary_indexset[i].
begin(),
1262 boundary_indexset[i].
end());
1266 template <
int dim,
int spacedim>
1271 std::vector<IndexSet> &boundary_indices,
1278 std::set<types::boundary_id> boundary_ids;
1279 for (
const auto &boundary_function : function_map)
1280 boundary_ids.insert(boundary_function.first);
1287 template <
int dim,
int spacedim>
1290 const std::set<types::boundary_id> &boundary_ids,
1291 std::vector<IndexSet> & boundary_indices,
1297 if (boundary_ids.size() == 0)
1301 if (boundary_indices[i].size() == 0)
1307 std::vector<types::global_dof_index> local_dofs;
1311 std::vector<std::vector<types::global_dof_index>> dofs_by_level(
1325 const unsigned int level = cell->level();
1329 if (cell->at_boundary(face_no) ==
true)
1332 cell->face(face_no);
1335 if (boundary_ids.find(bi) != boundary_ids.end())
1337 face->get_mg_dof_indices(
level, local_dofs);
1349 "It's probably worthwhile to select at least one component."));
1357 if (cell->at_boundary(face_no) ==
false)
1361 const unsigned int level = cell->level();
1364 cell->face(face_no);
1366 face->boundary_id();
1367 if (boundary_ids.find(boundary_component) != boundary_ids.end())
1370 for (
unsigned int i = 0; i < cell->get_fe().dofs_per_cell;
1374 cell->get_fe().get_nonzero_components(i);
1378 bool selected =
false;
1380 if (nonzero_component_array[c] ==
true &&
1381 component_mask[c] ==
true)
1389 nonzero_component_array[c] ==
false ||
1390 component_mask[c] ==
true,
1392 "You are using a non-primitive FiniteElement "
1393 "and try to constrain just some of its components!"));
1399 face->get_mg_dof_indices(
level, local_dofs);
1402 for (
unsigned int i = 0; i < local_dofs.size(); ++i)
1404 unsigned int component =
1415 cell->get_fe().get_nonzero_components(i);
1417 if (nonzero_component_array[c] ==
true)
1425 if (component_mask[component] ==
true)
1426 dofs_by_level[
level].push_back(local_dofs[i]);
1440 boundary_indices[
level].add_indices(
1448 template <
int dim,
int spacedim>
1452 std::vector<std::set<types::global_dof_index>> &non_interface_dofs)
1454 Assert(non_interface_dofs.size() ==
1457 non_interface_dofs.size(),
1465 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
1466 std::vector<bool> cell_dofs(dofs_per_cell,
false);
1467 std::vector<bool> cell_dofs_interface(dofs_per_cell,
false);
1470 endc = mg_dof_handler.
end();
1473 for (; cell != endc; ++cell)
1477 cell->level_subdomain_id() !=
1481 std::fill(cell_dofs.begin(), cell_dofs.end(),
false);
1482 std::fill(cell_dofs_interface.begin(),
1483 cell_dofs_interface.end(),
1489 cell->face(face_nr);
1490 if (!face->at_boundary() || cell->has_periodic_neighbor(face_nr))
1494 cell->neighbor_or_periodic_neighbor(face_nr);
1496 if ((neighbor->level() < cell->level()))
1498 for (
unsigned int j = 0; j < dofs_per_face; ++j)
1504 for (
unsigned int j = 0; j < dofs_per_face; ++j)
1511 for (
unsigned int j = 0; j < dofs_per_face; ++j)
1516 const unsigned int level = cell->level();
1517 cell->get_mg_dof_indices(local_dof_indices);
1519 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1520 if (cell_dofs[i] && !cell_dofs_interface[i])
1521 non_interface_dofs[
level].insert(local_dof_indices[i]);
1526 template <
int dim,
int spacedim>
1529 std::vector<IndexSet> & interface_dofs)
1531 Assert(interface_dofs.size() ==
1534 interface_dofs.size(),
1537 std::vector<std::vector<types::global_dof_index>> tmp_interface_dofs(
1538 interface_dofs.size());
1545 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
1547 std::vector<bool> cell_dofs(dofs_per_cell,
false);
1550 endc = mg_dof_handler.
end();
1552 for (; cell != endc; ++cell)
1561 bool has_coarser_neighbor =
false;
1563 std::fill(cell_dofs.begin(), cell_dofs.end(),
false);
1568 cell->face(face_nr);
1569 if (!face->at_boundary() || cell->has_periodic_neighbor(face_nr))
1573 cell->neighbor_or_periodic_neighbor(face_nr);
1578 .locally_owned_subdomain() !=
1580 neighbor->level_subdomain_id() ==
1585 if (neighbor->level() < cell->level())
1587 for (
unsigned int j = 0; j < dofs_per_face; ++j)
1590 has_coarser_neighbor =
true;
1595 if (has_coarser_neighbor ==
false)
1598 const unsigned int level = cell->level();
1599 cell->get_mg_dof_indices(local_dof_indices);
1601 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1604 tmp_interface_dofs[
level].push_back(local_dof_indices[i]);
1608 for (
unsigned int l = 0;
1612 interface_dofs[
l].clear();
1613 std::sort(tmp_interface_dofs[
l].
begin(), tmp_interface_dofs[
l].
end());
1614 interface_dofs[
l].add_indices(tmp_interface_dofs[
l].
begin(),
1615 std::unique(tmp_interface_dofs[
l].
begin(),
1616 tmp_interface_dofs[
l].
end()));
1617 interface_dofs[
l].compress();
1623 template <
int dim,
int spacedim>
1636 for (; cell != endc; ++cell)
1637 if (cell->is_locally_owned())
1639 min_level = cell->level();
1643 unsigned int global_min = min_level;
1658 template <
int dim,
int spacedim>
1672 tr->is_multilevel_hierarchy_constructed(),
1674 "We can only compute the workload imbalance if the multilevel hierarchy has been constructed!"));
1676 const unsigned int n_proc =
1678 const unsigned int n_global_levels = tr->n_global_levels();
1688 for (
int lvl = n_global_levels - 1; lvl >= 0; --lvl)
1693 for (
const auto &cell : tr->cell_iterators_on_level(lvl))
1694 if (cell->is_locally_owned_on_level())
1695 ++n_owned_cells_on_lvl;
1699 tr->get_communicator());
1701 total_cells_in_hierarchy +=
1703 tr->get_communicator());
1706 const double ideal_work =
1707 total_cells_in_hierarchy /
static_cast<double>(n_proc);
1717 #include "mg_tools.inst"