Loading...
Searching...
No Matches
complex Class Reference

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

#include <complex.H>

Inheritance diagram for complex:

Public Member Functions

 complex (const complex &) noexcept=default
 Copy construct.
complexoperator= (const complex &) noexcept=default
 Copy assignment.
 complex (complex &&) noexcept=default
 Move construct.
complexoperator= (complex &&) noexcept=default
 Move assignment.
constexpr complex () noexcept
 Default construct, as zero-initialized.
constexpr complex (Foam::zero) noexcept
 Construct zero-initialized from zero class.
constexpr complex (const scalar r) noexcept
 Construct from real component.
constexpr complex (const scalar r, const scalar i) noexcept
 Construct from real and imaginary parts.
 complex (const std::complex< float > &c)
 Implicit construct from std::complex.
 complex (const std::complex< double > &c)
 Implicit construct from std::complex.
 complex (Istream &is)
 Construct from Istream.
constexpr scalar real () const noexcept
 Real part of complex number - STL naming.
constexpr scalar imag () const noexcept
 Imaginary part of complex number - STL naming.
void real (scalar val) noexcept
 Set real part of complex number - STL naming.
void imag (scalar val) noexcept
 Set imaginary part of complex number - STL naming.
complex conjugate () const
 Complex conjugate.
scalar magnitude () const
 The magnitude (L2-norm) of complex. Called magnitude() instead mag(), which looks too much like imag().
scalar magSqr () const
 The L2-norm squared of complex.
scalar cmptSum () const noexcept
 The sum of real/imag components.
 operator std::complex< scalar > () const
 Implicit conversion to std::complex.
void operator= (Foam::zero)
 Assign zero.
void operator= (const scalar s)
 Assign scalar (imag = zero).
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
scalar Re () const noexcept
 Get real part of complex number. Same as real().
scalar Im () const noexcept
 Get imaginary part of complex number. Same as imag().
scalar & Re () noexcept
 Non-const access to real part. Prefer real() setter method.
scalar & Im () noexcept
 Non-const access to imaginary part. Prefer imag() setter method.

Friends

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 70 of file complex.H.

Constructor & Destructor Documentation

◆ complex() [1/9]

◆ complex() [2/9]

complex ( complex && )
defaultnoexcept

Move construct.

References complex(), and Foam::noexcept.

Here is the call graph for this function:

◆ complex() [3/9]

complex ( )
inlineconstexprnoexcept

Default construct, as zero-initialized.

Definition at line 24 of file complexI.H.

References Foam::noexcept.

◆ complex() [4/9]

complex ( Foam::zero )
inlineconstexprnoexcept

Construct zero-initialized from zero class.

Definition at line 31 of file complexI.H.

References Foam::noexcept.

◆ complex() [5/9]

complex ( const scalar r)
inlineexplicitconstexprnoexcept

Construct from real component.

Definition at line 38 of file complexI.H.

References Foam::noexcept.

◆ complex() [6/9]

complex ( const scalar r,
const scalar i )
inlineconstexprnoexcept

Construct from real and imaginary parts.

Definition at line 45 of file complexI.H.

References Foam::noexcept.

◆ complex() [7/9]

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

Implicit construct from std::complex.

Definition at line 52 of file complexI.H.

References imag(), and real().

Here is the call graph for this function:

◆ complex() [8/9]

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

Implicit construct from std::complex.

Definition at line 59 of file complexI.H.

References imag(), and real().

Here is the call graph for this function:

◆ complex() [9/9]

complex ( Istream & is)
explicit

Construct from Istream.

Definition at line 56 of file complex.C.

Member Function Documentation

◆ operator=() [1/4]

complex & operator= ( const complex & )
defaultnoexcept

Copy assignment.

References complex().

Here is the call graph for this function:

◆ operator=() [2/4]

complex & operator= ( complex && )
defaultnoexcept

Move assignment.

References complex(), and Foam::noexcept.

Here is the call graph for this function:

◆ real() [1/2]

scalar real ( ) const
inlineconstexprnoexcept

Real part of complex number - STL naming.

Definition at line 150 of file complex.H.

References Foam::noexcept, and real().

Referenced by complex(), complex(), Foam::lerp(), and real().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ imag() [1/2]

scalar imag ( ) const
inlineconstexprnoexcept

Imaginary part of complex number - STL naming.

Definition at line 155 of file complex.H.

References Foam::noexcept.

Referenced by complex(), complex(), and Foam::lerp().

Here is the caller graph for this function:

◆ real() [2/2]

void real ( scalar val)
inlinenoexcept

Set real part of complex number - STL naming.

Definition at line 160 of file complex.H.

◆ imag() [2/2]

void imag ( scalar val)
inlinenoexcept

Set imaginary part of complex number - STL naming.

Definition at line 165 of file complex.H.

◆ conjugate()

Foam::complex conjugate ( ) const
inline

Complex conjugate.

