--- /dev/null
+New: The new function Triangulation::as_dof_handler_level_iterator()
+allows to create level iterators based on other cell iterators.
+<br>
+(Peter Munch, 2023/08/01)
TriaActiveIterator<DoFCellAccessor<dim, spacedim, false>>
as_dof_handler_iterator(const DoFHandler<dim, spacedim> &dof_handler) const;
+ /**
+ * A function similar to as_dof_handler_iterator(). It converts
+ * a Triangulation active/level cell iterator to a
+ * DoFHandler active level cell iterator, or a DoFHandler level active/cell
+ * iterator to a level cell iterator of another DoFHandler. The
+ * @p iterator must be associated with the triangulation of the
+ * @p dof_handler.
+ */
+ TriaIterator<DoFCellAccessor<dim, spacedim, true>>
+ as_dof_handler_level_iterator(
+ const DoFHandler<dim, spacedim> &dof_handler) const;
+
+
/**
* @}
*/
}
+
+template <int dim, int spacedim>
+TriaIterator<DoFCellAccessor<dim, spacedim, true>>
+CellAccessor<dim, spacedim>::as_dof_handler_level_iterator(
+ const DoFHandler<dim, spacedim> &dof_handler) const
+{
+ Assert(&this->get_triangulation() == &dof_handler.get_triangulation(),
+ ExcMessage("The triangulation associated with the iterator does not "
+ "match that of the DoFHandler."));
+
+ return typename DoFHandler<dim, spacedim>::level_cell_iterator(
+ &dof_handler.get_triangulation(),
+ this->level(),
+ this->index(),
+ &dof_handler);
+}
+
+
+
// For codim>0 we proceed as follows:
// 1) project point onto manifold and
// 2) transform to the unit cell with a Q1 mapping