]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid preprocessor define. 15570/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 1 Jul 2023 21:12:27 +0000 (15:12 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sun, 2 Jul 2023 02:37:25 +0000 (20:37 -0600)
include/deal.II/lac/affine_constraints.templates.h

index da30239ef1c9ec9498d760597e4f6c3609fb755f..b9d0323387bda7ef69ab93714c6877b1f9de1092 100644 (file)
@@ -901,20 +901,28 @@ AffineConstraints<number>::close()
         }
     } // end of loop over all constraint lines
 
-#ifdef DEBUG
   // if in debug mode: check that no dof is constrained to another dof that
   // is also constrained. exclude dofs from this check whose constraint
   // lines are not stored on the local processor
-  for (const ConstraintLine &line : lines)
-    for (const std::pair<size_type, number> &entry : line.entries)
-      if ((local_lines.size() == 0) || (local_lines.is_element(entry.first)))
-        {
-          // make sure that entry->first is not the index of a line itself
-          const bool is_circle = is_constrained(entry.first);
-          Assert(is_circle == false,
-                 ExcDoFConstrainedToConstrainedDoF(line.index, entry.first));
-        }
-#endif
+  Assert(std::none_of(lines.begin(),
+                      lines.end(),
+                      [this](const ConstraintLine &line) {
+                        for (const std::pair<size_type, number> &entry :
+                             line.entries)
+                          if ((local_lines.size() == 0) ||
+                              (local_lines.is_element(entry.first)))
+                            {
+                              // make sure that entry->first is not the index of
+                              // a line itself
+                              const bool is_circle =
+                                is_constrained(entry.first);
+                              if (is_circle)
+                                return true;
+                            }
+                        return false;
+                      }),
+         ExcMessage("The constraints represented by this object have a cycle. "
+                    "This is not allowed."));
 
   sorted = true;
 }

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.