Definition at line 68 of file complexI.H.

References complex().

Referenced by Foam::operator&().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ magnitude()

Foam::scalar magnitude ( ) const
inline

The magnitude (L2-norm) of complex. Called magnitude() instead mag(), which looks too much like imag().

Definition at line 74 of file complexI.H.

◆ magSqr()

Foam::scalar magSqr ( ) const
inline

The L2-norm squared of complex.

Definition at line 80 of file complexI.H.

◆ cmptSum()

Foam::scalar cmptSum ( ) const
inlinenoexcept

The sum of real/imag components.

Definition at line 86 of file complexI.H.

References Foam::noexcept.

◆ operator std::complex< scalar >()

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

Implicit conversion to std::complex.

Definition at line 197 of file complex.H.

References complex().

Here is the call graph for this function:

◆ operator=() [3/4]

void operator= ( Foam::zero )
inline

Assign zero.

Definition at line 94 of file complexI.H.

◆ operator=() [4/4]

void operator= ( const scalar s)
inline

Assign scalar (imag = zero).

Definition at line 101 of file complexI.H.

References s().

Here is the call graph for this function:

◆ operator+=() [1/2]

void operator+= ( const complex & c)
inline

Definition at line 108 of file complexI.H.

References complex().

Here is the call graph for this function:

◆ operator+=() [2/2]

void operator+= ( const scalar s)
inline

Definition at line 115 of file complexI.H.

References s().

Here is the call graph for this function:

◆ operator-=() [1/2]

void operator-= ( const complex & c)
inline

Definition at line 121 of file complexI.H.

References complex().

Here is the call graph for this function:

◆ operator-=() [2/2]

void operator-= ( const scalar s)
inline

Definition at line 128 of file complexI.H.

References s().

Here is the call graph for this function:

◆ operator*=() [1/2]

void operator*= ( const complex & c)
inline

Definition at line 134 of file complexI.H.

References complex().

Here is the call graph for this function:

◆ operator*=() [2/2]

void operator*= ( const scalar s)
inline

Definition at line 140 of file complexI.H.

References s().

Here is the call graph for this function:

◆ operator/=() [1/2]

void operator/= ( const complex & c)
inline

Definition at line 147 of file complexI.H.

References complex().

Here is the call graph for this function:

◆ operator/=() [2/2]

void operator/= ( const scalar s)
inline

Definition at line 153 of file complexI.H.

References s().

Here is the call graph for this function:

◆ operator==()

bool operator== ( const complex & c) const
inline

Definition at line 160 of file complexI.H.

References complex(), and Foam::equal().

Here is the call graph for this function:

◆ operator!=()

bool operator!= ( const complex & c) const
inline

Definition at line 166 of file complexI.H.

References complex(), and Foam::operator==().

Here is the call graph for this function:

◆ Re() [1/2]

scalar Re ( ) const
inlinenoexcept

Get real part of complex number. Same as real().

Definition at line 255 of file complex.H.

References Foam::noexcept.

◆ Im() [1/2]

scalar Im ( ) const
inlinenoexcept

Get imaginary part of complex number. Same as imag().

Definition at line 260 of file complex.H.

References Foam::noexcept.

◆ Re() [2/2]

scalar & Re ( )
inlinenoexcept

Non-const access to real part. Prefer real() setter method.

Definition at line 265 of file complex.H.

References Foam::noexcept.

◆ Im() [2/2]

scalar & Im ( )
inlinenoexcept

Non-const access to imaginary part. Prefer imag() setter method.

Definition at line 270 of file complex.H.

References Foam::noexcept.

◆ operator- [1/4]

complex operator- ( const complex & c)
friend

Definition at line 279 of file complexI.H.

References complex().

◆ operator+ [1/3]

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

Definition at line 285 of file complexI.H.

References complex().

◆ operator+ [2/3]

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

Definition at line 295 of file complexI.H.

References complex(), and s().

◆ operator+ [3/3]

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

Definition at line 301 of file complexI.H.

References complex(), and s().

◆ operator- [2/4]

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

Definition at line 307 of file complexI.H.

References complex().

◆ operator- [3/4]

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

Definition at line 317 of file complexI.H.

References complex(), and s().

◆ operator- [4/4]

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

Definition at line 323 of file complexI.H.

References complex(), and s().

◆ operator* [1/3]

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

Definition at line 329 of file complexI.H.

References complex().

◆ operator* [2/3]

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

Definition at line 339 of file complexI.H.

References complex(), and s().

◆ operator* [3/3]

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

Definition at line 345 of file complexI.H.

References complex(), and s().

◆ operator/ [1/3]

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

Definition at line 351 of file complexI.H.

References complex().

◆ operator/ [2/3]

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

Definition at line 363 of file complexI.H.

References complex(), and s().

◆ operator/ [3/3]

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

Definition at line 369 of file complexI.H.

References complex(), and s().


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