Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
OSpectreComplex Class Reference

#include <spectre.h>

Inheritance diagram for OSpectreComplex:
Inheritance graph
[legend]
Collaboration diagram for OSpectreComplex:
Collaboration graph
[legend]

Public Member Functions

 OSpectreComplex ()
 
 OSpectreComplex (const TYComplex &defaultValue)
 
 OSpectreComplex (const OSpectreComplex &other)
 
 OSpectreComplex (const OSpectre &other)
 
 OSpectreComplex (const OSpectre &spectre1, const OSpectre &spectre2)
 
virtual ~OSpectreComplex ()
 
OSpectreComplexoperator= (const OSpectreComplex &other)
 operators More...
 
OSpectreAbstractoperator= (const OSpectreAbstract &other) override
 operator= More...
 
bool operator== (const OSpectreComplex &other) const
 
bool operator!= (const OSpectreComplex &other) const
 
OSpectreComplex operator+ (const OSpectreComplex &spectre) const
 
OSpectreComplex operator* (const OSpectreComplex &spectre) const
 Product of two complex spectrums (module/phase) More...
 
OSpectreComplex operator* (const OSpectre &spectre) const
 Computes the operation between a complex spectrum times a spectrum. More...
 
OSpectreComplex operator* (const double &coefficient) const
 Multiply a complex spectrum by a double coefficient. More...
 
OSpectreComplex operator/ (const OSpectreComplex &spectre) const
 Divide a complex spectrum by another one. More...
 
double * getTabValImag ()
 Get an array of the imaginary values of the spectrum. More...
 
const double * getTabValImag () const
 
void setValue (const double &freq, const double &reel, const double &imag=0.0)
 
void setValue (const double &freq, const TYComplex &cplx)
 
double getValueImag (double freq, bool *pValid=0)
 
void setPhase (const OSpectre &spectre)
 
void setPhase (const double &valeur=0.0)
 
OSpectre getPhase () const
 
OSpectre getModule () const
 
OSpectreComplex toModulePhase () const
 Conversion to module/phase. More...
 
- Public Member Functions inherited from OSpectre
 OSpectre ()
 Default constructor, the spectrum module is defined by the _defaultValue. More...
 
 OSpectre (double defaultValue)
 Constructor, the spectrum module is defined by the defaultValue given in parameter. More...
 
 OSpectre (const OSpectre &other)
 Copy constructor. More...
 
 OSpectre (const OSpectreAbstract &other)
 Copy constructor from OSpectreAbstract. More...
 
 OSpectre (const double *valeurs, unsigned nbVal, unsigned decalage)
 Constructor from an array (needed for the Harmonoise model) More...
 
virtual ~OSpectre ()
 Destructor. More...
 
OSpectreoperator= (const OSpectre &other)
 operator= More...
 
virtual bool operator== (const OSpectre &other) const
 operator== More...
 
virtual bool operator!= (const OSpectre &other) const
 operator != More...
 
double * getTabValReel () override
 
const double * getTabValReel () const override
 
OSpectreAbstractgetConcreteInstance () const override
 Return an instance of a concrete class of the same type as current. More...
 
void setValue (const double &freq, const double &reel=0.0)
 
double getValueReal (double freq)
 
bool isTonalite () const
 Existence d'une tonalite marquee. More...
 
- Public Member Functions inherited from OSpectreAbstract
 OSpectreAbstract ()
 Methods. More...
 
 OSpectreAbstract (TYSpectreForm form)
 
 OSpectreAbstract (bool isValid, TYSpectreType type, TYSpectreEtat etat, TYSpectreForm form)
 
virtual bool operator== (const OSpectreAbstract &other) const
 operator== More...
 
virtual bool operator!= (const OSpectreAbstract &other) const
 operator != More...
 
OSpectreAbstractoperator+ (const double &valeur) const
 Add a constant value to all the spectrum. More...
 
OSpectreAbstractoperator+ (const OSpectreAbstract &spectre) const
 Arithmetic sum of two spectrums in one-third Octave. More...
 
OSpectreAbstractoperator- (const OSpectreAbstract &spectre) const
 Arithmetic subtraction of two spectrums in one-third Octave. More...
 
OSpectreAbstractoperator* (const OSpectreAbstract &spectre) const
 Multiplication by a Spectre spectrum. More...
 
