Skip to content

Commit

Permalink
Some more small AffineConstraints code improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Jul 10, 2023
1 parent f0edc9a commit 7ad577a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions include/deal.II/lac/affine_constraints.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,9 @@ AffineConstraints<number>::close()
#ifdef DEBUG
size_type iteration = 0;
#endif
while (true)
bool chained_constraint_replaced = false;
do
{
bool chained_constraint_replaced = false;

for (ConstraintLine &line : lines)
{
#ifdef DEBUG
Expand All @@ -729,7 +728,7 @@ AffineConstraints<number>::close()
// have appended in this go around) and see whether they are
// further constrained. ignore elements that we don't store on
// the current processor
size_type entry = 0;
unsigned int entry = 0;
while (entry < line.entries.size())
if (((local_lines.size() == 0) ||
(local_lines.is_element(line.entries[entry].first))) &&
Expand All @@ -755,7 +754,7 @@ AffineConstraints<number>::close()
// where we will later process them once more
//
// we can of course only do that if the DoF that we are
// currently handle is constrained by a linear combination
// currently handling is constrained by a linear combination
// of other dofs:
if (constrained_line.entries.size() > 0)
{
Expand Down Expand Up @@ -808,18 +807,15 @@ AffineConstraints<number>::close()
++entry;
}

// if we didn't do anything in this round, then quit the loop
if (chained_constraint_replaced == false)
break;

#ifdef DEBUG
// increase iteration count. note that we should not iterate more
// times than there are constraints, since this puts a natural upper
// bound on the length of constraint chains
++iteration;
Assert(iteration <= lines.size(), ExcInternalError());
Assert(iteration <= lines.size() + 1, ExcInternalError());
#endif
}
while (chained_constraint_replaced == true);

// Finally sort the entries and re-scale them if necessary. in this step,
// we also throw out duplicates as mentioned above. moreover, as some
Expand Down

0 comments on commit 7ad577a

Please sign in to comment.