Division by zero in iterationsteps/obstacletnnmgstep.hh

As already mentioned here, the lines in iterationsteps/obstacletnnmgstep.hh

  defectConstraint.lower(j) /= coarseCorrection_[i][j];
  defectConstraint.upper(j) /= coarseCorrection_[i][j];

will carry out a division by zero if coarseCorrection_[i][j] is zero. Clang's -fsanitize=undefined warns about this, too.

If this is indeed desirable and someone has thought through the consequences that a value of NaN somewhere in defectConstraint has on the the remainder of the code, I'd at least like to see a comment that this is all intentional.

PS: possible micro-optimization: Since floating point division is considerably slower than multiplication, we might want to compute 1.0 / coarseCorrection_[i][j] once and then multiply by that value.

Assignee Loading
Time tracking Loading