OSpectreAbstractoperator* (const double &coefficient) const
 Multiplication by a double coefficient. More...
 
OSpectreAbstractsumdB (const OSpectreAbstract &spectre) const
 Energetic sum of two spectrums. More...
 
void setDefaultValue (const double &valeur=TY_SPECTRE_DEFAULT_VALUE)
 
bool isValid () const
 Check the spectrum validity. Invalidity is caused by: corrupted data, impossible calculation. More...
 
void setValid (const bool &valid=true)
 
TYSpectreType getType () const
 Get the spectrum type. More...
 
void setType (TYSpectreType type)
 Set the spectrum type. More...
 
TYSpectreEtat getEtat () const
 Get the spectrum state. More...
 
const TYSpectreEtat getEtat ()
 
void setEtat (TYSpectreEtat etat)
 Force the spectrum state (to use carefully ...) More...
 
TYSpectreForm getForm () const
 Get the spectrum form. More...
 
void setForm (TYSpectreForm form)
 Force the spectrum state (to use carefully ...) More...
 
unsigned int getNbValues () const
 Number of values in the spectrum. More...
 
void setDefaultValue (double module[], const unsigned int spectreNbElmt=TY_SPECTRE_DEFAULT_NB_ELMT, const double &valeur=TY_SPECTRE_DEFAULT_VALUE)
 
void getRangeValueReal (double *valeurs, const short &nbVal, const short &decalage)
 
OSpectreAbstractsum (const OSpectreAbstract &spectre) const
 Arithmetic sum of two spectrums in one-third Octave. More...
 
OSpectreAbstractsum (const double &value) const
 Arithmetic sum of a spectrum and a double scalar. More...
 
OSpectreAbstractmult (const OSpectreAbstract &spectre) const
 Multiplication of two spectrums. More...
 
OSpectreAbstractmult (const double &coefficient) const
 Multiply this spectrum par a double scalar. More...
 
OSpectreAbstractdiv (const OSpectreAbstract &spectre) const
 Division of two spectrums. More...
 
OSpectreAbstractdiv (const double &coefficient) const
 Division of this spectrum by a double scalar. More...
 
OSpectreAbstractsubst (const OSpectreAbstract &spectre) const
 Arithmetic subtraction of two spectrums in one-third Octave. More...
 
OSpectreAbstractsubst (const double &valeur) const
 Subtract a constant value to this spectrum. More...
 
OSpectreAbstractinvMult (const double &coefficient=1.0) const
 Division of a double constant by this spectrum. More...
 
OSpectreAbstractinv () const
 Division of one by this spectrum. More...
 
OSpectreAbstractpower (const double &puissance) const
 Return a spectrum as this spectrum raised to a double power. More...
 
OSpectreAbstractlog (const double &base=10.0) const
 Compute the log base n of this spectrum (n=10 by default). More...
 
OSpectreAbstractracine () const
 Compute the root square of this spectrum. More...
 
OSpectreAbstractexp (const double coef=1.0)
 Compute e^(coef * spectre) of this spectrum. More...
 
OSpectreAbstractsin () const
 Compute the sin of this spectrum. More...
 
OSpectreAbstractcos () const
 Compute the cos of this spectrum. More...
 
OSpectreAbstractabs () const
 Return the absolute value of this spectrum. More...
 
OSpectreAbstractsqrt () const
 Return the root square of a spectrum. More...
 
double valMax ()
 Return the maximum value of a spectrum. More...
 
OSpectreAbstractseuillage (const double &min=-200.0, const double max=200.0)
 Limit the spectrum values (min and max) More...
 
double sigma ()
 Sum the values of the spectrum. More...
 
const double sigma () const
 
OSpectreAbstracttoDB () const
 Converts to dB. More...
 
OSpectreAbstracttoGPhy () const
 Converts to physical quantity. More...
 
double valGlobDBLin () const
 Compute the global value dB[Lin] of a one-third Octave spectrum. More...
 
double valGlobDBA () const
 Compute the global value dB[A] of a one-third Octave spectrum. More...
 
OSpectreAbstracttoTOct () const
 Converts to one-third Octave. More...
 
OSpectreAbstracttoOct () const
 Converts to Octave. More...
 
OSpectreAbstractround ()
 
virtual void printme () const
 Print the spectrum. More...
 

Static Public Member Functions

