48 #define BOOST_BIND_GLOBAL_PLACEHOLDERS
49 #include <boost/config.hpp>
50 #include <boost/graph/adjacency_list.hpp>
51 #include <boost/graph/bandwidth.hpp>
52 #include <boost/graph/cuthill_mckee_ordering.hpp>
53 #include <boost/graph/king_ordering.hpp>
54 #include <boost/graph/minimum_degree_ordering.hpp>
55 #include <boost/graph/properties.hpp>
56 #include <boost/random.hpp>
57 #include <boost/random/uniform_int_distribution.hpp>
59 #undef BOOST_BIND_GLOBAL_PLACEHOLDERS
76 using namespace ::
boost;
78 using Graph = adjacency_list<vecS,
81 property<vertex_color_t,
83 property<vertex_degree_t, int>>>;
84 using Vertex = graph_traits<Graph>::vertex_descriptor;
85 using size_type = graph_traits<Graph>::vertices_size_type;
87 using Pair = std::pair<size_type, size_type>;
93 template <
int dim,
int spacedim>
96 const bool use_constraints,
99 boosttypes::vertex_degree_t>::type
114 for (
unsigned int row = 0; row < dsp.
n_rows(); ++row)
115 for (
unsigned int col = 0; col < dsp.
row_length(row); ++col)
119 boosttypes::graph_traits<boosttypes::Graph>::vertex_iterator ui, ui_end;
121 graph_degree = get(::boost::vertex_degree, graph);
122 for (::boost::tie(ui, ui_end) =
vertices(graph); ui != ui_end; ++ui)
123 graph_degree[*ui] = degree(*ui, graph);
128 template <
int dim,
int spacedim>
131 const bool reversed_numbering,
132 const bool use_constraints)
134 std::vector<types::global_dof_index> renumbering(
148 template <
int dim,
int spacedim>
152 const bool reversed_numbering,
153 const bool use_constraints)
157 boosttypes::vertex_degree_t>::type graph_degree;
162 boosttypes::vertex_index_t>::type index_map =
163 get(::boost::vertex_index, graph);
166 std::vector<boosttypes::Vertex> inv_perm(num_vertices(graph));
168 if (reversed_numbering ==
false)
169 ::boost::cuthill_mckee_ordering(graph,
171 get(::boost::vertex_color, graph),
172 make_degree_map(graph));
174 ::boost::cuthill_mckee_ordering(graph,
176 get(::boost::vertex_color, graph),
177 make_degree_map(graph));
180 new_dof_indices[index_map[inv_perm[c]]] = c;
182 Assert(std::find(new_dof_indices.begin(),
183 new_dof_indices.end(),
190 template <
int dim,
int spacedim>
193 const bool reversed_numbering,
194 const bool use_constraints)
196 std::vector<types::global_dof_index> renumbering(
210 template <
int dim,
int spacedim>
214 const bool reversed_numbering,
215 const bool use_constraints)
219 boosttypes::vertex_degree_t>::type graph_degree;
224 boosttypes::vertex_index_t>::type index_map =
225 get(::boost::vertex_index, graph);
228 std::vector<boosttypes::Vertex> inv_perm(num_vertices(graph));
230 if (reversed_numbering ==
false)
236 new_dof_indices[index_map[inv_perm[c]]] = c;
238 Assert(std::find(new_dof_indices.begin(),
239 new_dof_indices.end(),
246 template <
int dim,
int spacedim>
249 const bool reversed_numbering,
250 const bool use_constraints)
252 std::vector<types::global_dof_index> renumbering(
266 template <
int dim,
int spacedim>
269 std::vector<types::global_dof_index> &new_dof_indices,
271 const bool reversed_numbering,
272 const bool use_constraints)
274 (void)use_constraints;
283 using namespace ::
boost;
288 using Graph = adjacency_list<vecS, vecS, directedS>;
290 int n = dof_handler.
n_dofs();
294 std::vector<::types::global_dof_index> dofs_on_this_cell;
298 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
300 dofs_on_this_cell.resize(dofs_per_cell);
302 cell->get_active_or_mg_dof_indices(dofs_on_this_cell);
303 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
304 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
305 if (dofs_on_this_cell[i] > dofs_on_this_cell[j])
307 add_edge(dofs_on_this_cell[i], dofs_on_this_cell[j], G);
308 add_edge(dofs_on_this_cell[j], dofs_on_this_cell[i], G);
313 using Vector = std::vector<int>;
316 Vector inverse_perm(n, 0);
321 Vector supernode_sizes(n, 1);
324 ::boost::property_map<Graph, vertex_index_t>::type
id =
325 get(vertex_index, G);
331 minimum_degree_ordering(
333 make_iterator_property_map(degree.
begin(),
id, degree[0]),
336 make_iterator_property_map(supernode_sizes.
begin(),
343 for (
int i = 0; i < n; ++i)
353 if (reversed_numbering ==
true)
358 new_dof_indices.begin());
365 template <
int dim,
int spacedim>
368 const bool reversed_numbering,
369 const bool use_constraints,
370 const std::vector<types::global_dof_index> &starting_indices)
372 std::vector<types::global_dof_index> renumbering(
389 template <
int dim,
int spacedim>
392 std::vector<types::global_dof_index> &new_indices,
394 const bool reversed_numbering,
395 const bool use_constraints,
396 const std::vector<types::global_dof_index> &starting_indices,
397 const unsigned int level)
399 const bool reorder_level_dofs =
414 if (reorder_level_dofs ==
true)
418 const IndexSet locally_relevant_dofs =
419 (reorder_level_dofs ==
false ?
422 const IndexSet &locally_owned_dofs =
432 constraints.
reinit(locally_owned_dofs, locally_relevant_dofs);
443 locally_owned_dofs.
size());
444 if (reorder_level_dofs ==
false)
456 if (reversed_numbering)
469 const IndexSet locally_active_dofs =
470 (reorder_level_dofs ==
false ?
474 bool needs_locally_active =
false;
475 for (
const auto starting_index : starting_indices)
477 if ((needs_locally_active ==
479 (locally_owned_dofs.
is_element(starting_index) ==
false))
482 locally_active_dofs.
is_element(starting_index),
484 "You specified global degree of freedom " +
486 " as a starting index, but this index is not among the "
487 "locally active ones on this processor, as required "
488 "for this function."));
489 needs_locally_active =
true;
494 (needs_locally_active ? locally_active_dofs : locally_owned_dofs);
505 index_set_to_use.
size(),
507 if (reorder_level_dofs ==
false)
518 std::vector<types::global_dof_index> row_entries;
519 for (
unsigned int i = 0; i < index_set_to_use.
n_elements(); ++i)
523 const unsigned int row_length = dsp.
row_length(row);
525 for (
unsigned int j = 0; j < row_length; ++j)
528 if (col != row && index_set_to_use.
is_element(col))
538 std::vector<types::global_dof_index> local_starting_indices(
539 starting_indices.size());
540 for (
unsigned int i = 0; i < starting_indices.size(); ++i)
541 local_starting_indices[i] =
546 std::vector<types::global_dof_index> my_new_indices(
550 local_starting_indices);
551 if (reversed_numbering)
560 if (needs_locally_active ==
true)
563 IndexSet active_but_not_owned_dofs = locally_active_dofs;
564 active_but_not_owned_dofs.
subtract_set(locally_owned_dofs);
566 std::set<types::global_dof_index> erase_these_indices;
567 for (
const auto p : active_but_not_owned_dofs)
572 erase_these_indices.insert(my_new_indices[index]);
575 Assert(erase_these_indices.size() ==
578 Assert(
static_cast<unsigned int>(
579 std::count(my_new_indices.begin(),
580 my_new_indices.end(),
586 std::vector<types::global_dof_index> translate_indices(
587 my_new_indices.size());
589 std::set<types::global_dof_index>::const_iterator
590 next_erased_index = erase_these_indices.begin();
592 for (
unsigned int i = 0; i < translate_indices.size(); ++i)
593 if ((next_erased_index != erase_these_indices.end()) &&
594 (*next_erased_index == i))
601 translate_indices[i] = next_new_index;
611 new_indices.reserve(locally_owned_dofs.
n_elements());
612 for (
const auto &p : my_new_indices)
617 new_indices.push_back(translate_indices[p]);
623 new_indices = std::move(my_new_indices);
636 template <
int dim,
int spacedim>
639 const unsigned int level,
640 const bool reversed_numbering,
641 const std::vector<types::global_dof_index> &starting_indices)
646 std::vector<types::global_dof_index> new_indices(
665 template <
int dim,
int spacedim>
668 const std::vector<unsigned int> &component_order_arg)
670 std::vector<types::global_dof_index> renumbering(
674 compute_component_wise<dim, spacedim>(renumbering,
696 (result <= dof_handler.
n_dofs())),
704 template <
int dim,
int spacedim>
707 const unsigned int level,
708 const std::vector<unsigned int> &component_order_arg)
713 std::vector<types::global_dof_index> renumbering(
723 compute_component_wise<dim, spacedim>(
724 renumbering, start,
end, component_order_arg,
true);
737 template <
int dim,
int spacedim,
typename CellIterator>
740 const CellIterator &start,
742 const std::vector<unsigned int> &component_order_arg,
743 const bool is_level_operation)
746 start->get_dof_handler().get_fe_collection();
752 new_indices.resize(0);
759 const IndexSet &locally_owned_dofs =
761 start->get_dof_handler().locally_owned_mg_dofs(start->level()) :
762 start->get_dof_handler().locally_owned_dofs();
766 std::vector<unsigned int> component_order(component_order_arg);
771 if (component_order.empty())
772 for (
unsigned int i = 0; i < fe_collection.
n_components(); ++i)
773 component_order.push_back(i);
779 for (
const unsigned int component : component_order)
787 std::vector<types::global_dof_index> local_dof_indices;
799 std::vector<std::vector<unsigned int>> component_list(fe_collection.
size());
800 for (
unsigned int f = 0; f < fe_collection.
size(); ++f)
804 component_list[f].resize(dofs_per_cell);
805 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
807 component_list[f][i] =
811 const unsigned int comp =
817 component_list[f][i] = component_order[comp];
832 std::vector<std::vector<types::global_dof_index>> component_to_dof_map(
834 for (CellIterator cell = start; cell !=
end; ++cell)
836 if (is_level_operation)
839 if (!cell->is_locally_owned_on_level())
846 if (!cell->is_locally_owned())
850 if (is_level_operation)
852 cell->level() == start->level(),
854 "Multigrid renumbering in compute_component_wise() needs to be applied to a single level!"));
860 const unsigned int dofs_per_cell =
861 fe_collection[
fe_index].n_dofs_per_cell();
862 local_dof_indices.resize(dofs_per_cell);
863 cell->get_active_or_mg_dof_indices(local_dof_indices);
865 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
866 if (locally_owned_dofs.
is_element(local_dof_indices[i]))
868 local_dof_indices[i]);
894 for (
unsigned int component = 0; component < fe_collection.
n_components();
897 std::sort(component_to_dof_map[component].
begin(),
898 component_to_dof_map[component].
end());
899 component_to_dof_map[component].erase(
900 std::unique(component_to_dof_map[component].
begin(),
901 component_to_dof_map[component].
end()),
902 component_to_dof_map[component].
end());
907 const unsigned int n_buckets = fe_collection.
n_components();
908 std::vector<types::global_dof_index> shifts(n_buckets);
912 &start->get_dof_handler().get_triangulation())))
914 #ifdef DEAL_II_WITH_MPI
915 std::vector<types::global_dof_index> local_dof_count(n_buckets);
917 for (
unsigned int c = 0; c < n_buckets; ++c)
918 local_dof_count[c] = component_to_dof_map[c].size();
920 std::vector<types::global_dof_index> prefix_dof_count(n_buckets);
921 const int ierr = MPI_Exscan(local_dof_count.data(),
922 prefix_dof_count.data(),
929 std::vector<types::global_dof_index> global_dof_count(n_buckets);
936 for (
unsigned int c = 0; c < n_buckets; ++c)
938 shifts[c] = prefix_dof_count[c] + cumulated;
939 cumulated += global_dof_count[c];
949 for (
unsigned int c = 1; c < fe_collection.
n_components(); ++c)
950 shifts[c] = shifts[c - 1] + component_to_dof_map[c - 1].size();
959 for (
unsigned int component = 0; component < fe_collection.
n_components();
962 next_free_index = shifts[component];
965 component_to_dof_map[component])
977 return next_free_index;
982 template <
int dim,
int spacedim>
986 std::vector<types::global_dof_index> renumbering(
1007 (result <= dof_handler.
n_dofs())),
1015 template <
int dim,
int spacedim>
1022 std::vector<types::global_dof_index> renumbering(
1051 template <
int dim,
int spacedim,
class ITERATOR,
class ENDITERATOR>
1054 const ITERATOR &start,
1055 const ENDITERATOR &
end,
1056 const bool is_level_operation)
1059 start->get_dof_handler().get_fe_collection();
1065 new_indices.resize(0);
1072 const IndexSet &locally_owned_dofs =
1073 is_level_operation ?
1074 start->get_dof_handler().locally_owned_mg_dofs(start->level()) :
1075 start->get_dof_handler().locally_owned_dofs();
1079 std::vector<types::global_dof_index> local_dof_indices;
1084 std::vector<std::vector<types::global_dof_index>> block_list(
1085 fe_collection.
size());
1086 for (
unsigned int f = 0; f < fe_collection.
size(); ++f)
1105 std::vector<std::vector<types::global_dof_index>> block_to_dof_map(
1107 for (ITERATOR cell = start; cell !=
end; ++cell)
1109 if (is_level_operation)
1112 if (!cell->is_locally_owned_on_level())
1119 if (!cell->is_locally_owned())
1123 if (is_level_operation)
1125 cell->level() == start->level(),
1127 "Multigrid renumbering in compute_block_wise() needs to be applied to a single level!"));
1133 const unsigned int dofs_per_cell =
1134 fe_collection[
fe_index].n_dofs_per_cell();
1135 local_dof_indices.resize(dofs_per_cell);
1136 cell->get_active_or_mg_dof_indices(local_dof_indices);
1138 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1139 if (locally_owned_dofs.
is_element(local_dof_indices[i]))
1141 local_dof_indices[i]);
1156 for (
unsigned int block = 0; block < fe_collection.
n_blocks(); ++block)
1158 std::sort(block_to_dof_map[block].
begin(),
1159 block_to_dof_map[block].
end());
1160 block_to_dof_map[block].erase(
1161 std::unique(block_to_dof_map[block].
begin(),
1162 block_to_dof_map[block].
end()),
1163 block_to_dof_map[block].
end());
1168 const unsigned int n_buckets = fe_collection.
n_blocks();
1169 std::vector<types::global_dof_index> shifts(n_buckets);
1173 &start->get_dof_handler().get_triangulation())))
1175 #ifdef DEAL_II_WITH_MPI
1176 std::vector<types::global_dof_index> local_dof_count(n_buckets);
1178 for (
unsigned int c = 0; c < n_buckets; ++c)
1179 local_dof_count[c] = block_to_dof_map[c].size();
1181 std::vector<types::global_dof_index> prefix_dof_count(n_buckets);
1182 const int ierr = MPI_Exscan(local_dof_count.data(),
1183 prefix_dof_count.data(),
1190 std::vector<types::global_dof_index> global_dof_count(n_buckets);
1197 for (
unsigned int c = 0; c < n_buckets; ++c)
1199 shifts[c] = prefix_dof_count[c] + cumulated;
1200 cumulated += global_dof_count[c];
1210 for (
unsigned int c = 1; c < fe_collection.
n_blocks(); ++c)
1211 shifts[c] = shifts[c - 1] + block_to_dof_map[c - 1].size();
1220 for (
unsigned int block = 0; block < fe_collection.
n_blocks(); ++block)
1222 const typename std::vector<types::global_dof_index>::const_iterator
1223 begin_of_component = block_to_dof_map[block].begin(),
1224 end_of_component = block_to_dof_map[block].end();
1226 next_free_index = shifts[block];
1228 for (
typename std::vector<types::global_dof_index>::const_iterator
1229 dof_index = begin_of_component;
1230 dof_index != end_of_component;
1241 return next_free_index;
1253 template <
int dim,
typename CellIteratorType>
1255 compute_hierarchical_recursive(
1258 const CellIteratorType &cell,
1259 const IndexSet &locally_owned_dof_indices,
1260 std::vector<types::global_dof_index> &new_indices)
1263 next_free_dof_offset;
1265 if (cell->has_children())
1268 for (
unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell;
1270 current_next_free_dof_offset =
1271 compute_hierarchical_recursive<dim>(current_next_free_dof_offset,
1274 locally_owned_dof_indices,
1294 if (cell->is_locally_owned())
1297 const unsigned int dofs_per_cell =
1298 cell->get_fe().n_dofs_per_cell();
1299 std::vector<types::global_dof_index> local_dof_indices(
1301 cell->get_dof_indices(local_dof_indices);
1320 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1321 if (locally_owned_dof_indices.
is_element(local_dof_indices[i]))
1325 const unsigned int idx =
1327 local_dof_indices[i]);
1331 my_starting_index + current_next_free_dof_offset;
1332 ++current_next_free_dof_offset;
1338 return current_next_free_dof_offset;
1344 template <
int dim,
int spacedim>
1348 std::vector<types::global_dof_index> renumbering(
1371 #ifdef DEAL_II_WITH_MPI
1374 const int ierr = MPI_Exscan(&locally_owned_size,
1388 #ifdef DEAL_II_WITH_P4EST
1393 for (
unsigned int c = 0; c <
tria->
n_cells(0); ++c)
1395 const unsigned int coarse_cell_index =
1396 tria->get_p4est_tree_to_coarse_cell_permutation()[c];
1399 this_cell(
tria, 0, coarse_cell_index, &dof_handler);
1401 next_free_dof_offset =
1402 compute_hierarchical_recursive<dim>(next_free_dof_offset,
1417 dof_handler.
begin(0);
1418 cell != dof_handler.
end(0);
1420 next_free_dof_offset =
1421 compute_hierarchical_recursive<dim>(next_free_dof_offset,
1434 (next_free_dof_offset <= dof_handler.
n_dofs())),
1438 Assert(std::find(renumbering.begin(),
1448 template <
int dim,
int spacedim>
1451 const std::vector<bool> &selected_dofs)
1453 std::vector<types::global_dof_index> renumbering(
1462 template <
int dim,
int spacedim>
1465 const std::vector<bool> &selected_dofs,
1466 const unsigned int level)
1471 std::vector<types::global_dof_index> renumbering(
1483 template <
int dim,
int spacedim>
1486 std::vector<types::global_dof_index> &new_indices,
1488 const std::vector<bool> &selected_dofs)
1491 Assert(selected_dofs.size() == n_dofs,
1496 Assert(new_indices.size() == n_dofs,
1500 std::count(selected_dofs.begin(), selected_dofs.end(),
false);
1505 if (selected_dofs[i] ==
false)
1507 new_indices[i] = next_unselected;
1512 new_indices[i] = next_selected;
1521 template <
int dim,
int spacedim>
1524 std::vector<types::global_dof_index> &new_indices,
1526 const std::vector<bool> &selected_dofs,
1527 const unsigned int level)
1532 const unsigned int n_dofs = dof_handler.
n_dofs(
level);
1533 Assert(selected_dofs.size() == n_dofs,
1538 Assert(new_indices.size() == n_dofs,
1541 const unsigned int n_selected_dofs =
1542 std::count(selected_dofs.begin(), selected_dofs.end(),
false);
1544 unsigned int next_unselected = 0;
1545 unsigned int next_selected = n_selected_dofs;
1546 for (
unsigned int i = 0; i < n_dofs; ++i)
1547 if (selected_dofs[i] ==
false)
1549 new_indices[i] = next_unselected;
1554 new_indices[i] = next_selected;
1563 template <
int dim,
int spacedim>
1570 std::vector<types::global_dof_index> renumbering(
1579 template <
int dim,
int spacedim>
1582 std::vector<types::global_dof_index> &new_indices,
1583 std::vector<types::global_dof_index> &reverse,
1585 const typename std::vector<
1610 std::vector<bool> already_sorted(n_owned_dofs,
false);
1611 std::vector<types::global_dof_index> cell_dofs;
1615 unsigned int index = 0;
1617 for (
const auto &cell : cells)
1621 const unsigned int n_cell_dofs = cell->get_fe().n_dofs_per_cell();
1622 cell_dofs.resize(n_cell_dofs);
1624 cell->get_active_or_mg_dof_indices(cell_dofs);
1628 std::sort(cell_dofs.begin(), cell_dofs.end());
1630 for (
const auto dof : cell_dofs)
1632 const auto local_dof = owned_dofs.index_within_set(dof);
1634 !already_sorted[local_dof])
1636 already_sorted[local_dof] =
true;
1637 reverse[index++] = local_dof;
1641 Assert(index == n_owned_dofs,
1643 "Traversing over the given set of cells did not cover all "
1644 "degrees of freedom in the DoFHandler. Does the set of cells "
1645 "not include all active cells?"));
1648 new_indices[reverse[i]] = owned_dofs.nth_index_in_set(i);
1653 template <
int dim,
int spacedim>
1656 const unsigned int level,
1657 const typename std::vector<
1663 std::vector<types::global_dof_index> renumbering(dof.
n_dofs(
level));
1664 std::vector<types::global_dof_index> reverse(dof.
n_dofs(
level));
1672 template <
int dim,
int spacedim>
1675 std::vector<types::global_dof_index> &new_order,
1676 std::vector<types::global_dof_index> &reverse,
1678 const unsigned int level,
1679 const typename std::vector<
1693 std::vector<bool> already_sorted(n_global_dofs,
false);
1694 std::vector<types::global_dof_index> cell_dofs(n_cell_dofs);
1698 for (
const auto &cell : cells)
1702 cell->get_active_or_mg_dof_indices(cell_dofs);
1703 std::sort(cell_dofs.begin(), cell_dofs.end());
1705 for (
unsigned int i = 0; i < n_cell_dofs; ++i)
1707 if (!already_sorted[cell_dofs[i]])
1709 already_sorted[cell_dofs[i]] =
true;
1716 "Traversing over the given set of cells did not cover all "
1717 "degrees of freedom in the DoFHandler. Does the set of cells "
1718 "not include all cells of the specified level?"));
1721 new_order[reverse[i]] = i;
1726 template <
int dim,
int spacedim>
1730 const bool dof_wise_renumbering)
1732 std::vector<types::global_dof_index> renumbering(dof.
n_dofs());
1733 std::vector<types::global_dof_index> reverse(dof.
n_dofs());
1735 renumbering, reverse, dof, direction, dof_wise_renumbering);
1742 template <
int dim,
int spacedim>
1745 std::vector<types::global_dof_index> &reverse,
1748 const bool dof_wise_renumbering)
1754 if (dof_wise_renumbering ==
false)
1756 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
1762 comparator(direction);
1765 ordered_cells.push_back(cell);
1767 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
1779 const unsigned int n_dofs = dof.
n_dofs();
1780 std::vector<std::pair<Point<spacedim>,
unsigned int>>
1781 support_point_list(n_dofs);
1784 Assert(fe_collection[0].has_support_points(),
1787 for (
unsigned int comp = 0; comp < fe_collection.
size(); ++comp)
1789 Assert(fe_collection[comp].has_support_points(),
1795 quadrature_collection,
1798 std::vector<bool> already_touched(n_dofs,
false);
1800 std::vector<types::global_dof_index> local_dof_indices;
1804 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
1805 local_dof_indices.resize(dofs_per_cell);
1806 hp_fe_values.
reinit(cell);
1809 cell->get_active_or_mg_dof_indices(local_dof_indices);
1810 const std::vector<Point<spacedim>> &points =
1812 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1813 if (!already_touched[local_dof_indices[i]])
1815 support_point_list[local_dof_indices[i]].first = points[i];
1816 support_point_list[local_dof_indices[i]].second =
1817 local_dof_indices[i];
1818 already_touched[local_dof_indices[i]] =
true;
1823 std::sort(support_point_list.begin(),
1824 support_point_list.end(),
1827 new_indices[support_point_list[i].
second] = i;
1833 template <
int dim,
int spacedim>
1836 const unsigned int level,
1838 const bool dof_wise_renumbering)
1840 std::vector<types::global_dof_index> renumbering(dof.
n_dofs(
level));
1841 std::vector<types::global_dof_index> reverse(dof.
n_dofs(
level));
1843 renumbering, reverse, dof,
level, direction, dof_wise_renumbering);
1850 template <
int dim,
int spacedim>
1853 std::vector<types::global_dof_index> &reverse,
1855 const unsigned int level,
1857 const bool dof_wise_renumbering)
1859 if (dof_wise_renumbering ==
false)
1861 std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
1867 comparator(direction);
1876 ordered_cells.push_back(p);
1879 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
1888 std::vector<std::pair<Point<spacedim>,
unsigned int>>
1889 support_point_list(n_dofs);
1896 std::vector<bool> already_touched(dof.
n_dofs(),
false);
1899 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
1907 &begin_tria =
begin;
1908 begin->get_active_or_mg_dof_indices(local_dof_indices);
1909 fe_values.
reinit(begin_tria);
1910 const std::vector<Point<spacedim>> &points =
1912 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1913 if (!already_touched[local_dof_indices[i]])
1915 support_point_list[local_dof_indices[i]].first = points[i];
1916 support_point_list[local_dof_indices[i]].second =
1917 local_dof_indices[i];
1918 already_touched[local_dof_indices[i]] =
true;
1923 std::sort(support_point_list.begin(),
1924 support_point_list.end(),
1927 new_indices[support_point_list[i].
second] = i;
1961 template <
class DHCellIterator>
1963 operator()(
const DHCellIterator &c1,
const DHCellIterator &c2)
const
1967 return compare(c1, c2, std::integral_constant<int, dim>());
1974 template <
class DHCellIterator,
int xdim>
1977 const DHCellIterator &c2,
1978 std::integral_constant<int, xdim>)
const
1984 return (
counter ? (s1 > s2) : (s2 > s1));
1992 template <
class DHCellIterator>
1995 const DHCellIterator &,
1996 std::integral_constant<int, 1>)
const
1999 ExcMessage(
"This operation only makes sense for dim>=2."));
2007 template <
int dim,
int spacedim>
2013 std::vector<types::global_dof_index> renumbering(dof.
n_dofs());
2021 template <
int dim,
int spacedim>
2028 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
2034 ordered_cells.push_back(cell);
2036 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
2038 std::vector<types::global_dof_index> reverse(new_indices.size());
2044 template <
int dim,
int spacedim>
2047 const unsigned int level,
2051 std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
2063 ordered_cells.push_back(p);
2066 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
2073 template <
int dim,
int spacedim>
2077 std::vector<types::global_dof_index> renumbering(
2086 template <
int dim,
int spacedim>
2093 std::vector<types::global_dof_index> renumbering(
2104 template <
int dim,
int spacedim>
2110 Assert(new_indices.size() == n_dofs,
2113 std::iota(new_indices.begin(),
2121 ::boost::mt19937 random_number_generator;
2122 for (
unsigned int i = 1; i < n_dofs; ++i)
2125 const unsigned int j =
2126 ::boost::random::uniform_int_distribution<>(0, i)(
2127 random_number_generator);
2131 std::swap(new_indices[i], new_indices[j]);
2137 template <
int dim,
int spacedim>
2141 const unsigned int level)
2144 Assert(new_indices.size() == n_dofs,
2147 std::iota(new_indices.begin(),
2155 ::boost::mt19937 random_number_generator;
2156 for (
unsigned int i = 1; i < n_dofs; ++i)
2159 const unsigned int j =
2160 ::boost::random::uniform_int_distribution<>(0, i)(
2161 random_number_generator);
2165 std::swap(new_indices[i], new_indices[j]);
2171 template <
int dim,
int spacedim>
2179 "Parallel triangulations are already enumerated according to their MPI process id."));
2181 std::vector<types::global_dof_index> renumbering(
2190 template <
int dim,
int spacedim>
2196 Assert(new_dof_indices.size() == n_dofs,
2202 std::vector<types::subdomain_id> subdomain_association(n_dofs);
2204 const unsigned int n_subdomains =
2205 *std::max_element(subdomain_association.begin(),
2206 subdomain_association.end()) +
2216 std::fill(new_dof_indices.begin(),
2217 new_dof_indices.end(),
2223 if (subdomain_association[i] == subdomain)
2227 new_dof_indices[i] = next_free_index;
2233 Assert(std::find(new_dof_indices.begin(),
2234 new_dof_indices.end(),
2241 template <
int dim,
int spacedim>
2245 std::vector<types::global_dof_index> renumbering(
2258 template <
int dim,
int spacedim>
2261 std::vector<types::global_dof_index> &new_dof_indices,
2265 Assert(new_dof_indices.size() == n_dofs,
2277 std::vector<types::global_dof_index> component_renumbering(
2279 compute_component_wise<dim, spacedim>(component_renumbering,
2282 std::vector<unsigned int>(),
2287 const std::vector<types::global_dof_index> dofs_per_component =
2289 for (
const auto &dpc : dofs_per_component)
2293 const unsigned int n_components =
2297 dof_handler.
n_dofs() / n_components;
2303 if (component_renumbering.empty())
2305 new_dof_indices.resize(0);
2308 std::fill(new_dof_indices.begin(),
2309 new_dof_indices.end(),
2317 std::vector<types::global_dof_index> component_dofs(
2318 local_dofs_per_component);
2319 for (
unsigned int component = 0; component < n_components; ++component)
2321 for (std::size_t i = 0; i < local_dofs_per_component; ++i)
2323 component_renumbering[n_components * i + component];
2324 component_renumbered_dofs.
add_indices(component_dofs.begin(),
2325 component_dofs.end());
2327 component_renumbered_dofs.
compress();
2331 component_renumbered_dofs2.
add_indices(component_renumbering.begin(),
2332 component_renumbering.end());
2333 Assert(component_renumbered_dofs2 == component_renumbered_dofs,
2340 AssertThrow(fe.dofs_per_cell == 0 || fe.has_support_points(),
2342 for (
unsigned int i = 0; i < fe.n_base_elements(); ++i)
2344 fe.base_element(0).get_unit_support_points() ==
2345 fe.base_element(i).get_unit_support_points(),
2347 "All base elements should have the same support points."));
2350 std::vector<types::global_dof_index> component_to_nodal(
2354 std::vector<types::global_dof_index> cell_dofs;
2355 std::vector<types::global_dof_index> component_renumbered_cell_dofs;
2359 auto next_dof_it = locally_owned_dofs.
begin();
2361 if (cell->is_locally_owned())
2366 cell->get_dof_indices(cell_dofs);
2373 if (locally_owned_dofs.
is_element(cell_dofs[i]))
2375 const auto local_index =
2377 component_renumbered_cell_dofs[i] =
2378 component_renumbering[local_index];
2382 component_renumbered_cell_dofs[i] =
2391 component_renumbered_cell_dofs[i]))
2393 for (
unsigned int component = 0;
2400 const auto local_index =
2402 component_renumbered_cell_dofs[i] +
2403 dofs_per_component * component);
2405 if (component_to_nodal[local_index] ==
2408 component_to_nodal[local_index] = *next_dof_it;
2419 const auto local_index =
2421 new_dof_indices[i] = component_to_nodal[local_index];
2430 typename VectorizedArrayType>
2436 const std::vector<types::global_dof_index> new_global_numbers =
2446 template <
int dim,
int spacedim,
typename Number,
typename AdditionalDataType>
2450 const AdditionalDataType &matrix_free_data)
2452 const std::vector<types::global_dof_index> new_global_numbers =
2459 dof_handler.
renumber_dofs(matrix_free_data.mg_level, new_global_numbers);
2464 template <
int dim,
int spacedim,
typename Number,
typename AdditionalDataType>
2465 std::vector<types::global_dof_index>
2469 const AdditionalDataType &matrix_free_data)
2471 AdditionalDataType my_mf_data = matrix_free_data;
2472 my_mf_data.initialize_mapping =
false;
2475 typename AdditionalDataType::MatrixFreeType separate_matrix_free;
2494 std::vector<std::vector<unsigned int>>
2495 group_dofs_by_rank_access(
2500 std::vector<unsigned int> touch_count(partitioner.locally_owned_size());
2501 for (
const auto &p : partitioner.import_indices())
2502 for (
unsigned int i = p.first; i < p.second; ++i)
2506 std::vector<std::vector<unsigned int>> result(1);
2507 for (
unsigned int i = 0; i < touch_count.size(); ++i)
2508 if (touch_count[i] == 0)
2509 result.back().push_back(i);
2514 std::map<unsigned int, std::vector<unsigned int>>
2515 multiple_ranks_access_dof;
2516 const std::vector<std::pair<unsigned int, unsigned int>> &import_targets =
2517 partitioner.import_targets();
2518 auto it = partitioner.import_indices().begin();
2519 for (
const std::pair<unsigned int, unsigned int> &proc : import_targets)
2521 result.emplace_back();
2522 unsigned int count_dofs = 0;
2523 while (count_dofs < proc.second)
2525 for (
unsigned int i = it->first; i < it->
second;
2528 if (touch_count[i] == 1)
2529 result.back().push_back(i);
2531 multiple_ranks_access_dof[i].push_back(proc.first);
2541 std::map<std::vector<unsigned int>,
2542 std::vector<unsigned int>,
2543 std::function<
bool(
const std::vector<unsigned int> &,
2544 const std::vector<unsigned int> &)>>
2545 dofs_by_rank{[](
const std::vector<unsigned int> &a,
2546 const std::vector<unsigned int> &
b) {
2547 if (a.size() <
b.size())
2549 if (a.size() ==
b.size())
2551 for (
unsigned int i = 0; i < a.size(); ++i)
2554 else if (a[i] >
b[i])
2559 for (
const auto &entry : multiple_ranks_access_dof)
2560 dofs_by_rank[entry.second].push_back(entry.first);
2562 for (
const auto &procs : dofs_by_rank)
2563 result.push_back(procs.second);
2574 template <
int dim,
typename Number,
typename VectorizedArrayType>
2575 std::pair<std::vector<unsigned int>, std::vector<unsigned char>>
2576 compute_mf_numbering(
2578 const unsigned int component)
2582 const unsigned int n_comp =
2585 matrix_free.
get_dof_handler(component).get_fe().n_base_elements() == 1,
2593 const unsigned int fe_degree =
2595 const unsigned int nn = fe_degree - 1;
2604 std::array<std::pair<unsigned int, unsigned int>,
2605 ::Utilities::pow(3, dim)>
2609 dofs_on_objects[0] = std::make_pair(0
U, 1U);
2610 dofs_on_objects[1] = std::make_pair(2 * n_comp, nn);
2611 dofs_on_objects[2] = std::make_pair(n_comp, 1U);
2615 dofs_on_objects[0] = std::make_pair(0
U, 1U);
2616 dofs_on_objects[1] = std::make_pair(n_comp * (4 + 2 * nn), nn);
2617 dofs_on_objects[2] = std::make_pair(n_comp, 1U);
2618 dofs_on_objects[3] = std::make_pair(n_comp * 4, nn);
2619 dofs_on_objects[4] = std::make_pair(n_comp * (4 + 4 * nn), nn * nn);
2620 dofs_on_objects[5] = std::make_pair(n_comp * (4 + 1 * nn), nn);
2621 dofs_on_objects[6] = std::make_pair(2 * n_comp, 1U);
2622 dofs_on_objects[7] = std::make_pair(n_comp * (4 + 3 * nn), nn);
2623 dofs_on_objects[8] = std::make_pair(3 * n_comp, 1U);
2627 dofs_on_objects[0] = std::make_pair(0
U, 1U);
2628 dofs_on_objects[1] = std::make_pair(n_comp * (8 + 2 * nn), nn);
2629 dofs_on_objects[2] = std::make_pair(n_comp, 1U);
2630 dofs_on_objects[3] = std::make_pair(n_comp * 8, nn);
2631 dofs_on_objects[4] =
2632 std::make_pair(n_comp * (8 + 12 * nn + 4 * nn * nn), nn * nn);
2633 dofs_on_objects[5] = std::make_pair(n_comp * (8 + 1 * nn), nn);
2634 dofs_on_objects[6] = std::make_pair(n_comp * 2, 1U);
2635 dofs_on_objects[7] = std::make_pair(n_comp * (8 + 3 * nn), nn);
2636 dofs_on_objects[8] = std::make_pair(n_comp * 3, 1U);
2637 dofs_on_objects[9] = std::make_pair(n_comp * (8 + 8 * nn), nn);
2638 dofs_on_objects[10] =
2639 std::make_pair(n_comp * (8 + 12 * nn + 2 * nn * nn), nn * nn);
2640 dofs_on_objects[11] = std::make_pair(n_comp * (8 + 9 * nn), nn);
2641 dofs_on_objects[12] = std::make_pair(n_comp * (8 + 12 * nn), nn * nn);
2642 dofs_on_objects[13] =
2643 std::make_pair(n_comp * (8 + 12 * nn + 6 * nn * nn), nn * nn * nn);
2644 dofs_on_objects[14] =
2645 std::make_pair(n_comp * (8 + 12 * nn + 1 * nn * nn), nn * nn);
2646 dofs_on_objects[15] = std::make_pair(n_comp * (8 + 10 * nn), nn);
2647 dofs_on_objects[16] =
2648 std::make_pair(n_comp * (8 + 12 * nn + 3 * nn * nn), nn * nn);
2649 dofs_on_objects[17] = std::make_pair(n_comp * (8 + 11 * nn), nn);
2650 dofs_on_objects[18] = std::make_pair(n_comp * 4, 1U);
2651 dofs_on_objects[19] = std::make_pair(n_comp * (8 + 6 * nn), nn);
2652 dofs_on_objects[20] = std::make_pair(n_comp * 5, 1U);
2653 dofs_on_objects[21] = std::make_pair(n_comp * (8 + 4 * nn), nn);
2654 dofs_on_objects[22] =
2655 std::make_pair(n_comp * (8 + 12 * nn + 5 * nn * nn), nn * nn);
2656 dofs_on_objects[23] = std::make_pair(n_comp * (8 + 5 * nn), nn);
2657 dofs_on_objects[24] = std::make_pair(n_comp * 6, 1U);
2658 dofs_on_objects[25] = std::make_pair(n_comp * (8 + 7 * nn), nn);
2659 dofs_on_objects[26] = std::make_pair(n_comp * 7, 1U);
2664 std::vector<unsigned int> &result,
2665 unsigned int &counter_dof_numbers) {
2667 owned_dofs.index_within_set(dof_index);
2672 result[local_dof_index] = counter_dof_numbers++;
2676 unsigned int counter_dof_numbers = 0;
2677 std::vector<unsigned int> dofs_extracted;
2678 std::vector<types::global_dof_index> dof_indices(
2695 const unsigned int n_owned_dofs = owned_dofs.n_elements();
2696 std::vector<unsigned int> dof_numbers_mf_order(
2698 std::vector<unsigned int> last_touch_by_cell_batch_range(
2700 std::vector<unsigned char> touch_count(n_owned_dofs);
2702 const auto operation_on_cell_range =
2705 const unsigned int &,
2706 const std::pair<unsigned int, unsigned int> &cell_range) {
2707 for (
unsigned int cell = cell_range.first; cell < cell_range.second;
2711 for (
unsigned int v = 0;
2718 ->get_dof_indices(dof_indices);
2721 ->get_mg_dof_indices(dof_indices);
2723 for (
unsigned int a = 0; a < dofs_on_objects.size(); ++a)
2725 const auto &r = dofs_on_objects[a];
2726 if (a == 10 || a == 16)
2729 for (
unsigned int i1 = 0; i1 < nn; ++i1)
2730 for (
unsigned int i0 = 0; i0 < nn; ++i0)
2731 for (
unsigned int c = 0; c < n_comp; ++c)
2732 renumber_func(dof_indices[r.first + r.second * c +
2735 dof_numbers_mf_order,
2736 counter_dof_numbers);
2738 for (
unsigned int i = 0; i < r.second; ++i)
2739 for (
unsigned int c = 0; c < n_comp; ++c)
2741 dof_indices[r.first + r.second * c + i],
2743 dof_numbers_mf_order,
2744 counter_dof_numbers);
2753 dofs_extracted, cell);
2754 for (
const unsigned int dof_index : dofs_extracted)
2755 if (dof_index < n_owned_dofs &&
2756 last_touch_by_cell_batch_range[dof_index] !=
2759 ++touch_count[dof_index];
2760 last_touch_by_cell_batch_range[dof_index] =
2770 "version of MatrixFree::cell_loop"));
2772 matrix_free.template cell_loop<unsigned int, unsigned int>(
2773 operation_on_cell_range, counter_dof_numbers, counter_dof_numbers);
2777 return std::make_pair(dof_numbers_mf_order, touch_count);
2787 typename VectorizedArrayType>
2788 std::vector<types::global_dof_index>
2794 ExcMessage(
"You need to set up indices in MatrixFree "
2795 "to be able to compute a renumbering!"));
2798 unsigned int component = 0;
2799 for (; component < matrix_free.
n_components(); ++component)
2804 ExcMessage(
"Could not locate the given DoFHandler in MatrixFree"));
2816 const std::vector<std::vector<unsigned int>> dofs_by_rank_access =
2817 group_dofs_by_rank_access(
2820 const auto &[local_numbering, touch_count] =
2821 compute_mf_numbering(matrix_free, component);
2831 enum class Category : unsigned char
2838 std::vector<Category> categories(locally_owned_size);
2839 for (
unsigned int i = 0; i < locally_owned_size; ++i)
2840 switch (touch_count[i])
2843 categories[local_numbering[i]] = Category::constrained;
2846 categories[local_numbering[i]] = Category::single;
2849 categories[local_numbering[i]] = Category::multiple;
2852 for (
unsigned int chunk = 1; chunk < dofs_by_rank_access.size(); ++chunk)
2853 for (
const auto i : dofs_by_rank_access[chunk])
2854 categories[local_numbering[i]] = Category::mpi_dof;
2858 std::array<unsigned int, 4> n_entries_per_category{};
2859 for (
const Category i : categories)
2862 ++n_entries_per_category[
static_cast<int>(i)];
2864 std::array<unsigned int, 4> counters{};
2865 for (
unsigned int i = 1; i < 4; ++i)
2866 counters[i] = counters[i - 1] + n_entries_per_category[i - 1];
2867 std::vector<unsigned int> numbering_categories;
2868 numbering_categories.reserve(locally_owned_size);
2869 for (
const Category category : categories)
2871 numbering_categories.push_back(counters[
static_cast<int>(category)]);
2872 ++counters[
static_cast<int>(category)];
2876 std::vector<::types::global_dof_index> new_global_numbers(
2877 locally_owned_size);
2878 for (
unsigned int i = 0; i < locally_owned_size; ++i)
2879 new_global_numbers[i] =
2882 return new_global_numbers;
2890 #include "dof_renumbering.inst"
unsigned int first_selected_component(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
cell_iterator end() const
void renumber_dofs(const std::vector< types::global_dof_index > &new_numbers)
const Triangulation< dim, spacedim > & get_triangulation() const
active_cell_iterator begin_active(const unsigned int level=0) const
types::global_dof_index n_dofs() const
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
cell_iterator begin(const unsigned int level=0) const
MPI_Comm get_communicator() const
const IndexSet & locally_owned_dofs() const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
types::global_dof_index n_locally_owned_dofs() const
void add_entries(const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_unique_and_sorted=false)
size_type row_length(const size_type row) const
size_type column_number(const size_type row, const size_type index) const
const std::vector< Point< spacedim > > & get_quadrature_points() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access >> &cell)
unsigned int n_dofs_per_cell() const
unsigned int n_components() const
const unsigned int dofs_per_cell
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
const std::vector< Point< dim > > & get_unit_support_points() const
bool has_support_points() const
std::pair< unsigned int, types::global_dof_index > system_to_block_index(const unsigned int component) const
const ComponentMask & get_nonzero_components(const unsigned int i) const
bool is_primitive() const
size_type index_within_set(const size_type global_index) const
size_type n_elements() const
bool is_element(const size_type index) const
ElementIterator begin() const
void subtract_set(const IndexSet &other)
size_type nth_index_in_set(const size_type local_index) const
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
unsigned int n_active_entries_per_cell_batch(const unsigned int cell_batch_index) const
unsigned int get_mg_level() const
const internal::MatrixFreeFunctions::DoFInfo & get_dof_info(const unsigned int dof_handler_index_component=0) const
bool indices_initialized() const
DoFHandler< dim >::cell_iterator get_cell_iterator(const unsigned int cell_batch_index, const unsigned int lane_index, const unsigned int dof_handler_index=0) const
unsigned int n_components() const
const DoFHandler< dim > & get_dof_handler(const unsigned int dof_handler_index=0) const
const internal::MatrixFreeFunctions::TaskInfo & get_task_info() const
virtual MPI_Comm get_communicator() const
unsigned int n_active_cells() const
unsigned int n_cells() const
unsigned int size() const
void push_back(const FiniteElement< dim, spacedim > &new_fe)
unsigned int n_blocks() const
unsigned int n_components() const
const FEValuesType & get_present_fe_values() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, lda >> &cell, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int)
void push_back(const Quadrature< dim_in > &new_quadrature)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
IteratorRange< active_cell_iterator > active_cell_iterators() const
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcDoFHandlerNotInitialized()
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
void make_hanging_node_constraints(const DoFHandler< dim, spacedim > &dof_handler, AffineConstraints< number > &constraints)
void make_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternBase &sparsity_pattern, const AffineConstraints< number > &constraints={}, const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
@ update_quadrature_points
Transformed quadrature points.
Expression atan2(const Expression &y, const Expression &x)
graph_traits< Graph >::vertices_size_type size_type
graph_traits< Graph >::vertex_descriptor Vertex
adjacency_list< vecS, vecS, undirectedS, property< vertex_color_t, default_color_type, property< vertex_degree_t, int > >> Graph
std::pair< size_type, size_type > Pair
void create_graph(const DoFHandler< dim, spacedim > &dof_handler, const bool use_constraints, boosttypes::Graph &graph, boosttypes::property_map< boosttypes::Graph, boosttypes::vertex_degree_t >::type &graph_degree)
void compute_Cuthill_McKee(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false)
void Cuthill_McKee(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void king_ordering(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void compute_king_ordering(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false)
void compute_minimum_degree(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false)
void minimum_degree(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false)
void compute_support_point_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler)
void compute_subdomain_wise(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler)
void matrix_free_data_locality(DoFHandler< dim, spacedim > &dof_handler, const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free)
void subdomain_wise(DoFHandler< dim, spacedim > &dof_handler)
void hierarchical(DoFHandler< dim, spacedim > &dof_handler)
void compute_random(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler)
void component_wise(DoFHandler< dim, spacedim > &dof_handler, const std::vector< unsigned int > &target_component=std::vector< unsigned int >())
void downstream(DoFHandler< dim, spacedim > &dof_handler, const Tensor< 1, spacedim > &direction, const bool dof_wise_renumbering=false)
void compute_Cuthill_McKee(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &, const bool reversed_numbering=false, const bool use_constraints=false, const std::vector< types::global_dof_index > &starting_indices=std::vector< types::global_dof_index >(), const unsigned int level=numbers::invalid_unsigned_int)
void block_wise(DoFHandler< dim, spacedim > &dof_handler)
void Cuthill_McKee(DoFHandler< dim, spacedim > &dof_handler, const bool reversed_numbering=false, const bool use_constraints=false, const std::vector< types::global_dof_index > &starting_indices=std::vector< types::global_dof_index >())
void compute_sort_selected_dofs_back(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &selected_dofs)
void sort_selected_dofs_back(DoFHandler< dim, spacedim > &dof_handler, const std::vector< bool > &selected_dofs)
void support_point_wise(DoFHandler< dim, spacedim > &dof_handler)
void compute_cell_wise(std::vector< types::global_dof_index > &renumbering, std::vector< types::global_dof_index > &inverse_renumbering, const DoFHandler< dim, spacedim > &dof_handler, const std::vector< typename DoFHandler< dim, spacedim >::active_cell_iterator > &cell_order)
std::vector< types::global_dof_index > compute_matrix_free_data_locality(const DoFHandler< dim, spacedim > &dof_handler, const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free)
void clockwise_dg(DoFHandler< dim, spacedim > &dof_handler, const Point< spacedim > ¢er, const bool counter=false)
void random(DoFHandler< dim, spacedim > &dof_handler)
void compute_downstream(std::vector< types::global_dof_index > &new_dof_indices, std::vector< types::global_dof_index > &reverse, const DoFHandler< dim, spacedim > &dof_handler, const Tensor< 1, spacedim > &direction, const bool dof_wise_renumbering)
void cell_wise(DoFHandler< dim, spacedim > &dof_handler, const std::vector< typename DoFHandler< dim, spacedim >::active_cell_iterator > &cell_order)
types::global_dof_index compute_component_wise(std::vector< types::global_dof_index > &new_dof_indices, const CellIterator &start, const std_cxx20::type_identity_t< CellIterator > &end, const std::vector< unsigned int > &target_component, const bool is_level_operation)
types::global_dof_index compute_block_wise(std::vector< types::global_dof_index > &new_dof_indices, const ITERATOR &start, const ENDITERATOR &end, bool is_level_operation)
void compute_clockwise_dg(std::vector< types::global_dof_index > &new_dof_indices, const DoFHandler< dim, spacedim > &dof_handler, const Point< spacedim > ¢er, const bool counter)
void swap(MemorySpaceData< T, MemorySpace > &u, MemorySpaceData< T, MemorySpace > &v)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
VectorType::value_type * begin(VectorType &V)
VectorType::value_type * end(VectorType &V)
TrilinosWrappers::types::int_type global_index(const Epetra_BlockMap &map, const ::types::global_dof_index i)
T sum(const T &t, const MPI_Comm mpi_communicator)
T max(const T &t, const MPI_Comm mpi_communicator)
std::vector< Integer > reverse_permutation(const std::vector< Integer > &permutation)
void copy(const T *begin, const T *end, U *dest)
static const unsigned int invalid_unsigned_int
const types::global_dof_index invalid_dof_index
typename type_identity< T >::type type_identity_t
unsigned int global_dof_index
unsigned int subdomain_id
unsigned short int fe_index
bool compare(const DHCellIterator &c1, const DHCellIterator &c2, std::integral_constant< int, xdim >) const
bool compare(const DHCellIterator &, const DHCellIterator &, std::integral_constant< int, 1 >) const
ClockCells(const Point< dim > ¢er, bool counter)
const Point< dim > & center
bool operator()(const DHCellIterator &c1, const DHCellIterator &c2) const
void get_dof_indices_on_cell_batch(std::vector< unsigned int > &local_indices, const unsigned int cell_batch, const bool with_constraints=true) const
std::shared_ptr< const Utilities::MPI::Partitioner > vector_partitioner
TasksParallelScheme scheme
const ::Triangulation< dim, spacedim > & tria
#define DEAL_II_DOF_INDEX_MPI_TYPE