Public Member Functions | Friends | List of all members
complex Class Reference

A complex number, similar to the C++ complex type. More...

Public Member Functions

 complex (const complex &)=default
 
complexoperator= (const complex &)=default
 
 complex (complex &&)=default
 
complexoperator= (complex &&)=default
 
constexpr complex () noexcept
 
constexpr complex (const Foam::zero) noexcept
 
constexpr complex (const scalar r) noexcept
 
constexpr complex (const scalar r, const scalar i) noexcept
 
 complex (const std::complex< float > &c)
 
 complex (const std::complex< double > &c)
 
 complex (Istream &is)
 
constexpr scalar real () const
 
constexpr scalar imag () const
 
void real (scalar val)
 
void imag (scalar val)
 
scalar Re () const
 
scalar Im () const
 
scalar & Re ()
 
scalar & Im ()
 
complex conjugate () const
 
 operator std::complex< scalar > () const
 
void operator= (const Foam::zero)
 
void operator= (const scalar s)
 
void operator+= (const complex &c)
 
void operator+= (const scalar s)
 
void operator-= (const complex &c)
 
void operator-= (const scalar s)
 
void operator*= (const complex &c)
 
void operator*= (const scalar s)
 
void operator/= (const complex &c)
 
void operator/= (const scalar s)
 
bool operator== (const complex &c) const
 
bool operator!= (const complex &c) const
 

Friends

scalar magSqr (const complex &c)
 
scalar mag (const complex &c)
 
complex sqr (const complex &c)
 
complex sign (const complex &c)
 
scalar csign (const complex &c)
 
const friend complexmin (const complex &c1, const complex &c2)
 
const friend complexmax (const complex &c1, const complex &c2)
 
complex limit (const complex &c1, const complex &c2)
 
const friend complexsum (const complex &c)
 
complex operator- (const complex &c)
 
complex operator+ (const complex &c1, const complex &c2)
 
complex operator+ (const complex &c, const scalar s)
 
complex operator+ (const scalar s, const complex &c)
 
complex operator- (const complex &c1, const complex &c2)
 
complex operator- (const complex &c, const scalar s)
 
complex operator- (const scalar s, const complex &c)
 
complex operator* (const complex &c1, const complex &c2)
 
complex operator* (const complex &c, const scalar s)
 
complex operator* (const scalar s, const complex &c)
 
complex operator/ (const complex &c1, const complex &c2)
 
complex operator/ (const complex &c, const scalar s)
 
complex operator/ (const scalar s, const complex &c)
 

Detailed Description

A complex number, similar to the C++ complex type.

Source files

Definition at line 78 of file complex.H.

Constructor & Destructor Documentation

◆ complex() [1/9]

complex ( const complex )
default

◆ complex() [2/9]

complex ( complex &&  )
default

◆ complex() [3/9]

constexpr complex ( )
inlineconstexprnoexcept

Definition at line 24 of file complexI.H.

◆ complex() [4/9]

constexpr complex ( const Foam::zero  )
inlineconstexprnoexcept

Definition at line 31 of file complexI.H.

◆ complex() [5/9]

constexpr complex ( const scalar  r)
inlineexplicitconstexprnoexcept

Definition at line 38 of file complexI.H.

◆ complex() [6/9]

constexpr complex ( const scalar  r,
const scalar  i 
)
inlineconstexprnoexcept

Definition at line 45 of file complexI.H.

◆ complex() [7/9]

complex ( const std::complex< float > &  c)
inline

Definition at line 52 of file complexI.H.

◆ complex() [8/9]

complex ( const std::complex< double > &  c)
inline

Definition at line 59 of file complexI.H.

◆ complex() [9/9]

complex ( Istream is)
explicit

Definition at line 61 of file complex.C.

Member Function Documentation

◆ operator=() [1/4]

complex& operator= ( const complex )
default

◆ operator=() [2/4]

complex& operator= ( complex &&  )
default

◆ real() [1/2]

constexpr scalar real ( ) const
inlineconstexpr

Definition at line 132 of file complex.H.

◆ imag() [1/2]

constexpr scalar imag ( ) const
inlineconstexpr

Definition at line 138 of file complex.H.

◆ real() [2/2]

void real ( scalar  val)
inline

Definition at line 68 of file complexI.H.

References Foam::constant::atomic::re.

◆ imag() [2/2]

void imag ( scalar  val)
inline

Definition at line 74 of file complexI.H.

◆ Re() [1/2]

Foam::scalar & Re ( ) const
inline

Definition at line 80 of file complexI.H.

References Foam::constant::atomic::re.

◆ Im() [1/2]

Foam::scalar & Im ( ) const
inline

Definition at line 86 of file complexI.H.

◆ Re() [2/2]

scalar& Re ( )
inline

◆ Im() [2/2]

scalar& Im ( )
inline

◆ conjugate()

Foam::complex conjugate ( ) const
inline

Definition at line 104 of file complexI.H.

References Foam::roots::complex, and Foam::constant::atomic::re.

