From 419f3d845dfd15a1e6ea43cf6fc1b4b35d6a1db7 Mon Sep 17 00:00:00 2001
From: Peter Munch <peterrmuench@gmail.com>
Date: Fri, 20 Oct 2023 09:48:06 +0200
Subject: [PATCH] Update comment

---
 include/deal.II/dofs/dof_tools.h     | 15 +++++++++------
 source/dofs/dof_tools_constraints.cc | 14 ++++++++++----
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h
index e1dc5febd8..7cb861e0a9 100644
--- a/include/deal.II/dofs/dof_tools.h
+++ b/include/deal.II/dofs/dof_tools.h
@@ -1166,11 +1166,16 @@ namespace DoFTools
   namespace internal
   {
     /**
-     * Internally used in make_periodicity_constraints.
-     *
+     * This function is internally used in make_periodicity_constraints().
      * Enter constraints for periodicity into the given AffineConstraints
-     * object. this function is called when at least one of the two face
-     * iterators corresponds to an active object without further children
+     * object.
+     *
+     * This function works both on 1) an active mesh
+     * (`level == numbers::invalid_unsigned_int`) and on 2) multigrid levels.
+     *
+     * In the case of an active mesh, this function is called when at least
+     * one of the two face iterators corresponds to an active object
+     * without further children. Furthermore, @p face_1 is supposed to be active.
      *
      * The matrix @p transformation maps degrees of freedom from one face
      * to another. If the DoFs on the two faces are supposed to match exactly,
@@ -1178,8 +1183,6 @@ namespace DoFTools
      * once refined from face 1, then the matrix needs to be the interpolation
      * matrix from a face to this particular child
      *
-     * @note: @p face_1 is supposed to be active.
-     *
      * @note We have to be careful not to accidentally create constraint
      * cycles when adding periodic constraints: For example, as the
      * corresponding testcase bits/periodicity_05 demonstrates, we can
diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc
index 4d5aebe358..4d1ce5c73e 100644
--- a/source/dofs/dof_tools_constraints.cc
+++ b/source/dofs/dof_tools_constraints.cc
@@ -1869,9 +1869,12 @@ namespace DoFTools
       static const int dim      = FaceIterator::AccessorType::dimension;
       static const int spacedim = FaceIterator::AccessorType::space_dimension;
 
-      const bool use_mg = level != numbers::invalid_unsigned_int;
+      const bool use_mg = (level != numbers::invalid_unsigned_int);
+
+      // If we don't use multigrid, we should be in the case where face_1 is
+      // active, i.e. has no children. In the case of multigrid, constraints
+      // between cells on the same level are set up.
 
-      // we should be in the case where face_1 is active, i.e. has no children:
       Assert(use_mg || (!face_1->has_children()), ExcInternalError());
 
       Assert(face_1->n_active_fe_indices() == 1, ExcInternalError());
@@ -1884,8 +1887,11 @@ namespace DoFTools
         face_2->get_fe(face_2->nth_active_fe_index(0)).n_unique_faces(), 1);
       const unsigned int face_no = 0;
 
-      // If face_2 does have children, then we need to iterate over these
-      // children and set periodic constraints in the inverse direction:
+      // If we don't use multigrid and face_2 does have children,
+      // then we need to iterate over these children and set periodic
+      // constraints in the inverse direction. In the case of multigrid,
+      // we don't need to do this, since constraints between cells on
+      // the same level are set up.
 
       if ((!use_mg) && face_2->has_children())
         {
-- 
2.39.5