17 #ifndef __deal2__dof_accessor_templates_h 18 #define __deal2__dof_accessor_templates_h 21 #include <deal.II/base/config.h> 22 #include <deal.II/base/types.h> 23 #include <deal.II/lac/constraint_matrix.h> 24 #include <deal.II/dofs/dof_accessor.h> 25 #include <deal.II/dofs/dof_levels.h> 26 #include <deal.II/dofs/dof_faces.h> 27 #include <deal.II/hp/dof_level.h> 28 #include <deal.II/hp/dof_faces.h> 29 #include <deal.II/grid/tria_iterator.h> 30 #include <deal.II/grid/tria_iterator.templates.h> 41 template <
int structdim,
class DH,
bool lda>
45 Assert (
false, ExcInvalidObject());
50 template <
int structdim,
class DH,
bool lda>
56 const DH *dof_handler)
62 dof_handler(const_cast<DH *>(dof_handler))
67 template <
int structdim,
class DH,
bool lda>
68 template <
int structdim2,
int dim2,
int spacedim2>
71 Assert (
false, ExcInvalidObject());
76 template <
int structdim,
class DH,
bool lda>
77 template <
int dim2,
class DH2,
bool lda2>
82 Assert (
false, ExcInvalidObject());
87 template <
int structdim,
class DH,
bool lda>
97 template <
int structdim,
class DH,
bool lda>
102 Assert (dh != 0, ExcInvalidObject());
108 template <
int structdim,
class DH,
bool lda>
118 template <
int structdim,
class DH,
bool lda>
125 BaseClass::copy_from(da);
130 template <
int structdim,
class DH,
bool lda>
136 BaseClass::copy_from (a);
142 template <
int structdim,
class DH,
bool lda>
143 template <
int dim2,
class DH2,
bool lda2>
148 Assert (structdim == dim2, ExcCantCompareIterators());
150 return (BaseClass::operator == (a));
155 template <
int structdim,
class DH,
bool lda>
156 template <
int dim2,
class DH2,
bool lda2>
161 Assert (structdim == dim2, ExcCantCompareIterators());
163 return (BaseClass::operator != (a));
168 template <
int structdim,
class DH,
bool lda>
184 template <
int structdim,
class DH,
bool lda>
196 if (DH::dimension==structdim)
197 previous_level = this->
level () - 1;
227 template <
int spacedim>
231 const unsigned int obj_level,
232 const unsigned int obj_index,
233 const unsigned int fe_index,
234 const unsigned int local_index,
237 return dof_handler.levels[obj_level]->dof_object.
238 get_dof_index (dof_handler,
245 template <
int spacedim>
249 const unsigned int obj_level,
250 const unsigned int obj_index,
251 const unsigned int fe_index,
252 const unsigned int local_index,
256 dof_handler.levels[obj_level]->dof_object.
265 template <
int spacedim>
268 get_dof_index (const ::DoFHandler<2,spacedim> &dof_handler,
269 const unsigned int obj_level,
270 const unsigned int obj_index,
271 const unsigned int fe_index,
272 const unsigned int local_index,
277 return dof_handler.faces->lines.
278 get_dof_index (dof_handler,
285 template <
int spacedim>
289 const unsigned int obj_level,
290 const unsigned int obj_index,
291 const unsigned int fe_index,
292 const unsigned int local_index,
298 dof_handler.faces->lines.
307 template <
int spacedim>
310 get_dof_index (const ::DoFHandler<2,spacedim> &dof_handler,
311 const unsigned int obj_level,
312 const unsigned int obj_index,
313 const unsigned int fe_index,
314 const unsigned int local_index,
317 return dof_handler.levels[obj_level]->dof_object.
318 get_dof_index (dof_handler,
325 template <
int spacedim>
329 const unsigned int obj_level,
330 const unsigned int obj_index,
331 const unsigned int fe_index,
332 const unsigned int local_index,
336 dof_handler.levels[obj_level]->dof_object.
345 template <
int spacedim>
348 get_dof_index (const ::DoFHandler<3,spacedim> &dof_handler,
349 const unsigned int obj_level,
350 const unsigned int obj_index,
351 const unsigned int fe_index,
352 const unsigned int local_index,
357 return dof_handler.faces->lines.
358 get_dof_index (dof_handler,
365 template <
int spacedim>
369 const unsigned int obj_level,
370 const unsigned int obj_index,
371 const unsigned int fe_index,
372 const unsigned int local_index,
378 dof_handler.faces->lines.
388 template <
int spacedim>
391 get_dof_index (const ::DoFHandler<3,spacedim> &dof_handler,
392 const unsigned int obj_level,
393 const unsigned int obj_index,
394 const unsigned int fe_index,
395 const unsigned int local_index,
400 return dof_handler.faces->quads.
401 get_dof_index (dof_handler,
408 template <
int spacedim>
412 const unsigned int obj_level,
413 const unsigned int obj_index,
414 const unsigned int fe_index,
415 const unsigned int local_index,
421 dof_handler.faces->quads.
431 template <
int spacedim>
434 get_dof_index (const ::DoFHandler<3,spacedim> &dof_handler,
435 const unsigned int obj_level,
436 const unsigned int obj_index,
437 const unsigned int fe_index,
438 const unsigned int local_index,
441 return dof_handler.levels[obj_level]->dof_object.
442 get_dof_index (dof_handler,
449 template <
int spacedim>
453 const unsigned int obj_level,
454 const unsigned int obj_index,
455 const unsigned int fe_index,
456 const unsigned int local_index,
460 dof_handler.levels[obj_level]->dof_object.
469 template <
int spacedim>
472 get_dof_index (const ::hp::DoFHandler<1,spacedim> &dof_handler,
473 const unsigned int obj_level,
474 const unsigned int obj_index,
475 const unsigned int fe_index,
476 const unsigned int local_index,
477 const ::internal::int2type<1> &)
479 return dof_handler.levels[obj_level]->
480 get_dof_index (obj_index,
486 template <
int spacedim>
489 set_dof_index (const ::hp::DoFHandler<1,spacedim> &dof_handler,
490 const unsigned int obj_level,
491 const unsigned int obj_index,
492 const unsigned int fe_index,
493 const unsigned int local_index,
494 const ::internal::int2type<1> &,
497 dof_handler.levels[obj_level]->
505 template <
int spacedim>
508 get_dof_index (const ::hp::DoFHandler<2,spacedim> &dof_handler,
509 const unsigned int obj_level,
510 const unsigned int obj_index,
511 const unsigned int fe_index,
512 const unsigned int local_index,
513 const ::internal::int2type<1> &)
515 return dof_handler.faces->lines.
516 get_dof_index (dof_handler,
524 template <
int spacedim>
527 set_dof_index (const ::hp::DoFHandler<2,spacedim> &dof_handler,
528 const unsigned int obj_level,
529 const unsigned int obj_index,
530 const unsigned int fe_index,
531 const unsigned int local_index,
532 const ::internal::int2type<1> &,
535 dof_handler.faces->lines.
545 template <
int spacedim>
548 get_dof_index (const ::hp::DoFHandler<2,spacedim> &dof_handler,
549 const unsigned int obj_level,
550 const unsigned int obj_index,
551 const unsigned int fe_index,
552 const unsigned int local_index,
553 const ::internal::int2type<2> &)
555 return dof_handler.levels[obj_level]->
556 get_dof_index (obj_index,
562 template <
int spacedim>
565 set_dof_index (const ::hp::DoFHandler<2,spacedim> &dof_handler,
566 const unsigned int obj_level,
567 const unsigned int obj_index,
568 const unsigned int fe_index,
569 const unsigned int local_index,
570 const ::internal::int2type<2> &,
573 dof_handler.levels[obj_level]->
581 template <
int spacedim>
584 get_dof_index (const ::hp::DoFHandler<3,spacedim> &dof_handler,
585 const unsigned int obj_level,
586 const unsigned int obj_index,
587 const unsigned int fe_index,
588 const unsigned int local_index,
589 const ::internal::int2type<1> &)
591 return dof_handler.faces->lines.
592 get_dof_index (dof_handler,
600 template <
int spacedim>
603 set_dof_index (const ::hp::DoFHandler<3,spacedim> &dof_handler,
604 const unsigned int obj_level,
605 const unsigned int obj_index,
606 const unsigned int fe_index,
607 const unsigned int local_index,
608 const ::internal::int2type<1> &,
611 dof_handler.faces->lines.
621 template <
int spacedim>
624 get_dof_index (const ::hp::DoFHandler<3,spacedim> &dof_handler,
625 const unsigned int obj_level,
626 const unsigned int obj_index,
627 const unsigned int fe_index,
628 const unsigned int local_index,
629 const ::internal::int2type<2> &)
631 return dof_handler.faces->quads.
632 get_dof_index (dof_handler,
640 template <
int spacedim>
643 set_dof_index (const ::hp::DoFHandler<3,spacedim> &dof_handler,
644 const unsigned int obj_level,
645 const unsigned int obj_index,
646 const unsigned int fe_index,
647 const unsigned int local_index,
648 const ::internal::int2type<2> &,
651 dof_handler.faces->quads.
661 template <
int spacedim>
664 get_dof_index (const ::hp::DoFHandler<3,spacedim> &dof_handler,
665 const unsigned int obj_level,
666 const unsigned int obj_index,
667 const unsigned int fe_index,
668 const unsigned int local_index,
669 const ::internal::int2type<3> &)
671 return dof_handler.levels[obj_level]->
672 get_dof_index (obj_index,
678 template <
int spacedim>
681 set_dof_index (const ::hp::DoFHandler<3,spacedim> &dof_handler,
682 const unsigned int obj_level,
683 const unsigned int obj_index,
684 const unsigned int fe_index,
685 const unsigned int local_index,
686 const ::internal::int2type<3> &,
689 dof_handler.levels[obj_level]->
697 template <
int structdim,
int dim,
int spacedim>
703 const unsigned int fe_index,
704 const ::internal::int2type<structdim> &)
706 return (fe_index == 0);
711 template <
int structdim,
int dim,
int spacedim>
715 const unsigned int obj_level,
716 const unsigned int obj_index,
717 const ::internal::int2type<structdim> &)
737 raw_cell_iterator (&dof_handler.get_tria(),
751 ExcMessage (
"This cell is not active and therefore can't be " 752 "queried for its active FE indices"));
758 template <
int structdim,
int dim,
int spacedim>
762 const unsigned int obj_level,
763 const unsigned int obj_index,
764 const unsigned int n,
765 const ::internal::int2type<structdim> &)
785 raw_cell_iterator (&dof_handler.get_tria(),
799 ExcMessage (
"This cell is not active and therefore can't be " 800 "queried for its active FE indices"));
803 return ::DoFHandler<dim,spacedim>::default_fe_index;
807 template <
int spacedim>
811 const unsigned int obj_level,
812 const unsigned int obj_index,
813 const unsigned int fe_index,
814 const ::internal::int2type<1> &)
816 return dof_handler.levels[obj_level]->fe_index_is_active(obj_index,
821 template <
int spacedim>
825 const unsigned int obj_level,
826 const unsigned int obj_index,
827 const ::internal::int2type<1> &)
835 template <
int spacedim>
839 const unsigned int obj_level,
840 const unsigned int obj_index,
841 const unsigned int n,
842 const ::internal::int2type<1> &)
844 Assert (n==0,
ExcMessage(
"On cells, there can only be one active FE index"));
845 return dof_handler.levels[obj_level]->active_fe_index (obj_index);
849 template <
int spacedim>
853 const unsigned int obj_level,
854 const unsigned int obj_index,
855 const unsigned int fe_index,
856 const ::internal::int2type<1> &)
858 return dof_handler.faces->lines.fe_index_is_active(dof_handler,
865 template <
int spacedim>
870 const unsigned int obj_index,
871 const ::internal::int2type<1> &)
873 return dof_handler.faces->lines.n_active_fe_indices (dof_handler,
878 template <
int spacedim>
882 const unsigned int obj_level,
883 const unsigned int obj_index,
884 const unsigned int n,
885 const ::internal::int2type<1> &)
887 return dof_handler.faces->lines.nth_active_fe_index (dof_handler,
895 template <
int spacedim>
899 const unsigned int obj_level,
900 const unsigned int obj_index,
901 const unsigned int fe_index,
902 const ::internal::int2type<2> &)
904 return dof_handler.levels[obj_level]->fe_index_is_active(obj_index,
909 template <
int spacedim>
913 const unsigned int obj_level,
914 const unsigned int obj_index,
915 const ::internal::int2type<2> &)
923 template <
int spacedim>
927 const unsigned int obj_level,
928 const unsigned int obj_index,
929 const unsigned int n,
930 const ::internal::int2type<2> &)
932 Assert (n==0,
ExcMessage(
"On cells, there can only be one active FE index"));
933 return dof_handler.levels[obj_level]->active_fe_index (obj_index);
938 template <
int spacedim>
942 const unsigned int obj_level,
943 const unsigned int obj_index,
944 const unsigned int fe_index,
945 const ::internal::int2type<1> &)
947 return dof_handler.faces->lines.fe_index_is_active(dof_handler,
954 template <
int spacedim>
959 const unsigned int obj_index,
960 const ::internal::int2type<1> &)
962 return dof_handler.faces->lines.n_active_fe_indices (dof_handler,
968 template <
int spacedim>
972 const unsigned int obj_level,
973 const unsigned int obj_index,
974 const unsigned int n,
975 const ::internal::int2type<1> &)
977 return dof_handler.faces->lines.nth_active_fe_index (dof_handler,
985 template <
int spacedim>
989 const unsigned int obj_level,
990 const unsigned int obj_index,
991 const unsigned int fe_index,
992 const ::internal::int2type<2> &)
994 return dof_handler.faces->quads.fe_index_is_active(dof_handler,
1000 template <
int spacedim>
1004 const unsigned int obj_level,
1005 const unsigned int obj_index,
1006 const unsigned int fe_index,
1007 const ::internal::int2type<3> &)
1009 return dof_handler.levels[obj_level]->fe_index_is_active(obj_index,
1014 template <
int spacedim>
1018 const unsigned int ,
1019 const unsigned int obj_index,
1020 const ::internal::int2type<2> &)
1022 return dof_handler.faces->quads.n_active_fe_indices (dof_handler,
1028 template <
int spacedim>
1032 const unsigned int obj_level,
1033 const unsigned int obj_index,
1034 const unsigned int n,
1035 const ::internal::int2type<2> &)
1037 return dof_handler.faces->quads.nth_active_fe_index (dof_handler,
1045 template <
int spacedim>
1049 const unsigned int obj_level,
1050 const unsigned int obj_index,
1051 const ::internal::int2type<3> &)
1059 template <
int spacedim>
1063 const unsigned int obj_level,
1064 const unsigned int obj_index,
1065 const unsigned int n,
1066 const ::internal::int2type<3> &)
1068 Assert (n==0,
ExcMessage(
"On cells, there can only be one active FE index"));
1069 return dof_handler.levels[obj_level]->active_fe_index (obj_index);
1082 template <
int dim,
int spacedim>
1087 const unsigned int fe_index,
1088 const unsigned int local_index,
1092 ExcMessage (
"Only the default FE index is allowed for non-hp DoFHandler objects"));
1094 ExcMessage (
"No finite element collection is associated with " 1095 "this DoFHandler"));
1096 Assert (local_index < dof_handler.selected_fe->dofs_per_vertex,
1107 template <
int dim,
int spacedim>
1112 const unsigned int fe_index,
1113 const unsigned int local_index,
1117 ExcMessage (
"You need to specify a FE index when working " 1118 "with hp DoFHandlers"));
1120 ExcMessage (
"No finite element collection is associated with " 1121 "this DoFHandler"));
1125 Assert (fe_index < dof_handler.finite_elements->size(),
1129 ExcMessage (
"This vertex is unused and has no DoFs associated with it"));
1150 Assert (this_fe_index < dof_handler.finite_elements->size(),
1153 if (this_fe_index == fe_index)
1155 *(pointer + 1 + local_index) = global_index;
1176 template <
int dim,
int spacedim>
1180 const unsigned int vertex_index,
1181 const unsigned int fe_index,
1182 const unsigned int local_index)
1185 ExcMessage (
"Only the default FE index is allowed for non-hp DoFHandler objects"));
1186 Assert (dof_handler.selected_fe != 0,
1187 ExcMessage (
"No finite element collection is associated with " 1188 "this DoFHandler"));
1189 Assert (local_index < dof_handler.selected_fe->dofs_per_vertex,
1191 dof_handler.selected_fe->dofs_per_vertex));
1194 dof_handler.vertex_dofs[vertex_index *
1195 dof_handler.selected_fe->dofs_per_vertex
1200 template<
int dim,
int spacedim>
1203 get_vertex_dof_index (const ::hp::DoFHandler<dim,spacedim> &dof_handler,
1204 const unsigned int vertex_index,
1205 const unsigned int fe_index,
1206 const unsigned int local_index)
1209 ExcMessage (
"You need to specify a FE index when working " 1210 "with hp DoFHandlers"));
1211 Assert (dof_handler.finite_elements != 0,
1212 ExcMessage (
"No finite element collection is associated with " 1213 "this DoFHandler"));
1214 Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex,
1216 (*dof_handler.finite_elements)[fe_index].dofs_per_vertex));
1217 Assert (vertex_index < dof_handler.vertex_dofs_offsets.size(),
1219 dof_handler.vertex_dofs_offsets.size()));
1220 Assert (dof_handler.vertex_dofs_offsets[vertex_index] !=
1222 ExcMessage (
"This vertex is unused and has no DoFs associated with it"));
1242 Assert (this_fe_index < dof_handler.finite_elements->size(),
1245 if (this_fe_index == fe_index)
1246 return *(pointer + 1 + local_index);
1249 (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1);
1260 template<
int dim,
int spacedim>
1264 const unsigned int vertex_index)
1266 Assert (dof_handler.finite_elements != 0,
1267 ExcMessage (
"No finite element collection is associated with " 1268 "this DoFHandler"));
1283 unsigned int counter = 0;
1295 (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1);
1308 template<
int dim,
int spacedim>
1312 const unsigned int vertex_index,
1313 const unsigned int n)
1315 Assert (dof_handler.finite_elements != 0,
1316 ExcMessage (
"No finite element collection is associated with " 1317 "this DoFHandler"));
1318 Assert (n < n_active_vertex_fe_indices(dof_handler, vertex_index),
1319 ExcIndexRange (n, 0, n_active_vertex_fe_indices(dof_handler,
1323 Assert (dof_handler.vertex_dofs_offsets[vertex_index] !=
1336 unsigned int counter = 0;
1344 Assert (this_fe_index < dof_handler.finite_elements->size(),
1348 return this_fe_index;
1354 (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1);
1367 template<
int dim,
int spacedim>
1371 const unsigned int vertex_index,
1372 const unsigned int fe_index)
1375 ExcMessage (
"You need to specify a FE index when working " 1376 "with hp DoFHandlers"));
1377 Assert (dof_handler.finite_elements != 0,
1378 ExcMessage (
"No finite element collection is associated with " 1379 "this DoFHandler"));
1380 Assert (fe_index < dof_handler.finite_elements->size(),
1385 Assert (dof_handler.vertex_dofs_offsets[vertex_index] !=
1405 Assert (this_fe_index < dof_handler.finite_elements->size(),
1410 else if (this_fe_index == fe_index)
1413 pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1;
1417 template<
class DH,
bool lda>
1421 const std::vector<types::global_dof_index> &,
1429 template<
class DH,
bool lda>
1433 const std::vector<types::global_dof_index> &dof_indices,
1434 const unsigned int fe_index)
1437 std::vector<types::global_dof_index>::const_iterator next = dof_indices.begin ();
1439 for (
unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++
vertex)
1441 accessor.set_mg_vertex_dof_index(level,
vertex, dof, *next++, fe_index);
1443 for (
unsigned int line = 0; line < GeometryInfo<2>::lines_per_cell; ++
line)
1445 accessor.
line(
line)->set_mg_dof_index(level, dof, *next++);
1448 accessor.set_mg_dof_index(level, dof, *next++);
1455 template<
class DH,
bool lda>
1459 const std::vector<types::global_dof_index> &,
1471 template <
int dim,
class DH,
bool lda>
1475 const unsigned int fe_index)
const 1478 return ::internal::DoFAccessor::Implementation::get_dof_index (*this->
dof_handler,
1487 template<
int structdim,
class DH,
bool lda>
1491 const unsigned int i)
const 1497 template <
int dim,
class DH,
bool lda>
1502 const unsigned int fe_index)
const 1505 ::internal::DoFAccessor::Implementation::set_dof_index (*this->
dof_handler,
1516 template <
int dim,
class DH,
bool lda>
1523 ::internal::DoFAccessor::Implementation::
1532 template <
int dim,
class DH,
bool lda>
1539 ::internal::DoFAccessor::Implementation::
1549 template <
int dim,
class DH,
bool lda>
1556 ::internal::DoFAccessor::Implementation::
1566 template <
int structdim,
class DH,
bool lda>
1570 const unsigned int i,
1571 const unsigned int fe_index)
const 1574 ::internal::DoFAccessor::Implementation::get_vertex_dof_index
1582 template<
int structdim,
class DH,
bool lda>
1586 const unsigned int vertex,
1587 const unsigned int i,
1588 const unsigned int fe_index)
const 1598 template <
int structdim,
class DH,
bool lda>
1602 const unsigned int i,
1604 const unsigned int fe_index)
const 1615 template<
int structdim,
class DH,
bool lda>
1619 const unsigned int vertex,
1620 const unsigned int i,
1622 const unsigned int fe_index)
const 1632 template<
int structdim,
class DH,
bool lda>
1636 const unsigned int i,
1647 template <
int dim,
int spacedim>
1658 template <
int dim,
int spacedim>
1661 get_fe (const ::hp::FECollection<dim,spacedim> &fe,
1662 const unsigned int index)
1670 template <
int dim,
class DH,
bool lda>
1676 ExcMessage (
"This function can only be called for active fe indices"));
1678 return ::internal::DoFAccessor::get_fe (this->
dof_handler->get_fe(), fe_index);
1687 template <
class DH,
bool lda>
1689 std::vector<types::global_dof_index> &dof_indices,
1690 const unsigned int fe_index)
1692 const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex,
1693 dofs_per_line = accessor.get_fe(fe_index).dofs_per_line;
1694 std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
1696 for (
unsigned int d=0; d<dofs_per_vertex; ++d)
1697 *next++ = accessor.vertex_dof_index(
vertex,d,fe_index);
1698 for (
unsigned int d=0; d<dofs_per_line; ++d)
1699 *next++ = accessor.dof_index(d,fe_index);
1704 template <
class DH,
bool lda>
1706 std::vector<types::global_dof_index> &dof_indices,
1707 const unsigned int fe_index)
1709 const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex,
1710 dofs_per_line = accessor.get_fe(fe_index).dofs_per_line,
1711 dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad;
1712 std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
1714 for (
unsigned int d=0; d<dofs_per_vertex; ++d)
1715 *next++ = accessor.vertex_dof_index(
vertex,d,fe_index);
1728 for (
unsigned int d=0; d<dofs_per_line; ++d)
1729 *next++ = accessor.line(
line)->dof_index(accessor.get_fe(fe_index).
1730 adjust_line_dof_index_for_line_orientation(d,
1731 accessor.line_orientation(
line)),
1733 for (
unsigned int d=0; d<dofs_per_quad; ++d)
1734 *next++ = accessor.dof_index(d,fe_index);
1739 template <
class DH,
bool lda>
1741 std::vector<types::global_dof_index> &dof_indices,
1742 const unsigned int fe_index)
1744 const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex,
1745 dofs_per_line = accessor.get_fe(fe_index).dofs_per_line,
1746 dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad,
1747 dofs_per_hex = accessor.get_fe(fe_index).dofs_per_hex;
1748 std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
1750 for (
unsigned int d=0; d<dofs_per_vertex; ++d)
1751 *next++ = accessor.vertex_dof_index(
vertex,d,fe_index);
1764 for (
unsigned int d=0; d<dofs_per_line; ++d)
1765 *next++ = accessor.line(
line)->dof_index(accessor.get_fe(fe_index).
1766 adjust_line_dof_index_for_line_orientation(d,
1767 accessor.line_orientation(
line)),fe_index);
1782 for (
unsigned int d=0; d<dofs_per_quad; ++d)
1783 *next++ = accessor.quad(
quad)->dof_index(accessor.get_fe(fe_index).
1784 adjust_quad_dof_index_for_face_orientation(d,
1785 accessor.face_orientation(
quad),
1786 accessor.face_flip(
quad),
1787 accessor.face_rotation(
quad)),
1789 for (
unsigned int d=0; d<dofs_per_hex; ++d)
1790 *next++ = accessor.dof_index(d,fe_index);
1795 template<
class DH,
bool lda>
1798 std::vector<types::global_dof_index> &dof_indices,
1799 const unsigned int fe_index)
1801 const DH &handler = accessor.get_dof_handler();
1806 = handler.get_fe ()[fe_index];
1807 std::vector<types::global_dof_index>::iterator next = dof_indices.begin ();
1809 for (
unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell; ++
vertex)
1810 for (
unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
1811 *next++ = accessor.mg_vertex_dof_index (level,
vertex, dof);
1813 for (
unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
1814 *next++ = accessor.mg_dof_index (level, dof);
1821 template<
class DH,
bool lda>
1824 std::vector<types::global_dof_index> &dof_indices,
1825 const unsigned int fe_index)
1827 const DH &handler = accessor.get_dof_handler();
1832 std::vector<types::global_dof_index>::iterator next = dof_indices.begin ();
1834 for (
unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++
vertex)
1835 for (
unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
1836 *next++ = accessor.mg_vertex_dof_index (level,
vertex, dof);
1838 for (
unsigned int line = 0; line < GeometryInfo<2>::lines_per_cell; ++
line)
1839 for (
unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
1840 *next++ = accessor.line (
line)->mg_dof_index (level, dof);
1842 for (
unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof)
1843 *next++ = accessor.mg_dof_index (level, dof);
1850 template<
class DH,
bool lda>
1853 std::vector<types::global_dof_index> &dof_indices,
1854 const unsigned int fe_index)
1856 const DH &handler = accessor.get_dof_handler();
1861 std::vector<types::global_dof_index>::iterator next = dof_indices.begin ();
1863 for (
unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell; ++
vertex)
1864 for (
unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
1865 *next++ = accessor.mg_vertex_dof_index (level,
vertex, dof);
1867 for (
unsigned int line = 0; line < GeometryInfo<3>::lines_per_cell; ++
line)
1868 for (
unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
1869 *next++ = accessor.line (
line)->mg_dof_index (level, dof);
1871 for (
unsigned int quad = 0; quad < GeometryInfo<3>::quads_per_cell; ++
quad)
1872 for (
unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof)
1873 *next++ = accessor.quad (
quad)->mg_dof_index (level, dof);
1875 for (
unsigned int dof = 0; dof < fe.dofs_per_hex; ++dof)
1876 *next++ = accessor.mg_dof_index (level, dof);
1886 template <
int structdim,
class DH,
bool lda>
1890 const unsigned int fe_index)
const 1900 Assert (dof_indices.size() ==
1901 (2*this->
dof_handler->get_fe()[fe_index].dofs_per_vertex +
1902 this->
dof_handler->get_fe()[fe_index].dofs_per_line),
1903 ExcVectorDoesNotMatch());
1906 Assert (dof_indices.size() ==
1907 (4*this->
dof_handler->get_fe()[fe_index].dofs_per_vertex +
1908 4*this->
dof_handler->get_fe()[fe_index].dofs_per_line +
1909 this->
dof_handler->get_fe()[fe_index].dofs_per_quad),
1910 ExcVectorDoesNotMatch());
1913 Assert (dof_indices.size() ==
1914 (8*this->
dof_handler->get_fe()[fe_index].dofs_per_vertex +
1915 12*this->
dof_handler->get_fe()[fe_index].dofs_per_line +
1916 6*this->
dof_handler->get_fe()[fe_index].dofs_per_quad +
1917 this->
dof_handler->get_fe()[fe_index].dofs_per_hex),
1918 ExcVectorDoesNotMatch());
1938 (this->
dof_handler->get_fe()[fe_index].dofs_per_cell ==
1940 this->
dof_handler->get_fe()[fe_index].dofs_per_vertex),
1944 ::internal::DoFAccessor::get_dof_indices (*
this, dof_indices, fe_index);
1949 template<
int structdim,
class DH,
bool lda>
1952 std::vector<types::global_dof_index> &dof_indices,
1953 const unsigned int fe_index)
const 1962 Assert (dof_indices.size () ==
1963 2 * this->
dof_handler->get_fe ()[fe_index].dofs_per_vertex +
1964 this->
dof_handler->get_fe ()[fe_index].dofs_per_line,
1965 ExcVectorDoesNotMatch ());
1971 Assert (dof_indices.size () ==
1972 4 * (this->
dof_handler->get_fe ()[fe_index].dofs_per_vertex +
1973 this->
dof_handler->get_fe ()[fe_index].dofs_per_line) +
1974 this->
dof_handler->get_fe ()[fe_index].dofs_per_quad,
1975 ExcVectorDoesNotMatch ());
1981 Assert (dof_indices.size () ==
1982 8 * this->
dof_handler->get_fe ()[fe_index].dofs_per_vertex +
1983 12 * this->
dof_handler->get_fe ()[fe_index].dofs_per_line +
1984 6 * this->
dof_handler->get_fe ()[fe_index].dofs_per_quad +
1985 this->
dof_handler->get_fe ()[fe_index].dofs_per_hex,
1986 ExcVectorDoesNotMatch ());
1994 internal::DoFAccessor::get_mg_dof_indices (*
this,
2001 template<
int structdim,
class DH,
bool lda>
2004 const std::vector<types::global_dof_index> &dof_indices,
2005 const unsigned int fe_index)
2014 Assert (dof_indices.size () ==
2015 2 * this->
dof_handler->get_fe ()[fe_index].dofs_per_vertex +
2016 this->
dof_handler->get_fe ()[fe_index].dofs_per_line,
2017 ExcVectorDoesNotMatch ());
2023 Assert (dof_indices.size () ==
2024 4 * (this->
dof_handler->get_fe ()[fe_index].dofs_per_vertex +
2025 this->
dof_handler->get_fe ()[fe_index].dofs_per_line) +
2026 this->
dof_handler->get_fe ()[fe_index].dofs_per_quad,
2027 ExcVectorDoesNotMatch ());
2033 Assert (dof_indices.size () ==
2034 8 * this->
dof_handler->get_fe ()[fe_index].dofs_per_vertex +
2035 12 * this->
dof_handler->get_fe ()[fe_index].dofs_per_line +
2036 6 * this->
dof_handler->get_fe ()[fe_index].dofs_per_quad +
2037 this->
dof_handler->get_fe ()[fe_index].dofs_per_hex,
2038 ExcVectorDoesNotMatch ());
2046 internal::DoFAccessor::Implementation::set_mg_dof_indices (*
this,
2057 template <
bool lda,
class DH>
2059 typename ::internal::DoFHandler::Iterators<DH, lda>::quad_iterator
2060 get_quad(const ::Triangulation<DH::dimension, DH::space_dimension> *
tria,
2069 typename ::internal::DoFHandler::Iterators<::DoFHandler<2,2>, lda>::quad_iterator
2070 get_quad(const ::Triangulation<2,2> *,
2075 return typename ::internal::DoFHandler::Iterators<::DoFHandler<2,2>, lda>::line_iterator();
2080 typename ::internal::DoFHandler::Iterators<::DoFHandler<2,3>, lda>::quad_iterator
2081 get_quad(const ::Triangulation<2,3> *,
2086 return typename ::internal::DoFHandler::Iterators<::DoFHandler<2,3>, lda>::line_iterator();
2091 typename ::internal::DoFHandler::Iterators<::hp::DoFHandler<2,2>, lda>::quad_iterator
2092 get_quad(const ::Triangulation<2,2> *,
2097 return typename ::internal::DoFHandler::Iterators<::hp::DoFHandler<2,2>, lda>::line_iterator();
2102 typename ::internal::DoFHandler::Iterators<::hp::DoFHandler<2,3>, lda>::quad_iterator
2103 get_quad(const ::Triangulation<2,3> *,
2108 return typename ::internal::DoFHandler::Iterators<::hp::DoFHandler<2,3>, lda>::line_iterator();
2114 template <
int structdim,
class DH,
bool lda>
2116 typename ::internal::DoFHandler::Iterators<DH,lda>::line_iterator
2125 "current object is a line itself."));
2127 typename ::internal::DoFHandler::Iterators<DH,lda>::cell_iterator
2139 return typename ::internal::DoFHandler::Iterators<DH,lda>::line_iterator
2147 template <
int structdim,
class DH,
bool lda>
2149 typename ::internal::DoFHandler::Iterators<DH,lda>::quad_iterator
2160 "current object is a quad itself."));
2162 typename ::internal::DoFHandler::Iterators<DH>::cell_iterator
2174 return typename ::internal::DoFHandler::Iterators<DH,lda>::quad_iterator
2185 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2189 Assert (
false, ExcInvalidObject());
2194 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2210 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2216 const DH<1,spacedim> *)
2221 ExcMessage (
"This constructor can not be called for face iterators in 1d."));
2226 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2227 template <
int structdim2,
int dim2,
int spacedim2>
2230 Assert (
false, ExcInvalidObject());
2235 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2236 template <
int dim2,
class DH2,
bool lda2>
2240 Assert (
false, ExcInvalidObject());
2245 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2250 Assert (dh != 0, ExcInvalidObject());
2256 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2258 const DH<1,spacedim> &
2266 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2270 std::vector<types::global_dof_index> &dof_indices,
2271 const unsigned int fe_index)
const 2273 for (
unsigned int i=0; i<dof_indices.size(); ++i)
2277 this->global_vertex_index,
2284 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2289 const unsigned int i,
2290 const unsigned int fe_index)
const 2293 return ::internal::DoFAccessor::Implementation::get_vertex_dof_index (
2295 this->global_vertex_index,
2302 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2308 BaseClass::copy_from(da);
2313 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2314 template <
bool lda2>
2319 BaseClass::copy_from (a);
2325 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2326 template <
int dim2,
class DH2,
bool lda2>
2331 Assert (dim2 == 0, ExcCantCompareIterators());
2333 return (BaseClass::operator == (a));
2338 template <
template <
int,
int>
class DH,
int spacedim,
bool lda>
2339 template <
int dim2,
class DH2,
bool lda2>
2344 Assert (dim2 == 0, ExcCantCompareIterators());
2346 return (BaseClass::operator != (a));
2362 using ::DoFCellAccessor;
2377 template <
int spacedim,
bool lda>
2389 if (accessor.has_children()
2391 (accessor.get_fe().dofs_per_cell !=
2395 const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex,
2396 dofs_per_line = accessor.get_fe().dofs_per_line,
2397 dofs_per_cell = accessor.get_fe().dofs_per_cell;
2403 Assert (accessor.present_index * dofs_per_cell + dofs_per_cell
2405 accessor.dof_handler->levels[accessor.present_level]
2406 ->cell_dof_indices_cache.size(),
2409 std::vector<types::global_dof_index>::iterator next
2410 = (accessor.dof_handler->levels[accessor.present_level]
2411 ->cell_dof_indices_cache.begin() + accessor.present_index * dofs_per_cell);
2414 for (
unsigned int d=0; d<dofs_per_vertex; ++d)
2415 *next++ = accessor.vertex_dof_index(
vertex,d);
2416 for (
unsigned int d=0; d<dofs_per_line; ++d)
2417 *next++ = accessor.dof_index(d);
2422 template <
int spacedim,
bool lda>
2434 if (accessor.has_children()
2436 (accessor.get_fe().dofs_per_cell !=
2440 const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex,
2441 dofs_per_line = accessor.get_fe().dofs_per_line,
2442 dofs_per_quad = accessor.get_fe().dofs_per_quad,
2443 dofs_per_cell = accessor.get_fe().dofs_per_cell;
2449 Assert (accessor.present_index * dofs_per_cell + dofs_per_cell
2451 accessor.dof_handler->levels[accessor.present_level]
2452 ->cell_dof_indices_cache.size(),
2455 std::vector<types::global_dof_index>::iterator next
2456 = (accessor.dof_handler->levels[accessor.present_level]
2457 ->cell_dof_indices_cache.begin() + accessor.present_index * dofs_per_cell);
2460 for (
unsigned int d=0; d<dofs_per_vertex; ++d)
2461 *next++ = accessor.vertex_dof_index(
vertex,d);
2463 for (
unsigned int d=0; d<dofs_per_line; ++d)
2464 *next++ = accessor.line(
line)->dof_index(d);
2465 for (
unsigned int d=0; d<dofs_per_quad; ++d)
2466 *next++ = accessor.dof_index(d);
2470 template <
int spacedim,
bool lda>
2482 if (accessor.has_children()
2484 (accessor.get_fe().dofs_per_cell !=
2488 const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex,
2489 dofs_per_line = accessor.get_fe().dofs_per_line,
2490 dofs_per_quad = accessor.get_fe().dofs_per_quad,
2491 dofs_per_hex = accessor.get_fe().dofs_per_hex,
2492 dofs_per_cell = accessor.get_fe().dofs_per_cell;
2498 Assert (accessor.present_index * dofs_per_cell + dofs_per_cell
2500 accessor.dof_handler->levels[accessor.present_level]
2501 ->cell_dof_indices_cache.size(),
2504 std::vector<types::global_dof_index>::iterator next
2505 = (accessor.dof_handler->levels[accessor.present_level]
2506 ->cell_dof_indices_cache.begin() + accessor.present_index * dofs_per_cell);
2509 for (
unsigned int d=0; d<dofs_per_vertex; ++d)
2510 *next++ = accessor.vertex_dof_index(
vertex,d);
2523 for (
unsigned int d=0; d<dofs_per_line; ++d)
2524 *next++ = accessor.line(
line)->dof_index(accessor.dof_handler->get_fe().
2525 adjust_line_dof_index_for_line_orientation(d,
2526 accessor.line_orientation(
line)));
2541 for (
unsigned int d=0; d<dofs_per_quad; ++d)
2542 *next++ = accessor.quad(
quad)->dof_index(accessor.dof_handler->get_fe().
2543 adjust_quad_dof_index_for_face_orientation(d,
2544 accessor.face_orientation(
quad),
2545 accessor.face_flip(
quad),
2546 accessor.face_rotation(
quad)));
2547 for (
unsigned int d=0; d<dofs_per_hex; ++d)
2548 *next++ = accessor.dof_index(d);
2556 template <
int dim,
int spacedim,
bool lda>
2562 if (accessor.has_children())
2565 const unsigned int dofs_per_cell = accessor.get_fe().dofs_per_cell;
2571 Assert (static_cast<unsigned int>(accessor.present_index)
2573 accessor.dof_handler->levels[accessor.present_level]
2574 ->cell_cache_offsets.size(),
2576 Assert (accessor.dof_handler->levels[accessor.present_level]
2577 ->cell_cache_offsets[accessor.present_index]
2579 accessor.dof_handler->levels[accessor.present_level]
2580 ->cell_dof_indices_cache.size(),
2583 std::vector<types::global_dof_index> dof_indices (dofs_per_cell);
2584 static_cast<const ::DoFAccessor<dim,::hp::DoFHandler<dim,spacedim>,lda
> &>
2588 = &accessor.dof_handler->levels[accessor.present_level]
2589 ->cell_dof_indices_cache[accessor.dof_handler->levels[accessor.present_level]
2590 ->cell_cache_offsets[accessor.present_index]];
2591 for (
unsigned int i=0; i<dofs_per_cell; ++i, ++next_dof_index)
2592 *next_dof_index = dof_indices[i];
2604 template <
int spacedim,
bool lda>
2608 const std::vector<types::global_dof_index> &local_dof_indices)
2610 Assert (accessor.has_children() ==
false,
2613 const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex,
2614 dofs_per_line = accessor.get_fe().dofs_per_line,
2615 dofs_per_cell = accessor.get_fe().dofs_per_cell;
2617 Assert (local_dof_indices.size() == dofs_per_cell,
2620 unsigned int index = 0;
2623 for (
unsigned int d=0; d<dofs_per_vertex; ++d, ++
index)
2624 accessor.set_vertex_dof_index(
vertex,d,
2625 local_dof_indices[index]);
2627 for (
unsigned int d=0; d<dofs_per_line; ++d, ++
index)
2628 accessor.set_dof_index(d, local_dof_indices[index]);
2630 Assert (index == dofs_per_cell,
2636 template <
int spacedim,
bool lda>
2640 const std::vector<types::global_dof_index> &local_dof_indices)
2642 Assert (accessor.has_children() ==
false,
2645 const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex,
2646 dofs_per_line = accessor.get_fe().dofs_per_line,
2647 dofs_per_quad = accessor.get_fe().dofs_per_quad,
2648 dofs_per_cell = accessor.get_fe().dofs_per_cell;
2650 Assert (local_dof_indices.size() == dofs_per_cell,
2653 unsigned int index = 0;
2656 for (
unsigned int d=0; d<dofs_per_vertex; ++d, ++
index)
2657 accessor.set_vertex_dof_index(
vertex,d,
2658 local_dof_indices[index]);
2660 for (
unsigned int d=0; d<dofs_per_line; ++d, ++
index)
2661 accessor.line(
line)->set_dof_index(d, local_dof_indices[index]);
2663 for (
unsigned int d=0; d<dofs_per_quad; ++d, ++
index)
2664 accessor.set_dof_index(d, local_dof_indices[index]);
2666 Assert (index == dofs_per_cell,
2672 template <
int spacedim,
bool lda>
2676 const std::vector<types::global_dof_index> &local_dof_indices)
2678 Assert (accessor.has_children() ==
false,
2681 const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex,
2682 dofs_per_line = accessor.get_fe().dofs_per_line,
2683 dofs_per_quad = accessor.get_fe().dofs_per_quad,
2684 dofs_per_hex = accessor.get_fe().dofs_per_hex,
2685 dofs_per_cell = accessor.get_fe().dofs_per_cell;
2687 Assert (local_dof_indices.size() == dofs_per_cell,
2690 unsigned int index = 0;
2693 for (
unsigned int d=0; d<dofs_per_vertex; ++d, ++
index)
2694 accessor.set_vertex_dof_index(
vertex,d,
2695 local_dof_indices[index]);
2708 for (
unsigned int d=0; d<dofs_per_line; ++d, ++
index)
2709 accessor.line(
line)->set_dof_index(accessor.dof_handler->get_fe().
2710 adjust_line_dof_index_for_line_orientation(d,
2711 accessor.line_orientation(
line)),
2712 local_dof_indices[index]);
2727 for (
unsigned int d=0; d<dofs_per_quad; ++d, ++
index)
2728 accessor.quad(
quad)->set_dof_index(accessor.dof_handler->get_fe().
2729 adjust_quad_dof_index_for_face_orientation(d,
2730 accessor.face_orientation(
quad),
2731 accessor.face_flip(
quad),
2732 accessor.face_rotation(
quad)),
2733 local_dof_indices[index]);
2734 for (
unsigned int d=0; d<dofs_per_hex; ++d, ++
index)
2735 accessor.set_dof_index(d, local_dof_indices[index]);
2737 Assert (index == dofs_per_cell,
2746 template <
int dim,
int spacedim,
bool lda>
2750 const std::vector<types::global_dof_index> &)
2762 template <
int dim,
int spacedim,
bool lda>
2775 template <
int dim,
int spacedim,
bool lda>
2780 Assert (static_cast<unsigned int>(accessor.level()) < accessor.dof_handler->levels.size(),
2783 return accessor.dof_handler->levels[accessor.level()]
2784 ->active_fe_index(accessor.present_index);
2795 template <
int dim,
int spacedim,
bool lda>
2799 const unsigned int i)
2804 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
2805 Assert (i == 0,
typename BaseClass::ExcInvalidObject());
2810 template <
int dim,
int spacedim,
bool lda>
2814 const unsigned int i)
2816 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
2817 Assert (accessor.dof_handler != 0,
2818 typename BaseClass::ExcInvalidObject());
2819 Assert (static_cast<unsigned int>(accessor.level()) <
2820 accessor.dof_handler->levels.size(),
2823 accessor.dof_handler->levels[accessor.level()]
2824 ->set_active_fe_index (accessor.present_index, i);
2829 template <
int dim,
int spacedim,
bool lda,
typename ForwardIterator,
class OutputVector>
2833 ForwardIterator local_source_begin,
2834 ForwardIterator local_source_end,
2835 OutputVector &global_destination)
2837 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
2838 Assert (accessor.dof_handler != 0,
2839 typename BaseClass::ExcInvalidObject());
2840 Assert (&accessor.get_fe() != 0,
2841 typename BaseClass::ExcInvalidObject());
2842 Assert (static_cast<unsigned int>(local_source_end-local_source_begin)
2844 accessor.get_fe().dofs_per_cell,
2845 typename BaseClass::ExcVectorDoesNotMatch());
2846 Assert (accessor.dof_handler->n_dofs() == global_destination.size(),
2847 typename BaseClass::ExcVectorDoesNotMatch());
2849 Assert (!accessor.has_children(),
2852 const unsigned int n_dofs = local_source_end - local_source_begin;
2855 ->cell_dof_indices_cache[accessor.present_index * n_dofs];
2858 global_destination.add(n_dofs, dofs, local_source_begin);
2863 template <
int dim,
int spacedim,
bool lda,
typename ForwardIterator,
class OutputVector>
2867 ForwardIterator local_source_begin,
2868 ForwardIterator local_source_end,
2869 OutputVector &global_destination)
2871 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
2872 Assert (accessor.dof_handler != 0,
2873 typename BaseClass::ExcInvalidObject());
2874 Assert (&accessor.get_fe() != 0,
2875 typename BaseClass::ExcInvalidObject());
2876 Assert (local_source_end-local_source_begin == accessor.get_fe().dofs_per_cell,
2877 typename BaseClass::ExcVectorDoesNotMatch());
2878 Assert (accessor.dof_handler->n_dofs() == global_destination.size(),
2879 typename BaseClass::ExcVectorDoesNotMatch());
2881 const unsigned int n_dofs = local_source_end - local_source_begin;
2886 std::vector<types::global_dof_index> dofs (n_dofs);
2887 accessor.get_dof_indices (dofs);
2890 global_destination.add (n_dofs, dofs.begin(), local_source_begin);
2895 template <
int dim,
int spacedim,
bool lda,
typename ForwardIterator,
class OutputVector>
2900 ForwardIterator local_source_begin,
2901 ForwardIterator local_source_end,
2902 OutputVector &global_destination)
2904 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
2905 Assert (accessor.dof_handler != 0,
2906 typename BaseClass::ExcInvalidObject());
2907 Assert (&accessor.get_fe() != 0,
2908 typename BaseClass::ExcInvalidObject());
2909 Assert (local_source_end-local_source_begin == accessor.get_fe().dofs_per_cell,
2910 typename BaseClass::ExcVectorDoesNotMatch());
2911 Assert (accessor.dof_handler->n_dofs() == global_destination.size(),
2912 typename BaseClass::ExcVectorDoesNotMatch());
2914 Assert (!accessor.has_children(),
2917 const unsigned int n_dofs = local_source_end - local_source_begin;
2920 ->cell_dof_indices_cache[accessor.present_index * n_dofs];
2924 dofs, global_destination);
2929 template <
int dim,
int spacedim,
bool lda,
typename ForwardIterator,
class OutputVector>
2934 ForwardIterator local_source_begin,
2935 ForwardIterator local_source_end,
2936 OutputVector &global_destination)
2938 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
2939 Assert (accessor.dof_handler != 0,
2940 typename BaseClass::ExcInvalidObject());
2941 Assert (&accessor.get_fe() != 0,
2942 typename BaseClass::ExcInvalidObject());
2943 Assert (local_source_end-local_source_begin == accessor.get_fe().dofs_per_cell,
2944 typename BaseClass::ExcVectorDoesNotMatch());
2945 Assert (accessor.dof_handler->n_dofs() == global_destination.size(),
2946 typename BaseClass::ExcVectorDoesNotMatch());
2948 const unsigned int n_dofs = local_source_end - local_source_begin;
2953 std::vector<types::global_dof_index> dofs (n_dofs);
2954 accessor.get_dof_indices (dofs);
2958 dofs.begin(), global_destination);
2963 template <
int dim,
int spacedim,
bool lda,
typename number,
class OutputMatrix>
2967 const ::FullMatrix<number> &local_source,
2968 OutputMatrix &global_destination)
2970 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
2971 Assert (accessor.dof_handler != 0,
2972 typename BaseClass::ExcInvalidObject());
2973 Assert (&accessor.get_fe() != 0,
2974 typename BaseClass::ExcInvalidObject());
2975 Assert (local_source.m() == accessor.get_fe().dofs_per_cell,
2976 typename BaseClass::ExcMatrixDoesNotMatch());
2977 Assert (local_source.n() == accessor.get_fe().dofs_per_cell,
2978 typename BaseClass::ExcMatrixDoesNotMatch());
2979 Assert (accessor.dof_handler->n_dofs() == global_destination.m(),
2980 typename BaseClass::ExcMatrixDoesNotMatch());
2981 Assert (accessor.dof_handler->n_dofs() == global_destination.n(),
2982 typename BaseClass::ExcMatrixDoesNotMatch());
2984 Assert (!accessor.has_children(),
2987 const unsigned int n_dofs = local_source.m();
2990 ->cell_dof_indices_cache[accessor.present_index * n_dofs];
2993 for (
unsigned int i=0; i<n_dofs; ++i)
2994 global_destination.add(dofs[i], n_dofs, dofs,
2995 &local_source(i,0));
3000 template <
int dim,
int spacedim,
bool lda,
typename number,
class OutputMatrix>
3004 const ::FullMatrix<number> &local_source,
3005 OutputMatrix &global_destination)
3007 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
3008 Assert (accessor.dof_handler != 0,
3009 typename BaseClass::ExcInvalidObject());
3010 Assert (&accessor.get_fe() != 0,
3011 typename BaseClass::ExcInvalidObject());
3012 Assert (local_source.m() == accessor.get_fe().dofs_per_cell,
3013 typename BaseClass::ExcMatrixDoesNotMatch());
3014 Assert (local_source.n() == accessor.get_fe().dofs_per_cell,
3015 typename BaseClass::ExcVectorDoesNotMatch());
3016 Assert (accessor.dof_handler->n_dofs() == global_destination.m(),
3017 typename BaseClass::ExcMatrixDoesNotMatch());
3018 Assert (accessor.dof_handler->n_dofs() == global_destination.n(),
3019 typename BaseClass::ExcMatrixDoesNotMatch());
3021 const unsigned int n_dofs = local_source.size();
3026 std::vector<types::global_dof_index> dofs (n_dofs);
3027 accessor.get_dof_indices (dofs);
3030 global_destination.add(dofs,local_source);
3035 template <
int dim,
int spacedim,
bool lda,
typename number,
3036 class OutputMatrix,
typename OutputVector>
3040 const ::FullMatrix<number> &local_matrix,
3041 const ::Vector<number> &local_vector,
3042 OutputMatrix &global_matrix,
3043 OutputVector &global_vector)
3045 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
3046 Assert (accessor.dof_handler != 0,
3047 typename BaseClass::ExcInvalidObject());
3048 Assert (&accessor.get_fe() != 0,
3049 typename BaseClass::ExcInvalidObject());
3050 Assert (local_matrix.m() == accessor.get_fe().dofs_per_cell,
3051 typename BaseClass::ExcMatrixDoesNotMatch());
3052 Assert (local_matrix.n() == accessor.get_fe().dofs_per_cell,
3053 typename BaseClass::ExcVectorDoesNotMatch());
3054 Assert (accessor.dof_handler->n_dofs() == global_matrix.m(),
3055 typename BaseClass::ExcMatrixDoesNotMatch());
3056 Assert (accessor.dof_handler->n_dofs() == global_matrix.n(),
3057 typename BaseClass::ExcMatrixDoesNotMatch());
3058 Assert (local_vector.size() == accessor.get_fe().dofs_per_cell,
3059 typename BaseClass::ExcVectorDoesNotMatch());
3060 Assert (accessor.dof_handler->n_dofs() == global_vector.size(),
3061 typename BaseClass::ExcVectorDoesNotMatch());
3063 Assert (!accessor.has_children(),
3066 const unsigned int n_dofs = accessor.get_fe().dofs_per_cell;
3068 ->cell_dof_indices_cache[accessor.present_index *n_dofs];
3071 for (
unsigned int i=0; i<n_dofs; ++i)
3073 global_matrix.add(dofs[i], n_dofs, dofs, &local_matrix(i,0));
3074 global_vector(dofs[i]) += local_vector(i);
3080 template <
int dim,
int spacedim,
bool lda,
typename number,
3081 class OutputMatrix,
typename OutputVector>
3085 const ::FullMatrix<number> &local_matrix,
3086 const ::Vector<number> &local_vector,
3087 OutputMatrix &global_matrix,
3088 OutputVector &global_vector)
3090 typedef ::DoFAccessor<dim,DoFHandler<dim,spacedim>, lda>
BaseClass;
3091 Assert (accessor.dof_handler != 0,
3092 typename BaseClass::ExcInvalidObject());
3093 Assert (&accessor.get_fe() != 0,
3094 typename BaseClass::ExcInvalidObject());
3095 Assert (local_matrix.m() == accessor.get_fe().dofs_per_cell,
3096 typename BaseClass::ExcMatrixDoesNotMatch());
3097 Assert (local_matrix.n() == accessor.get_fe().dofs_per_cell,
3098 typename BaseClass::ExcVectorDoesNotMatch());
3099 Assert (accessor.dof_handler->n_dofs() == global_matrix.m(),
3100 typename BaseClass::ExcMatrixDoesNotMatch());
3101 Assert (accessor.dof_handler->n_dofs() == global_matrix.n(),
3102 typename BaseClass::ExcMatrixDoesNotMatch());
3103 Assert (local_vector.size() == accessor.get_fe().dofs_per_cell,
3104 typename BaseClass::ExcVectorDoesNotMatch());
3105 Assert (accessor.dof_handler->n_dofs() == global_vector.size(),
3106 typename BaseClass::ExcVectorDoesNotMatch());
3108 const unsigned int n_dofs = local_matrix.size();
3116 std::vector<types::global_dof_index> dofs (n_dofs);
3117 accessor.get_dof_indices (dofs);
3120 global_matrix.add(dofs,local_matrix);
3121 global_vector.add(dofs,local_vector);
3128 template <
class DH,
bool lda>
3140 template <
class DH,
bool lda>
3141 template <
int structdim2,
int dim2,
int spacedim2>
3145 Assert (
false,
typename BaseClass::ExcInvalidObject());
3150 template <
class DH,
bool lda>
3151 template <
int dim2,
class DH2,
bool lda2>
3159 template <
class DH,
bool lda>
3166 this->neighbor_level (i),
3167 this->neighbor_index (i),
3172 Assert (q->used(), TriaAccessorExceptions::ExcUnusedCellAsNeighbor());
3178 template <
class DH,
bool lda>
3191 Assert (q->used(), TriaAccessorExceptions::ExcUnusedCellAsChild());
3197 template <
class DH,
bool lda>
3216 template <
class DH,
bool lda>
3219 get_face (const ::DoFCellAccessor<DH,lda> &cell,
3220 const unsigned int i,
3221 const ::internal::int2type<1>)
3224 a (&cell.get_triangulation(),
3225 ((i == 0) && cell.at_boundary(0)
3229 ((i == 1) && cell.at_boundary(1)
3234 cell.vertex_index(i),
3235 &cell.get_dof_handler());
3236 return ::TriaIterator<::DoFAccessor<0,DH,lda> > (a);
3240 template <
class DH,
bool lda>
3243 get_face (const ::DoFCellAccessor<DH,lda> &cell,
3244 const unsigned int i,
3245 const ::internal::int2type<2>)
3247 return cell.line(i);
3251 template <
class DH,
bool lda>
3254 get_face (const ::DoFCellAccessor<DH,lda> &cell,
3255 const unsigned int i,
3256 const ::internal::int2type<3>)
3258 return cell.quad(i);
3264 template <
class DH,
bool lda>
3273 const unsigned int dim = DH::dimension;
3279 template <
class DH,
bool lda>
3284 Assert (this->active(),
ExcMessage (
"get_dof_indices() only works on active cells."));
3285 Assert (this->is_artificial() ==
false,
3286 ExcMessage (
"Can't ask for DoF indices on artificial cells."));
3292 for (
unsigned int i=0; i<this->
get_fe().dofs_per_cell; ++i, ++cache)
3293 dof_indices[i] = *cache;
3298 template<
class DH,
bool lda>
3307 template<
class DH,
bool lda>
3316 template<
class DH,
bool lda>
3328 template <
class DH,
bool lda>
3329 template <
class InputVector,
typename number>
3340 template <
class DH,
bool lda>
3341 template <
class InputVector,
typename ForwardIterator>
3345 ForwardIterator local_values_begin,
3346 ForwardIterator local_values_end)
const 3348 Assert (this->is_artificial() ==
false,
3349 ExcMessage (
"Can't ask for DoF indices on artificial cells."));
3353 Assert (static_cast<unsigned int>(local_values_end-local_values_begin)
3354 == this->
get_fe().dofs_per_cell,
3355 typename DoFCellAccessor::ExcVectorDoesNotMatch());
3357 typename DoFCellAccessor::ExcVectorDoesNotMatch());
3363 values.extract_subvector_to (cache,
3364 cache + this->
get_fe().dofs_per_cell,
3365 local_values_begin);
3370 template <
class DH,
bool lda>
3371 template <
class InputVector,
typename ForwardIterator>
3375 const InputVector &values,
3376 ForwardIterator local_values_begin,
3377 ForwardIterator local_values_end)
const 3379 Assert (this->is_artificial() ==
false,
3380 ExcMessage (
"Can't ask for DoF indices on artificial cells."));
3384 Assert (static_cast<unsigned int>(local_values_end-local_values_begin)
3385 == this->
get_fe().dofs_per_cell,
3386 typename DoFCellAccessor::ExcVectorDoesNotMatch());
3388 typename DoFCellAccessor::ExcVectorDoesNotMatch());
3401 template <
class DH,
bool lda>
3402 template <
class OutputVector,
typename number>
3406 OutputVector &values)
const 3408 Assert (this->is_artificial() ==
false,
3409 ExcMessage (
"Can't ask for DoF indices on artificial cells."));
3413 Assert (static_cast<unsigned int>(local_values.
size())
3414 == this->
get_fe().dofs_per_cell,
3415 typename DoFCellAccessor::ExcVectorDoesNotMatch());
3417 typename DoFCellAccessor::ExcVectorDoesNotMatch());
3424 for (
unsigned int i=0; i<this->
get_fe().dofs_per_cell; ++i, ++cache)
3425 values(*cache) = local_values(i);
3430 template <
class DH,
bool lda>
3440 template <
class DH,
bool lda>
3445 return ::internal::DoFCellAccessor::Implementation::active_fe_index (*
this);
3450 template <
class DH,
bool lda>
3461 template <
class DH,
bool lda>
3462 template <
typename number,
typename OutputVector>
3467 OutputVector &global_destination)
const 3469 ::internal::DoFCellAccessor::Implementation::
3470 distribute_local_to_global (*
this, local_source.
begin(),
3471 local_source.
end(), global_destination);
3476 template <
class DH,
bool lda>
3477 template <
typename ForwardIterator,
typename OutputVector>
3481 ForwardIterator local_source_begin,
3482 ForwardIterator local_source_end,
3483 OutputVector &global_destination)
const 3485 ::internal::DoFCellAccessor::Implementation::
3486 distribute_local_to_global (*
this, local_source_begin,
3487 local_source_end, global_destination);
3492 template <
class DH,
bool lda>
3493 template <
typename ForwardIterator,
typename OutputVector>
3498 ForwardIterator local_source_begin,
3499 ForwardIterator local_source_end,
3500 OutputVector &global_destination)
const 3502 ::internal::DoFCellAccessor::Implementation::
3503 distribute_local_to_global (*
this, constraints, local_source_begin,
3504 local_source_end, global_destination);
3509 template <
class DH,
bool lda>
3510 template <
typename number,
typename OutputMatrix>
3515 OutputMatrix &global_destination)
const 3517 ::internal::DoFCellAccessor::Implementation::
3518 distribute_local_to_global (*
this,local_source,global_destination);
3523 template <
class DH,
bool lda>
3524 template <
typename number,
typename OutputMatrix,
typename OutputVector>
3530 OutputMatrix &global_matrix,
3531 OutputVector &global_vector)
const 3533 ::internal::DoFCellAccessor::Implementation::
3534 distribute_local_to_global (*
this,local_matrix,local_vector,
3535 global_matrix,global_vector);
3539 DEAL_II_NAMESPACE_CLOSE
static void update_cell_dof_indices_cache(const DoFCellAccessor< DoFHandler< 1, spacedim >, lda > &accessor)
types::global_dof_index mg_dof_index(const int level, const unsigned int i) const
const Triangulation< dim, spacedim > & get_triangulation() const
TriaIterator< DoFCellAccessor< DH, level_dof_access > > child(const unsigned int) const
TriaIterator< DoFCellAccessor< DH, level_dof_access > > neighbor(const unsigned int) const
void distribute_local_to_global(const Vector< number > &local_source, OutputVector &global_destination) const
const DH & get_dof_handler() const
void set_active_fe_index(const unsigned int i)
#define AssertDimension(dim1, dim2)
SmartPointer< const hp::FECollection< dim, spacedim >, hp::DoFHandler< dim, spacedim > > finite_elements
TriaIterator< DoFAccessor< structdim, DH, level_dof_access > > parent() const
unsigned int active_fe_index() const
static const unsigned int dimension
bool operator==(const DoFAccessor< dim2, DH2, level_dof_access2 > &) const
void set_dof_handler(DH *dh)
void get_active_or_mg_dof_indices(std::vector< types::global_dof_index > &dof_indices) const
::ExceptionBase & ExcMessage(std::string arg1)
typename::internal::DoFAccessor::Inheritance< structdim, dimension, space_dimension >::BaseClass BaseClass
static void set_active_fe_index(const DoFCellAccessor< DoFHandler< dim, spacedim >, lda > &, const unsigned int i)
const unsigned int dofs_per_quad
SmartPointer< const FiniteElement< dim, spacedim >, DoFHandler< dim, spacedim > > selected_fe
SmartPointer< const Triangulation< dim, spacedim >, DoFHandler< dim, spacedim > > tria
static types::global_dof_index get_vertex_dof_index(const ::DoFHandler< dim, spacedim > &dof_handler, const unsigned int vertex_index, const unsigned int fe_index, const unsigned int local_index)
typename::internal::DoFHandler::Iterators< DH, level_dof_access >::line_iterator line(const unsigned int i) const
#define AssertThrow(cond, exc)
const unsigned int dofs_per_line
static void set_dof_indices(DoFCellAccessor< DoFHandler< 1, spacedim >, lda > &accessor, const std::vector< types::global_dof_index > &local_dof_indices)
static bool fe_is_active_on_vertex(const ::hp::DoFHandler< dim, spacedim > &dof_handler, const unsigned int vertex_index, const unsigned int fe_index)
bool has_children() const
static types::global_dof_index get_dof_index(const ::DoFHandler< 1, spacedim > &dof_handler, const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index,::internal::int2type< 1 >)
types::global_dof_index mg_vertex_dof_index(const int level, const unsigned int vertex, const unsigned int i, const unsigned int fe_index=DH::default_fe_index) const
TriaIterator< DoFAccessor< structdim, DH, level_dof_access > > child(const unsigned int c) const
void set_mg_dof_indices(const int level, const std::vector< types::global_dof_index > &dof_indices, const unsigned int fe_index=DH::default_fe_index)
types::global_dof_index dof_index(const unsigned int i, const unsigned int fe_index=DH::default_fe_index) const
static void set_vertex_dof_index(::DoFHandler< dim, spacedim > &dof_handler, const unsigned int vertex_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index)
static unsigned int active_fe_index(const DoFCellAccessor< DoFHandler< dim, spacedim >, lda > &)
void distribute_local_to_global(const InVector &local_vector, const std::vector< size_type > &local_dof_indices, OutVector &global_vector) const
static unsigned int nth_active_vertex_fe_index(const ::hp::DoFHandler< dim, spacedim > &dof_handler, const unsigned int vertex_index, const unsigned int n)
static const unsigned int dimension
unsigned int global_dof_index
void get_mg_dof_indices(const int level, std::vector< types::global_dof_index > &dof_indices, const unsigned int fe_index=DH::default_fe_index) const
#define Assert(cond, exc)
void get_dof_values(const InputVector &values, Vector< number > &local_values) const
unsigned int vertex_index(const unsigned int i) const
const Triangulation< dim, spacedim > * tria
void set_mg_dof_indices(const std::vector< types::global_dof_index > &dof_indices)
void set_dof_values(const Vector< number > &local_values, OutputVector &values) const
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static const unsigned int dim
bool fe_index_is_active(const unsigned int fe_index) const
types::global_dof_index vertex_dof_index(const unsigned int vertex, const unsigned int i, const unsigned int fe_index=DH::default_fe_index) const
typename::internal::TriaAccessor::PresentLevelType< structdim, dim >::type present_level
::ExceptionBase & ExcImpossibleInDim(int arg1)
IteratorState::IteratorStates state() const
static unsigned int n_active_vertex_fe_indices(const ::hp::DoFHandler< dim, spacedim > &dof_handler, const unsigned int vertex_index)
const FiniteElement< DH::dimension, DH::space_dimension > & get_fe(const unsigned int fe_index) const
TriaIterator< TriaAccessor< structdim, dim, spacedim > > child(const unsigned int i) const
unsigned int nth_active_fe_index(const unsigned int n) const
unsigned int quad_index(const unsigned int i) const
void set_dof_index(const unsigned int i, const types::global_dof_index index, const unsigned int fe_index=DH::default_fe_index) const
TriaIterator< DoFCellAccessor< DH, level_dof_access > > parent() const
TriaIterator< DoFAccessor< DH::dimension-1, DH, level_dof_access > > face(const unsigned int i) const
int child_index(const unsigned int i) const
bool operator!=(const DoFAccessor< dim2, DH2, level_dof_access2 > &) const
::ExceptionBase & ExcNotImplemented()
::ExceptionBase & ExcNotInitialized()
Iterator reached end of container.
const unsigned int dofs_per_vertex
const FiniteElement< DH::dimension, DH::space_dimension > & get_fe() const
void get_dof_indices(std::vector< types::global_dof_index > &dof_indices) const
static const unsigned int space_dimension
std::vector< types::global_dof_index > vertex_dofs_offsets
void get_dof_indices(std::vector< types::global_dof_index > &dof_indices, const unsigned int fe_index=DH::default_fe_index) const
const types::global_dof_index invalid_dof_index
::ExceptionBase & ExcInternalError()
std::vector< types::global_dof_index > vertex_dofs
void get_mg_dof_indices(std::vector< types::global_dof_index > &dof_indices) const
DoFCellAccessor(const Triangulation< DH::dimension, DH::space_dimension > *tria, const int level, const int index, const AccessorData *local_data)
void copy_from(const DoFAccessor< structdim, DH, level_dof_access2 > &a)
void get_dof_values(const VectorType &global_vector, ForwardIteratorInd local_indices_begin, ForwardIteratorVec local_vector_begin, ForwardIteratorVec local_vector_end) const
std::vector< types::global_dof_index > vertex_dofs
void set_vertex_dof_index(const unsigned int vertex, const unsigned int i, const types::global_dof_index index, const unsigned int fe_index=DH::default_fe_index) const
typename::internal::DoFHandler::Iterators< DH, level_dof_access >::quad_iterator quad(const unsigned int i) const
Point< spacedim > & vertex(const unsigned int i) const
unsigned int n_active_fe_indices() const
unsigned int line_index(const unsigned int i) const