Fix (or work around?) strange bug on Windows

The definition of std::max uses references for parameters, which leads
to unnecessary storing of constants on the stack. If the stack is
overwritten this leads to wrong results.
max2() works around this using call-by-value.
This commit is contained in:
Matthias Hochsteger 2017-02-16 09:12:45 +01:00
parent cd314e2f45
commit 002a2cba6b

View File

@ -693,9 +693,9 @@ namespace netgen
{
facecoeffsindex[i] = nd;
if (top.GetFaceType(i+1) == TRIG)
nd += max (0, (faceorder[i]-1)*(faceorder[i]-2)/2);
nd += max2 (0, (faceorder[i]-1)*(faceorder[i]-2)/2);
else
nd += max (0, sqr(faceorder[i]-1));
nd += max2 (0, sqr(faceorder[i]-1));
}
facecoeffsindex[nfaces] = nd;