[MathLib] Avoid the division by zero in componentwiseDivide
The function MathLib::LinAlg::componentwiseDivide computes the division of two vectors, x/y
component-wise. In the Eigen specialization of that template function, Eigen vector member function cwiseQuotient
is called to compute x/y
. Unfortunately, the division by zero gives nan
by cwiseQuotient
. This MR replaces cwiseQuotient
with binaryExpr
.
Note that MathLib::LinAlg::componentwiseDivide
is used in the extrapolation function, where y
is a vector stores the counts of elements for a node for extrapolation. For a node, if there is no contribution of the extrapolated integration point values from its connected elements, the count is zero.
-
Feature description was added to the changelog -
Tests covering your feature were added? -
Any new feature or behavior change was documented?
Edited by wenqing