From: Wolfgang Bangerth Date: Sat, 1 Jul 2023 21:12:27 +0000 (-0600) Subject: Avoid preprocessor define. X-Git-Tag: relicensing~808^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15570%2Fhead;p=dealii.git Avoid preprocessor define. --- diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index da30239ef1..b9d0323387 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -901,20 +901,28 @@ AffineConstraints::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 &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 &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; }