◆ operator std::complex< scalar >()

operator std::complex< scalar > ( ) const
inline

Definition at line 177 of file complex.H.

◆ operator=() [3/4]

void operator= ( const Foam::zero  )
inline

Definition at line 112 of file complexI.H.

References Foam::constant::atomic::re.

◆ operator=() [4/4]

void operator= ( const scalar  s)
inline

Definition at line 119 of file complexI.H.

References Foam::constant::atomic::re, and s.

◆ operator+=() [1/2]

void operator+= ( const complex c)
inline

Definition at line 126 of file complexI.H.

References Foam::constant::universal::c, and Foam::constant::atomic::re.

◆ operator+=() [2/2]

void operator+= ( const scalar  s)
inline

Definition at line 133 of file complexI.H.

References Foam::constant::atomic::re, and s.

◆ operator-=() [1/2]

void operator-= ( const complex c)
inline

Definition at line 139 of file complexI.H.

References Foam::constant::universal::c, and Foam::constant::atomic::re.

◆ operator-=() [2/2]

void operator-= ( const scalar  s)
inline

Definition at line 146 of file complexI.H.

References Foam::constant::atomic::re, and s.

◆ operator*=() [1/2]

void operator*= ( const complex c)
inline

Definition at line 152 of file complexI.H.

References Foam::constant::universal::c.

◆ operator*=() [2/2]

void operator*= ( const scalar  s)
inline

Definition at line 158 of file complexI.H.

References Foam::constant::atomic::re, and s.

◆ operator/=() [1/2]

void operator/= ( const complex c)
inline

Definition at line 165 of file complexI.H.

References Foam::constant::universal::c.

◆ operator/=() [2/2]

void operator/= ( const scalar  s)
inline

Definition at line 171 of file complexI.H.

References Foam::constant::atomic::re, and s.

◆ operator==()

bool operator== ( const complex c) const
inline

Definition at line 178 of file complexI.H.

References Foam::constant::universal::c, Foam::equal(), and Foam::constant::atomic::re.

Here is the call graph for this function:

◆ operator!=()

bool operator!= ( const complex c) const
inline

Definition at line 184 of file complexI.H.

References Foam::constant::universal::c, and Foam::operator==().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ magSqr

scalar magSqr ( const complex c)
friend

Definition at line 203 of file complexI.H.

◆ mag

scalar mag ( const complex c)
friend

Definition at line 209 of file complexI.H.

◆ sqr

complex sqr ( const complex c)
friend

Definition at line 215 of file complexI.H.

◆ sign

complex sign ( const complex c)
friend

Definition at line 221 of file complexI.H.

◆ csign

scalar csign ( const complex c)
friend

Definition at line 228 of file complexI.H.

◆ min

const friend complex& min ( const complex c1,
const complex c2 
)
friend

Definition at line 234 of file complexI.H.

◆ max

const friend complex& max ( const complex c1,
const complex c2 
)
friend

Definition at line 245 of file complexI.H.

◆ limit

complex limit ( const complex c1,
const complex c2 
)
friend

Definition at line 256 of file complexI.H.

◆ sum

const friend complex& sum ( const complex c)
friend

Definition at line 262 of file complexI.H.

◆ operator- [1/4]

complex operator- ( const complex c)
friend

Definition at line 278 of file complexI.H.

◆ operator+ [1/3]

complex operator+ ( const complex c1,
const complex c2 
)
friend

Definition at line 284 of file complexI.H.

◆ operator+ [2/3]

complex operator+ ( const complex c,
const scalar  s 
)
friend

Definition at line 294 of file complexI.H.

◆ operator+ [3/3]

complex operator+ ( const scalar  s,
const complex c 
)
friend

Definition at line 300 of file complexI.H.

◆ operator- [2/4]

complex operator- ( const complex c1,
const complex c2 
)
friend

Definition at line 306 of file complexI.H.

◆ operator- [3/4]

complex operator- ( const complex c,
const scalar  s 
)
friend

Definition at line 316 of file complexI.H.

◆ operator- [4/4]

complex operator- ( const scalar  s,
const complex c 
)
friend

Definition at line 322 of file complexI.H.

◆ operator* [1/3]

complex operator* ( const complex c1,
const complex c2 
)
friend

Definition at line 328 of file complexI.H.

◆ operator* [2/3]

complex operator* ( const complex c,
const scalar  s 
)
friend

Definition at line 338 of file complexI.H.

◆ operator* [3/3]

complex operator* ( const scalar  s,
const complex c 
)
friend

Definition at line 344 of file complexI.H.

◆ operator/ [1/3]

complex operator/ ( const complex c1,
const complex c2 
)
friend

Definition at line 350 of file complexI.H.

◆ operator/ [2/3]

complex operator/ ( const complex c,
const scalar  s 
)
friend

Definition at line 362 of file complexI.H.

◆ operator/ [3/3]

complex operator/ ( const scalar  s,
const complex c 
)
friend

Definition at line 368 of file complexI.H.


The documentation for this class was generated from the following files: