83 return std::hypot(re, im);
89 return (re*re + im*im);
183 return c.conjugate();
194 return c.magnitude();
204inline complex
sqr(
const complex& c)
211inline complex
sign(
const complex& c)
214 const scalar
s(
mag(c));
215 return s < ROOTVSMALL ?
Zero : c/
s;
226inline const complex&
min(
const complex& c1,
const complex& c2)
228 return (c1.magSqr() < c2.magSqr()) ? c1 : c2;
232inline const complex&
max(
const complex& c1,
const complex& c2)
234 return (c1.magSqr() < c2.magSqr()) ? c2 : c1;
238inline complex
limit(
const complex& c1,
const complex& c2)
242 limit(c1.real(), c2.real()),
243 limit(c1.imag(), c2.imag())
251 const scalar onet = (1-t);
255 onet*a.
real() + t*
b.real(),
256 onet*a.
imag() + t*
b.imag()
267template<
class Cmpt>
class Tensor;
270inline complex
transform(
const Tensor<scalar>&,
const complex c)
278inline complex
operator-(
const complex& c)
332 c1.re*c2.re - c1.im*c2.im,
333 c1.im*c2.re + c1.re*c2.im
352 const scalar sqrC2 = c2.magSqr();
356 (c1.re*c2.re + c1.im*c2.im)/sqrC2,
357 (c1.im*c2.re - c1.re*c2.im)/sqrC2
384 #define transFunc(func) \
385 inline complex func(const complex& c) \
387 return std:: func (static_cast<std::complex<scalar>>(c)); \
412 static_cast<std::complex<scalar>
>(
x),
413 static_cast<std::complex<scalar>
>(
y)
419#define powFuncs(type2) \
420 inline complex pow(const complex& x, const type2 y) \
422 return std::pow(static_cast<std::complex<scalar>>(x), y); \
425 inline complex pow(const type2 x, const complex& y) \
429 static_cast<std::complex<scalar>>(x), \
430 static_cast<std::complex<scalar>>(y) \
436#if (WM_LABEL_SIZE == 64) && (defined(__APPLE__) || defined(_WIN32))
449inline complex
pow4(
const complex& c)
455inline complex
pow5(
const complex& c)
461inline complex
pow6(
const complex& c)
467inline complex
pow025(
const complex& c)
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
A complex number, similar to the C++ complex type.
complex conjugate() const
Complex conjugate.
complex & operator=(const complex &) noexcept=default
Copy assignment.
void operator+=(const complex &c)
constexpr scalar real() const noexcept
Real part of complex number - STL naming.
constexpr complex() noexcept
Default construct, as zero-initialized.
constexpr scalar imag() const noexcept
Imaginary part of complex number - STL naming.
void operator-=(const complex &c)
complex(const complex &) noexcept=default
Copy construct.
void operator*=(const complex &c)
bool operator!=(const complex &c) const
void operator/=(const complex &c)
scalar cmptSum() const noexcept
The sum of real/imag components.
scalar magSqr() const
The L2-norm squared of complex.
bool operator==(const complex &c) const
scalar magnitude() const
The magnitude (L2-norm) of complex. Called magnitude() instead mag(), which looks too much like imag(...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
bitSet operator~(const bitSet &bitset)
Bitset complement, returns a copy of the bitset with all its bits flipped.
dimensionedScalar pow6(const dimensionedScalar &ds)
dimensionedScalar pow5(const dimensionedScalar &ds)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar asin(const dimensionedScalar &ds)
dimensionedScalar exp(const dimensionedScalar &ds)
dimensionedScalar tan(const dimensionedScalar &ds)
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
complex limit(const complex &c1, const complex &c2)
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
dimensionedScalar pow3(const dimensionedScalar &ds)
dimensionedScalar cosh(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
bool equal(const T &a, const T &b)
Compare two values for equality.
dimensionedScalar tanh(const dimensionedScalar &ds)
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
dimensionedScalar sinh(const dimensionedScalar &ds)
dimensionedScalar log10(const dimensionedScalar &ds)
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
dimensionedScalar log(const dimensionedScalar &ds)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
dimensionedScalar acosh(const dimensionedScalar &ds)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dimensionedScalar sqrt(const dimensionedScalar &ds)
scalar csign(const complex &c)
csgn() https://en.wikipedia.org/wiki/Sign_function#Complex_signum
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar atanh(const dimensionedScalar &ds)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
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) transFunc(erf) transFunc(erfc) transFunc(lgamma) transFunc(tgamma) besselFunc(j0) besselFunc(j1) besselFunc(y0) besselFunc(y1) besselFunc2(jn) besselFunc2(yn) inline Scalar &setComponent(Scalar &val
Non-const access to scalar-type (has no components).
dimensionedScalar atan(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
dimensionedScalar acos(const dimensionedScalar &ds)
dimensionedScalar pow025(const dimensionedScalar &ds)
dimensionedScalar asinh(const dimensionedScalar &ds)