]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow for the default construction of 1d face iterators.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 19 Aug 2021 23:18:46 +0000 (17:18 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 20 Aug 2021 00:18:52 +0000 (18:18 -0600)
include/deal.II/dofs/dof_accessor.h
include/deal.II/dofs/dof_accessor.templates.h

index 9d81ce0749ddf68fca03c752b0872363781fb924..b3636f13b9827af245b3462473c6bd3440f6fc84 100644 (file)
@@ -851,7 +851,8 @@ public:
   /**
    * Constructor. This constructor exists in order to maintain interface
    * compatibility with the other accessor classes. However, it doesn't do
-   * anything useful here and so may not actually be called.
+   * anything useful here and so may not actually be called except to
+   * default-construct iterator objects.
    */
   DoFAccessor(const Triangulation<1, spacedim> *,
               const int                                  = 0,
index d360a2642a9f845e89cd483bf8e903c9e6c9dc0b..582405f1c1b5d7aef8d907186da6d3f706643eb0 100644 (file)
@@ -1836,15 +1836,31 @@ inline DoFAccessor<0, 1, spacedim, level_dof_access>::DoFAccessor(
 
 template <int spacedim, bool level_dof_access>
 inline DoFAccessor<0, 1, spacedim, level_dof_access>::DoFAccessor(
-  const Triangulation<1, spacedim> *,
-  const int,
-  const int,
-  const DoFHandler<1, spacedim> *)
-  : dof_handler(nullptr)
-{
-  Assert(false,
+  const Triangulation<1, spacedim> *tria,
+  const int                         level,
+  const int                         index,
+  const DoFHandler<1, spacedim> *   dof_handler)
+  // This is the constructor signature for "ordinary" (non-vertex)
+  // accessors and we shouldn't be calling it altogether. But it is also
+  // the constructor that the default-constructor of TriaRawIterator
+  // calls when default-constructing an iterator object. If so, this
+  // happens with level==-2 and index==-2, and this is the only case we
+  // would like to support. We do this by just forwarding to the
+  // other constructor of this class, and then asserting the condition
+  // on level and index.
+  : DoFAccessor<0, 1, spacedim, level_dof_access>(
+      tria,
+      TriaAccessor<0, 1, spacedim>::interior_vertex,
+      0U,
+      dof_handler)
+{
+  (void)level;
+  (void)index;
+  Assert((tria == nullptr) && (level == -2) && (index == -2) &&
+           (dof_handler == nullptr),
          ExcMessage(
-           "This constructor can not be called for face iterators in 1d."));
+           "This constructor can not be called for face iterators in 1d, "
+           "except to default-construct iterator objects."));
 }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.