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,
* 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
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());
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())
{