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

#include <spectre.h>

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

Public Member Functions

 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...
 
OSpectreAbstractoperator= (const OSpectreAbstract &other) override
 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 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 _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...
 

Static Protected Attributes

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

Definition at line 324 of file spectre.h.

Constructor & Destructor Documentation

◆ OSpectre() [1/5]

OSpectre::OSpectre ( )

Default constructor, the spectrum module is defined by the _defaultValue.

Definition at line 838 of file spectre.cpp.

Here is the caller graph for this function:

◆ OSpectre() [2/5]

OSpectre::OSpectre ( double  defaultValue)

Constructor, the spectrum module is defined by the defaultValue given in parameter.

Definition at line 846 of file spectre.cpp.

◆ OSpectre() [3/5]

OSpectre::OSpectre ( const OSpectre other)

Copy constructor.

Definition at line 870 of file spectre.cpp.

◆ OSpectre() [4/5]

OSpectre::OSpectre ( const OSpectreAbstract other)

Copy constructor from OSpectreAbstract.

Definition at line 875 of file spectre.cpp.

◆ OSpectre() [5/5]

OSpectre::OSpectre ( const double *  valeurs,
unsigned  nbVal,
unsigned  decalage 
)

Constructor from an array (needed for the Harmonoise model)

Parameters
valeursArray of values per frequency
nbValArray size
decalageFrequency offset relative to the standard band TYMPAN (16-16000)

Definition at line 854 of file spectre.cpp.

◆ ~OSpectre()

OSpectre::~OSpectre ( )
virtual

Destructor.

Definition at line 880 of file spectre.cpp.

Member Function Documentation

◆ getConcreteInstance()

OSpectreAbstract * OSpectre::getConcreteInstance ( ) const
overridevirtual

Return an instance of a concrete class of the same type as current.

Implements OSpectreAbstract.

Definition at line 948 of file spectre.cpp.

Here is the call graph for this function:

◆ getEmptyLinSpectre()

OSpectre OSpectre::getEmptyLinSpectre ( const double &  valInit = 1.0E-20)
static

Create a physical quantity spectrum.

Definition at line 1115 of file spectre.cpp.

Here is the caller graph for this function:

◆ getIndice()

static int OSpectre::getIndice ( const double &  freq)
inlinestatic

Return the index associated to a frequency.

Definition at line 397 of file spectre.h.

Here is the caller graph for this function:

◆ getLambda()

OSpectre OSpectre::getLambda ( const double &  c)
static

Return a spectrum representating the wavelength associated to each frequency

Parameters
cWave propagating speed
Returns
An OSpectre

Definition at line 1062 of file spectre.cpp.

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

◆ getOSpectreFreqExact()

OSpectre OSpectre::getOSpectreFreqExact ( )
static

Return the spectrum of the exact frequencies.

Returns
An OSpectre

Definition at line 989 of file spectre.cpp.

◆ getTabFreqExact()

OTabFreq OSpectre::getTabFreqExact ( )
static

Return the array of exact frequencies. The calling method should free the allocated memory for this array.

Returns
The array of exact frequencies.

Definition at line 979 of file spectre.cpp.

Here is the caller graph for this function:

◆ getTabValReel() [1/2]

const double* OSpectre::getTabValReel ( ) const
inlineoverridevirtual

Implements OSpectreAbstract.

Definition at line 360 of file spectre.h.

◆ getTabValReel() [2/2]

double* OSpectre::getTabValReel ( )
inlineoverridevirtual

XXX These are the modulus to put into the solver model. Get the array of real values

Implements OSpectreAbstract.

Definition at line 356 of file spectre.h.

Here is the caller graph for this function:

◆ getValueReal()

double OSpectre::getValueReal ( double  freq)

Get the value for a frequency.

Parameters
freqFrequency.
Returns
The real number.

Definition at line 959 of file spectre.cpp.

Here is the caller graph for this function:

◆ isTonalite()

bool OSpectre::isTonalite ( ) const

Existence d'une tonalite marquee.

Definition at line 1076 of file spectre.cpp.

Here is the caller graph for this function:

◆ makeOctSpect()

OSpectre OSpectre::makeOctSpect ( )
static

Make a spectrum in Octave.

Definition at line 1122 of file spectre.cpp.

Here is the caller graph for this function:

◆ operator!=()

bool OSpectre::operator!= ( const OSpectre other) const
virtual

operator !=

Definition at line 943 of file spectre.cpp.

Here is the call graph for this function:

◆ operator=() [1/2]

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

operator=

Definition at line 882 of file spectre.cpp.

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

◆ operator=() [2/2]

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

operator=

Reimplemented from OSpectreAbstract.

Reimplemented in OSpectreComplex.

Definition at line 895 of file spectre.cpp.

Here is the call graph for this function:

◆ operator==()

bool OSpectre::operator== ( const OSpectre other) const
virtual

operator==

Definition at line 924 of file spectre.cpp.

Here is the caller graph for this function:

◆ pondA()

OSpectre OSpectre::pondA ( )
static

Build a weighted spectrum A.

Definition at line 999 of file spectre.cpp.

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

◆ pondB()

OSpectre OSpectre::pondB ( )
static

Build a weighted spectrum B.

Definition at line 1021 of file spectre.cpp.

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

◆ pondC()

OSpectre OSpectre::pondC ( )
static

Build a weighted spectrum C.

Definition at line 1043 of file spectre.cpp.

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

◆ setFMax()

static void OSpectre::setFMax ( const double &  fMax)
inlinestatic

Define maximal frequency.

Definition at line 408 of file spectre.h.

◆ setFMin()

static void OSpectre::setFMin ( const double &  fMin)
inlinestatic

Define minimal frequency.

Definition at line 403 of file spectre.h.

◆ setMapFreqIndice()

std::map< double, int > OSpectre::setMapFreqIndice ( )
static

Construction du tableau frequence/indice.

Definition at line 967 of file spectre.cpp.

◆ setValue()

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

Set a new value to the frequencies array.

Parameters
freqFrequency to which a new value is given.
reelValue.

Definition at line 953 of file spectre.cpp.

Member Data Documentation

◆ _fMax

double OSpectre::_fMax = 16000
staticprotected

Maximal frequency.

Definition at line 461 of file spectre.h.

◆ _fMin

double OSpectre::_fMin = 16
staticprotected

Minimal frequency.

Definition at line 458 of file spectre.h.

◆ _freqNorm

const double OSpectre::_freqNorm
staticprotected
Initial value:
= {
16.0, 20.0, 25.0,
31.5, 40.0, 50.0,
63.0, 80.0, 100.0,
125.0, 160.0, 200.0,
250.0, 315.0, 400.0,
500.0, 630.0, 800.0,
1000.0, 1250.0, 1600.0,
2000.0, 2500.0, 3150.0,
4000.0, 5000.0, 6300.0,
8000.0, 10000.0, 12500.0,
16000.0}

Array of center frequencies (Hz) normalized in one-third Octave.

Definition at line 455 of file spectre.h.

◆ _mapFreqIndice

std::map< double, int > OSpectre::_mapFreqIndice = setMapFreqIndice()
staticprotected

Mapping between frequency and array index.

Definition at line 464 of file spectre.h.

◆ _module

double OSpectre::_module[TY_SPECTRE_DEFAULT_NB_ELMT]
protected

Real values array for module.

Definition at line 467 of file spectre.h.


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