static OSpectreComplex getCplxSpectre (const double &valInit=1.0E-20)
 Build a OSpectreComplex complex spectrum. More...
 
- Static Public Member Functions inherited from OSpectre
static OSpectre getEmptyLinSpectre (const double &valInit=1.0E-20)
 Create a physical quantity spectrum. More...
 
static OSpectre makeOctSpect ()
 Make a spectrum in Octave. More...
 
static int getIndice (const double &freq)
 Return the index associated to a frequency. More...
 
static void setFMin (const double &fMin)
 Define minimal frequency. More...
 
static void setFMax (const double &fMax)
 Define maximal frequency. More...
 
static OTabFreq getTabFreqExact ()
 
static OSpectre getOSpectreFreqExact ()
 Return the spectrum of the exact frequencies. More...
 
static std::map< double, int > setMapFreqIndice ()
 Construction du tableau frequence/indice. More...
 
static OSpectre pondA ()
 Build a weighted spectrum A. More...
 
static OSpectre pondB ()
 Build a weighted spectrum B. More...
 
static OSpectre pondC ()
 Build a weighted spectrum C. More...
 
static OSpectre getLambda (const double &c)
 
- Static Public Member Functions inherited from OSpectreAbstract
static OSpectreAbstractmakeOctSpect ()
 Make a spectrum in Octave. More...
 

Protected Attributes

double _phase [TY_SPECTRE_DEFAULT_NB_ELMT]
 Array of the imaginary numbers (phase) More...
 
- Protected Attributes inherited from OSpectre
double _module [TY_SPECTRE_DEFAULT_NB_ELMT]
 Real values array for module. More...
 
- Protected Attributes inherited from OSpectreAbstract
bool _valid
 Spectrum validity. More...
 
TYSpectreType _type
 Spectrum type. More...
 
TYSpectreEtat _etat
 Spectrum state (physical quantity or dB). More...
 
TYSpectreForm _form
 Representation of the spectrum: one-third Octave, Octave, constant delta f, unstructured. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from OSpectre
static const double _freqNorm []
 Array of center frequencies (Hz) normalized in one-third Octave. More...
 
static double _fMin = 16
 Minimal frequency. More...
 
static double _fMax = 16000
 Maximal frequency. More...
 
static std::map< double, int > _mapFreqIndice = setMapFreqIndice()
 Mapping between frequency and array index. More...
 
- Static Protected Attributes inherited from OSpectreAbstract
static double _defaultValue = TY_SPECTRE_DEFAULT_VALUE
 Default value for the spectrum. More...
 

Detailed Description

Define a module/phase spectrum

Definition at line 479 of file spectre.h.

Constructor & Destructor Documentation

◆ OSpectreComplex() [1/5]

OSpectreComplex::OSpectreComplex ( )

Definition at line 1144 of file spectre.cpp.

◆ OSpectreComplex() [2/5]

OSpectreComplex::OSpectreComplex ( const TYComplex defaultValue)

Definition at line 1152 of file spectre.cpp.

◆ OSpectreComplex() [3/5]

OSpectreComplex::OSpectreComplex ( const OSpectreComplex other)

Definition at line 1160 of file spectre.cpp.

◆ OSpectreComplex() [4/5]

OSpectreComplex::OSpectreComplex ( const OSpectre other)

Constructor from a OSpectre (which is the module of the complex spectrum)

Definition at line 1165 of file spectre.cpp.

Here is the call graph for this function:

◆ OSpectreComplex() [5/5]

OSpectreComplex::OSpectreComplex ( const OSpectre spectre1,
const OSpectre spectre2 
)

Constructor from 2 OSpectre : module and phase

Definition at line 1174 of file spectre.cpp.

◆ ~OSpectreComplex()

OSpectreComplex::~OSpectreComplex ( )
virtual

Definition at line 1183 of file spectre.cpp.

Member Function Documentation

◆ getCplxSpectre()

OSpectreComplex OSpectreComplex::getCplxSpectre ( const double &  valInit = 1.0E-20)
static

Build a OSpectreComplex complex spectrum.

Definition at line 1404 of file spectre.cpp.

Here is the call graph for this function:

◆ getModule()

OSpectre OSpectreComplex::getModule ( ) const

Get the module of this spectrum.

Definition at line 1375 of file spectre.cpp.

