59 typename SparsityPatternType,
63 SparsityPatternType & sparsity,
65 const bool keep_constrained_dofs,
71 Assert(sparsity.n_rows() == n_dofs,
73 Assert(sparsity.n_cols() == n_dofs,
86 "For distributed Triangulation objects and associated "
87 "DoFHandler objects, asking for any subdomain other than the "
88 "locally owned one does not make sense."));
91 std::vector<types::global_dof_index> dofs_on_this_cell;
99 (subdomain_id == cell->subdomain_id())) &&
100 cell->is_locally_owned())
102 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
103 dofs_on_this_cell.resize(dofs_per_cell);
104 cell->get_dof_indices(dofs_on_this_cell);
111 keep_constrained_dofs);
119 typename SparsityPatternType,
124 SparsityPatternType & sparsity,
126 const bool keep_constrained_dofs,
132 Assert(sparsity.n_rows() == n_dofs,
134 Assert(sparsity.n_cols() == n_dofs,
153 "For distributed Triangulation objects and associated "
154 "DoFHandler objects, asking for any subdomain other than the "
155 "locally owned one does not make sense."));
161 const std::vector<Table<2, Coupling>> dof_mask
166 std::vector<Table<2, bool>> bool_dof_mask(fe_collection.
size());
167 for (
unsigned int f = 0; f < fe_collection.
size(); ++f)
169 bool_dof_mask[f].reinit(
171 fe_collection[f].n_dofs_per_cell()));
172 bool_dof_mask[f].fill(
false);
173 for (
unsigned int i = 0; i < fe_collection[f].n_dofs_per_cell(); ++i)
174 for (
unsigned int j = 0; j < fe_collection[f].n_dofs_per_cell(); ++j)
175 if (dof_mask[f](i, j) !=
none)
176 bool_dof_mask[f](i, j) =
true;
179 std::vector<types::global_dof_index> dofs_on_this_cell(
187 (subdomain_id == cell->subdomain_id())) &&
188 cell->is_locally_owned())
190 const unsigned int fe_index = cell->active_fe_index();
191 const unsigned int dofs_per_cell =
192 fe_collection[fe_index].n_dofs_per_cell();
194 dofs_on_this_cell.resize(dofs_per_cell);
195 cell->get_dof_indices(dofs_on_this_cell);
203 keep_constrained_dofs,
204 bool_dof_mask[fe_index]);
210 template <
int dim,
int spacedim,
typename SparsityPatternType>
214 SparsityPatternType & sparsity)
221 Assert(sparsity.n_rows() == n_dofs_row,
223 Assert(sparsity.n_cols() == n_dofs_col,
237 ExcMessage(
"This function can only be used with with parallel "
238 "Triangulations when the Triangulations are equal."));
244 std::list<std::pair<cell_iterator, cell_iterator>> cell_list =
247#ifdef DEAL_II_WITH_MPI
258 Assert(this_subdomain_id ==
265 [=](
const std::pair<cell_iterator, cell_iterator> &pair) {
266 return pair.first->subdomain_id() != this_subdomain_id ||
267 pair.second->subdomain_id() != this_subdomain_id;
273 for (
const auto &cell_pair : cell_list)
275 const cell_iterator cell_row = cell_pair.first;
276 const cell_iterator cell_col = cell_pair.second;
278 if (cell_row->is_active() && cell_col->is_active())
280 const unsigned int dofs_per_cell_row =
281 cell_row->get_fe().n_dofs_per_cell();
282 const unsigned int dofs_per_cell_col =
283 cell_col->get_fe().n_dofs_per_cell();
284 std::vector<types::global_dof_index> local_dof_indices_row(
286 std::vector<types::global_dof_index> local_dof_indices_col(
288 cell_row->get_dof_indices(local_dof_indices_row);
289 cell_col->get_dof_indices(local_dof_indices_col);
290 for (
unsigned int i = 0; i < dofs_per_cell_row; ++i)
291 sparsity.add_entries(local_dof_indices_row[i],
292 local_dof_indices_col.begin(),
293 local_dof_indices_col.end());
295 else if (cell_row->has_children())
300 GridTools::get_active_child_cells<DoFHandler<dim, spacedim>>(
302 for (
unsigned int i = 0; i < child_cells.size(); ++i)
305 cell_row_child = child_cells[i];
306 const unsigned int dofs_per_cell_row =
308 const unsigned int dofs_per_cell_col =
309 cell_col->get_fe().n_dofs_per_cell();
310 std::vector<types::global_dof_index> local_dof_indices_row(
312 std::vector<types::global_dof_index> local_dof_indices_col(
314 cell_row_child->get_dof_indices(local_dof_indices_row);
315 cell_col->get_dof_indices(local_dof_indices_col);
316 for (
unsigned int r = 0; r < dofs_per_cell_row; ++r)
317 sparsity.add_entries(local_dof_indices_row[r],
318 local_dof_indices_col.begin(),
319 local_dof_indices_col.end());
327 GridTools::get_active_child_cells<DoFHandler<dim, spacedim>>(
329 for (
unsigned int i = 0; i < child_cells.size(); ++i)
332 cell_col_child = child_cells[i];
333 const unsigned int dofs_per_cell_row =
335 const unsigned int dofs_per_cell_col =
337 std::vector<types::global_dof_index> local_dof_indices_row(
339 std::vector<types::global_dof_index> local_dof_indices_col(
341 cell_row->get_dof_indices(local_dof_indices_row);
342 cell_col_child->get_dof_indices(local_dof_indices_col);
343 for (
unsigned int r = 0; r < dofs_per_cell_row; ++r)
344 sparsity.add_entries(local_dof_indices_row[r],
345 local_dof_indices_col.begin(),
346 local_dof_indices_col.end());
354 template <
int dim,
int spacedim,
typename SparsityPatternType>
358 const std::vector<types::global_dof_index> &dof_to_boundary_mapping,
359 SparsityPatternType & sparsity)
365 std::map<types::boundary_id, const Function<spacedim, double> *>
367 boundary_ids[0] =
nullptr;
368 boundary_ids[1] =
nullptr;
369 make_boundary_sparsity_pattern<dim, spacedim, SparsityPatternType>(
370 dof, boundary_ids, dof_to_boundary_mapping, sparsity);
381 if (sparsity.n_rows() != 0)
391 std::vector<types::global_dof_index> dofs_on_this_face;
400 for (
const unsigned int f : cell->face_indices())
401 if (cell->at_boundary(f))
403 const unsigned int dofs_per_face =
404 cell->get_fe().n_dofs_per_face(f);
405 dofs_on_this_face.resize(dofs_per_face);
406 cell->face(f)->get_dof_indices(dofs_on_this_face,
407 cell->active_fe_index());
410 for (
unsigned int i = 0; i < dofs_per_face; ++i)
411 for (
unsigned int j = 0; j < dofs_per_face; ++j)
412 sparsity.add(dof_to_boundary_mapping[dofs_on_this_face[i]],
413 dof_to_boundary_mapping[dofs_on_this_face[j]]);
421 typename SparsityPatternType,
428 const std::vector<types::global_dof_index> &dof_to_boundary_mapping,
429 SparsityPatternType & sparsity)
434 for (
unsigned int direction = 0; direction < 2; ++direction)
437 if (boundary_ids.find(direction) == boundary_ids.end())
444 while (!cell->at_boundary(direction))
445 cell = cell->neighbor(direction);
446 while (!cell->is_active())
447 cell = cell->child(direction);
449 const unsigned int dofs_per_vertex =
451 std::vector<types::global_dof_index> boundary_dof_boundary_indices(
455 for (
unsigned int i = 0; i < dofs_per_vertex; ++i)
456 boundary_dof_boundary_indices[i] =
457 dof_to_boundary_mapping[cell->vertex_dof_index(direction, i)];
459 for (
unsigned int i = 0; i < dofs_per_vertex; ++i)
460 sparsity.add_entries(boundary_dof_boundary_indices[i],
461 boundary_dof_boundary_indices.begin(),
462 boundary_dof_boundary_indices.end());
481 if (sparsity.n_rows() != 0)
491 std::vector<types::global_dof_index> dofs_on_this_face;
494 for (
const unsigned int f : cell->face_indices())
495 if (boundary_ids.find(cell->face(f)->boundary_id()) !=
498 const unsigned int dofs_per_face =
499 cell->get_fe().n_dofs_per_face(f);
500 dofs_on_this_face.resize(dofs_per_face);
501 cell->face(f)->get_dof_indices(dofs_on_this_face,
502 cell->active_fe_index());
505 for (
unsigned int i = 0; i < dofs_per_face; ++i)
506 for (
unsigned int j = 0; j < dofs_per_face; ++j)
507 sparsity.add(dof_to_boundary_mapping[dofs_on_this_face[i]],
508 dof_to_boundary_mapping[dofs_on_this_face[j]]);
516 typename SparsityPatternType,
520 SparsityPatternType & sparsity,
522 const bool keep_constrained_dofs,
544 "For distributed Triangulation objects and associated "
545 "DoFHandler objects, asking for any subdomain other than the "
546 "locally owned one does not make sense."));
549 std::vector<types::global_dof_index> dofs_on_this_cell;
550 std::vector<types::global_dof_index> dofs_on_other_cell;
564 (subdomain_id == cell->subdomain_id())) &&
565 cell->is_locally_owned())
567 const unsigned int n_dofs_on_this_cell =
568 cell->get_fe().n_dofs_per_cell();
569 dofs_on_this_cell.resize(n_dofs_on_this_cell);
570 cell->get_dof_indices(dofs_on_this_cell);
577 keep_constrained_dofs);
579 for (
const unsigned int face : cell->face_indices())
583 const bool periodic_neighbor = cell->has_periodic_neighbor(face);
584 if (!cell->at_boundary(face) || periodic_neighbor)
587 neighbor = cell->neighbor_or_periodic_neighbor(face);
594 while (neighbor->has_children())
595 neighbor = neighbor->child(face == 0 ? 1 : 0);
597 if (neighbor->has_children())
599 for (
unsigned int sub_nr = 0;
600 sub_nr != cell_face->n_active_descendants();
604 level_cell_iterator sub_neighbor =
606 cell->periodic_neighbor_child_on_subface(
608 cell->neighbor_child_on_subface(face, sub_nr);
610 const unsigned int n_dofs_on_neighbor =
612 dofs_on_other_cell.resize(n_dofs_on_neighbor);
613 sub_neighbor->get_dof_indices(dofs_on_other_cell);
619 keep_constrained_dofs);
624 keep_constrained_dofs);
628 if (sub_neighbor->subdomain_id() !=
629 cell->subdomain_id())
633 keep_constrained_dofs);
640 if ((!periodic_neighbor &&
641 cell->neighbor_is_coarser(face)) ||
642 (periodic_neighbor &&
643 cell->periodic_neighbor_is_coarser(face)))
644 if (neighbor->subdomain_id() == cell->subdomain_id())
647 const unsigned int n_dofs_on_neighbor =
649 dofs_on_other_cell.resize(n_dofs_on_neighbor);
651 neighbor->get_dof_indices(dofs_on_other_cell);
657 keep_constrained_dofs);
663 if (!cell->neighbor_or_periodic_neighbor(face)
665 (neighbor->subdomain_id() != cell->subdomain_id()))
671 keep_constrained_dofs);
672 if (neighbor->subdomain_id() != cell->subdomain_id())
676 keep_constrained_dofs);
686 template <
int dim,
int spacedim,
typename SparsityPatternType>
689 SparsityPatternType & sparsity)
695 template <
int dim,
int spacedim>
712 for (
unsigned int i = 0; i < n_dofs; ++i)
714 const unsigned int ii =
720 for (
unsigned int j = 0; j < n_dofs; ++j)
722 const unsigned int jj =
728 dof_couplings(i, j) = component_couplings(ii, jj);
731 return dof_couplings;
736 template <
int dim,
int spacedim>
737 std::vector<Table<2, Coupling>>
742 std::vector<Table<2, Coupling>> return_value(fe.
size());
743 for (
unsigned int i = 0; i < fe.
size(); ++i)
760 typename SparsityPatternType,
765 SparsityPatternType & sparsity,
767 const bool keep_constrained_dofs,
773 const unsigned int)> &face_has_flux_coupling)
779 std::vector<types::global_dof_index> dofs_on_this_cell(
781 std::vector<types::global_dof_index> dofs_on_other_cell(
800 bool_int_dof_mask.fill(
false);
803 if (int_dof_mask(i, j) !=
none)
804 bool_int_dof_mask(i, j) =
true;
808 (subdomain_id == cell->subdomain_id())) &&
809 cell->is_locally_owned())
811 cell->get_dof_indices(dofs_on_this_cell);
815 keep_constrained_dofs,
818 for (
const unsigned int face_n : cell->face_indices())
821 cell_face = cell->face(face_n);
823 const bool periodic_neighbor =
824 cell->has_periodic_neighbor(face_n);
826 if (cell->at_boundary(face_n) && (!periodic_neighbor))
831 const bool i_non_zero_i =
832 support_on_face(i, face_n);
836 const bool j_non_zero_i =
837 support_on_face(j, face_n);
839 if (flux_dof_mask(i, j) ==
always ||
840 (flux_dof_mask(i, j) ==
nonzero &&
841 i_non_zero_i && j_non_zero_i))
842 sparsity.add(dofs_on_this_cell[i],
843 dofs_on_this_cell[j]);
849 if (!face_has_flux_coupling(cell, face_n))
853 spacedim>::level_cell_iterator
855 cell->neighbor_or_periodic_neighbor(face_n);
860 if (neighbor->level() == cell->level() &&
861 neighbor->index() > cell->index() &&
862 neighbor->is_active() &&
863 neighbor->is_locally_owned())
877 if (neighbor->level() != cell->level() &&
878 ((!periodic_neighbor &&
879 !cell->neighbor_is_coarser(face_n)) ||
880 (periodic_neighbor &&
881 !cell->periodic_neighbor_is_coarser(face_n))) &&
882 neighbor->is_locally_owned())
885 const unsigned int neighbor_face_n =
887 cell->periodic_neighbor_face_no(face_n) :
888 cell->neighbor_face_no(face_n);
898 while (neighbor->has_children())
899 neighbor = neighbor->child(face_n == 0 ? 1 : 0);
901 if (neighbor->has_children())
903 for (
unsigned int sub_nr = 0;
904 sub_nr != cell_face->n_children();
908 level_cell_iterator sub_neighbor =
911 ->periodic_neighbor_child_on_subface(
913 cell->neighbor_child_on_subface(face_n,
916 sub_neighbor->get_dof_indices(
918 for (
unsigned int i = 0;
922 const bool i_non_zero_i =
923 support_on_face(i, face_n);
924 const bool i_non_zero_e =
925 support_on_face(i, neighbor_face_n);
926 for (
unsigned int j = 0;
930 const bool j_non_zero_i =
931 support_on_face(j, face_n);
932 const bool j_non_zero_e =
933 support_on_face(j, neighbor_face_n);
935 if (flux_dof_mask(i, j) ==
always)
938 dofs_on_this_cell[i],
939 dofs_on_other_cell[j]);
941 dofs_on_other_cell[i],
942 dofs_on_this_cell[j]);
944 dofs_on_this_cell[i],
945 dofs_on_this_cell[j]);
947 dofs_on_other_cell[i],
948 dofs_on_other_cell[j]);
950 else if (flux_dof_mask(i, j) ==
953 if (i_non_zero_i && j_non_zero_e)
955 dofs_on_this_cell[i],
956 dofs_on_other_cell[j]);
957 if (i_non_zero_e && j_non_zero_i)
959 dofs_on_other_cell[i],
960 dofs_on_this_cell[j]);
961 if (i_non_zero_i && j_non_zero_i)
963 dofs_on_this_cell[i],
964 dofs_on_this_cell[j]);
965 if (i_non_zero_e && j_non_zero_e)
967 dofs_on_other_cell[i],
968 dofs_on_other_cell[j]);
971 if (flux_dof_mask(j, i) ==
always)
974 dofs_on_this_cell[j],
975 dofs_on_other_cell[i]);
977 dofs_on_other_cell[j],
978 dofs_on_this_cell[i]);
980 dofs_on_this_cell[j],
981 dofs_on_this_cell[i]);
983 dofs_on_other_cell[j],
984 dofs_on_other_cell[i]);
986 else if (flux_dof_mask(j, i) ==
989 if (j_non_zero_i && i_non_zero_e)
991 dofs_on_this_cell[j],
992 dofs_on_other_cell[i]);
993 if (j_non_zero_e && i_non_zero_i)
995 dofs_on_other_cell[j],
996 dofs_on_this_cell[i]);
997 if (j_non_zero_i && i_non_zero_i)
999 dofs_on_this_cell[j],
1000 dofs_on_this_cell[i]);
1001 if (j_non_zero_e && i_non_zero_e)
1003 dofs_on_other_cell[j],
1004 dofs_on_other_cell[i]);
1012 neighbor->get_dof_indices(dofs_on_other_cell);
1016 const bool i_non_zero_i =
1017 support_on_face(i, face_n);
1018 const bool i_non_zero_e =
1019 support_on_face(i, neighbor_face_n);
1020 for (
unsigned int j = 0;
1024 const bool j_non_zero_i =
1025 support_on_face(j, face_n);
1026 const bool j_non_zero_e =
1027 support_on_face(j, neighbor_face_n);
1028 if (flux_dof_mask(i, j) ==
always)
1030 sparsity.add(dofs_on_this_cell[i],
1031 dofs_on_other_cell[j]);
1032 sparsity.add(dofs_on_other_cell[i],
1033 dofs_on_this_cell[j]);
1034 sparsity.add(dofs_on_this_cell[i],
1035 dofs_on_this_cell[j]);
1036 sparsity.add(dofs_on_other_cell[i],
1037 dofs_on_other_cell[j]);
1039 if (flux_dof_mask(i, j) ==
nonzero)
1041 if (i_non_zero_i && j_non_zero_e)
1042 sparsity.add(dofs_on_this_cell[i],
1043 dofs_on_other_cell[j]);
1044 if (i_non_zero_e && j_non_zero_i)
1045 sparsity.add(dofs_on_other_cell[i],
1046 dofs_on_this_cell[j]);
1047 if (i_non_zero_i && j_non_zero_i)
1048 sparsity.add(dofs_on_this_cell[i],
1049 dofs_on_this_cell[j]);
1050 if (i_non_zero_e && j_non_zero_e)
1051 sparsity.add(dofs_on_other_cell[i],
1052 dofs_on_other_cell[j]);
1055 if (flux_dof_mask(j, i) ==
always)
1057 sparsity.add(dofs_on_this_cell[j],
1058 dofs_on_other_cell[i]);
1059 sparsity.add(dofs_on_other_cell[j],
1060 dofs_on_this_cell[i]);
1061 sparsity.add(dofs_on_this_cell[j],
1062 dofs_on_this_cell[i]);
1063 sparsity.add(dofs_on_other_cell[j],
1064 dofs_on_other_cell[i]);
1066 if (flux_dof_mask(j, i) ==
nonzero)
1068 if (j_non_zero_i && i_non_zero_e)
1069 sparsity.add(dofs_on_this_cell[j],
1070 dofs_on_other_cell[i]);
1071 if (j_non_zero_e && i_non_zero_i)
1072 sparsity.add(dofs_on_other_cell[j],
1073 dofs_on_this_cell[i]);
1074 if (j_non_zero_i && i_non_zero_i)
1075 sparsity.add(dofs_on_this_cell[j],
1076 dofs_on_this_cell[i]);
1077 if (j_non_zero_e && i_non_zero_e)
1078 sparsity.add(dofs_on_other_cell[j],
1079 dofs_on_other_cell[i]);
1097 const ::hp::FECollection<dim, spacedim> &fe =
1100 std::vector<types::global_dof_index> dofs_on_this_cell(
1102 std::vector<types::global_dof_index> dofs_on_other_cell(
1105 const unsigned int n_components = fe.n_components();
1115 for (
unsigned int c1 = 0; c1 < n_components; ++c1)
1116 for (
unsigned int c2 = 0; c2 < n_components; ++c2)
1117 if (int_mask(c1, c2) !=
none || flux_mask(c1, c2) !=
none)
1118 int_and_flux_mask(c1, c2) =
always;
1120 std::vector<Table<2, Coupling>> int_and_flux_dof_mask =
1125 std::vector<Table<2, bool>> bool_int_and_flux_dof_mask(fe.size());
1126 for (
unsigned int f = 0; f < fe.size(); ++f)
1128 bool_int_and_flux_dof_mask[f].reinit(
1130 fe[f].n_dofs_per_cell()));
1131 bool_int_and_flux_dof_mask[f].fill(
false);
1132 for (
unsigned int i = 0; i < fe[f].n_dofs_per_cell(); ++i)
1133 for (
unsigned int j = 0; j < fe[f].n_dofs_per_cell(); ++j)
1134 if (int_and_flux_dof_mask[f](i, j) !=
none)
1135 bool_int_and_flux_dof_mask[f](i, j) =
true;
1141 (subdomain_id == cell->subdomain_id())) &&
1142 cell->is_locally_owned())
1144 dofs_on_this_cell.resize(cell->get_fe().n_dofs_per_cell());
1145 cell->get_dof_indices(dofs_on_this_cell);
1153 keep_constrained_dofs,
1154 bool_int_and_flux_dof_mask[cell->active_fe_index()]);
1157 for (
const unsigned int face : cell->face_indices())
1159 const typename ::DoFHandler<dim,
1160 spacedim>::face_iterator
1161 cell_face = cell->face(face);
1163 const bool periodic_neighbor =
1164 cell->has_periodic_neighbor(face);
1166 if ((!cell->at_boundary(face)) || periodic_neighbor)
1168 typename ::DoFHandler<dim, spacedim>::
1169 level_cell_iterator neighbor =
1170 cell->neighbor_or_periodic_neighbor(face);
1172 if (!face_has_flux_coupling(cell, face))
1179 if (neighbor->level() == cell->level() &&
1180 neighbor->index() > cell->index() &&
1181 neighbor->is_active() &&
1182 neighbor->is_locally_owned())
1196 if (neighbor->level() != cell->level() &&
1197 ((!periodic_neighbor &&
1198 !cell->neighbor_is_coarser(face)) ||
1199 (periodic_neighbor &&
1200 !cell->periodic_neighbor_is_coarser(face))) &&
1201 neighbor->is_locally_owned())
1211 while (neighbor->has_children())
1212 neighbor = neighbor->child(face == 0 ? 1 : 0);
1214 if (neighbor->has_children())
1216 for (
unsigned int sub_nr = 0;
1217 sub_nr != cell_face->n_children();
1220 const typename ::DoFHandler<dim,
1222 level_cell_iterator sub_neighbor =
1225 ->periodic_neighbor_child_on_subface(
1227 cell->neighbor_child_on_subface(face,
1230 dofs_on_other_cell.resize(
1231 sub_neighbor->get_fe().n_dofs_per_cell());
1232 sub_neighbor->get_dof_indices(
1233 dofs_on_other_cell);
1234 for (
unsigned int i = 0;
1235 i < cell->get_fe().n_dofs_per_cell();
1238 const unsigned int ii =
1239 (cell->get_fe().is_primitive(i) ?
1241 .system_to_component_index(i)
1244 .get_nonzero_components(i)
1245 .first_selected_component());
1247 Assert(ii < cell->get_fe().n_components(),
1250 for (
unsigned int j = 0;
1251 j < sub_neighbor->get_fe()
1255 const unsigned int jj =
1256 (sub_neighbor->get_fe()
1258 sub_neighbor->get_fe()
1259 .system_to_component_index(j)
1261 sub_neighbor->get_fe()
1262 .get_nonzero_components(j)
1263 .first_selected_component());
1265 Assert(jj < sub_neighbor->get_fe()
1269 if ((flux_mask(ii, jj) ==
always) ||
1270 (flux_mask(ii, jj) ==
nonzero))
1273 dofs_on_this_cell[i],
1274 dofs_on_other_cell[j]);
1277 if ((flux_mask(jj, ii) ==
always) ||
1278 (flux_mask(jj, ii) ==
nonzero))
1281 dofs_on_other_cell[j],
1282 dofs_on_this_cell[i]);
1290 dofs_on_other_cell.resize(
1291 neighbor->get_fe().n_dofs_per_cell());
1292 neighbor->get_dof_indices(dofs_on_other_cell);
1293 for (
unsigned int i = 0;
1294 i < cell->get_fe().n_dofs_per_cell();
1297 const unsigned int ii =
1298 (cell->get_fe().is_primitive(i) ?
1300 .system_to_component_index(i)
1303 .get_nonzero_components(i)
1304 .first_selected_component());
1306 Assert(ii < cell->get_fe().n_components(),
1309 for (
unsigned int j = 0;
1310 j < neighbor->get_fe().n_dofs_per_cell();
1313 const unsigned int jj =
1314 (neighbor->get_fe().is_primitive(j) ?
1316 .system_to_component_index(j)
1319 .get_nonzero_components(j)
1320 .first_selected_component());
1323 jj < neighbor->get_fe().n_components(),
1326 if ((flux_mask(ii, jj) ==
always) ||
1327 (flux_mask(ii, jj) ==
nonzero))
1329 sparsity.add(dofs_on_this_cell[i],
1330 dofs_on_other_cell[j]);
1333 if ((flux_mask(jj, ii) ==
always) ||
1334 (flux_mask(jj, ii) ==
nonzero))
1336 sparsity.add(dofs_on_other_cell[j],
1337 dofs_on_this_cell[i]);
1353 template <
int dim,
int spacedim,
typename SparsityPatternType>
1356 SparsityPatternType & sparsity,
1363 const bool keep_constrained_dofs =
true;
1368 keep_constrained_dofs,
1372 internal::always_couple_on_faces<dim, spacedim>);
1379 typename SparsityPatternType,
1384 SparsityPatternType & sparsity,
1386 const bool keep_constrained_dofs,
1390 const std::function<
1392 const unsigned int)> &face_has_flux_coupling)
1401 Assert(sparsity.n_rows() == n_dofs,
1403 Assert(sparsity.n_cols() == n_dofs,
1405 Assert(int_mask.n_rows() == n_comp,
1407 Assert(int_mask.n_cols() == n_comp,
1409 Assert(flux_mask.n_rows() == n_comp,
1411 Assert(flux_mask.n_cols() == n_comp,
1424 "For distributed Triangulation objects and associated "
1425 "DoFHandler objects, asking for any subdomain other than the "
1426 "locally owned one does not make sense."));
1430 face_has_flux_coupling,
1432 "The function which specifies if a flux coupling occurs over a given "
1435 internal::make_flux_sparsity_pattern(dof,
1438 keep_constrained_dofs,
1442 face_has_flux_coupling);
1450#include "dof_tools_sparsity.inst"
void add_entries_local_to_global(const std::vector< size_type > &local_dof_indices, SparsityPatternType &sparsity_pattern, const bool keep_constrained_entries=true, const Table< 2, bool > &dof_mask=Table< 2, bool >()) const
unsigned int first_selected_component(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
types::global_dof_index n_boundary_dofs() const
const Triangulation< dim, spacedim > & get_triangulation() const
bool has_hp_capabilities() const
types::global_dof_index n_dofs() const
typename LevelSelector::cell_iterator level_cell_iterator
cell_iterator begin(const unsigned int level=0) const
unsigned int n_dofs_per_vertex() const
unsigned int n_dofs_per_cell() const
unsigned int n_components() const
const ComponentMask & get_nonzero_components(const unsigned int i) const
bool is_primitive() const
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
virtual types::subdomain_id locally_owned_subdomain() const
unsigned int size() const
unsigned int max_dofs_per_face() const
unsigned int max_dofs_per_cell() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
IteratorRange< active_cell_iterator > active_cell_iterators() const
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
typename ActiveSelector::face_iterator face_iterator
typename ActiveSelector::active_cell_iterator active_cell_iterator
void make_flux_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternType &sparsity_pattern)
void make_boundary_sparsity_pattern(const DoFHandler< dim, spacedim > &dof, const std::vector< types::global_dof_index > &dof_to_boundary_mapping, SparsityPatternType &sparsity_pattern)
void make_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternType &sparsity_pattern, const AffineConstraints< number > &constraints=AffineConstraints< number >(), const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
const types::boundary_id internal_face_boundary_id
const types::subdomain_id invalid_subdomain_id
const types::global_dof_index invalid_dof_index
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation