16 #include <deal.II/base/memory_consumption.h> 17 #include <deal.II/base/geometry_info.h> 18 #include <deal.II/base/thread_management.h> 19 #include <deal.II/base/std_cxx11/bind.h> 20 #include <deal.II/hp/dof_handler.h> 21 #include <deal.II/hp/dof_level.h> 22 #include <deal.II/hp/dof_faces.h> 23 #include <deal.II/dofs/dof_accessor.h> 24 #include <deal.II/grid/tria_accessor.h> 25 #include <deal.II/grid/tria_iterator.h> 26 #include <deal.II/grid/tria_levels.h> 27 #include <deal.II/grid/tria.h> 28 #include <deal.II/fe/fe.h> 29 #include <deal.II/distributed/shared_tria.h> 30 #include <deal.II/distributed/tria.h> 36 DEAL_II_NAMESPACE_OPEN
46 #define HpDoFHandler DoFHandler 63 std::vector<std::pair<unsigned int, unsigned int> > DoFIdentities;
81 template <
int structdim,
int dim,
int spacedim>
85 std_cxx11::shared_ptr<DoFIdentities> &identities)
90 if (identities.get() == 0)
97 std_cxx11::shared_ptr<DoFIdentities>
105 std_cxx11::shared_ptr<DoFIdentities>
113 std_cxx11::shared_ptr<DoFIdentities>
119 Assert (
false, ExcNotImplemented());
125 for (
unsigned int i=0; i<identities->size(); ++i)
127 Assert ((*identities)[i].first < fe1.template n_dofs_per_object<structdim>(),
129 Assert ((*identities)[i].second < fe2.template n_dofs_per_object<structdim>(),
146 template <
int dim,
int spacedim,
typename iterator>
148 get_most_dominating_fe_index (
const iterator &
object)
150 unsigned int dominating_fe_index = 0;
151 for (; dominating_fe_index<
object->n_active_fe_indices();
152 ++dominating_fe_index)
155 =
object->get_fe (object->nth_active_fe_index(dominating_fe_index));
158 domination = FiniteElementDomination::either_element_can_dominate;
159 for (
unsigned int other_fe_index=0;
160 other_fe_index<
object->n_active_fe_indices();
162 if (other_fe_index != dominating_fe_index)
166 =
object->get_fe (object->nth_active_fe_index(other_fe_index));
168 domination = domination &
176 if ((domination == FiniteElementDomination::this_element_dominates)
178 (domination == FiniteElementDomination::either_element_can_dominate)
180 (domination == FiniteElementDomination::no_requirements))
186 if (dominating_fe_index != object->n_active_fe_indices())
192 return object->nth_active_fe_index(dominating_fe_index);
214 using ::hp::DoFHandler;
229 template<
int dim,
int spacedim>
246 std::vector<std::vector<bool> >
247 vertex_fe_association (dof_handler.finite_elements->size(),
248 std::vector<bool> (dof_handler.
tria->n_vertices(),
false));
250 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
252 for (
unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
253 vertex_fe_association[cell->active_fe_index()][cell->vertex_index(v)]
264 for (
unsigned int v=0; v<dof_handler.
tria->n_vertices(); ++v)
265 if (dof_handler.
tria->vertex_used(v) ==
true)
268 for (; fe<dof_handler.finite_elements->size(); ++fe)
269 if (vertex_fe_association[fe][v] ==
true)
271 Assert (fe != dof_handler.finite_elements->size(), ExcInternalError());
286 dof_handler.vertex_dofs_offsets.resize (dof_handler.
tria->n_vertices(),
289 unsigned int vertex_slots_needed = 0;
290 for (
unsigned int v=0; v<dof_handler.
tria->n_vertices(); ++v)
291 if (dof_handler.
tria->vertex_used(v) ==
true)
293 dof_handler.vertex_dofs_offsets[v] = vertex_slots_needed;
295 for (
unsigned int fe=0; fe<dof_handler.finite_elements->size(); ++fe)
296 if (vertex_fe_association[fe][v] ==
true)
297 vertex_slots_needed += (*dof_handler.finite_elements)[fe].dofs_per_vertex + 1;
298 ++vertex_slots_needed;
305 dof_handler.
vertex_dofs.resize (vertex_slots_needed,
307 for (
unsigned int v=0; v<dof_handler.
tria->n_vertices(); ++v)
308 if (dof_handler.
tria->vertex_used(v) ==
true)
311 for (
unsigned int fe=0; fe<dof_handler.finite_elements->size(); ++fe)
312 if (vertex_fe_association[fe][v] ==
true)
321 pointer += (*dof_handler.finite_elements)[fe].dofs_per_vertex + 1;
345 template <
int spacedim>
351 const unsigned int dim = 1;
354 const unsigned int fe_index = cell->active_fe_index ();
365 for (
unsigned int vertex=0; vertex<GeometryInfo<1>::vertices_per_cell; ++vertex)
366 if (cell->vertex_dof_index(vertex, 0, fe_index) ==
369 cell->set_vertex_dof_index (vertex, d, next_free_dof, fe_index);
375 Assert ((cell->dof_index(0, fe_index) ==
379 for (
unsigned int d=0; d<fe.
dofs_per_line; ++d, ++next_free_dof)
380 cell->set_dof_index (d, next_free_dof, fe_index);
384 cell->set_user_flag ();
386 return next_free_dof;
390 template <
int spacedim>
393 distribute_dofs_on_cell (
const typename ::hp::DoFHandler<2,spacedim>::active_cell_iterator &cell,
396 const unsigned int dim = 2;
399 const unsigned int fe_index = cell->active_fe_index ();
410 for (
unsigned int vertex=0; vertex<GeometryInfo<2>::vertices_per_cell; ++vertex)
411 if (cell->vertex_dof_index(vertex, 0, fe_index) ==
414 cell->set_vertex_dof_index (vertex, d, next_free_dof, fe_index);
422 for (
unsigned int l=0; l<GeometryInfo<2>::lines_per_cell; ++l)
424 typename HpDoFHandler<dim,spacedim>::line_iterator
425 line = cell->line(l);
427 if (line->dof_index(0,fe_index) ==
429 for (
unsigned int d=0; d<fe.
dofs_per_line; ++d, ++next_free_dof)
430 line->set_dof_index (d, next_free_dof, fe_index);
438 Assert ((cell->dof_index(0, fe_index) ==
442 for (
unsigned int d=0; d<fe.
dofs_per_quad; ++d, ++next_free_dof)
443 cell->set_dof_index (d, next_free_dof, fe_index);
447 cell->set_user_flag ();
449 return next_free_dof;
453 template <
int spacedim>
456 distribute_dofs_on_cell (
const typename ::hp::DoFHandler<3,spacedim>::active_cell_iterator &cell,
459 const unsigned int dim = 3;
462 const unsigned int fe_index = cell->active_fe_index ();
473 for (
unsigned int vertex=0; vertex<GeometryInfo<3>::vertices_per_cell; ++vertex)
474 if (cell->vertex_dof_index(vertex, 0, fe_index) ==
477 cell->set_vertex_dof_index (vertex, d, next_free_dof, fe_index);
485 for (
unsigned int l=0; l<GeometryInfo<3>::lines_per_cell; ++l)
487 typename HpDoFHandler<dim,spacedim>::line_iterator
488 line = cell->line(l);
490 if (line->dof_index(0,fe_index) ==
492 for (
unsigned int d=0; d<fe.
dofs_per_line; ++d, ++next_free_dof)
493 line->set_dof_index (d, next_free_dof, fe_index);
498 for (
unsigned int q=0; q<GeometryInfo<3>::quads_per_cell; ++q)
500 typename HpDoFHandler<dim,spacedim>::quad_iterator
501 quad = cell->quad(q);
503 if (quad->dof_index(0,fe_index) ==
505 for (
unsigned int d=0; d<fe.
dofs_per_quad; ++d, ++next_free_dof)
506 quad->set_dof_index (d, next_free_dof, fe_index);
514 Assert ((cell->dof_index(0, fe_index) ==
518 for (
unsigned int d=0; d<fe.
dofs_per_hex; ++d, ++next_free_dof)
519 cell->set_dof_index (d, next_free_dof, fe_index);
523 cell->set_user_flag ();
525 return next_free_dof;
538 template <
int spacedim>
543 const unsigned int dim = 1;
547 Assert (dof_handler.finite_elements != 0,
548 typename BaseClass::ExcNoFESelected());
549 Assert (dof_handler.finite_elements->size() > 0,
550 typename BaseClass::ExcNoFESelected());
553 BaseClass::ExcInvalidTriangulation());
555 ExcInternalError ());
561 std::vector<std::vector<DoFLevel::active_fe_index_type> >
562 active_fe_backup(dof_handler.
levels.size ());
563 for (
unsigned int level = 0; level<dof_handler.
levels.size (); ++level)
564 std::swap (dof_handler.
levels[level]->active_fe_indices,
565 active_fe_backup[level]);
573 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
576 std::swap (active_fe_backup[level],
577 dof_handler.
levels[level]->active_fe_indices);
597 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
599 dof_handler.
levels[level]->dof_offsets
600 = std::vector<DoFLevel::offset_type> (
601 dof_handler.
tria->n_raw_lines(level),
603 dof_handler.
levels[level]->cell_cache_offsets
604 = std::vector<DoFLevel::offset_type> (
605 dof_handler.
tria->n_raw_lines(level),
610 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
613 if (!cell->has_children())
615 dof_handler.
levels[level]->dof_offsets[cell->index()] = next_free_dof;
616 next_free_dof += cell->get_fe().dofs_per_line;
618 dof_handler.
levels[level]->cell_cache_offsets[cell->index()] = cache_size;
619 cache_size += cell->get_fe().dofs_per_cell;
622 dof_handler.
levels[level]->dof_indices
623 = std::vector<types::global_dof_index> (next_free_dof,
625 dof_handler.
levels[level]->cell_dof_indices_cache
626 = std::vector<types::global_dof_index> (cache_size,
638 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
641 for (
typename HpDoFHandler<dim,spacedim>::cell_iterator
644 if (!cell->has_children())
645 counter += cell->get_fe().dofs_per_line;
647 Assert (dof_handler.
levels[level]->dof_indices.size() == counter,
649 Assert (static_cast<unsigned int>
650 (std::count (dof_handler.
levels[level]->dof_offsets.begin(),
651 dof_handler.
levels[level]->dof_offsets.end(),
654 dof_handler.
tria->n_raw_lines(level) - dof_handler.
tria->n_active_lines(level),
661 reserve_space_vertices (dof_handler);
665 template <
int spacedim>
670 const unsigned int dim = 2;
674 Assert (dof_handler.finite_elements != 0,
675 typename BaseClass::ExcNoFESelected());
676 Assert (dof_handler.finite_elements->size() > 0,
677 typename BaseClass::ExcNoFESelected());
679 typename BaseClass::ExcInvalidTriangulation());
681 ExcInternalError ());
687 std::vector<std::vector<DoFLevel::active_fe_index_type> >
688 active_fe_backup(dof_handler.
levels.size ());
689 for (
unsigned int level = 0; level<dof_handler.
levels.size (); ++level)
690 std::swap (dof_handler.
levels[level]->active_fe_indices,
691 active_fe_backup[level]);
699 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
702 std::swap (active_fe_backup[level],
703 dof_handler.
levels[level]->active_fe_indices);
725 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
727 dof_handler.
levels[level]->dof_offsets
728 = std::vector<DoFLevel::offset_type> (
729 dof_handler.
tria->n_raw_quads(level),
731 dof_handler.
levels[level]->cell_cache_offsets
732 = std::vector<DoFLevel::offset_type> (
733 dof_handler.
tria->n_raw_quads(level),
738 for (
typename HpDoFHandler<dim, spacedim>::active_cell_iterator
741 if (!cell->has_children())
743 dof_handler.
levels[level]->dof_offsets[cell->index()] = next_free_dof;
744 next_free_dof += cell->get_fe().dofs_per_quad;
746 dof_handler.
levels[level]->cell_cache_offsets[cell->index()] = cache_size;
747 cache_size += cell->get_fe().dofs_per_cell;
750 dof_handler.
levels[level]->dof_indices
751 = std::vector<types::global_dof_index> (next_free_dof,
753 dof_handler.
levels[level]->cell_dof_indices_cache
754 = std::vector<types::global_dof_index> (cache_size,
766 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
769 for (
typename HpDoFHandler<dim,spacedim>::cell_iterator
772 if (!cell->has_children())
773 counter += cell->get_fe().dofs_per_quad;
775 Assert (dof_handler.
levels[level]->dof_indices.size() == counter,
777 Assert (static_cast<unsigned int>
778 (std::count (dof_handler.
levels[level]->dof_offsets.begin(),
779 dof_handler.
levels[level]->dof_offsets.end(),
782 dof_handler.
tria->n_raw_quads(level) - dof_handler.
tria->n_active_quads(level),
815 std::vector<bool> saved_line_user_flags;
817 .save_user_flags_line (saved_line_user_flags);
819 .clear_user_flags_line ();
825 unsigned int n_line_slots = 0;
827 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
829 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
830 if (! cell->face(face)->user_flag_set())
844 if (cell->at_boundary(face)
846 cell->face(face)->has_children()
848 cell->neighbor_is_coarser(face)
850 (!cell->at_boundary(face)
852 (cell->active_fe_index() == cell->neighbor(face)->active_fe_index())))
860 += (*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_line + 2;
870 += ((*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_line
872 (*dof_handler.finite_elements)[cell->neighbor(face)->active_fe_index()]
879 cell->face(face)->set_user_flag ();
890 dof_handler.
faces->lines.dof_offsets
891 = std::vector<unsigned int> (dof_handler.
tria->n_raw_lines(),
893 dof_handler.
faces->lines.dofs
894 = std::vector<types::global_dof_index> (n_line_slots,
903 .clear_user_flags_line ();
905 unsigned int next_free_line_slot = 0;
907 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
909 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
910 if (! cell->face(face)->user_flag_set())
914 if (cell->at_boundary(face)
916 cell->face(face)->has_children()
918 cell->neighbor_is_coarser(face)
920 (!cell->at_boundary(face)
922 (cell->active_fe_index() == cell->neighbor(face)->active_fe_index())))
925 ->lines.dof_offsets[cell->face(face)->index()]
926 = next_free_line_slot;
933 ->lines.dofs[next_free_line_slot]
934 = cell->active_fe_index();
956 += (*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_line + 2;
961 ->lines.dof_offsets[cell->face(face)->index()]
962 = next_free_line_slot;
969 ->lines.dofs[next_free_line_slot]
970 = cell->active_fe_index();
984 ->lines.dofs[next_free_line_slot
986 (*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_line
989 = cell->neighbor(face)->active_fe_index();
1009 += ((*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_line
1011 (*dof_handler.finite_elements)[cell->neighbor(face)->active_fe_index()]
1019 cell->face(face)->set_user_flag ();
1026 Assert (next_free_line_slot == n_line_slots,
1027 ExcInternalError());
1031 const_cast<::Triangulation<dim,spacedim>&
>(*dof_handler.
tria)
1032 .load_user_flags_line (saved_line_user_flags);
1037 reserve_space_vertices (dof_handler);
1041 template <
int spacedim>
1046 const unsigned int dim = 3;
1050 Assert (dof_handler.finite_elements != 0,
1051 typename BaseClass::ExcNoFESelected());
1052 Assert (dof_handler.finite_elements->size() > 0,
1053 typename BaseClass::ExcNoFESelected());
1055 typename BaseClass::ExcInvalidTriangulation());
1057 ExcInternalError ());
1063 std::vector<std::vector<DoFLevel::active_fe_index_type> >
1064 active_fe_backup(dof_handler.
levels.size ());
1065 for (
unsigned int level = 0; level<dof_handler.
levels.size (); ++level)
1066 std::swap (dof_handler.
levels[level]->active_fe_indices,
1067 active_fe_backup[level]);
1075 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
1078 std::swap (active_fe_backup[level],
1079 dof_handler.
levels[level]->active_fe_indices);
1101 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
1103 dof_handler.
levels[level]->dof_offsets
1104 = std::vector<DoFLevel::offset_type> (
1105 dof_handler.
tria->n_raw_hexs(level),
1107 dof_handler.
levels[level]->cell_cache_offsets
1108 = std::vector<DoFLevel::offset_type> (
1109 dof_handler.
tria->n_raw_hexs(level),
1114 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
1117 if (!cell->has_children())
1119 dof_handler.
levels[level]->dof_offsets[cell->index()] = next_free_dof;
1120 next_free_dof += cell->get_fe().dofs_per_hex;
1122 dof_handler.
levels[level]->cell_cache_offsets[cell->index()] = cache_size;
1123 cache_size += cell->get_fe().dofs_per_cell;
1126 dof_handler.
levels[level]->dof_indices
1127 = std::vector<types::global_dof_index> (next_free_dof,
1129 dof_handler.
levels[level]->cell_dof_indices_cache
1130 = std::vector<types::global_dof_index> (cache_size,
1142 for (
unsigned int level=0; level<dof_handler.
tria->n_levels(); ++level)
1145 for (
typename HpDoFHandler<dim,spacedim>::cell_iterator
1148 if (!cell->has_children())
1149 counter += cell->get_fe().dofs_per_hex;
1151 Assert (dof_handler.
levels[level]->dof_indices.size() == counter,
1152 ExcInternalError());
1153 Assert (static_cast<unsigned int>
1154 (std::count (dof_handler.
levels[level]->dof_offsets.begin(),
1155 dof_handler.
levels[level]->dof_offsets.end(),
1158 dof_handler.
tria->n_raw_hexs(level) - dof_handler.
tria->n_active_hexs(level),
1159 ExcInternalError());
1191 std::vector<bool> saved_quad_user_flags;
1193 .save_user_flags_quad (saved_quad_user_flags);
1195 .clear_user_flags_quad ();
1200 unsigned int n_quad_slots = 0;
1202 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
1204 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1205 if (! cell->face(face)->user_flag_set())
1222 if (cell->at_boundary(face)
1224 cell->face(face)->has_children()
1226 cell->neighbor_is_coarser(face)
1228 (!cell->at_boundary(face)
1230 (cell->active_fe_index() == cell->neighbor(face)->active_fe_index())))
1238 += (*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_quad + 2;
1248 += ((*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_quad
1250 (*dof_handler.finite_elements)[cell->neighbor(face)->active_fe_index()]
1257 cell->face(face)->set_user_flag ();
1270 dof_handler.
faces->quads.dof_offsets
1271 = std::vector<unsigned int>
1272 (dof_handler.
tria->n_raw_quads(),
1273 (
unsigned int)(-1));
1274 dof_handler.
faces->quads.dofs
1275 = std::vector<types::global_dof_index> (n_quad_slots,
1285 .clear_user_flags_quad ();
1287 unsigned int next_free_quad_slot = 0;
1289 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
1291 for (
unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
1292 if (! cell->face(face)->user_flag_set())
1296 if (cell->at_boundary(face)
1298 cell->face(face)->has_children()
1300 cell->neighbor_is_coarser(face)
1302 (!cell->at_boundary(face)
1304 (cell->active_fe_index() == cell->neighbor(face)->active_fe_index())))
1307 ->quads.dof_offsets[cell->face(face)->index()]
1308 = next_free_quad_slot;
1315 ->quads.dofs[next_free_quad_slot]
1316 = cell->active_fe_index();
1338 += (*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_quad + 2;
1343 ->quads.dof_offsets[cell->face(face)->index()]
1344 = next_free_quad_slot;
1351 ->quads.dofs[next_free_quad_slot]
1352 = cell->active_fe_index();
1366 ->quads.dofs[next_free_quad_slot
1368 (*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_quad
1371 = cell->neighbor(face)->active_fe_index();
1391 += ((*dof_handler.finite_elements)[cell->active_fe_index()].dofs_per_quad
1393 (*dof_handler.finite_elements)[cell->neighbor(face)->active_fe_index()]
1401 cell->face(face)->set_user_flag ();
1407 Assert (next_free_quad_slot == n_quad_slots,
1408 ExcInternalError());
1412 const_cast<::Triangulation<dim,spacedim>&
>(*dof_handler.
tria)
1413 .load_user_flags_quad (saved_quad_user_flags);
1438 std::vector<std::vector<bool> >
1439 line_fe_association (dof_handler.finite_elements->size(),
1440 std::vector<bool> (dof_handler.
tria->n_raw_lines(),
1443 for (
typename HpDoFHandler<dim,spacedim>::active_cell_iterator
1445 cell!=dof_handler.
end(); ++cell)
1446 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
1447 line_fe_association[cell->active_fe_index()][cell->line_index(l)]
1459 std::vector<bool> line_is_used (dof_handler.
tria->n_raw_lines(),
false);
1460 for (
unsigned int line=0; line<dof_handler.
tria->n_raw_lines(); ++line)
1461 for (
unsigned int fe=0; fe<dof_handler.finite_elements->size(); ++fe)
1462 if (line_fe_association[fe][line] ==
true)
1464 line_is_used[line] =
true;
1479 dof_handler.
faces->lines.dof_offsets
1480 .resize (dof_handler.
tria->n_raw_lines(),
1483 unsigned int line_slots_needed = 0;
1484 for (
unsigned int line=0; line<dof_handler.
tria->n_raw_lines(); ++line)
1485 if (line_is_used[line] ==
true)
1487 dof_handler.
faces->lines.dof_offsets[line] = line_slots_needed;
1489 for (
unsigned int fe=0; fe<dof_handler.finite_elements->size(); ++fe)
1490 if (line_fe_association[fe][line] ==
true)
1491 line_slots_needed += (*dof_handler.finite_elements)[fe].dofs_per_line + 1;
1492 ++line_slots_needed;
1499 dof_handler.
faces->lines.dofs.resize (line_slots_needed,
1501 for (
unsigned int line=0; line<dof_handler.
tria->n_raw_lines(); ++line)
1502 if (line_is_used[line] ==
true)
1504 unsigned int pointer = dof_handler.
faces->lines.dof_offsets[line];
1505 for (
unsigned int fe=0; fe<dof_handler.finite_elements->size(); ++fe)
1506 if (line_fe_association[fe][line] ==
true)
1514 dof_handler.
faces->lines.dofs[pointer] = fe;
1515 pointer += (*dof_handler.finite_elements)[fe].dofs_per_line + 1;
1526 reserve_space_vertices (dof_handler);
1534 template <
int spacedim>
1539 return std::min(static_cast<types::global_dof_index> (3*
1541 2*dof_handler.finite_elements->max_dofs_per_line()),
1547 template <
int spacedim>
1574 switch (dof_handler.
tria->max_adjacent_cells())
1578 28*dof_handler.finite_elements->max_dofs_per_line() +
1579 8*dof_handler.finite_elements->max_dofs_per_quad();
1583 31*dof_handler.finite_elements->max_dofs_per_line() +
1584 9*dof_handler.finite_elements->max_dofs_per_quad();
1588 42*dof_handler.finite_elements->max_dofs_per_line() +
1589 12*dof_handler.finite_elements->max_dofs_per_quad();
1593 45*dof_handler.finite_elements->max_dofs_per_line() +
1594 13*dof_handler.finite_elements->max_dofs_per_quad();
1598 56*dof_handler.finite_elements->max_dofs_per_line() +
1599 16*dof_handler.finite_elements->max_dofs_per_quad();
1602 Assert (
false, ExcNotImplemented());
1605 return std::min(max_couplings,dof_handler.
n_dofs());
1609 template <
int spacedim>
1624 const unsigned int max_adjacent_cells = dof_handler.
tria->max_adjacent_cells();
1627 if (max_adjacent_cells <= 8)
1629 7*6*7*3*dof_handler.finite_elements->max_dofs_per_line() +
1630 9*4*7*3*dof_handler.finite_elements->max_dofs_per_quad() +
1631 27*dof_handler.finite_elements->max_dofs_per_hex();
1634 Assert (
false, ExcNotImplemented());
1638 return std::min(max_couplings,dof_handler.
n_dofs());
1648 template<
int dim,
int spacedim>
1651 template<
int dim,
int spacedim>
1654 template<
int dim,
int spacedim>
1659 template<
int dim,
int spacedim>
1662 tria(&tria, typeid(*this).name()),
1668 ExcMessage (
"The given triangulation is parallel distributed but " 1669 "this class does not currently support this."));
1671 create_active_fe_table ();
1673 tria_listeners.push_back
1676 std_cxx11::ref(*
this))));
1677 tria_listeners.push_back
1680 std_cxx11::ref(*
this))));
1681 tria_listeners.push_back
1684 std_cxx11::ref(*
this))));
1688 template<
int dim,
int spacedim>
1693 for (
unsigned int i=0; i<tria_listeners.size(); ++i)
1694 tria_listeners[i].disconnect ();
1695 tria_listeners.clear ();
1704 template <
int dim,
int spacedim>
1714 template <
int dim,
int spacedim>
1722 while (i->has_children())
1730 template <
int dim,
int spacedim>
1741 template <
int dim,
int spacedim>
1751 template <
int dim,
int spacedim>
1762 template <
int dim,
int spacedim>
1772 template <
int dim,
int spacedim>
1783 template <
int dim,
int spacedim>
1794 template <
int dim,
int spacedim>
1812 Assert (finite_elements != 0, ExcNoFESelected());
1819 while (!cell->at_boundary(0))
1820 cell = cell->neighbor(0);
1821 n += cell->
get_fe().dofs_per_vertex;
1825 while (!cell->at_boundary(1))
1826 cell = cell->neighbor(1);
1827 n += cell->
get_fe().dofs_per_vertex;
1837 Assert (finite_elements != 0, ExcNoFESelected());
1842 for (FunctionMap::const_iterator i=boundary_ids.begin();
1843 i!=boundary_ids.end(); ++i)
1844 Assert ((i->first == 0) || (i->first == 1),
1845 ExcInvalidBoundaryIndicator());
1851 if (boundary_ids.find (0) != boundary_ids.end())
1854 while (!cell->at_boundary(0))
1855 cell = cell->neighbor(0);
1856 n += cell->
get_fe().dofs_per_vertex;
1860 if (boundary_ids.find (1) != boundary_ids.end())
1863 while (!cell->at_boundary(1))
1864 cell = cell->neighbor(1);
1865 n += cell->
get_fe().dofs_per_vertex;
1876 Assert (finite_elements != 0, ExcNoFESelected());
1881 for (std::set<types::boundary_id>::const_iterator i=boundary_ids.begin();
1882 i!=boundary_ids.end(); ++i)
1883 Assert ((*i == 0) || (*i == 1),
1884 ExcInvalidBoundaryIndicator());
1890 if (boundary_ids.find (0) != boundary_ids.end())
1893 while (!cell->at_boundary(0))
1894 cell = cell->neighbor(0);
1895 n += cell->
get_fe().dofs_per_vertex;
1899 if (boundary_ids.find (1) != boundary_ids.end())
1902 while (!cell->at_boundary(1))
1903 cell = cell->neighbor(1);
1904 n += cell->
get_fe().dofs_per_vertex;
1914 Assert(
false,ExcNotImplemented());
1921 Assert(
false,ExcNotImplemented());
1928 Assert(
false,ExcNotImplemented());
1937 Assert(
false,ExcNotImplemented());
1944 Assert(
false,ExcNotImplemented());
1951 Assert(
false,ExcNotImplemented());
1956 template<
int dim,
int spacedim>
1959 Assert (finite_elements != 0, ExcNoFESelected());
1961 std::set<types::global_dof_index> boundary_dofs;
1962 std::vector<types::global_dof_index> dofs_on_face;
1975 typename HpDoFHandler<dim,spacedim>::active_cell_iterator cell = this->
begin_active (),
1977 for (; cell!=endc; ++cell)
1978 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
1979 if (cell->at_boundary(f))
1981 const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
1982 dofs_on_face.resize (dofs_per_face);
1984 cell->face(f)->get_dof_indices (dofs_on_face,
1985 cell->active_fe_index());
1986 for (
unsigned int i=0; i<dofs_per_face; ++i)
1987 boundary_dofs.insert(dofs_on_face[i]);
1989 return boundary_dofs.size();
1994 template<
int dim,
int spacedim>
1998 Assert (finite_elements != 0, ExcNoFESelected());
2000 ExcInvalidBoundaryIndicator());
2005 std::set<types::global_dof_index> boundary_dofs;
2006 std::vector<types::global_dof_index> dofs_on_face;
2009 typename HpDoFHandler<dim,spacedim>::active_cell_iterator cell = this->
begin_active (),
2011 for (; cell!=endc; ++cell)
2012 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
2013 if (cell->at_boundary(f) &&
2014 (boundary_ids.find(cell->face(f)->boundary_id()) !=
2015 boundary_ids.end()))
2017 const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
2018 dofs_on_face.resize (dofs_per_face);
2020 cell->face(f)->get_dof_indices (dofs_on_face,
2021 cell->active_fe_index());
2022 for (
unsigned int i=0; i<dofs_per_face; ++i)
2023 boundary_dofs.insert(dofs_on_face[i]);
2025 return boundary_dofs.size();
2030 template<
int dim,
int spacedim>
2034 Assert (finite_elements != 0, ExcNoFESelected());
2036 ExcInvalidBoundaryIndicator());
2041 std::set<types::global_dof_index> boundary_dofs;
2042 std::vector<types::global_dof_index> dofs_on_face;
2045 typename HpDoFHandler<dim,spacedim>::active_cell_iterator cell = this->
begin_active (),
2047 for (; cell!=endc; ++cell)
2048 for (
unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
2049 if (cell->at_boundary(f) &&
2050 (boundary_ids.find(cell->face(f)->boundary_id()) !=
2051 boundary_ids.end()))
2053 const unsigned int dofs_per_face = cell->get_fe().dofs_per_face;
2054 dofs_on_face.resize (dofs_per_face);
2056 cell->face(f)->get_dof_indices (dofs_on_face,
2057 cell->active_fe_index());
2058 for (
unsigned int i=0; i<dofs_per_face; ++i)
2059 boundary_dofs.insert(dofs_on_face[i]);
2061 return boundary_dofs.size();
2069 Assert(
false,ExcNotImplemented());
2078 Assert(
false,ExcNotImplemented());
2087 Assert(
false,ExcNotImplemented());
2093 template<
int dim,
int spacedim>
2106 for (
unsigned int i=0; i<
levels.size(); ++i)
2115 template<
int dim,
int spacedim>
2132 vertex_dof_identities (
get_fe().size(),
2138 for (
unsigned int vertex_index=0; vertex_index<
get_tria().n_vertices();
2141 const unsigned int n_active_fe_indices
2142 = ::internal::DoFAccessor::Implementation::
2143 n_active_vertex_fe_indices (*
this, vertex_index);
2144 if (n_active_fe_indices > 1)
2148 = ::internal::DoFAccessor::Implementation::
2149 nth_active_vertex_fe_index (*
this, vertex_index, 0);
2156 for (
unsigned int f=1; f<n_active_fe_indices; ++f)
2160 = ::internal::DoFAccessor::Implementation::
2161 nth_active_vertex_fe_index (*
this, vertex_index, f);
2167 ::internal::hp::ensure_existence_of_dof_identities<0>
2168 (
get_fe()[first_fe_index],
2169 get_fe()[other_fe_index],
2170 vertex_dof_identities[first_fe_index][other_fe_index]);
2196 ::internal::hp::DoFIdentities &identities
2197 = *vertex_dof_identities[first_fe_index][other_fe_index];
2198 for (
unsigned int i=0; i<identities.size(); ++i)
2201 = ::internal::DoFAccessor::Implementation::
2202 get_vertex_dof_index (*
this,
2205 identities[i].first);
2207 = ::internal::DoFAccessor::Implementation::
2208 get_vertex_dof_index (*
this,
2211 identities[i].second);
2213 Assert ((new_dof_indices[higher_dof_index] ==
2216 (new_dof_indices[higher_dof_index] ==
2218 ExcInternalError());
2220 new_dof_indices[higher_dof_index] = lower_dof_index;
2249 template<
int dim,
int spacedim>
2256 std::vector<bool> user_flags;
2277 line_dof_identities (finite_elements->size(),
2278 finite_elements->size());
2281 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
2282 if (cell->line(l)->user_flag_set() ==
false)
2284 const line_iterator line = cell->line(l);
2285 line->set_user_flag ();
2287 unsigned int unique_sets_of_dofs
2288 = line->n_active_fe_indices();
2292 for (
unsigned int f=0; f<line->n_active_fe_indices(); ++f)
2293 for (
unsigned int g=f+1; g<line->n_active_fe_indices(); ++g)
2295 const unsigned int fe_index_1 = line->nth_active_fe_index (f),
2296 fe_index_2 = line->nth_active_fe_index (g);
2298 if (((*finite_elements)[fe_index_1].dofs_per_line
2300 (*finite_elements)[fe_index_2].dofs_per_line)
2302 ((*finite_elements)[fe_index_1].dofs_per_line > 0))
2304 internal::hp::ensure_existence_of_dof_identities<1>
2305 ((*finite_elements)[fe_index_1],
2306 (*finite_elements)[fe_index_2],
2307 line_dof_identities[fe_index_1][fe_index_2]);
2310 if (line_dof_identities[fe_index_1][fe_index_2]->size()
2312 (*finite_elements)[fe_index_1].dofs_per_line)
2315 for (; i<(*finite_elements)[fe_index_1].dofs_per_line; ++i)
2316 if (((*(line_dof_identities[fe_index_1][fe_index_2]))[i].first != i)
2318 ((*(line_dof_identities[fe_index_1][fe_index_2]))[i].second != i))
2322 if (i == (*finite_elements)[fe_index_1].dofs_per_line)
2329 --unique_sets_of_dofs;
2331 for (
unsigned int j=0; j<(*finite_elements)[fe_index_1].dofs_per_line; ++j)
2334 = line->dof_index (j, fe_index_1);
2336 = line->dof_index (j, fe_index_2);
2341 if (new_dof_indices[master_dof_index] !=
2344 Assert (new_dof_indices[new_dof_indices[master_dof_index]] ==
2346 ExcInternalError());
2348 new_dof_indices[slave_dof_index]
2349 = new_dof_indices[master_dof_index];
2353 Assert ((new_dof_indices[master_dof_index] ==
2356 (new_dof_indices[slave_dof_index] ==
2358 ExcInternalError());
2360 new_dof_indices[slave_dof_index] = master_dof_index;
2376 if ((unique_sets_of_dofs == 2) && (dim == 2))
2380 const unsigned int most_dominating_fe_index
2381 = internal::hp::get_most_dominating_fe_index<dim,spacedim> (line);
2389 const unsigned int n_active_fe_indices
2390 = line->n_active_fe_indices ();
2395 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
2396 if (line->nth_active_fe_index (f) !=
2397 most_dominating_fe_index)
2400 other_fe_index = line->nth_active_fe_index (f);
2402 internal::hp::ensure_existence_of_dof_identities<1>
2403 ((*finite_elements)[most_dominating_fe_index],
2404 (*finite_elements)[other_fe_index],
2405 line_dof_identities[most_dominating_fe_index][other_fe_index]);
2407 internal::hp::DoFIdentities &identities
2408 = *line_dof_identities[most_dominating_fe_index][other_fe_index];
2409 for (
unsigned int i=0; i<identities.size(); ++i)
2412 = line->dof_index (identities[i].first, most_dominating_fe_index);
2414 = line->dof_index (identities[i].second, other_fe_index);
2416 Assert ((new_dof_indices[master_dof_index] ==
2419 (new_dof_indices[slave_dof_index] ==
2421 ExcInternalError());
2423 new_dof_indices[slave_dof_index] = master_dof_index;
2432 .load_user_flags_line(user_flags);
2437 template <
int dim,
int spacedim>
2445 Assert (dim < 3, ExcInternalError());
2455 const int spacedim = 3;
2462 std::vector<bool> user_flags;
2487 quad_dof_identities (finite_elements->size(),
2488 finite_elements->size());
2491 for (
unsigned int q=0; q<GeometryInfo<dim>::quads_per_cell; ++q)
2492 if ((cell->quad(q)->user_flag_set() ==
false)
2494 (cell->quad(q)->n_active_fe_indices() == 2))
2496 const quad_iterator quad = cell->quad(q);
2497 quad->set_user_flag ();
2503 const unsigned int most_dominating_fe_index
2504 = internal::hp::get_most_dominating_fe_index<dim,spacedim> (quad);
2512 const unsigned int n_active_fe_indices
2513 = quad->n_active_fe_indices ();
2521 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
2522 if (quad->nth_active_fe_index (f) !=
2523 most_dominating_fe_index)
2526 other_fe_index = quad->nth_active_fe_index (f);
2528 internal::hp::ensure_existence_of_dof_identities<2>
2529 ((*finite_elements)[most_dominating_fe_index],
2530 (*finite_elements)[other_fe_index],
2531 quad_dof_identities[most_dominating_fe_index][other_fe_index]);
2533 internal::hp::DoFIdentities &identities
2534 = *quad_dof_identities[most_dominating_fe_index][other_fe_index];
2535 for (
unsigned int i=0; i<identities.size(); ++i)
2538 = quad->dof_index (identities[i].first, most_dominating_fe_index);
2540 = quad->dof_index (identities[i].second, other_fe_index);
2542 Assert ((new_dof_indices[master_dof_index] ==
2545 (new_dof_indices[slave_dof_index] ==
2547 ExcInternalError());
2549 new_dof_indices[slave_dof_index] = master_dof_index;
2557 .load_user_flags_quad(user_flags);
2562 template <
int dim,
int spacedim>
2566 ExcDimensionMismatch(active_fe_indices.size(),
get_tria().n_active_cells()));
2568 create_active_fe_table ();
2578 for (
unsigned int i=0; cell!=endc; ++cell, ++i)
2579 cell->set_active_fe_index(active_fe_indices[i]);
2584 template <
int dim,
int spacedim>
2587 active_fe_indices.resize(
get_tria().n_active_cells());
2595 for (
unsigned int i=0; cell!=endc; ++cell, ++i)
2596 active_fe_indices[i]=cell->active_fe_index();
2601 template<
int dim,
int spacedim>
2604 Assert (
tria->n_levels() > 0, ExcInvalidTriangulation());
2606 finite_elements = &ff;
2611 create_active_fe_table ();
2618 Assert (cell->active_fe_index() < finite_elements->size(),
2619 ExcInvalidFEIndex (cell->active_fe_index(),
2620 finite_elements->size()));
2635 std::vector<bool> user_flags;
2636 tria->save_user_flags(user_flags);
2649 for (; cell != endc; ++cell)
2651 = ::internal::hp::DoFHandler::Implementation::distribute_dofs_on_cell<spacedim> (cell,
2667 std::vector<types::global_dof_index>
2669 compute_vertex_dof_identities (constrained_indices);
2670 compute_line_dof_identities (constrained_indices);
2671 compute_quad_dof_identities (constrained_indices);
2676 std::vector<types::global_dof_index>
2682 new_dof_indices[i] = next_free_dof;
2692 Assert (new_dof_indices[constrained_indices[i]] !=
2694 ExcInternalError());
2696 new_dof_indices[i] = new_dof_indices[constrained_indices[i]];
2702 ExcInternalError());
2703 Assert (new_dof_indices[i] < next_free_dof,
2704 ExcInternalError());
2726 ExcMessage (
"Global number of degrees of freedom is too large."));
2728 = std::vector<types::global_dof_index> (1,
2739 = std::vector<IndexSet> (1,
2746 cell !=
end(); ++cell)
2747 cell->update_cell_dof_indices_cache ();
2751 for (
int level=
levels.size()-1; level>=0; --level)
2752 tg +=
Threads::new_task (&::internal::hp::DoFLevel::compress_data<dim,spacedim>,
2753 *
levels[level], *finite_elements);
2763 template<
int dim,
int spacedim>
2767 finite_elements = 0;
2775 template<
int dim,
int spacedim>
2778 Assert (new_numbers.size() ==
n_dofs(), ExcRenumberingIncomplete());
2784 std::vector<types::global_dof_index> tmp(new_numbers);
2785 std::sort (tmp.begin(), tmp.end());
2786 std::vector<types::global_dof_index>::const_iterator p = tmp.begin();
2788 for (; p!=tmp.end(); ++p, ++i)
2789 Assert (*p == i, ExcNewNumbersNotConsecutive(i));
2798 for (
int level=
levels.size()-1; level>=0; --level)
2799 tg +=
Threads::new_task (&::internal::hp::DoFLevel::uncompress_data<dim,spacedim>,
2800 *
levels[level], *finite_elements);
2809 cell !=
end(); ++cell)
2810 cell->update_cell_dof_indices_cache ();
2815 for (
int level=
levels.size()-1; level>=0; --level)
2816 tg +=
Threads::new_task (&::internal::hp::DoFLevel::compress_data<dim,spacedim>,
2817 *
levels[level], *finite_elements);
2824 template<
int dim,
int spacedim>
2830 Assert (new_numbers.size() ==
n_dofs(), ExcRenumberingIncomplete());
2832 for (
unsigned int vertex_index=0; vertex_index<
get_tria().n_vertices();
2835 const unsigned int n_active_fe_indices
2836 = ::internal::DoFAccessor::Implementation::
2837 n_active_vertex_fe_indices (*
this, vertex_index);
2839 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
2841 const unsigned int fe_index
2842 = ::internal::DoFAccessor::Implementation::
2843 nth_active_vertex_fe_index (*
this, vertex_index, f);
2845 for (
unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_vertex; ++d)
2848 = ::internal::DoFAccessor::Implementation::
2849 get_vertex_dof_index(*
this,
2853 ::internal::DoFAccessor::Implementation::
2854 set_vertex_dof_index (*
this,
2858 new_numbers[vertex_dof_index]);
2866 template<
int dim,
int spacedim>
2872 Assert (new_numbers.size() ==
n_dofs(), ExcRenumberingIncomplete());
2879 std::vector<bool> saved_line_user_flags;
2886 for (
unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
2887 if (cell->line(l)->user_flag_set() ==
false)
2889 const line_iterator line = cell->line(l);
2890 line->set_user_flag();
2892 const unsigned int n_active_fe_indices
2893 = line->n_active_fe_indices ();
2895 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
2897 const unsigned int fe_index
2898 = line->nth_active_fe_index (f);
2900 for (
unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_line; ++d)
2901 line->set_dof_index (d,
2902 new_numbers[line->dof_index(d,fe_index)],
2922 const unsigned int dim = 2;
2923 const unsigned int spacedim = 2;
2925 Assert (new_numbers.size() ==
n_dofs(), ExcRenumberingIncomplete());
2932 std::vector<bool> saved_quad_user_flags;
2939 for (
unsigned int q=0; q<GeometryInfo<dim>::quads_per_cell; ++q)
2940 if (cell->quad(q)->user_flag_set() ==
false)
2942 const quad_iterator quad = cell->quad(q);
2943 quad->set_user_flag();
2945 const unsigned int n_active_fe_indices
2946 = quad->n_active_fe_indices ();
2948 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
2950 const unsigned int fe_index
2951 = quad->nth_active_fe_index (f);
2953 for (
unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_quad; ++d)
2954 quad->set_dof_index (d,
2955 new_numbers[quad->dof_index(d,fe_index)],
2974 const unsigned int dim = 2;
2975 const unsigned int spacedim = 3;
2977 Assert (new_numbers.size() ==
n_dofs(), ExcRenumberingIncomplete());
2984 std::vector<bool> saved_quad_user_flags;
2991 for (
unsigned int q=0; q<GeometryInfo<dim>::quads_per_cell; ++q)
2992 if (cell->quad(q)->user_flag_set() ==
false)
2994 const quad_iterator quad = cell->quad(q);
2995 quad->set_user_flag();
2997 const unsigned int n_active_fe_indices
2998 = quad->n_active_fe_indices ();
3000 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
3002 const unsigned int fe_index
3003 = quad->nth_active_fe_index (f);
3005 for (
unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_quad; ++d)
3006 quad->set_dof_index (d,
3007 new_numbers[quad->dof_index(d,fe_index)],
3025 const unsigned int dim = 3;
3026 const unsigned int spacedim = 3;
3028 Assert (new_numbers.size() ==
n_dofs(), ExcRenumberingIncomplete());
3035 std::vector<bool> saved_quad_user_flags;
3042 for (
unsigned int q=0; q<GeometryInfo<dim>::quads_per_cell; ++q)
3043 if (cell->quad(q)->user_flag_set() ==
false)
3045 const quad_iterator quad = cell->quad(q);
3046 quad->set_user_flag();
3048 const unsigned int n_active_fe_indices
3049 = quad->n_active_fe_indices ();
3051 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
3053 const unsigned int fe_index
3054 = quad->nth_active_fe_index (f);
3056 for (
unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_quad; ++d)
3057 quad->set_dof_index (d,
3058 new_numbers[quad->dof_index(d,fe_index)],
3076 const unsigned int dim = 3;
3077 const unsigned int spacedim = 3;
3079 Assert (new_numbers.size() ==
n_dofs(), ExcRenumberingIncomplete());
3086 std::vector<bool> saved_hex_user_flags;
3097 if (cell->user_flag_set() ==
false)
3099 const hex_iterator hex = cell;
3100 hex->set_user_flag();
3102 const unsigned int n_active_fe_indices
3103 = hex->n_active_fe_indices ();
3105 for (
unsigned int f=0; f<n_active_fe_indices; ++f)
3107 const unsigned int fe_index
3108 = hex->nth_active_fe_index (f);
3110 for (
unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_hex; ++d)
3111 hex->set_dof_index (d,
3112 new_numbers[hex->dof_index(d,fe_index)],
3125 template <
int dim,
int spacedim>
3129 Assert (finite_elements != 0, ExcNoFESelected());
3130 return ::internal::hp::DoFHandler::Implementation::max_couplings_between_dofs (*
this);
3135 template <
int dim,
int spacedim>
3139 Assert (finite_elements != 0, ExcNoFESelected());
3144 return finite_elements->max_dofs_per_vertex();
3146 return (3*finite_elements->max_dofs_per_vertex()
3148 2*finite_elements->max_dofs_per_line());
3163 return (19*finite_elements->max_dofs_per_vertex() +
3164 28*finite_elements->max_dofs_per_line() +
3165 8*finite_elements->max_dofs_per_quad());
3167 Assert (
false, ExcNotImplemented());
3174 template<
int dim,
int spacedim>
3180 levels.push_back (new ::internal::hp::DoFLevel);
3187 for (
unsigned int level=0; level<
levels.size(); ++level)
3189 if (
levels[level]->active_fe_indices.size () == 0)
3190 levels[level]->active_fe_indices.resize (
tria->n_raw_cells(level),
3203 tria->n_raw_cells(level),
3204 ExcInternalError ());
3210 template <
int dim,
int spacedim>
3213 create_active_fe_table ();
3219 Assert (has_children.size () == 0, ExcInternalError ());
3220 for (
unsigned int i=0; i<
levels.size(); ++i)
3222 const unsigned int cells_on_level =
tria->n_raw_cells(i);
3223 std::vector<bool> *has_children_level =
3224 new std::vector<bool> (cells_on_level);
3230 std::transform (
tria->levels[i]->cells.children.begin (),
3231 tria->levels[i]->cells.children.end (),
3232 has_children_level->begin (),
3233 std::bind2nd (std::not_equal_to<int>(), -1));
3235 std::transform (
tria->levels[i]->cells.refinement_cases.begin (),
3236 tria->levels[i]->cells.refinement_cases.end (),
3237 has_children_level->begin (),
3238 std::bind2nd (std::not_equal_to<unsigned char>(),
3241 has_children.push_back (has_children_level);
3247 template<
int dim,
int spacedim>
3251 Assert (has_children.size () ==
levels.size (), ExcInternalError ());
3256 levels.push_back (new ::internal::hp::DoFLevel);
3271 for (
unsigned int i=0; i<
levels.size(); ++i)
3272 levels[i]->active_fe_indices.resize (
tria->n_raw_cells(i), 0);
3288 if (finite_elements != 0)
3292 for (; cell != endc; ++cell)
3310 if (cell->has_children () &&
3311 !(*has_children [cell->level ()])[cell->index ()])
3319 for (
unsigned int i = 0; i < cell->n_children(); ++i)
3320 cell->child (i)->set_active_fe_index
3321 (
levels[cell->level()]->active_fe_index (cell->index()));
3327 std::vector<std::vector<bool> *>::iterator children_level;
3328 for (children_level = has_children.begin ();
3329 children_level != has_children.end ();
3331 delete (*children_level);
3332 has_children.clear ();
3336 template <
int dim,
int spacedim>
3337 template <
int structdim>
3342 const unsigned int)
const 3344 Assert (
false, ExcNotImplemented());
3349 template <
int dim,
int spacedim>
3350 template <
int structdim>
3358 Assert (
false, ExcNotImplemented());
3362 template<
int dim,
int spacedim>
3365 for (
unsigned int i=0; i<
levels.size(); ++i)
3372 std::vector<types::global_dof_index> tmp;
3377 std::vector<types::global_dof_index> tmp;
3378 std::swap (vertex_dofs_offsets, tmp);
3386 #include "dof_handler.inst" 3389 DEAL_II_NAMESPACE_CLOSE
IteratorRange< active_cell_iterator > active_cell_iterators_on_level(const unsigned int level) const
unsigned int max_couplings_between_dofs() const
static const unsigned int invalid_unsigned_int
void load_user_flags_line(std::istream &in)
cell_iterator begin(const unsigned int level=0) const
void save_user_flags_quad(std::ostream &out) const
void load_user_flags(std::istream &in)
::ExceptionBase & ExcMessage(std::string arg1)
cell_iterator end() const
const unsigned int dofs_per_quad
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
void clear_user_flags_quad()
unsigned int max_dofs_per_face(const DoFHandler< dim, spacedim > &dh)
std::vector<::internal::DoFHandler::DoFLevel< dim > * > levels
ActiveSelector::active_cell_iterator active_cell_iterator
SmartPointer< const Triangulation< dim, spacedim >, DoFHandler< dim, spacedim > > tria
unsigned int max_dofs_per_vertex(const DoFHandler< dim, spacedim > &dh)
#define AssertThrow(cond, exc)
virtual std::size_t memory_consumption() const
::internal::DoFHandler::NumberCache number_cache
static unsigned int max_couplings_between_dofs(const DoFHandler< 1, spacedim > &dof_handler)
const FiniteElement< dim, spacedim > & get_fe() const
const unsigned int dofs_per_line
void load_user_flags_quad(std::istream &in)
ActiveSelector::active_cell_iterator active_cell_iterator
types::global_dof_index n_locally_owned_dofs
active_cell_iterator begin_active(const unsigned int level=0) const
const hp::FECollection< dim, spacedim > & get_fe() const
void load_user_flags_hex(std::istream &in)
ActiveSelector::cell_iterator cell_iterator
void save_user_flags_line(std::ostream &out) const
void clear_user_flags_hex()
unsigned int global_dof_index
static types::global_dof_index distribute_dofs_on_cell(const typename ::hp::DoFHandler< 1, spacedim >::active_cell_iterator &cell, types::global_dof_index next_free_dof)
const unsigned int dofs_per_hex
#define Assert(cond, exc)
IteratorRange< active_cell_iterator > active_cell_iterators() const
active_cell_iterator end_active(const unsigned int level) const
types::global_dof_index n_boundary_dofs() const
types::global_dof_index n_dofs() const
static void reserve_space_vertices(DoFHandler< dim, spacedim > &dof_handler)
::internal::DoFHandler::DoFFaces< dim > * faces
ActiveSelector::cell_iterator cell_iterator
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
static void reserve_space(DoFHandler< 1, spacedim > &dof_handler)
void save_user_flags_hex(std::ostream &out) const
void add_range(const size_type begin, const size_type end)
void renumber_dofs(const std::vector< types::global_dof_index > &new_numbers)
std_cxx11::enable_if< std_cxx11::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
const Triangulation< dim, spacedim > & get_tria() const DEAL_II_DEPRECATED
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
std::vector< types::global_dof_index > n_locally_owned_dofs_per_processor
virtual void distribute_dofs(const FiniteElement< dim, spacedim > &fe)
FunctionMap< dim >::type FunctionMap
IteratorRange< cell_iterator > cell_iterators_on_level(const unsigned int level) const
const Triangulation< dim, spacedim > & get_triangulation() const
Iterator points to a valid object.
const unsigned int dofs_per_vertex
std::vector< IndexSet > locally_owned_dofs_per_processor
const types::boundary_id internal_face_boundary_id
types::global_dof_index n_global_dofs
unsigned int max_couplings_between_boundary_dofs() const
void clear_user_flags_line()
const types::global_dof_index invalid_dof_index
IteratorRange< cell_iterator > cell_iterators() const
virtual FiniteElementDomination::Domination compare_for_face_domination(const FiniteElement< dim, spacedim > &fe_other) const
std::vector< types::global_dof_index > vertex_dofs
Task< RT > new_task(const std_cxx11::function< RT()> &function)
IndexSet locally_owned_dofs