mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Scalar.H: Minor reorganization
This commit is contained in:
@ -109,6 +109,39 @@ public:
|
|||||||
word name(const Scalar);
|
word name(const Scalar);
|
||||||
|
|
||||||
|
|
||||||
|
// Standard C++ transcendental functions
|
||||||
|
transFunc(sqrt)
|
||||||
|
|
||||||
|
transFunc(cbrt)
|
||||||
|
transFunc(exp)
|
||||||
|
transFunc(log)
|
||||||
|
transFunc(log10)
|
||||||
|
transFunc(sin)
|
||||||
|
transFunc(cos)
|
||||||
|
transFunc(tan)
|
||||||
|
transFunc(asin)
|
||||||
|
transFunc(acos)
|
||||||
|
transFunc(atan)
|
||||||
|
transFunc(sinh)
|
||||||
|
transFunc(cosh)
|
||||||
|
transFunc(tanh)
|
||||||
|
transFunc(asinh)
|
||||||
|
transFunc(acosh)
|
||||||
|
transFunc(atanh)
|
||||||
|
|
||||||
|
// Standard ANSI-C (but not in <cmath>) transcendental functions
|
||||||
|
|
||||||
|
transFunc(erf)
|
||||||
|
transFunc(erfc)
|
||||||
|
transFunc(lgamma)
|
||||||
|
|
||||||
|
transFunc(j0)
|
||||||
|
transFunc(j1)
|
||||||
|
|
||||||
|
transFunc(y0)
|
||||||
|
transFunc(y1)
|
||||||
|
|
||||||
|
|
||||||
inline Scalar& setComponent(Scalar& s, const direction)
|
inline Scalar& setComponent(Scalar& s, const direction)
|
||||||
{
|
{
|
||||||
return s;
|
return s;
|
||||||
@ -191,22 +224,6 @@ inline Scalar sqr(const Scalar s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
|
|
||||||
{
|
|
||||||
Scalar maga = mag(a);
|
|
||||||
Scalar magb = mag(b);
|
|
||||||
|
|
||||||
if (maga > magb)
|
|
||||||
{
|
|
||||||
return maga*sqrt(1.0 + sqr(magb/maga));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return magb < ScalarVSMALL ? 0.0 : magb*sqrt(1.0 + sqr(maga/magb));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Scalar pow3(const Scalar s)
|
inline Scalar pow3(const Scalar s)
|
||||||
{
|
{
|
||||||
return s*sqr(s);
|
return s*sqr(s);
|
||||||
@ -290,37 +307,20 @@ inline Scalar cmptMag(const Scalar s)
|
|||||||
return mag(s);
|
return mag(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
|
||||||
|
{
|
||||||
|
Scalar maga = mag(a);
|
||||||
|
Scalar magb = mag(b);
|
||||||
|
|
||||||
// Standard C++ transcendental functions
|
if (maga > magb)
|
||||||
transFunc(sqrt)
|
{
|
||||||
transFunc(cbrt)
|
return maga*sqrt(1.0 + sqr(magb/maga));
|
||||||
transFunc(exp)
|
}
|
||||||
transFunc(log)
|
else
|
||||||
transFunc(log10)
|
{
|
||||||
transFunc(sin)
|
return magb < ScalarVSMALL ? 0.0 : magb*sqrt(1.0 + sqr(maga/magb));
|
||||||
transFunc(cos)
|
}
|
||||||
transFunc(tan)
|
}
|
||||||
transFunc(asin)
|
|
||||||
transFunc(acos)
|
|
||||||
transFunc(atan)
|
|
||||||
transFunc(sinh)
|
|
||||||
transFunc(cosh)
|
|
||||||
transFunc(tanh)
|
|
||||||
transFunc(asinh)
|
|
||||||
transFunc(acosh)
|
|
||||||
transFunc(atanh)
|
|
||||||
|
|
||||||
// Standard ANSI-C (but not in <cmath>) transcendental functions
|
|
||||||
|
|
||||||
transFunc(erf)
|
|
||||||
transFunc(erfc)
|
|
||||||
transFunc(lgamma)
|
|
||||||
|
|
||||||
transFunc(j0)
|
|
||||||
transFunc(j1)
|
|
||||||
|
|
||||||
transFunc(y0)
|
|
||||||
transFunc(y1)
|
|
||||||
|
|
||||||
|
|
||||||
// Stabilisation around zero for division
|
// Stabilisation around zero for division
|
||||||
|
|||||||
Reference in New Issue
Block a user