39#ifndef Foam_primitives_complex_H
40#define Foam_primitives_complex_H
135 void real(scalar val)
noexcept { re = val; }
138 void imag(scalar val)
noexcept { im = val; }
151 inline scalar
magSqr()
const;
162 return std::complex<scalar>(re, im);
239 std::integral_constant<Foam::direction, 2>
272 static constexpr direction nComponents = 2;
278 static const char*
const componentNames[];
304 operator complex&()
noexcept {
return p_; }
320 std::enable_if_t<!std::is_same_v<complex, T>,
const T&>
328 std::enable_if_t<std::is_same_v<complex, T>,
complex>
331 return val.conjugate();
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A complex number, similar to the C++ complex type.
friend complex operator-(const complex &c)
complex(complex &&) noexcept=default
Move construct.
scalar & Im() noexcept
Non-const access to imaginary part. Prefer imag() setter method.
complex conjugate() const
Complex conjugate.
scalar Im() const noexcept
Get imaginary part of complex number. Same as imag().
void real(scalar val) noexcept
Set real part of complex number - STL naming.
scalar & Re() noexcept
Non-const access to real part. Prefer real() setter method.
complex & operator=(const complex &) noexcept=default
Copy assignment.
void operator+=(const complex &c)
friend complex operator+(const complex &c1, const complex &c2)
scalar Re() const noexcept
Get real part of complex number. Same as real().
constexpr scalar real() const noexcept
Real part of complex number - STL naming.
friend complex operator*(const complex &c1, const complex &c2)
constexpr complex() noexcept
Default construct, as zero-initialized.
void imag(scalar val) noexcept
Set imaginary part of complex number - STL naming.
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)
friend complex operator/(const complex &c1, const complex &c2)
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 1 (one) that can be used to avoid manipulating objects known to b...
static const char *const typeName
static const complex zero
complex (0,0)
static const complex rootMax
complex (ROOTVGREAT, ROOTVGREAT)
static const complex one
complex (1,0)
static const complex min
complex (-VGREAT,-VGREAT)
complex cmptType
Component type.
static const complex max
complex (VGREAT,VGREAT)
static const char *const componentNames[]
pTraits(const complex &val) noexcept
Copy construct from primitive.
static constexpr direction nComponents
Number of components in complex is 2.
static constexpr direction rank
Rank of complex is 0.
static constexpr direction dim
Dimensionality of space.
scalar magType
Magnitude type.
pTraits(Istream &is)
Read construct from Istream.
label labelType
Equivalent type of labels used for valid component indexing.
static const complex rootMin
complex (-ROOTVGREAT, -ROOTVGREAT)
A traits class, which is primarily used for primitives and vector-space.
pTraits(const Base &obj)
Copy construct from base class.
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
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))
Implementation details for various OpenFOAM classes.
std::enable_if_t<!std::is_same_v< complex, T >, const T & > conj(const T &val)
The 'conjugate' of non-complex returns itself (pass-through) it does not return a complex!
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.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Istream & operator>>(Istream &, directionInfo &)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A template class to specify if a data type is composed solely of Foam::scalar elements.
A template class to specify that a data type can be considered as being contiguous in memory.
The underlying component data type: default is pass-through.
The vector-space number of components: default is 1.