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)
233 ::boost::king_ordering(graph, inv_perm.begin());
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)
354 std::copy(perm.
begin(), perm.
end(), new_dof_indices.begin());
356 std::copy(inverse_perm.
begin(),
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 =
416 if (reorder_level_dofs ==
false)
419 locally_relevant_dofs);
428 locally_relevant_dofs);
439 constraints.
reinit(locally_relevant_dofs);
450 locally_owned_dofs.
size());
451 if (reorder_level_dofs ==
false)
463 if (reversed_numbering)
477 if (reorder_level_dofs ==
false)
480 locally_active_dofs);
489 bool needs_locally_active =
false;
490 for (
const auto starting_index : starting_indices)
492 if ((needs_locally_active ==
494 (locally_owned_dofs.
is_element(starting_index) ==
false))
497 locally_active_dofs.
is_element(starting_index),
499 "You specified global degree of freedom " +
500 std::to_string(starting_index) +
501 " as a starting index, but this index is not among the "
502 "locally active ones on this processor, as required "
503 "for this function."));
504 needs_locally_active =
true;
509 (needs_locally_active ? locally_active_dofs : locally_owned_dofs);
520 index_set_to_use.
size(),
522 if (reorder_level_dofs ==
false)
533 std::vector<types::global_dof_index> row_entries;
534 for (
unsigned int i = 0; i < index_set_to_use.
n_elements(); ++i)
538 const unsigned int row_length = dsp.
row_length(row);
540 for (
unsigned int j = 0; j < row_length; ++j)
543 if (col != row && index_set_to_use.
is_element(col))
553 std::vector<types::global_dof_index> local_starting_indices(
554 starting_indices.size());
555 for (
unsigned int i = 0; i < starting_indices.size(); ++i)
556 local_starting_indices[i] =
561 std::vector<types::global_dof_index> my_new_indices(
565 local_starting_indices);
566 if (reversed_numbering)
575 if (needs_locally_active ==
true)
578 IndexSet active_but_not_owned_dofs = locally_active_dofs;
579 active_but_not_owned_dofs.
subtract_set(locally_owned_dofs);
581 std::set<types::global_dof_index> erase_these_indices;
582 for (
const auto p : active_but_not_owned_dofs)
587 erase_these_indices.insert(my_new_indices[index]);
590 Assert(erase_these_indices.size() ==
593 Assert(
static_cast<unsigned int>(
594 std::count(my_new_indices.begin(),
595 my_new_indices.end(),
601 std::vector<types::global_dof_index> translate_indices(
602 my_new_indices.size());
604 std::set<types::global_dof_index>::const_iterator
605 next_erased_index = erase_these_indices.begin();
607 for (
unsigned int i = 0; i < translate_indices.size(); ++i)
608 if ((next_erased_index != erase_these_indices.end()) &&
609 (*next_erased_index == i))
616 translate_indices[i] = next_new_index;
626 new_indices.reserve(locally_owned_dofs.
n_elements());
627 for (
const auto &p : my_new_indices)
632 new_indices.push_back(translate_indices[p]);
638 new_indices = std::move(my_new_indices);
651 template <
int dim,
int spacedim>
654 const unsigned int level,
655 const bool reversed_numbering,
656 const std::vector<types::global_dof_index> &starting_indices)
661 std::vector<types::global_dof_index> new_indices(
680 template <
int dim,
int spacedim>
683 const std::vector<unsigned int> &component_order_arg)
685 std::vector<types::global_dof_index> renumbering(
689 compute_component_wise<dim, spacedim>(renumbering,
711 (result <= dof_handler.
n_dofs())),
719 template <
int dim,
int spacedim>
722 const unsigned int level,
723 const std::vector<unsigned int> &component_order_arg)
728 std::vector<types::global_dof_index> renumbering(
738 compute_component_wise<dim, spacedim>(
739 renumbering, start, end, component_order_arg,
true);
752 template <
int dim,
int spacedim,
typename CellIterator>
755 const CellIterator & start,
757 const std::vector<unsigned int> &component_order_arg,
758 const bool is_level_operation)
761 start->get_dof_handler().get_fe_collection();
767 new_indices.resize(0);
774 const IndexSet &locally_owned_dofs =
776 start->get_dof_handler().locally_owned_mg_dofs(start->level()) :
777 start->get_dof_handler().locally_owned_dofs();
781 std::vector<unsigned int> component_order(component_order_arg);
786 if (component_order.size() == 0)
787 for (
unsigned int i = 0; i < fe_collection.
n_components(); ++i)
788 component_order.push_back(i);
794 for (
const unsigned int component : component_order)
802 std::vector<types::global_dof_index> local_dof_indices;
814 std::vector<std::vector<unsigned int>> component_list(fe_collection.
size());
815 for (
unsigned int f = 0; f < fe_collection.
size(); ++f)
819 component_list[f].resize(dofs_per_cell);
820 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
822 component_list[f][i] =
826 const unsigned int comp =
832 component_list[f][i] = component_order[comp];
847 std::vector<std::vector<types::global_dof_index>> component_to_dof_map(
849 for (CellIterator cell = start; cell != end; ++cell)
851 if (is_level_operation)
854 if (!cell->is_locally_owned_on_level())
861 if (!cell->is_locally_owned())
865 if (is_level_operation)
867 cell->level() == start->level(),
869 "Multigrid renumbering in compute_component_wise() needs to be applied to a single level!"));
875 const unsigned int dofs_per_cell =
876 fe_collection[fe_index].n_dofs_per_cell();
877 local_dof_indices.resize(dofs_per_cell);
878 cell->get_active_or_mg_dof_indices(local_dof_indices);
880 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
881 if (locally_owned_dofs.
is_element(local_dof_indices[i]))
882 component_to_dof_map[component_list[fe_index][i]].
push_back(
883 local_dof_indices[i]);
909 for (
unsigned int component = 0; component < fe_collection.
n_components();
912 std::sort(component_to_dof_map[component].begin(),
913 component_to_dof_map[component].end());
914 component_to_dof_map[component].erase(
915 std::unique(component_to_dof_map[component].begin(),
916 component_to_dof_map[component].end()),
917 component_to_dof_map[component].end());
922 const unsigned int n_buckets = fe_collection.
n_components();
923 std::vector<types::global_dof_index> shifts(n_buckets);
927 &start->get_dof_handler().get_triangulation())))
929#ifdef DEAL_II_WITH_MPI
930 std::vector<types::global_dof_index> local_dof_count(n_buckets);
932 for (
unsigned int c = 0; c < n_buckets; ++c)
933 local_dof_count[c] = component_to_dof_map[c].size();
935 std::vector<types::global_dof_index> prefix_dof_count(n_buckets);
936 const int ierr = MPI_Exscan(local_dof_count.data(),
937 prefix_dof_count.data(),
944 std::vector<types::global_dof_index> global_dof_count(n_buckets);
951 for (
unsigned int c = 0; c < n_buckets; ++c)
953 shifts[c] = prefix_dof_count[c] + cumulated;
954 cumulated += global_dof_count[c];
964 for (
unsigned int c = 1; c < fe_collection.
n_components(); ++c)
965 shifts[c] = shifts[c - 1] + component_to_dof_map[c - 1].size();
974 for (
unsigned int component = 0; component < fe_collection.
n_components();
977 next_free_index = shifts[component];
980 component_to_dof_map[component])
992 return next_free_index;
997 template <
int dim,
int spacedim>
1001 std::vector<types::global_dof_index> renumbering(
1022 (result <= dof_handler.
n_dofs())),
1030 template <
int dim,
int spacedim>
1037 std::vector<types::global_dof_index> renumbering(
1066 template <
int dim,
int spacedim,
class ITERATOR,
class ENDITERATOR>
1069 const ITERATOR & start,
1070 const ENDITERATOR & end,
1071 const bool is_level_operation)
1074 start->get_dof_handler().get_fe_collection();
1080 new_indices.resize(0);
1087 const IndexSet &locally_owned_dofs =
1088 is_level_operation ?
1089 start->get_dof_handler().locally_owned_mg_dofs(start->level()) :
1090 start->get_dof_handler().locally_owned_dofs();
1094 std::vector<types::global_dof_index> local_dof_indices;
1099 std::vector<std::vector<types::global_dof_index>> block_list(
1100 fe_collection.
size());
1101 for (
unsigned int f = 0; f < fe_collection.
size(); ++f)
1120 std::vector<std::vector<types::global_dof_index>> block_to_dof_map(
1122 for (ITERATOR cell = start; cell != end; ++cell)
1124 if (is_level_operation)
1127 if (!cell->is_locally_owned_on_level())
1134 if (!cell->is_locally_owned())
1138 if (is_level_operation)
1140 cell->level() == start->level(),
1142 "Multigrid renumbering in compute_block_wise() needs to be applied to a single level!"));
1148 const unsigned int dofs_per_cell =
1149 fe_collection[fe_index].n_dofs_per_cell();
1150 local_dof_indices.resize(dofs_per_cell);
1151 cell->get_active_or_mg_dof_indices(local_dof_indices);
1153 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1154 if (locally_owned_dofs.
is_element(local_dof_indices[i]))
1155 block_to_dof_map[block_list[fe_index][i]].
push_back(
1156 local_dof_indices[i]);
1171 for (
unsigned int block = 0; block < fe_collection.
n_blocks(); ++block)
1173 std::sort(block_to_dof_map[block].begin(),
1174 block_to_dof_map[block].end());
1175 block_to_dof_map[block].erase(
1176 std::unique(block_to_dof_map[block].begin(),
1177 block_to_dof_map[block].end()),
1178 block_to_dof_map[block].end());
1183 const unsigned int n_buckets = fe_collection.
n_blocks();
1184 std::vector<types::global_dof_index> shifts(n_buckets);
1188 &start->get_dof_handler().get_triangulation())))
1190#ifdef DEAL_II_WITH_MPI
1191 std::vector<types::global_dof_index> local_dof_count(n_buckets);
1193 for (
unsigned int c = 0; c < n_buckets; ++c)
1194 local_dof_count[c] = block_to_dof_map[c].size();
1196 std::vector<types::global_dof_index> prefix_dof_count(n_buckets);
1197 const int ierr = MPI_Exscan(local_dof_count.data(),
1198 prefix_dof_count.data(),
1205 std::vector<types::global_dof_index> global_dof_count(n_buckets);
1212 for (
unsigned int c = 0; c < n_buckets; ++c)
1214 shifts[c] = prefix_dof_count[c] + cumulated;
1215 cumulated += global_dof_count[c];
1225 for (
unsigned int c = 1; c < fe_collection.
n_blocks(); ++c)
1226 shifts[c] = shifts[c - 1] + block_to_dof_map[c - 1].size();
1235 for (
unsigned int block = 0; block < fe_collection.
n_blocks(); ++block)
1237 const typename std::vector<types::global_dof_index>::const_iterator
1238 begin_of_component = block_to_dof_map[block].begin(),
1239 end_of_component = block_to_dof_map[block].end();
1241 next_free_index = shifts[block];
1243 for (
typename std::vector<types::global_dof_index>::const_iterator
1244 dof_index = begin_of_component;
1245 dof_index != end_of_component;
1256 return next_free_index;
1268 template <
int dim,
class CellIteratorType>
1270 compute_hierarchical_recursive(
1273 const CellIteratorType & cell,
1274 const IndexSet & locally_owned_dof_indices,
1275 std::vector<types::global_dof_index> &new_indices)
1278 next_free_dof_offset;
1280 if (cell->has_children())
1283 for (
unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell;
1285 current_next_free_dof_offset =
1286 compute_hierarchical_recursive<dim>(current_next_free_dof_offset,
1289 locally_owned_dof_indices,
1309 if (cell->is_locally_owned())
1312 const unsigned int dofs_per_cell =
1313 cell->get_fe().n_dofs_per_cell();
1314 std::vector<types::global_dof_index> local_dof_indices(
1316 cell->get_dof_indices(local_dof_indices);
1335 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1336 if (locally_owned_dof_indices.
is_element(local_dof_indices[i]))
1340 const unsigned int idx =
1342 local_dof_indices[i]);
1346 my_starting_index + current_next_free_dof_offset;
1347 ++current_next_free_dof_offset;
1353 return current_next_free_dof_offset;
1359 template <
int dim,
int spacedim>
1363 std::vector<types::global_dof_index> renumbering(
1386#ifdef DEAL_II_WITH_MPI
1389 const int ierr = MPI_Exscan(&locally_owned_size,
1403#ifdef DEAL_II_WITH_P4EST
1408 for (
unsigned int c = 0; c <
tria->
n_cells(0); ++c)
1410 const unsigned int coarse_cell_index =
1411 tria->get_p4est_tree_to_coarse_cell_permutation()[c];
1414 this_cell(
tria, 0, coarse_cell_index, &dof_handler);
1416 next_free_dof_offset =
1417 compute_hierarchical_recursive<dim>(next_free_dof_offset,
1432 dof_handler.
begin(0);
1433 cell != dof_handler.
end(0);
1435 next_free_dof_offset =
1436 compute_hierarchical_recursive<dim>(next_free_dof_offset,
1449 (next_free_dof_offset <= dof_handler.
n_dofs())),
1453 Assert(std::find(renumbering.begin(),
1463 template <
int dim,
int spacedim>
1466 const std::vector<bool> & selected_dofs)
1468 std::vector<types::global_dof_index> renumbering(
1477 template <
int dim,
int spacedim>
1480 const std::vector<bool> & selected_dofs,
1481 const unsigned int level)
1486 std::vector<types::global_dof_index> renumbering(
1498 template <
int dim,
int spacedim>
1501 std::vector<types::global_dof_index> &new_indices,
1503 const std::vector<bool> & selected_dofs)
1506 Assert(selected_dofs.size() == n_dofs,
1511 Assert(new_indices.size() == n_dofs,
1515 std::count(selected_dofs.begin(), selected_dofs.end(),
false);
1520 if (selected_dofs[i] ==
false)
1522 new_indices[i] = next_unselected;
1527 new_indices[i] = next_selected;
1536 template <
int dim,
int spacedim>
1539 std::vector<types::global_dof_index> &new_indices,
1541 const std::vector<bool> & selected_dofs,
1542 const unsigned int level)
1547 const unsigned int n_dofs = dof_handler.
n_dofs(
level);
1548 Assert(selected_dofs.size() == n_dofs,
1553 Assert(new_indices.size() == n_dofs,
1556 const unsigned int n_selected_dofs =
1557 std::count(selected_dofs.begin(), selected_dofs.end(),
false);
1559 unsigned int next_unselected = 0;
1560 unsigned int next_selected = n_selected_dofs;
1561 for (
unsigned int i = 0; i < n_dofs; ++i)
1562 if (selected_dofs[i] ==
false)
1564 new_indices[i] = next_unselected;
1569 new_indices[i] = next_selected;
1578 template <
int dim,
int spacedim>
1585 std::vector<types::global_dof_index> renumbering(
1594 template <
int dim,
int spacedim>
1597 std::vector<types::global_dof_index> &new_indices,
1598 std::vector<types::global_dof_index> &reverse,
1600 const typename std::vector<
1625 std::vector<bool> already_sorted(n_owned_dofs,
false);
1626 std::vector<types::global_dof_index> cell_dofs;
1630 unsigned int index = 0;
1632 for (
const auto &cell : cells)
1636 const unsigned int n_cell_dofs = cell->get_fe().n_dofs_per_cell();
1637 cell_dofs.resize(n_cell_dofs);
1639 cell->get_active_or_mg_dof_indices(cell_dofs);
1643 std::sort(cell_dofs.begin(), cell_dofs.end());
1645 for (
const auto dof : cell_dofs)
1647 const auto local_dof = owned_dofs.index_within_set(dof);
1649 !already_sorted[local_dof])
1651 already_sorted[local_dof] =
true;
1652 reverse[index++] = local_dof;
1656 Assert(index == n_owned_dofs,
1658 "Traversing over the given set of cells did not cover all "
1659 "degrees of freedom in the DoFHandler. Does the set of cells "
1660 "not include all active cells?"));
1663 new_indices[reverse[i]] = owned_dofs.nth_index_in_set(i);
1668 template <
int dim,
int spacedim>
1671 const unsigned int level,
1672 const typename std::vector<
1678 std::vector<types::global_dof_index> renumbering(dof.
n_dofs(
level));
1679 std::vector<types::global_dof_index> reverse(dof.
n_dofs(
level));
1687 template <
int dim,
int spacedim>
1690 std::vector<types::global_dof_index> &new_order,
1691 std::vector<types::global_dof_index> &reverse,
1693 const unsigned int level,
1694 const typename std::vector<
1708 std::vector<bool> already_sorted(n_global_dofs,
false);
1709 std::vector<types::global_dof_index> cell_dofs(n_cell_dofs);
1711 unsigned int global_index = 0;
1713 for (
const auto &cell : cells)
1717 cell->get_active_or_mg_dof_indices(cell_dofs);
1718 std::sort(cell_dofs.begin(), cell_dofs.end());
1720 for (
unsigned int i = 0; i < n_cell_dofs; ++i)
1722 if (!already_sorted[cell_dofs[i]])
1724 already_sorted[cell_dofs[i]] =
true;
1725 reverse[global_index++] = cell_dofs[i];
1729 Assert(global_index == n_global_dofs,
1731 "Traversing over the given set of cells did not cover all "
1732 "degrees of freedom in the DoFHandler. Does the set of cells "
1733 "not include all cells of the specified level?"));
1736 new_order[reverse[i]] = i;
1741 template <
int dim,
int spacedim>
1745 const bool dof_wise_renumbering)
1747 std::vector<types::global_dof_index> renumbering(dof.
n_dofs());
1748 std::vector<types::global_dof_index> reverse(dof.
n_dofs());
1750 renumbering, reverse, dof, direction, dof_wise_renumbering);
1757 template <
int dim,
int spacedim>
1760 std::vector<types::global_dof_index> &reverse,
1763 const bool dof_wise_renumbering)
1769 if (dof_wise_renumbering ==
false)
1771 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
1777 comparator(direction);
1780 ordered_cells.push_back(cell);
1782 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
1794 const unsigned int n_dofs = dof.
n_dofs();
1795 std::vector<std::pair<Point<spacedim>,
unsigned int>>
1796 support_point_list(n_dofs);
1799 Assert(fe_collection[0].has_support_points(),
1802 for (
unsigned int comp = 0; comp < fe_collection.
size(); ++comp)
1804 Assert(fe_collection[comp].has_support_points(),
1810 quadrature_collection,
1813 std::vector<bool> already_touched(n_dofs,
false);
1815 std::vector<types::global_dof_index> local_dof_indices;
1819 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
1820 local_dof_indices.resize(dofs_per_cell);
1821 hp_fe_values.
reinit(cell);
1824 cell->get_active_or_mg_dof_indices(local_dof_indices);
1825 const std::vector<Point<spacedim>> &points =
1827 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1828 if (!already_touched[local_dof_indices[i]])
1830 support_point_list[local_dof_indices[i]].first = points[i];
1831 support_point_list[local_dof_indices[i]].second =
1832 local_dof_indices[i];
1833 already_touched[local_dof_indices[i]] =
true;
1838 std::sort(support_point_list.begin(),
1839 support_point_list.end(),
1842 new_indices[support_point_list[i].
second] = i;
1848 template <
int dim,
int spacedim>
1851 const unsigned int level,
1853 const bool dof_wise_renumbering)
1855 std::vector<types::global_dof_index> renumbering(dof.
n_dofs(
level));
1856 std::vector<types::global_dof_index> reverse(dof.
n_dofs(
level));
1858 renumbering, reverse, dof,
level, direction, dof_wise_renumbering);
1865 template <
int dim,
int spacedim>
1868 std::vector<types::global_dof_index> &reverse,
1870 const unsigned int level,
1872 const bool dof_wise_renumbering)
1874 if (dof_wise_renumbering ==
false)
1876 std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
1882 comparator(direction);
1891 ordered_cells.push_back(p);
1894 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
1903 std::vector<std::pair<Point<spacedim>,
unsigned int>>
1904 support_point_list(n_dofs);
1911 std::vector<bool> already_touched(dof.
n_dofs(),
false);
1914 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
1919 for (; begin != end; ++begin)
1922 &begin_tria = begin;
1923 begin->get_active_or_mg_dof_indices(local_dof_indices);
1924 fe_values.
reinit(begin_tria);
1925 const std::vector<Point<spacedim>> &points =
1927 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1928 if (!already_touched[local_dof_indices[i]])
1930 support_point_list[local_dof_indices[i]].first = points[i];
1931 support_point_list[local_dof_indices[i]].second =
1932 local_dof_indices[i];
1933 already_touched[local_dof_indices[i]] =
true;
1938 std::sort(support_point_list.begin(),
1939 support_point_list.end(),
1942 new_indices[support_point_list[i].
second] = i;
1976 template <
class DHCellIterator>
1978 operator()(
const DHCellIterator &c1,
const DHCellIterator &c2)
const
1982 return compare(c1, c2, std::integral_constant<int, dim>());
1989 template <
class DHCellIterator,
int xdim>
1992 const DHCellIterator &c2,
1993 std::integral_constant<int, xdim>)
const
1997 const double s1 = std::atan2(
v1[0],
v1[1]);
1998 const double s2 = std::atan2(v2[0], v2[1]);
1999 return (
counter ? (s1 > s2) : (s2 > s1));
2007 template <
class DHCellIterator>
2010 const DHCellIterator &,
2011 std::integral_constant<int, 1>)
const
2014 ExcMessage(
"This operation only makes sense for dim>=2."));
2022 template <
int dim,
int spacedim>
2028 std::vector<types::global_dof_index> renumbering(dof.
n_dofs());
2036 template <
int dim,
int spacedim>
2043 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
2049 ordered_cells.push_back(cell);
2051 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
2053 std::vector<types::global_dof_index> reverse(new_indices.size());
2059 template <
int dim,
int spacedim>
2062 const unsigned int level,
2066 std::vector<typename DoFHandler<dim, spacedim>::level_cell_iterator>
2078 ordered_cells.push_back(p);
2081 std::sort(ordered_cells.begin(), ordered_cells.end(), comparator);
2088 template <
int dim,
int spacedim>
2092 std::vector<types::global_dof_index> renumbering(
2101 template <
int dim,
int spacedim>
2108 std::vector<types::global_dof_index> renumbering(
2119 template <
int dim,
int spacedim>
2125 Assert(new_indices.size() == n_dofs,
2128 std::iota(new_indices.begin(),
2136 ::boost::mt19937 random_number_generator;
2137 for (
unsigned int i = 1; i < n_dofs; ++i)
2140 const unsigned int j =
2141 ::boost::random::uniform_int_distribution<>(0, i)(
2142 random_number_generator);
2146 std::swap(new_indices[i], new_indices[j]);
2152 template <
int dim,
int spacedim>
2156 const unsigned int level)
2159 Assert(new_indices.size() == n_dofs,
2162 std::iota(new_indices.begin(),
2170 ::boost::mt19937 random_number_generator;
2171 for (
unsigned int i = 1; i < n_dofs; ++i)
2174 const unsigned int j =
2175 ::boost::random::uniform_int_distribution<>(0, i)(
2176 random_number_generator);
2180 std::swap(new_indices[i], new_indices[j]);
2186 template <
int dim,
int spacedim>
2194 "Parallel triangulations are already enumerated according to their MPI process id."));
2196 std::vector<types::global_dof_index> renumbering(
2205 template <
int dim,
int spacedim>
2211 Assert(new_dof_indices.size() == n_dofs,
2217 std::vector<types::subdomain_id> subdomain_association(n_dofs);
2219 const unsigned int n_subdomains =
2220 *std::max_element(subdomain_association.begin(),
2221 subdomain_association.end()) +
2231 std::fill(new_dof_indices.begin(),
2232 new_dof_indices.end(),
2238 if (subdomain_association[i] == subdomain)
2242 new_dof_indices[i] = next_free_index;
2248 Assert(std::find(new_dof_indices.begin(),
2249 new_dof_indices.end(),
2256 template <
int dim,
int spacedim>
2260 std::vector<types::global_dof_index> renumbering(
2273 template <
int dim,
int spacedim>
2276 std::vector<types::global_dof_index> &new_dof_indices,
2280 Assert(new_dof_indices.size() == n_dofs,
2292 std::vector<types::global_dof_index> component_renumbering(
2294 compute_component_wise<dim, spacedim>(component_renumbering,
2297 std::vector<unsigned int>(),
2302 const std::vector<types::global_dof_index> dofs_per_component =
2304 for (
const auto &dpc : dofs_per_component)
2308 const unsigned int n_components =
2312 dof_handler.
n_dofs() / n_components;
2318 if (component_renumbering.size() == 0)
2320 new_dof_indices.resize(0);
2323 std::fill(new_dof_indices.begin(),
2324 new_dof_indices.end(),
2332 std::vector<types::global_dof_index> component_dofs(
2333 local_dofs_per_component);
2334 for (
unsigned int component = 0; component < n_components; ++component)
2336 for (std::size_t i = 0; i < local_dofs_per_component; ++i)
2338 component_renumbering[n_components * i + component];
2339 component_renumbered_dofs.
add_indices(component_dofs.begin(),
2340 component_dofs.end());
2342 component_renumbered_dofs.
compress();
2346 component_renumbered_dofs2.
add_indices(component_renumbering.begin(),
2347 component_renumbering.end());
2348 Assert(component_renumbered_dofs2 == component_renumbered_dofs,
2355 AssertThrow(fe.dofs_per_cell == 0 || fe.has_support_points(),
2357 for (
unsigned int i = 0; i < fe.n_base_elements(); ++i)
2359 fe.base_element(0).get_unit_support_points() ==
2360 fe.base_element(i).get_unit_support_points(),
2362 "All base elements should have the same support points."));
2365 std::vector<types::global_dof_index> component_to_nodal(
2369 std::vector<types::global_dof_index> cell_dofs;
2370 std::vector<types::global_dof_index> component_renumbered_cell_dofs;
2374 auto next_dof_it = locally_owned_dofs.
begin();
2376 if (cell->is_locally_owned())
2381 cell->get_dof_indices(cell_dofs);
2388 if (locally_owned_dofs.
is_element(cell_dofs[i]))
2390 const auto local_index =
2392 component_renumbered_cell_dofs[i] =
2393 component_renumbering[local_index];
2397 component_renumbered_cell_dofs[i] =
2406 component_renumbered_cell_dofs[i]))
2408 for (
unsigned int component = 0;
2415 const auto local_index =
2417 component_renumbered_cell_dofs[i] +
2418 dofs_per_component * component);
2420 if (component_to_nodal[local_index] ==
2423 component_to_nodal[local_index] = *next_dof_it;
2434 const auto local_index =
2436 new_dof_indices[i] = component_to_nodal[local_index];
2445 typename VectorizedArrayType>
2451 const std::vector<types::global_dof_index> new_global_numbers =
2461 template <
int dim,
int spacedim,
typename Number,
typename AdditionalDataType>
2465 const AdditionalDataType & matrix_free_data)
2467 const std::vector<types::global_dof_index> new_global_numbers =
2474 dof_handler.
renumber_dofs(matrix_free_data.mg_level, new_global_numbers);
2479 template <
int dim,
int spacedim,
typename Number,
typename AdditionalDataType>
2480 std::vector<types::global_dof_index>
2484 const AdditionalDataType & matrix_free_data)
2486 AdditionalDataType my_mf_data = matrix_free_data;
2487 my_mf_data.initialize_mapping =
false;
2488 my_mf_data.tasks_parallel_scheme = AdditionalDataType::none;
2490 typename AdditionalDataType::MatrixFreeType separate_matrix_free;
2509 std::vector<std::vector<unsigned int>>
2510 group_dofs_by_rank_access(
2511 const ::Utilities::MPI::Partitioner &partitioner)
2515 std::vector<unsigned int> touch_count(partitioner.locally_owned_size());
2516 for (
const auto &p : partitioner.import_indices())
2517 for (unsigned
int i = p.
first; i < p.second; ++i)
2521 std::vector<std::vector<unsigned int>> result(1);
2522 for (
unsigned int i = 0; i < touch_count.size(); ++i)
2523 if (touch_count[i] == 0)
2524 result.back().push_back(i);
2529 std::map<unsigned int, std::vector<unsigned int>>
2530 multiple_ranks_access_dof;
2531 const std::vector<std::pair<unsigned int, unsigned int>> &import_targets =
2532 partitioner.import_targets();
2533 auto it = partitioner.import_indices().begin();
2534 for (
const std::pair<unsigned int, unsigned int> &proc : import_targets)
2536 result.emplace_back();
2537 unsigned int count_dofs = 0;
2538 while (count_dofs < proc.second)
2540 for (
unsigned int i = it->first; i < it->second;
2543 if (touch_count[i] == 1)
2544 result.back().push_back(i);
2546 multiple_ranks_access_dof[i].push_back(proc.first);
2556 std::map<std::vector<unsigned int>,
2557 std::vector<unsigned int>,
2558 std::function<
bool(
const std::vector<unsigned int> &,
2559 const std::vector<unsigned int> &)>>
2560 dofs_by_rank{[](
const std::vector<unsigned int> &a,
2561 const std::vector<unsigned int> &
b) {
2562 if (a.size() <
b.size())
2564 if (a.size() ==
b.size())
2566 for (
unsigned int i = 0; i < a.size(); ++i)
2569 else if (a[i] > b[i])
2574 for (
const auto &entry : multiple_ranks_access_dof)
2575 dofs_by_rank[entry.
second].push_back(entry.
first);
2577 for (
const auto &procs : dofs_by_rank)
2578 result.push_back(procs.
second);
2589 template <
int dim,
typename Number,
typename VectorizedArrayType>
2590 std::pair<std::vector<unsigned int>, std::vector<unsigned char>>
2591 compute_mf_numbering(
2593 const unsigned int component)
2597 const unsigned int n_comp =
2600 matrix_free.
get_dof_handler(component).get_fe().n_base_elements() == 1,
2608 const unsigned int fe_degree =
2610 const unsigned int nn = fe_degree - 1;
2619 std::array<std::pair<unsigned int, unsigned int>,
2624 dofs_on_objects[0] = std::make_pair(0U, 1U);
2625 dofs_on_objects[1] = std::make_pair(2 * n_comp, nn);
2626 dofs_on_objects[2] = std::make_pair(n_comp, 1U);
2630 dofs_on_objects[0] = std::make_pair(0U, 1U);
2631 dofs_on_objects[1] = std::make_pair(n_comp * (4 + 2 * nn), nn);
2632 dofs_on_objects[2] = std::make_pair(n_comp, 1U);
2633 dofs_on_objects[3] = std::make_pair(n_comp * 4, nn);
2634 dofs_on_objects[4] = std::make_pair(n_comp * (4 + 4 * nn), nn * nn);
2635 dofs_on_objects[5] = std::make_pair(n_comp * (4 + 1 * nn), nn);
2636 dofs_on_objects[6] = std::make_pair(2 * n_comp, 1U);
2637 dofs_on_objects[7] = std::make_pair(n_comp * (4 + 3 * nn), nn);
2638 dofs_on_objects[8] = std::make_pair(3 * n_comp, 1U);
2642 dofs_on_objects[0] = std::make_pair(0U, 1U);
2643 dofs_on_objects[1] = std::make_pair(n_comp * (8 + 2 * nn), nn);
2644 dofs_on_objects[2] = std::make_pair(n_comp, 1U);
2645 dofs_on_objects[3] = std::make_pair(n_comp * 8, nn);
2646 dofs_on_objects[4] =
2647 std::make_pair(n_comp * (8 + 12 * nn + 4 * nn * nn), nn * nn);
2648 dofs_on_objects[5] = std::make_pair(n_comp * (8 + 1 * nn), nn);
2649 dofs_on_objects[6] = std::make_pair(n_comp * 2, 1U);
2650 dofs_on_objects[7] = std::make_pair(n_comp * (8 + 3 * nn), nn);
2651 dofs_on_objects[8] = std::make_pair(n_comp * 3, 1U);
2652 dofs_on_objects[9] = std::make_pair(n_comp * (8 + 8 * nn), nn);
2653 dofs_on_objects[10] =
2654 std::make_pair(n_comp * (8 + 12 * nn + 2 * nn * nn), nn * nn);
2655 dofs_on_objects[11] = std::make_pair(n_comp * (8 + 9 * nn), nn);
2656 dofs_on_objects[12] = std::make_pair(n_comp * (8 + 12 * nn), nn * nn);
2657 dofs_on_objects[13] =
2658 std::make_pair(n_comp * (8 + 12 * nn + 6 * nn * nn), nn * nn * nn);
2659 dofs_on_objects[14] =
2660 std::make_pair(n_comp * (8 + 12 * nn + 1 * nn * nn), nn * nn);
2661 dofs_on_objects[15] = std::make_pair(n_comp * (8 + 10 * nn), nn);
2662 dofs_on_objects[16] =
2663 std::make_pair(n_comp * (8 + 12 * nn + 3 * nn * nn), nn * nn);
2664 dofs_on_objects[17] = std::make_pair(n_comp * (8 + 11 * nn), nn);
2665 dofs_on_objects[18] = std::make_pair(n_comp * 4, 1U);
2666 dofs_on_objects[19] = std::make_pair(n_comp * (8 + 6 * nn), nn);
2667 dofs_on_objects[20] = std::make_pair(n_comp * 5, 1U);
2668 dofs_on_objects[21] = std::make_pair(n_comp * (8 + 4 * nn), nn);
2669 dofs_on_objects[22] =
2670 std::make_pair(n_comp * (8 + 12 * nn + 5 * nn * nn), nn * nn);
2671 dofs_on_objects[23] = std::make_pair(n_comp * (8 + 5 * nn), nn);
2672 dofs_on_objects[24] = std::make_pair(n_comp * 6, 1U);
2673 dofs_on_objects[25] = std::make_pair(n_comp * (8 + 7 * nn), nn);
2674 dofs_on_objects[26] = std::make_pair(n_comp * 7, 1U);
2679 std::vector<unsigned int> & result,
2680 unsigned int &counter_dof_numbers) {
2682 owned_dofs.index_within_set(dof_index);
2687 result[local_dof_index] = counter_dof_numbers++;
2691 unsigned int counter_dof_numbers = 0;
2692 std::vector<unsigned int> dofs_extracted;
2693 std::vector<types::global_dof_index> dof_indices(
2710 const unsigned int n_owned_dofs = owned_dofs.n_elements();
2711 std::vector<unsigned int> dof_numbers_mf_order(
2713 std::vector<unsigned int> last_touch_by_cell_batch_range(
2715 std::vector<unsigned char> touch_count(n_owned_dofs);
2717 const auto operation_on_cell_range =
2720 const unsigned int &,
2721 const std::pair<unsigned int, unsigned int> &cell_range) {
2722 for (
unsigned int cell = cell_range.first; cell < cell_range.second;
2726 for (
unsigned int v = 0;
2733 ->get_dof_indices(dof_indices);
2736 ->get_mg_dof_indices(dof_indices);
2738 for (
unsigned int a = 0; a < dofs_on_objects.size(); ++a)
2740 const auto &r = dofs_on_objects[a];
2741 if (a == 10 || a == 16)
2744 for (
unsigned int i1 = 0; i1 < nn; ++i1)
2745 for (
unsigned int i0 = 0; i0 < nn; ++i0)
2746 for (
unsigned int c = 0; c < n_comp; ++c)
2747 renumber_func(dof_indices[r.first + r.second * c +
2750 dof_numbers_mf_order,
2751 counter_dof_numbers);
2753 for (
unsigned int i = 0; i < r.second; ++i)
2754 for (
unsigned int c = 0; c < n_comp; ++c)
2756 dof_indices[r.first + r.second * c + i],
2758 dof_numbers_mf_order,
2759 counter_dof_numbers);
2768 dofs_extracted, cell);
2769 for (
const unsigned int dof_index : dofs_extracted)
2770 if (dof_index < n_owned_dofs &&
2771 last_touch_by_cell_batch_range[dof_index] !=
2774 ++touch_count[dof_index];
2775 last_touch_by_cell_batch_range[dof_index] =
2785 "version of MatrixFree::cell_loop"));
2787 matrix_free.template cell_loop<unsigned int, unsigned int>(
2788 operation_on_cell_range, counter_dof_numbers, counter_dof_numbers);
2792 return std::make_pair(dof_numbers_mf_order, touch_count);
2802 typename VectorizedArrayType>
2803 std::vector<types::global_dof_index>
2809 ExcMessage(
"You need to set up indices in MatrixFree "
2810 "to be able to compute a renumbering!"));
2813 unsigned int component = 0;
2814 for (; component < matrix_free.
n_components(); ++component)
2819 ExcMessage(
"Could not locate the given DoFHandler in MatrixFree"));
2832 const std::vector<std::vector<unsigned int>> dofs_by_rank_access =
2833 group_dofs_by_rank_access(
2836 const std::pair<std::vector<unsigned int>, std::vector<unsigned char>>
2837 local_numbering = compute_mf_numbering(matrix_free, component);
2842 std::vector<unsigned int> new_numbers;
2843 new_numbers.reserve(owned_dofs.
n_elements());
2849 const std::vector<unsigned int> &purely_local_dofs = dofs_by_rank_access[0];
2850 for (
const unsigned int i : purely_local_dofs)
2851 if (local_numbering.second[i] == 1)
2852 new_numbers.push_back(i);
2854 const auto comparator = [&](
const unsigned int a,
const unsigned int b) {
2855 return (local_numbering.first[a] < local_numbering.first[b]);
2858 std::sort(new_numbers.begin(), new_numbers.end(), comparator);
2859 unsigned int sorted_size = new_numbers.size();
2863 for (
auto i : purely_local_dofs)
2864 if (local_numbering.second[i] > 1)
2865 new_numbers.push_back(i);
2866 std::sort(new_numbers.begin() + sorted_size, new_numbers.end(), comparator);
2867 sorted_size = new_numbers.size();
2870 for (
unsigned int chunk = 1; chunk < dofs_by_rank_access.size(); ++chunk)
2871 for (
auto i : dofs_by_rank_access[chunk])
2872 new_numbers.push_back(i);
2873 std::sort(new_numbers.begin() + sorted_size, new_numbers.end(), comparator);
2874 sorted_size = new_numbers.size();
2877 for (
auto i : purely_local_dofs)
2878 if (local_numbering.second[i] == 0)
2879 new_numbers.push_back(i);
2880 std::sort(new_numbers.begin() + sorted_size, new_numbers.end(), comparator);
2884 std::vector<::types::global_dof_index> new_global_numbers(
2886 for (
unsigned int i = 0; i < new_numbers.size(); ++i)
2889 return new_global_numbers;
2897#include "dof_renumbering.inst"
void reinit(const IndexSet &local_constraints=IndexSet())
unsigned int first_selected_component(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
cell_iterator end() const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
void renumber_dofs(const std::vector< types::global_dof_index > &new_numbers)
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
const Triangulation< dim, spacedim > & get_triangulation() const
const IndexSet & locally_owned_dofs() const
active_cell_iterator begin_active(const unsigned int level=0) const
types::global_dof_index n_dofs() const
typename LevelSelector::cell_iterator level_cell_iterator
cell_iterator begin(const unsigned int level=0) const
MPI_Comm get_communicator() 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, types::global_dof_index > system_to_block_index(const unsigned int component) const
const ComponentMask & get_nonzero_components(const unsigned int i) const
bool has_support_points() const
const std::vector< Point< dim > > & get_unit_support_points() const
bool is_primitive() const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) 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)
const internal::MatrixFreeFunctions::TaskInfo & get_task_info() const
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
const DoFHandler< dim > & get_dof_handler(const unsigned int dof_handler_index=0) 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
bool indices_initialized() const
unsigned int n_components() 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 & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDoFHandlerNotInitialized()
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::active_cell_iterator active_cell_iterator
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=AffineConstraints< number >(), const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
@ update_quadrature_points
Transformed quadrature points.
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)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
T sum(const T &t, const MPI_Comm mpi_communicator)
T max(const T &t, const MPI_Comm mpi_communicator)
constexpr T pow(const T base, const int iexp)
std::vector< Integer > reverse_permutation(const std::vector< Integer > &permutation)
static const unsigned int invalid_unsigned_int
const types::global_dof_index invalid_dof_index
typename type_identity< T >::type type_identity_t
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