Here is the call graph for this function:

◆ getPhase()

OSpectre OSpectreComplex::getPhase ( ) const

Get the phase of this spectrum.

Returns
A OSpectre.

Definition at line 1365 of file spectre.cpp.

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

◆ getTabValImag() [1/2]

double* OSpectreComplex::getTabValImag ( )
inline

Get an array of the imaginary values of the spectrum.

Definition at line 513 of file spectre.h.

Here is the caller graph for this function:

◆ getTabValImag() [2/2]

const double* OSpectreComplex::getTabValImag ( ) const
inline

Definition at line 517 of file spectre.h.

◆ getValueImag()

double OSpectreComplex::getValueImag ( double  freq,
bool *  pValid = 0 
)

Get for a frequency the imaginary number from the Frequency/Complex array

Parameters
freqFrequency.
pValidFalse if the frequency is not valid for this spectrum.
Returns
Imaginary number

Definition at line 1343 of file spectre.cpp.

◆ operator!=()

bool OSpectreComplex::operator!= ( const OSpectreComplex other) const

Definition at line 1242 of file spectre.cpp.

Here is the call graph for this function:

◆ operator*() [1/3]

OSpectreComplex OSpectreComplex::operator* ( const double &  coefficient) const

Multiply a complex spectrum by a double coefficient.

Definition at line 1301 of file spectre.cpp.

◆ operator*() [2/3]

OSpectreComplex OSpectreComplex::operator* ( const OSpectre spectre) const

Computes the operation between a complex spectrum times a spectrum.

Definition at line 1285 of file spectre.cpp.

◆ operator*() [3/3]

OSpectreComplex OSpectreComplex::operator* ( const OSpectreComplex spectre) const

Product of two complex spectrums (module/phase)

Definition at line 1269 of file spectre.cpp.

◆ operator+()

OSpectreComplex OSpectreComplex::operator+ ( const OSpectreComplex spectre) const

Definition at line 1247 of file spectre.cpp.

◆ operator/()

OSpectreComplex OSpectreComplex::operator/ ( const OSpectreComplex spectre) const

Divide a complex spectrum by another one.

Definition at line 1315 of file spectre.cpp.

◆ operator=() [1/2]

OSpectreAbstract & OSpectreComplex::operator= ( const OSpectreAbstract other)
overridevirtual

operator=

Reimplemented from OSpectre.

Definition at line 1199 of file spectre.cpp.

Here is the call graph for this function:

◆ operator=() [2/2]

OSpectreComplex & OSpectreComplex::operator= ( const OSpectreComplex other)

operators

Definition at line 1185 of file spectre.cpp.

Here is the call graph for this function:

◆ operator==()

bool OSpectreComplex::operator== ( const OSpectreComplex other) const

Definition at line 1224 of file spectre.cpp.

Here is the caller graph for this function:

◆ setPhase() [1/2]

void OSpectreComplex::setPhase ( const double &  valeur = 0.0)

Set the phase to this spectrum.

Parameters
valeurA double.

Definition at line 1357 of file spectre.cpp.

◆ setPhase() [2/2]

void OSpectreComplex::setPhase ( const OSpectre spectre)

Set the phase to a spectrum.

Parameters
spectreA OSpectre.

Definition at line 1349 of file spectre.cpp.

◆ setValue() [1/2]

void OSpectreComplex::setValue ( const double &  freq,
const double &  reel,
const double &  imag = 0.0 
)

Set a complex value to the array Frequency/Complex.

Parameters
freqFrequency.
reelReal number.
imagImaginary number.

Definition at line 1331 of file spectre.cpp.

Here is the caller graph for this function:

◆ setValue() [2/2]

void OSpectreComplex::setValue ( const double &  freq,
const TYComplex cplx 
)

Set a complex value to the array Frequency/Complex.

Parameters
freqFrequency.
cplxA TYComplex complex number

Definition at line 1338 of file spectre.cpp.

Here is the call graph for this function:

◆ toModulePhase()

OSpectreComplex OSpectreComplex::toModulePhase ( ) const

Conversion to module/phase.

Definition at line 1385 of file spectre.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ _phase

double OSpectreComplex::_phase[TY_SPECTRE_DEFAULT_NB_ELMT]
protected

Array of the imaginary numbers (phase)

Definition at line 577 of file spectre.h.


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