// leaves out is faces in 3d --
// let's hope that this never is
// a problem
- Assert ((dim==structdim
- ?
- typename
- dealii::DoFHandler<dim,spacedim>::
- raw_cell_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- (structdim==1
- ?
- typename
- dealii::DoFHandler<dim,spacedim>::
- raw_line_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- true))
- == true,
- ExcMessage ("This cell is not active and therefore can't be "
- "queried for its active FE indices"));
- Assert ((dim==structdim
- ?
- typename
- dealii::internal::DoFHandler::
- Iterators<dealii::DoFHandler<dim,spacedim> >::
- raw_cell_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- (structdim==1
- ?
- typename
- dealii::internal::DoFHandler::
- Iterators<dealii::DoFHandler<dim,spacedim> >::
- raw_line_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- true))
- == true,
- ExcMessage ("This cell is not active and therefore can't be "
- "queried for its active FE indices"));
- return 1;
- }
-
-
-
- template <int structdim, int dim, int spacedim>
- static
- unsigned int
- nth_active_fe_index (const dealii::DoFHandler<dim,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int n,
- const dealii::internal::int2type<structdim> &)
- {
++ Assert ((dim==structdim
++ ?
++ typename
++ dealii::internal::DoFHandler::
++ Iterators<dealii::DoFHandler<dim,spacedim> >::
++ raw_cell_iterator (&dof_handler.get_tria(),
++ obj_level,
++ obj_index,
++ &dof_handler)->used()
++ :
++ (structdim==1
++ ?
++ typename
++ dealii::internal::DoFHandler::
++ Iterators<dealii::DoFHandler<dim,spacedim> >::
++ raw_line_iterator (&dof_handler.get_tria(),
++ obj_level,
++ obj_index,
++ &dof_handler)->used()
++ :
++ true))
++ == true,
++ ExcMessage ("This cell is not active and therefore can't be "
++ "queried for its active FE indices"));
+ return 1;
+ }
+
+
+
+ template <int structdim, int dim, int spacedim>
+ static
+ unsigned int
+ nth_active_fe_index (const dealii::DoFHandler<dim,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int n,
+ const dealii::internal::int2type<structdim> &)
+ {
// check that the object we look
// at is in fact active. the
// problem is that we have
// leaves out is faces in 3d --
// let's hope that this never is
// a problem
- Assert ((dim==structdim
- ?
- typename
- dealii::internal::DoFHandler::
- Iterators<dealii::DoFHandler<dim,spacedim> >::
- raw_cell_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- (structdim==1
- ?
- typename
- dealii::internal::DoFHandler::
- Iterators<dealii::DoFHandler<dim,spacedim> >::
- raw_line_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- true))
- == true,
- ExcMessage ("This cell is not active and therefore can't be "
- "queried for its active FE indices"));
- Assert (n == 0, ExcIndexRange (n, 0, 1));
-
- return dealii::DoFHandler<dim,spacedim>::default_fe_index;
- }
-
-
- template <int spacedim>
- static
- bool
- fe_index_is_active (const dealii::hp::DoFHandler<1,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int fe_index,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.levels[obj_level]->dof_object.fe_index_is_active(dof_handler,
- obj_index,
- fe_index,
- obj_level);
- }
-
-
- template <int spacedim>
- static
- unsigned int
- n_active_fe_indices (const dealii::hp::DoFHandler<1,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.levels[obj_level]->dof_object.n_active_fe_indices (dof_handler,
- obj_index);
- }
-
-
-
- template <int spacedim>
- static
- unsigned int
- nth_active_fe_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int n,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.levels[obj_level]->dof_object.nth_active_fe_index (dof_handler,
- obj_level,
- obj_index,
- n);
- }
-
-
- template <int spacedim>
- static
- bool
- fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int fe_index,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.faces->lines.fe_index_is_active(dof_handler,
- obj_index,
- fe_index,
- obj_level);
- }
-
-
- template <int spacedim>
- static
- unsigned int
- n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
- const unsigned int ,
- const unsigned int obj_index,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.faces->lines.n_active_fe_indices (dof_handler,
- obj_index);
- }
-
-
- template <int spacedim>
- static
- unsigned int
- nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int n,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.faces->lines.nth_active_fe_index (dof_handler,
- obj_level,
- obj_index,
- n);
- }
-
-
-
- template <int spacedim>
- static
- bool
- fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int fe_index,
- const dealii::internal::int2type<2> &)
- {
- return dof_handler.levels[obj_level]->dof_object.fe_index_is_active(dof_handler,
- obj_index,
- fe_index,
- obj_level);
- }
-
-
- template <int spacedim>
- static
- unsigned int
- n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const dealii::internal::int2type<2> &)
- {
- return dof_handler.levels[obj_level]->dof_object.n_active_fe_indices (dof_handler,
- obj_index);
- }
-
-
-
- template <int spacedim>
- static
- unsigned int
- nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int n,
- const dealii::internal::int2type<2> &)
- {
- return dof_handler.levels[obj_level]->dof_object.nth_active_fe_index (dof_handler,
- obj_level,
- obj_index,
- n);
- }
-
-
-
- template <int spacedim>
- static
- bool
- fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int fe_index,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.faces->lines.fe_index_is_active(dof_handler,
- obj_index,
- fe_index,
- obj_level);
- }
-
-
- template <int spacedim>
- static
- unsigned int
- n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int,
- const unsigned int obj_index,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.faces->lines.n_active_fe_indices (dof_handler,
- obj_index);
- }
-
-
-
- template <int spacedim>
- static
- unsigned int
- nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int n,
- const dealii::internal::int2type<1> &)
- {
- return dof_handler.faces->lines.nth_active_fe_index (dof_handler,
- obj_level,
- obj_index,
- n);
- }
-
-
-
- template <int spacedim>
- static
- bool
- fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int fe_index,
- const dealii::internal::int2type<2> &)
- {
- return dof_handler.faces->quads.fe_index_is_active(dof_handler,
- obj_index,
- fe_index,
- obj_level);
- }
-
- template <int spacedim>
- static
- bool
- fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int fe_index,
- const dealii::internal::int2type<3> &)
- {
- return dof_handler.levels[obj_level]->dof_object.fe_index_is_active(dof_handler,
- obj_index,
- fe_index,
- obj_level);
- }
-
-
- template <int spacedim>
- static
- unsigned int
- n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int ,
- const unsigned int obj_index,
- const dealii::internal::int2type<2> &)
- {
- return dof_handler.faces->quads.n_active_fe_indices (dof_handler,
- obj_index);
- }
-
-
-
- template <int spacedim>
- static
- unsigned int
- nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int n,
- const dealii::internal::int2type<2> &)
- {
- return dof_handler.faces->quads.nth_active_fe_index (dof_handler,
- obj_level,
- obj_index,
- n);
- }
-
-
-
- template <int spacedim>
- static
- unsigned int
- n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const dealii::internal::int2type<3> &)
- {
- return dof_handler.levels[obj_level]->dof_object.n_active_fe_indices (dof_handler,
- obj_index);
- }
-
-
-
- template <int spacedim>
- static
- unsigned int
- nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
- const unsigned int obj_level,
- const unsigned int obj_index,
- const unsigned int n,
- const dealii::internal::int2type<3> &)
- {
- return dof_handler.levels[obj_level]->dof_object.nth_active_fe_index (dof_handler,
- obj_level,
- obj_index,
- n);
- }
+ Assert ((dim==structdim
- ?
- typename
- dealii::DoFHandler<dim,spacedim>::
- raw_cell_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- (structdim==1
- ?
- typename
- dealii::DoFHandler<dim,spacedim>::
- raw_line_iterator (&dof_handler.get_tria(),
- obj_level,
- obj_index,
- &dof_handler)->used()
- :
- true))
- == true,
- ExcMessage ("This cell is not active and therefore can't be "
- "queried for its active FE indices"));
++ ?
++ typename
++ dealii::internal::DoFHandler::
++ Iterators<dealii::DoFHandler<dim,spacedim> >::
++ raw_cell_iterator (&dof_handler.get_tria(),
++ obj_level,
++ obj_index,
++ &dof_handler)->used()
++ :
++ (structdim==1
++ ?
++ typename
++ dealii::internal::DoFHandler::
++ Iterators<dealii::DoFHandler<dim,spacedim> >::
++ raw_line_iterator (&dof_handler.get_tria(),
++ obj_level,
++ obj_index,
++ &dof_handler)->used()
++ :
++ true))
++ == true,
++ ExcMessage ("This cell is not active and therefore can't be "
++ "queried for its active FE indices"));
+ Assert (n == 0, ExcIndexRange (n, 0, 1));
+
+ return dealii::DoFHandler<dim,spacedim>::default_fe_index;
+ }
+
+
+ template <int spacedim>
+ static
+ bool
+ fe_index_is_active (const dealii::hp::DoFHandler<1,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int fe_index,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ n_active_fe_indices (const dealii::hp::DoFHandler<1,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.n_active_fe_indices (dof_handler,
+ obj_index);
+ }
+
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ nth_active_fe_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int n,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.nth_active_fe_index (dof_handler,
+ obj_level,
+ obj_index,
+ n);
+ }
+
+
+ template <int spacedim>
+ static
+ bool
+ fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int fe_index,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.faces->lines.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
+ const unsigned int ,
+ const unsigned int obj_index,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.faces->lines.n_active_fe_indices (dof_handler,
+ obj_index);
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int n,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.faces->lines.nth_active_fe_index (dof_handler,
+ obj_level,
+ obj_index,
+ n);
+ }
+
+
+
+ template <int spacedim>
+ static
+ bool
+ fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int fe_index,
+ const dealii::internal::int2type<2> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const dealii::internal::int2type<2> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.n_active_fe_indices (dof_handler,
+ obj_index);
+ }
+
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int n,
+ const dealii::internal::int2type<2> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.nth_active_fe_index (dof_handler,
+ obj_level,
+ obj_index,
+ n);
+ }
+
+
+
+ template <int spacedim>
+ static
+ bool
+ fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int fe_index,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.faces->lines.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int,
+ const unsigned int obj_index,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.faces->lines.n_active_fe_indices (dof_handler,
+ obj_index);
+ }
+
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int n,
+ const dealii::internal::int2type<1> &)
+ {
+ return dof_handler.faces->lines.nth_active_fe_index (dof_handler,
+ obj_level,
+ obj_index,
+ n);
+ }
+
+
+
+ template <int spacedim>
+ static
+ bool
+ fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int fe_index,
+ const dealii::internal::int2type<2> &)
+ {
+ return dof_handler.faces->quads.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
+ }
+
+ template <int spacedim>
+ static
+ bool
+ fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int fe_index,
+ const dealii::internal::int2type<3> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.fe_index_is_active(dof_handler,
+ obj_index,
+ fe_index,
+ obj_level);
+ }
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int ,
+ const unsigned int obj_index,
+ const dealii::internal::int2type<2> &)
+ {
+ return dof_handler.faces->quads.n_active_fe_indices (dof_handler,
+ obj_index);
+ }
+
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int n,
+ const dealii::internal::int2type<2> &)
+ {
+ return dof_handler.faces->quads.nth_active_fe_index (dof_handler,
+ obj_level,
+ obj_index,
+ n);
+ }
+
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const dealii::internal::int2type<3> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.n_active_fe_indices (dof_handler,
+ obj_index);
+ }
+
+
+
+ template <int spacedim>
+ static
+ unsigned int
+ nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler,
+ const unsigned int obj_level,
+ const unsigned int obj_index,
+ const unsigned int n,
+ const dealii::internal::int2type<3> &)
+ {
+ return dof_handler.levels[obj_level]->dof_object.nth_active_fe_index (dof_handler,
+ obj_level,
+ obj_index,
+ n);
+ }
/**
* Set the @p local_index-th
// applies, if the face_rotation or
// face_orientation is non-standard
for (unsigned int quad=0; quad<6; ++quad)
- for (unsigned int d=0; d<dofs_per_quad; ++d)
- *next++ = accessor.quad(quad)->dof_index(accessor.get_fe(fe_index).
- adjust_quad_dof_index_for_face_orientation(d,
- accessor.face_orientation(quad),
- accessor.face_flip(quad),
- accessor.face_rotation(quad)),
- fe_index);
+ for (unsigned int d=0; d<dofs_per_quad; ++d)
+ *next++ = accessor.quad(quad)->dof_index(accessor.get_fe(fe_index).
+ adjust_quad_dof_index_for_face_orientation(d,
+ accessor.face_orientation(quad),
+ accessor.face_flip(quad),
+ accessor.face_rotation(quad)),
+ fe_index);
for (unsigned int d=0; d<dofs_per_hex; ++d)
- *next++ = accessor.dof_index(d,fe_index);
+ *next++ = accessor.dof_index(d,fe_index);
+ }
-
++
+ template<class DH>
+ void get_mg_dof_indices (const dealii::DoFAccessor<1, DH>& accessor, const int level, std::vector<unsigned int>& dof_indices, const unsigned int fe_index) {
+ const FiniteElement<DH::dimension, DH::space_dimension>& fe = accessor.get_dof_handler ().get_fe ()[fe_index];
+ std::vector<unsigned int>::iterator next = dof_indices.begin ();
-
++
+ for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell; ++vertex)
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ *next++ = accessor.mg_vertex_dof_index (level, vertex, dof);
-
++
+ for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
+ *next++ = accessor.mg_dof_index (level, dof);
-
++
+ Assert (next == dof_indices.end (), ExcInternalError ());
+ }
-
++
+ template<class DH>
+ void get_mg_dof_indices (const dealii::DoFAccessor<2, DH>& accessor, const int level, std::vector<unsigned int>& dof_indices, const unsigned int fe_index) {
+ const FiniteElement<DH::dimension, DH::space_dimension>& fe = accessor.get_dof_handler ().get_fe ()[fe_index];
+ std::vector<unsigned int>::iterator next = dof_indices.begin ();
-
++
+ for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++vertex)
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ *next++ = accessor.mg_vertex_dof_index (level, vertex, dof);
-
++
+ for (unsigned int line = 0; line < GeometryInfo<2>::lines_per_cell; ++line)
+ for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
+ *next++ = accessor.line (line)->mg_dof_index (level, dof);
-
++
+ for (unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof)
+ *next++ = accessor.mg_dof_index (level, dof);
-
++
+ Assert (next == dof_indices.end (), ExcInternalError ());
+ }
-
++
+ template<class DH>
+ void get_mg_dof_indices (const dealii::DoFAccessor<3, DH>& accessor, const int level, std::vector<unsigned int>& dof_indices, const unsigned int fe_index) {
+ const FiniteElement<DH::dimension, DH::space_dimension>& fe = accessor.get_dof_handler ().get_fe ()[fe_index];
+ std::vector<unsigned int>::iterator next = dof_indices.begin ();
-
++
+ for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell; ++vertex)
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ *next++ = accessor.mg_vertex_dof_index (level, vertex, dof);
-
++
+ for (unsigned int line = 0; line < GeometryInfo<3>::lines_per_cell; ++line)
+ for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
+ *next++ = accessor.line (line)->mg_dof_index (level, dof);
-
++
+ for (unsigned int quad = 0; quad < GeometryInfo<3>::quads_per_cell; ++quad)
+ for (unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof)
+ *next++ = accessor.quad (quad)->mg_dof_index (level, dof);
-
++
+ for (unsigned int dof = 0; dof < fe.dofs_per_hex; ++dof)
+ *next++ = accessor.mg_dof_index (level, dof);
-
++
+ Assert (next == dof_indices.end (), ExcInternalError ());
}
}
}
dealii::internal::DoFAccessor::get_dof_indices (*this, dof_indices, fe_index);
}
-
+template<int structdim, class DH>
+inline
+void DoFAccessor<structdim, DH>::get_mg_dof_indices (const int level, std::vector<unsigned int>& dof_indices, const unsigned int fe_index) const {
+ Assert (this->dof_handler != 0, ExcInvalidObject ());
+ Assert (&this->dof_handler->get_fe () != 0, ExcInvalidObject ());
-
++
+ switch (structdim) {
+ case 1: {
+ Assert (dof_indices.size () == 2 * this->dof_handler->get_fe ()[fe_index].dofs_per_vertex + this->dof_handler->get_fe ()[fe_index].dofs_per_line, ExcVectorDoesNotMatch ());
+ break;
+ }
-
++
+ case 2: {
+ Assert (dof_indices.size () == 4 * (this->dof_handler->get_fe ()[fe_index].dofs_per_vertex + this->dof_handler->get_fe ()[fe_index].dofs_per_line) + this->dof_handler->get_fe ()[fe_index].dofs_per_quad, ExcVectorDoesNotMatch ());
+ break;
+ }
-
+
+ case 3: {
+ Assert (dof_indices.size () == 8 * this->dof_handler->get_fe ()[fe_index].dofs_per_vertex + 12 * this->dof_handler->get_fe ()[fe_index].dofs_per_line + 6 * this->dof_handler->get_fe ()[fe_index].dofs_per_quad + this->dof_handler->get_fe ()[fe_index].dofs_per_hex, ExcVectorDoesNotMatch ());
+ break;
+ }
-
+
+ default:
+ Assert (false, ExcNotImplemented ());
+ }
+
+ internal::DoFAccessor::get_mg_dof_indices (*this, level, dof_indices, fe_index);
+}
template <int structdim, class DH>
inline
* was selected when calling
* @p distribute_dofs the last time.
*/
- template <int spacedim>
- static
- void reserve_space (DoFHandler<1,spacedim> &dof_handler)
- {
- dof_handler.vertex_dofs
- .resize(dof_handler.tria->n_vertices() *
- dof_handler.selected_fe->dofs_per_vertex,
- DoFHandler<1,spacedim>::invalid_dof_index);
-
- for (unsigned int i=0; i<dof_handler.tria->n_levels(); ++i)
- {
- dof_handler.levels
- .push_back (new internal::DoFHandler::DoFLevel<1>);
-
- dof_handler.levels.back()->dof_object.dofs
- .resize (dof_handler.tria->n_raw_cells(i) *
- dof_handler.selected_fe->dofs_per_line,
- DoFHandler<1,spacedim>::invalid_dof_index);
-
- dof_handler.levels.back()->cell_dof_indices_cache
- .resize (dof_handler.tria->n_raw_cells(i) *
- dof_handler.selected_fe->dofs_per_cell,
- DoFHandler<1,spacedim>::invalid_dof_index);
- }
- }
-
-
- template <int spacedim>
- static
- void reserve_space (DoFHandler<2,spacedim> &dof_handler)
- {
- dof_handler.vertex_dofs
- .resize(dof_handler.tria->n_vertices() *
- dof_handler.selected_fe->dofs_per_vertex,
- DoFHandler<2,spacedim>::invalid_dof_index);
-
- for (unsigned int i=0; i<dof_handler.tria->n_levels(); ++i)
- {
- dof_handler.levels.push_back (new internal::DoFHandler::DoFLevel<2>);
+ template <int spacedim>
+ static
+ void reserve_space (DoFHandler<1,spacedim> &dof_handler)
+ {
+ dof_handler.vertex_dofs
+ .resize(dof_handler.tria->n_vertices() *
+ dof_handler.selected_fe->dofs_per_vertex,
+ DoFHandler<1,spacedim>::invalid_dof_index);
+
+ for (unsigned int i=0; i<dof_handler.tria->n_levels(); ++i)
+ {
- dof_handler.levels
- .push_back (new internal::DoFHandler::DoFLevel<1>);
-
- dof_handler.levels.back()->dof_object.dofs
- .resize (dof_handler.tria->n_raw_lines(i) *
- dof_handler.selected_fe->dofs_per_line,
- DoFHandler<1,spacedim>::invalid_dof_index);
-
- dof_handler.levels.back()->cell_dof_indices_cache
- .resize (dof_handler.tria->n_raw_lines(i) *
- dof_handler.selected_fe->dofs_per_cell,
- DoFHandler<1,spacedim>::invalid_dof_index);
- }
++ dof_handler.levels
++ .push_back (new internal::DoFHandler::DoFLevel<1>);
++
++ dof_handler.levels.back()->dof_object.dofs
++ .resize (dof_handler.tria->n_raw_cells(i) *
++ dof_handler.selected_fe->dofs_per_line,
++ DoFHandler<1,spacedim>::invalid_dof_index);
++
++ dof_handler.levels.back()->cell_dof_indices_cache
++ .resize (dof_handler.tria->n_raw_cells(i) *
++ dof_handler.selected_fe->dofs_per_cell,
++ DoFHandler<1,spacedim>::invalid_dof_index);
++ }
+ }
+
+
+ template <int spacedim>
+ static
+ void reserve_space (DoFHandler<2,spacedim> &dof_handler)
+ {
+ dof_handler.vertex_dofs
+ .resize(dof_handler.tria->n_vertices() *
+ dof_handler.selected_fe->dofs_per_vertex,
+ DoFHandler<2,spacedim>::invalid_dof_index);
+
+ for (unsigned int i=0; i<dof_handler.tria->n_levels(); ++i)
+ {
+ dof_handler.levels.push_back (new internal::DoFHandler::DoFLevel<2>);
- dof_handler.levels.back()->dof_object.dofs
- .resize (dof_handler.tria->n_raw_quads(i) *
- dof_handler.selected_fe->dofs_per_quad,
- DoFHandler<2,spacedim>::invalid_dof_index);
+ dof_handler.levels.back()->dof_object.dofs
+ .resize (dof_handler.tria->n_raw_cells(i) *
+ dof_handler.selected_fe->dofs_per_quad,
+ DoFHandler<2,spacedim>::invalid_dof_index);
- dof_handler.levels.back()->cell_dof_indices_cache
- .resize (dof_handler.tria->n_raw_quads(i) *
- dof_handler.selected_fe->dofs_per_cell,
- DoFHandler<2,spacedim>::invalid_dof_index);
- }
+ dof_handler.levels.back()->cell_dof_indices_cache
+ .resize (dof_handler.tria->n_raw_cells(i) *
+ dof_handler.selected_fe->dofs_per_cell,
+ DoFHandler<2,spacedim>::invalid_dof_index);
+ }
- dof_handler.faces = new internal::DoFHandler::DoFFaces<2>;
- dof_handler.faces->lines.dofs
- .resize (dof_handler.tria->n_raw_lines() *
- dof_handler.selected_fe->dofs_per_line,
- DoFHandler<2,spacedim>::invalid_dof_index);
- }
+ dof_handler.faces = new internal::DoFHandler::DoFFaces<2>;
+ dof_handler.faces->lines.dofs
+ .resize (dof_handler.tria->n_raw_lines() *
+ dof_handler.selected_fe->dofs_per_line,
+ DoFHandler<2,spacedim>::invalid_dof_index);
+ }
- template <int spacedim>
- static
- void reserve_space (DoFHandler<3,spacedim> &dof_handler)
- {
- dof_handler.vertex_dofs
- .resize(dof_handler.tria->n_vertices() *
- dof_handler.selected_fe->dofs_per_vertex,
- DoFHandler<3,spacedim>::invalid_dof_index);
+ template <int spacedim>
+ static
+ void reserve_space (DoFHandler<3,spacedim> &dof_handler)
+ {
+ dof_handler.vertex_dofs
+ .resize(dof_handler.tria->n_vertices() *
+ dof_handler.selected_fe->dofs_per_vertex,
+ DoFHandler<3,spacedim>::invalid_dof_index);
- for (unsigned int i=0; i<dof_handler.tria->n_levels(); ++i)
- {
- dof_handler.levels.push_back (new internal::DoFHandler::DoFLevel<3>);
+ for (unsigned int i=0; i<dof_handler.tria->n_levels(); ++i)
+ {
+ dof_handler.levels.push_back (new internal::DoFHandler::DoFLevel<3>);
- dof_handler.levels.back()->dof_object.dofs
- .resize (dof_handler.tria->n_raw_hexs(i) *
- dof_handler.selected_fe->dofs_per_hex,
- DoFHandler<3,spacedim>::invalid_dof_index);
+ dof_handler.levels.back()->dof_object.dofs
+ .resize (dof_handler.tria->n_raw_cells(i) *
+ dof_handler.selected_fe->dofs_per_hex,
+ DoFHandler<3,spacedim>::invalid_dof_index);
- dof_handler.levels.back()->cell_dof_indices_cache
- .resize (dof_handler.tria->n_raw_hexs(i) *
- dof_handler.selected_fe->dofs_per_cell,
- DoFHandler<3,spacedim>::invalid_dof_index);
- }
- dof_handler.faces = new internal::DoFHandler::DoFFaces<3>;
+ dof_handler.levels.back()->cell_dof_indices_cache
+ .resize (dof_handler.tria->n_raw_cells(i) *
+ dof_handler.selected_fe->dofs_per_cell,
+ DoFHandler<3,spacedim>::invalid_dof_index);
+ }
+ dof_handler.faces = new internal::DoFHandler::DoFFaces<3>;
- dof_handler.faces->lines.dofs
- .resize (dof_handler.tria->n_raw_lines() *
- dof_handler.selected_fe->dofs_per_line,
- DoFHandler<3,spacedim>::invalid_dof_index);
- dof_handler.faces->quads.dofs
- .resize (dof_handler.tria->n_raw_quads() *
- dof_handler.selected_fe->dofs_per_quad,
- DoFHandler<3,spacedim>::invalid_dof_index);
- }
+ dof_handler.faces->lines.dofs
+ .resize (dof_handler.tria->n_raw_lines() *
+ dof_handler.selected_fe->dofs_per_line,
+ DoFHandler<3,spacedim>::invalid_dof_index);
+ dof_handler.faces->quads.dofs
+ .resize (dof_handler.tria->n_raw_quads() *
+ dof_handler.selected_fe->dofs_per_quad,
+ DoFHandler<3,spacedim>::invalid_dof_index);
+ }
-
++
+ template<int spacedim>
+ static
+ void reserve_space_mg (DoFHandler<1, spacedim>& dof_handler) {
+ Assert (dof_handler.get_tria ().n_levels () > 0, ExcMessage ("Invalid triangulation"));
+ dof_handler.clear_mg_space ();
-
++
+ const dealii::Triangulation<1, spacedim>& tria = dof_handler.get_tria ();
+ const unsigned int& dofs_per_line = dof_handler.get_fe ().dofs_per_line;
+ const unsigned int& n_levels = tria.n_levels ();
-
++
+ for (unsigned int i = 0; i < n_levels; ++i) {
+ dof_handler.mg_levels.push_back (new internal::DoFHandler::DoFLevel<1>);
+ dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<unsigned int> (tria.n_raw_lines (i) * dofs_per_line, DoFHandler<1>::invalid_dof_index);
+ }
-
++
+ const unsigned int& n_vertices = tria.n_vertices ();
-
++
+ dof_handler.mg_vertex_dofs.resize (n_vertices);
-
++
+ std::vector<unsigned int> max_level (n_vertices, 0);
+ std::vector<unsigned int> min_level (n_vertices, n_levels);
-
++
+ for (typename dealii::Triangulation<1, spacedim>::cell_iterator cell = tria.begin (); cell != tria.end (); ++cell) {
+ const unsigned int level = cell->level ();
-
++
+ for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell; ++vertex) {
+ const unsigned int vertex_index = cell->vertex_index (vertex);
-
++
+ if (min_level[vertex_index] > level)
+ min_level[vertex_index] = level;
-
++
+ if (max_level[vertex_index] < level)
+ max_level[vertex_index] = level;
+ }
+ }
-
++
+ for (unsigned int vertex = 0; vertex < n_vertices; ++vertex)
+ if (tria.vertex_used (vertex)) {
+ Assert (min_level[vertex] < n_levels, ExcInternalError ());
+ Assert (max_level[vertex] >= min_level[vertex], ExcInternalError ());
+ dof_handler.mg_vertex_dofs[vertex].init (min_level[vertex], max_level[vertex], dof_handler.get_fe ().dofs_per_vertex);
+ }
-
++
+ else {
+ Assert (min_level[vertex] == n_levels, ExcInternalError ());
+ Assert (max_level[vertex] == 0, ExcInternalError ());
+ dof_handler.mg_vertex_dofs[vertex].init (1, 0, 0);
+ }
+ }
-
++
+ template<int spacedim>
+ static
+ void reserve_space_mg (DoFHandler<2, spacedim>& dof_handler) {
+ Assert (dof_handler.get_tria ().n_levels () > 0, ExcMessage ("Invalid triangulation"));
+ dof_handler.clear_mg_space ();
-
++
+ const dealii::FiniteElement<2, spacedim>& fe = dof_handler.get_fe ();
+ const dealii::Triangulation<2, spacedim>& tria = dof_handler.get_tria ();
+ const unsigned int& n_levels = tria.n_levels ();
-
++
+ for (unsigned int i = 0; i < n_levels; ++i) {
+ dof_handler.mg_levels.push_back (new internal::DoFHandler::DoFLevel<2>);
+ dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<unsigned int> (tria.n_raw_quads (i) * fe.dofs_per_quad, DoFHandler<2>::invalid_dof_index);
+ }
-
++
+ dof_handler.mg_faces = new internal::DoFHandler::DoFFaces<2>;
+ dof_handler.mg_faces->lines.dofs = std::vector<unsigned int> (tria.n_raw_lines () * fe.dofs_per_line, DoFHandler<2>::invalid_dof_index);
-
++
+ const unsigned int& n_vertices = tria.n_vertices ();
-
++
+ dof_handler.mg_vertex_dofs.resize (n_vertices);
-
++
+ std::vector<unsigned int> max_level (n_vertices, 0);
+ std::vector<unsigned int> min_level (n_vertices, n_levels);
-
++
+ for (typename dealii::Triangulation<2, spacedim>::cell_iterator cell = tria.begin (); cell != tria.end (); ++cell) {
+ const unsigned int level = cell->level ();
-
++
+ for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++vertex) {
+ const unsigned int vertex_index = cell->vertex_index (vertex);
-
++
+ if (min_level[vertex_index] > level)
+ min_level[vertex_index] = level;
-
++
+ if (max_level[vertex_index] < level)
+ max_level[vertex_index] = level;
+ }
+ }
-
++
+ for (unsigned int vertex = 0; vertex < n_vertices; ++vertex)
+ if (tria.vertex_used (vertex)) {
+ Assert (min_level[vertex] < n_levels, ExcInternalError ());
+ Assert (max_level[vertex] >= min_level[vertex], ExcInternalError ());
+ dof_handler.mg_vertex_dofs[vertex].init (min_level[vertex], max_level[vertex], fe.dofs_per_vertex);
+ }
-
++
+ else {
+ Assert (min_level[vertex] == n_levels, ExcInternalError ());
+ Assert (max_level[vertex] == 0, ExcInternalError ());
+ dof_handler.mg_vertex_dofs[vertex].init (1, 0, 0);
+ }
+ }
-
++
+ template<int spacedim>
+ static
+ void reserve_space_mg (DoFHandler<3, spacedim>& dof_handler) {
+ Assert (dof_handler.get_tria ().n_levels () > 0, ExcMessage ("Invalid triangulation"));
+ dof_handler.clear_mg_space ();
-
++
+ const dealii::FiniteElement<3, spacedim>& fe = dof_handler.get_fe ();
+ const dealii::Triangulation<3, spacedim>& tria = dof_handler.get_tria ();
+ const unsigned int& n_levels = tria.n_levels ();
-
++
+ for (unsigned int i = 0; i < n_levels; ++i) {
+ dof_handler.mg_levels.push_back (new internal::DoFHandler::DoFLevel<3>);
+ dof_handler.mg_levels.back ()->dof_object.dofs = std::vector<unsigned int> (tria.n_raw_hexs (i) * fe.dofs_per_hex, DoFHandler<3>::invalid_dof_index);
+ }
-
++
+ dof_handler.mg_faces = new internal::DoFHandler::DoFFaces<3>;
+ dof_handler.mg_faces->lines.dofs = std::vector<unsigned int> (tria.n_raw_lines () * fe.dofs_per_line, DoFHandler<3>::invalid_dof_index);
+ dof_handler.mg_faces->quads.dofs = std::vector<unsigned int> (tria.n_raw_quads () * fe.dofs_per_quad, DoFHandler<3>::invalid_dof_index);
-
++
+ const unsigned int& n_vertices = tria.n_vertices ();
-
++
+ dof_handler.mg_vertex_dofs.resize (n_vertices);
-
++
+ std::vector<unsigned int> max_level (n_vertices, 0);
+ std::vector<unsigned int> min_level (n_vertices, n_levels);
-
++
+ for (typename dealii::Triangulation<3, spacedim>::cell_iterator cell = tria.begin (); cell != tria.end (); ++cell) {
+ const unsigned int level = cell->level ();
-
++
+ for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell; ++vertex) {
+ const unsigned int vertex_index = cell->vertex_index (vertex);
-
++
+ if (min_level[vertex_index] > level)
+ min_level[vertex_index] = level;
-
++
+ if (max_level[vertex_index] < level)
+ max_level[vertex_index] = level;
+ }
+ }
-
++
+ for (unsigned int vertex = 0; vertex < n_vertices; ++vertex)
+ if (tria.vertex_used (vertex)) {
+ Assert (min_level[vertex] < n_levels, ExcInternalError ());
+ Assert (max_level[vertex] >= min_level[vertex], ExcInternalError ());
+ dof_handler.mg_vertex_dofs[vertex].init (min_level[vertex], max_level[vertex], fe.dofs_per_vertex);
+ }
-
++
+ else {
+ Assert (min_level[vertex] == n_levels, ExcInternalError ());
+ Assert (max_level[vertex] == 0, ExcInternalError ());
+ dof_handler.mg_vertex_dofs[vertex].init (1, 0, 0);
+ }
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int distribute_dofs_on_cell (typename DoFHandler<1, spacedim>::cell_iterator& cell, unsigned int next_free_dof) {
+ const FiniteElement<1, spacedim>& fe = cell->get_fe ();
-
++
+ if (fe.dofs_per_vertex > 0)
+ for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell; ++vertex) {
+ typename DoFHandler<1, spacedim>::cell_iterator neighbor = cell->neighbor (vertex);
-
++
+ if (neighbor.state () == IteratorState::valid)
+ if (neighbor->user_flag_set () && (neighbor->level () == cell->level ())) {
+ if (vertex == 0)
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ cell->set_mg_vertex_dof_index (cell->level (), 0, dof, neighbor->mg_vertex_dof_index (cell->level (), 1, dof));
-
++
+ else
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ cell->set_mg_vertex_dof_index (cell->level (), 1, dof, neighbor->mg_vertex_dof_index (cell->level (), 0, dof));
-
++
+ continue;
+ }
-
++
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ cell->set_mg_vertex_dof_index (cell->level (), vertex, dof, next_free_dof++);
+ }
-
++
+ if (fe.dofs_per_line > 0)
+ for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
+ cell->set_mg_dof_index (cell->level (), dof, next_free_dof++);
-
++
+ cell->set_user_flag ();
+ return next_free_dof;
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int distribute_dofs_on_cell (typename DoFHandler<2, spacedim>::cell_iterator& cell, unsigned int next_free_dof) {
+ const FiniteElement<2, spacedim>& fe = cell->get_fe ();
-
++
+ if (fe.dofs_per_vertex > 0)
+ for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell; ++vertex)
+ if (cell->mg_vertex_dof_index (cell->level (), vertex, 0) == DoFHandler<2>::invalid_dof_index)
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ cell->set_mg_vertex_dof_index (cell->level (), vertex, dof, next_free_dof++);
-
++
+ if (fe.dofs_per_line > 0)
+ for (unsigned int face = 0; face < GeometryInfo<2>::faces_per_cell; ++face) {
+ typename DoFHandler<2, spacedim>::line_iterator line = cell->line (face);
-
++
+ if (line->mg_dof_index (cell->level (), 0) == DoFHandler<2>::invalid_dof_index)
+ for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
+ line->set_mg_dof_index (cell->level (), dof, next_free_dof++);
+ }
-
++
+ if (fe.dofs_per_quad > 0)
+ for (unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof)
+ cell->set_mg_dof_index (cell->level (), dof, next_free_dof++);
-
++
+ cell->set_user_flag ();
+ return next_free_dof;
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int distribute_dofs_on_cell (typename DoFHandler<3, spacedim>::cell_iterator& cell, unsigned int next_free_dof) {
+ const FiniteElement<3, spacedim>& fe = cell->get_fe ();
-
++
+ if (fe.dofs_per_vertex > 0)
+ for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell; ++vertex)
+ if (cell->mg_vertex_dof_index (cell->level (), vertex, 0) == DoFHandler<3>::invalid_dof_index)
+ for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
+ cell->set_mg_vertex_dof_index (cell->level (), vertex, dof, next_free_dof++);
-
++
+ if (fe.dofs_per_line > 0)
+ for (unsigned int line = 0; line < GeometryInfo<3>::lines_per_cell; ++line) {
+ typename DoFHandler<3, spacedim>::line_iterator line_it = cell->line (line);
-
++
+ if (line_it->mg_dof_index (cell->level (), 0) == DoFHandler<3>::invalid_dof_index)
+ for (unsigned int dof = 0; dof < fe.dofs_per_line; ++dof)
+ line_it->set_mg_dof_index (cell->level (), dof, next_free_dof++);
+ }
-
++
+ if (fe.dofs_per_quad > 0)
+ for (unsigned int face = 0; face < GeometryInfo<3>::quads_per_cell; ++face) {
+ typename DoFHandler<3, spacedim>::quad_iterator quad = cell->quad (face);
-
++
+ if (quad->mg_dof_index (cell->level (), 0) == DoFHandler<3>::invalid_dof_index)
+ for (unsigned int dof = 0; dof < fe.dofs_per_quad; ++dof)
+ quad->set_mg_dof_index (cell->level (), dof, next_free_dof++);
+ }
-
++
+ if (fe.dofs_per_hex > 0)
+ for (unsigned int dof = 0; dof < fe.dofs_per_hex; ++dof)
+ cell->set_mg_dof_index (cell->level (), dof, next_free_dof++);
-
++
+ cell->set_user_flag ();
+ return next_free_dof;
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int get_dof_index (const DoFHandler<1, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<1>& mg_level, internal::DoFHandler::DoFFaces<1>&, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<1>) {
+ return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index);
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int get_dof_index (const DoFHandler<2, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<2>&, internal::DoFHandler::DoFFaces<2>& mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<1>) {
+ return mg_faces.lines.get_dof_index (dof_handler, obj_index, fe_index, local_index);
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int get_dof_index (const DoFHandler<2, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<2>& mg_level, internal::DoFHandler::DoFFaces<2>&, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<2>) {
+ return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index);
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int get_dof_index (const DoFHandler<3, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<3>&, internal::DoFHandler::DoFFaces<3>& mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<1>) {
+ return mg_faces.lines.get_dof_index (dof_handler, obj_index, fe_index, local_index);
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int get_dof_index (const DoFHandler<3, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<3>&, internal::DoFHandler::DoFFaces<3>& mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<2>) {
+ return mg_faces.quads.get_dof_index (dof_handler, obj_index, fe_index, local_index);
+ }
-
++
+ template<int spacedim>
+ static
+ unsigned int get_dof_index (const DoFHandler<3, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<3>& mg_level, internal::DoFHandler::DoFFaces<3>&, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const int2type<3>) {
+ return mg_level.dof_object.get_dof_index (dof_handler, obj_index, fe_index, local_index);
+ }
-
++
+ template<int spacedim>
+ static
+ void set_dof_index (const DoFHandler<1, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<1>& mg_level, internal::DoFHandler::DoFFaces<1>&, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<1>) {
+ mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index);
+ }
-
++
+ template<int spacedim>
+ static
+ void set_dof_index (const DoFHandler<2, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<2>&, internal::DoFHandler::DoFFaces<2>& mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<1>) {
+ mg_faces.lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index);
+ }
-
++
+ template<int spacedim>
+ static
+ void set_dof_index (const DoFHandler<2, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<2>& mg_level, internal::DoFHandler::DoFFaces<2>&, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<2>) {
+ mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index);
+ }
-
++
+ template<int spacedim>
+ static
+ void set_dof_index (const DoFHandler<3, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<3>&, internal::DoFHandler::DoFFaces<3>& mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<1>) {
+ mg_faces.lines.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index);
+ }
-
++
+ template<int spacedim>
+ static
+ void set_dof_index (const DoFHandler<3, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<3>&, internal::DoFHandler::DoFFaces<3>& mg_faces, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<2>) {
+ mg_faces.quads.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index);
+ }
-
++
+ template<int spacedim>
+ static
+ void set_dof_index (const DoFHandler<3, spacedim>& dof_handler, internal::DoFHandler::DoFLevel<3>& mg_level, internal::DoFHandler::DoFFaces<3>&, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index, const int2type<3>) {
+ mg_level.dof_object.set_dof_index (dof_handler, obj_index, fe_index, local_index, global_index);
+ }
};
}
}
DoFHandler<dim,spacedim>::memory_consumption () const
{
std::size_t mem = (MemoryConsumption::memory_consumption (tria) +
- MemoryConsumption::memory_consumption (selected_fe) +
- MemoryConsumption::memory_consumption (block_info_object) +
- MemoryConsumption::memory_consumption (levels) +
- MemoryConsumption::memory_consumption (*faces) +
- MemoryConsumption::memory_consumption (faces) +
- sizeof (number_cache) +
- MemoryConsumption::memory_consumption (vertex_dofs));
+ MemoryConsumption::memory_consumption (selected_fe) +
+ MemoryConsumption::memory_consumption (block_info_object) +
+ MemoryConsumption::memory_consumption (levels) +
+ MemoryConsumption::memory_consumption (*faces) +
+ MemoryConsumption::memory_consumption (faces) +
+ sizeof (number_cache) +
+ MemoryConsumption::memory_consumption (vertex_dofs));
for (unsigned int i=0; i<levels.size(); ++i)
mem += MemoryConsumption::memory_consumption (*levels[i]);
-
+
+ for (unsigned int level = 0; level < mg_levels.size (); ++level)
+ mem += mg_levels[level]->memory_consumption ();
-
++
+ mem += MemoryConsumption::memory_consumption (*mg_faces);
-
++
+ for (unsigned int i = 0; i < mg_vertex_dofs.size (); ++i)
+ mem += sizeof (MGVertexDoFs) + (1 + mg_vertex_dofs[i].get_finest_level () - mg_vertex_dofs[i].get_coarsest_level ()) * sizeof (unsigned int);
-
++
+ mem += MemoryConsumption::memory_consumption (mg_used_dofs);
return mem;
}
}
-
+template<int dim, int spacedim>
+void DoFHandler<dim, spacedim>::distribute_mg_dofs (const FiniteElement<dim, spacedim>& fe) {
+ Assert ((dynamic_cast<const parallel::distributed::Triangulation<dim, spacedim>*> (&*tria) == 0), ExcMessage ("Invalid triangulation"));
+ distribute_dofs (fe);
+ reserve_space ();
-
++
+ const unsigned int& n_levels = (*tria).n_levels ();
-
++
+ mg_used_dofs.resize (n_levels, 0);
-
++
+ std::vector<bool> user_flags;
-
++
+ (*tria).save_user_flags (user_flags);
+ const_cast<Triangulation<dim, spacedim>&>(*tria).clear_user_flags ();
-
++
+ for (unsigned int level = 0; level < n_levels; ++level) {
+ unsigned int next_free_dof = 0;
-
++
+ for (cell_iterator cell = begin (level); cell != end (level); ++cell)
+ next_free_dof = internal::DoFHandler::Implementation::distribute_dofs_on_cell<spacedim> (cell, next_free_dof);
-
++
+ mg_used_dofs[level] = next_free_dof;
+ }
-
++
+ const_cast<Triangulation<dim, spacedim>&>(*tria).load_user_flags (user_flags);
+ block_info_object.initialize (*this, true, true);
+}
+
+template<int dim, int spacedim>
+void DoFHandler<dim, spacedim>::reserve_space () {
+ internal::DoFHandler::Implementation::reserve_space_mg (*this);
+}
+
+template<int dim, int spacedim>
+void DoFHandler<dim, spacedim>::clear_mg_space () {
+ for (unsigned int i = 0; i < mg_levels.size (); ++i)
+ delete mg_levels[i];
-
++
+ mg_levels.clear ();
+ delete mg_faces;
+ mg_faces = NULL;
-
++
+ std::vector<MGVertexDoFs> tmp;
++
+ std::swap (mg_vertex_dofs, tmp);
+}
+
template<int dim, int spacedim>
void DoFHandler<dim,spacedim>::initialize_local_block_info ()
std::swap (vertex_dofs, tmp);
}
-
+template<int dim, int spacedim>
+template<int structdim>
+unsigned int DoFHandler<dim, spacedim>::get_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const {
+ return internal::DoFHandler::Implementation::get_dof_index (*this, *this->mg_levels[obj_level], *this->mg_faces, obj_index, fe_index, local_index, internal::int2type<structdim> ());
+}
+
+template<int dim, int spacedim>
+template<int structdim>
+void DoFHandler<dim, spacedim>::set_dof_index (const unsigned int obj_level, const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const unsigned int global_index) const {
+ internal::DoFHandler::Implementation::set_dof_index (*this, *this->mg_levels[obj_level], *this->mg_faces, obj_index, fe_index, local_index, global_index, internal::int2type<structdim> ());
+}
+
+template<int dim, int spacedim>
+DoFHandler<dim, spacedim>::MGVertexDoFs::MGVertexDoFs (): coarsest_level (numbers::invalid_unsigned_int), finest_level (0), indices (0), indices_offset (0) {
+}
+
+template<int dim, int spacedim>
+DoFHandler<dim, spacedim>::MGVertexDoFs::~MGVertexDoFs () {
+ delete[] indices;
+ delete[] indices_offset;
+}
+
+template<int dim, int spacedim>
+void DoFHandler<dim, spacedim>::MGVertexDoFs::init (const unsigned int cl, const unsigned int fl, const unsigned int dofs_per_vertex) {
+ if (indices != 0) {
+ delete[] indices;
+ indices = 0;
+ }
-
++
+ if (indices_offset != 0) {
+ delete[] indices_offset;
+ indices_offset = 0;
+ }
-
++
+ coarsest_level = cl;
+ finest_level = fl;
-
++
+ if (cl > fl)
+ return;
-
++
+ const unsigned int n_levels = finest_level - coarsest_level + 1;
+ const unsigned int n_indices = n_levels * dofs_per_vertex;
-
++
+ indices = new unsigned int[n_indices];
+ Assert (indices != 0, ExcNoMemory ());
-
++
+ for (unsigned int i = 0; i < n_indices; ++i)
+ indices[i] = DoFHandler<dim, spacedim>::invalid_dof_index;
-
++
+ indices_offset = new unsigned int[n_levels];
+ Assert (indices != 0, ExcNoMemory ());
++
+ for (unsigned int i = 0; i < n_levels; ++i)
+ indices_offset[i] = i * dofs_per_vertex;
+}
+
+template<int dim, int spacedim>
+unsigned int DoFHandler<dim, spacedim>::MGVertexDoFs::get_coarsest_level () const {
+ return coarsest_level;
+}
+
+template<int dim, int spacedim>
+unsigned int DoFHandler<dim, spacedim>::MGVertexDoFs::get_finest_level () const {
+ return finest_level;
+}
+
/*-------------- Explicit Instantiations -------------------------------*/
#include "dof_handler.inst"
// at most 2
Table<2,std_cxx1x::shared_ptr<internal::hp::DoFIdentities> >
line_dof_identities (finite_elements->size(),
- finite_elements->size());
+ finite_elements->size());
- for (line_iterator line=begin_line(); line!=end_line(); ++line)
- {
+ for (active_cell_iterator cell=begin_active(); cell!=end(); ++cell)
+ for (unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
+ if (cell->line(l)->user_flag_set() == false)
+ {
+ const line_iterator line = cell->line(l);
+ line->set_user_flag ();
+
unsigned int unique_sets_of_dofs
= line->n_active_fe_indices();
// particularly frequent case
Table<2,std_cxx1x::shared_ptr<internal::hp::DoFIdentities> >
quad_dof_identities (finite_elements->size(),
- finite_elements->size());
+ finite_elements->size());
- for (quad_iterator quad=begin_quad(); quad!=end_quad(); ++quad)
- if (quad->n_active_fe_indices() == 2)
- {
- // find out which is the
- // most dominating finite
- // element of the ones that
- // are used on this quad
- const unsigned int most_dominating_fe_index
- = internal::hp::get_most_dominating_fe_index<dim,spacedim> (quad);
-
- const unsigned int n_active_fe_indices
- = quad->n_active_fe_indices ();
-
- // loop over the indices of
- // all the finite elements
- // that are not dominating,
- // and identify their dofs
- // to the most dominating
- // one
- for (unsigned int f=0; f<n_active_fe_indices; ++f)
- if (quad->nth_active_fe_index (f) !=
- most_dominating_fe_index)
- {
- const unsigned int
- other_fe_index = quad->nth_active_fe_index (f);
-
- internal::hp::ensure_existence_of_dof_identities<2>
- ((*finite_elements)[most_dominating_fe_index],
- (*finite_elements)[other_fe_index],
- quad_dof_identities[most_dominating_fe_index][other_fe_index]);
-
- internal::hp::DoFIdentities &identities
- = *quad_dof_identities[most_dominating_fe_index][other_fe_index];
- for (unsigned int i=0; i<identities.size(); ++i)
- {
- const unsigned int master_dof_index
- = quad->dof_index (identities[i].first, most_dominating_fe_index);
- const unsigned int slave_dof_index
- = quad->dof_index (identities[i].second, other_fe_index);
-
- Assert ((new_dof_indices[master_dof_index] ==
- numbers::invalid_unsigned_int)
- ||
- (new_dof_indices[slave_dof_index] ==
- master_dof_index),
- ExcInternalError());
-
- new_dof_indices[slave_dof_index] = master_dof_index;
- }
- }
- }
+ for (active_cell_iterator cell=begin_active(); cell!=end(); ++cell)
+ for (unsigned int q=0; q<GeometryInfo<dim>::quads_per_cell; ++q)
+ if ((cell->quad(q)->user_flag_set() == false)
+ &&
+ (cell->quad(q)->n_active_fe_indices() == 2))
+ {
+ const quad_iterator quad = cell->quad(q);
+ quad->set_user_flag ();
+
+ // find out which is the
+ // most dominating finite
+ // element of the ones that
+ // are used on this quad
+ const unsigned int most_dominating_fe_index
+ = internal::hp::get_most_dominating_fe_index<dim,spacedim> (quad);
+
+ const unsigned int n_active_fe_indices
+ = quad->n_active_fe_indices ();
+
+ // loop over the indices of
+ // all the finite elements
+ // that are not dominating,
+ // and identify their dofs
+ // to the most dominating
+ // one
+ for (unsigned int f=0; f<n_active_fe_indices; ++f)
+ if (quad->nth_active_fe_index (f) !=
+ most_dominating_fe_index)
+ {
+ const unsigned int
+ other_fe_index = quad->nth_active_fe_index (f);
+
+ internal::hp::ensure_existence_of_dof_identities<2>
+ ((*finite_elements)[most_dominating_fe_index],
+ (*finite_elements)[other_fe_index],
+ quad_dof_identities[most_dominating_fe_index][other_fe_index]);
+
+ internal::hp::DoFIdentities &identities
+ = *quad_dof_identities[most_dominating_fe_index][other_fe_index];
+ for (unsigned int i=0; i<identities.size(); ++i)
+ {
+ const unsigned int master_dof_index
+ = quad->dof_index (identities[i].first, most_dominating_fe_index);
+ const unsigned int slave_dof_index
+ = quad->dof_index (identities[i].second, other_fe_index);
+
+ Assert ((new_dof_indices[master_dof_index] ==
+ numbers::invalid_unsigned_int)
+ ||
+ (new_dof_indices[slave_dof_index] ==
+ master_dof_index),
+ ExcInternalError());
+
+ new_dof_indices[slave_dof_index] = master_dof_index;
+ }
+ }
+ }
+
+ // finally restore the user flags
+ const_cast<Triangulation<dim,spacedim> &>(this->get_tria())
+ .load_user_flags_quad(user_flags);
}
void
DoFHandler<2,2>::
renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
- internal::int2type<2>)
+ internal::int2type<2>)
{
+ const unsigned int dim = 2;
+ const unsigned int spacedim = 2;
+
Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
renumber_dofs_internal (new_numbers, internal::int2type<1>());
void
DoFHandler<2,3>::
renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
- internal::int2type<2>)
+ internal::int2type<2>)
{
+ const unsigned int dim = 2;
+ const unsigned int spacedim = 3;
+
Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
renumber_dofs_internal (new_numbers, internal::int2type<1>());
void
DoFHandler<3,3>::
renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
- internal::int2type<2>)
+ internal::int2type<2>)
{
+ const unsigned int dim = 3;
+ const unsigned int spacedim = 3;
+
Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
renumber_dofs_internal (new_numbers, internal::int2type<1>());
void
DoFHandler<3,3>::
renumber_dofs_internal (const std::vector<unsigned int> &new_numbers,
- internal::int2type<3>)
+ internal::int2type<3>)
{
+ const unsigned int dim = 3;
+ const unsigned int spacedim = 3;
+
Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
renumber_dofs_internal (new_numbers, internal::int2type<2>());
}
- Assert (false, ExcNotImplemented());
+ template <int dim, int spacedim>
+ template <int structdim>
+ unsigned int
+ DoFHandler<dim,spacedim>::get_dof_index (const unsigned int,
+ const unsigned int,
+ const unsigned int,
+ const unsigned int) const
+ {
+ Assert (false, ExcNotImplemented());
+ return numbers::invalid_unsigned_int;
+ }
+
+
+ template <int dim, int spacedim>
+ template <int structdim>
+ void
+ DoFHandler<dim,spacedim>::set_dof_index (const unsigned int,
+ const unsigned int,
+ const unsigned int,
+ const unsigned int,
+ const unsigned int) const
+ {
++ Assert (false, ExcNotImplemented());
+ }
+
+
template<int dim, int spacedim>
void DoFHandler<dim,spacedim>::clear_space ()
{