Code_TYMPAN
4.2.0
Industrial site acoustic simulation
|
Store acoustic power values for different frequencies. More...
#include <spectre.h>
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 double *valeurs, unsigned nbVal, unsigned decalage) | |
Constructor from an array (needed for the Harmonoise model) More... | |
virtual | ~OSpectre () |
Destructor. More... | |
virtual OSpectre & | operator= (const OSpectre &other) |
operator= More... | |
virtual bool | operator== (const OSpectre &other) const |
operator== More... | |
virtual bool | operator!= (const OSpectre &other) const |
operator != More... | |
OSpectre | operator* (const OSpectre &spectre) const |
Multiplication by a Spectre spectrum. More... | |
OSpectre | operator* (const double &coefficient) const |
Multiplication by a double coefficient. More... | |
virtual OSpectre | operator+ (const double &valeur) const |
Add a constant value to all the spectrum. More... | |
virtual OSpectre | operator+ (const OSpectre &spectre) const |
Arithmetic sum of two spectrums in one-third Octave. More... | |
virtual OSpectre | operator- (const OSpectre &spectre) const |
Arithmetic subtraction of two spectrums in one-third Octave. More... | |
virtual bool | isValid () const |
Check the spectrum validity. Invalidity is caused by: corrupted data, impossible calculation. More... | |
virtual void | setValid (const bool &valid=true) |
virtual TYSpectreType | getType () const |
Get the spectrum type. More... | |
virtual void | setType (TYSpectreType type) |
Set the spectrum type. More... | |
virtual TYSpectreEtat | getEtat () const |
Get the spectrum state. More... | |
virtual const TYSpectreEtat | getEtat () |
void | setEtat (TYSpectreEtat etat) |
Force the spectrum state (to use carefully ...) More... | |
virtual double * | getTabValReel () |
virtual const double * | getTabValReel () const |
virtual unsigned int | getNbValues () const |
Number of values in the spectrum. More... | |
virtual void | setDefaultValue (const double &valeur=TY_SPECTRE_DEFAULT_VALUE) |
virtual void | setValue (const float &freq, const double &reel=0.0) |
virtual double | getValueReal (double freq) |
virtual void | getRangeValueReal (double *valeurs, const short &nbVal, const short &decalage) |
virtual double | valGlobDBLin () const |
Compute the global value dB[Lin] of a one-third Octave spectrum. More... | |
virtual double | valGlobDBA () const |
Compute the global value dB[A] of a one-third Octave spectrum. More... | |
virtual OSpectre | toDB () const |
Converts to dB. More... | |
virtual OSpectre | toGPhy () const |
Converts to physical quantity. More... | |
virtual OSpectre | sum (const OSpectre &spectre) const |
Arithmetic sum of two spectrums in one-third Octave. More... | |
virtual OSpectre | sum (const double &valeur) const |
Add a constant value to this spectrum. More... | |
virtual OSpectre | sumdB (const OSpectre &spectre) const |
Energetic sum of two spectrums in one-third Octave. More... | |
virtual OSpectre | subst (const OSpectre &spectre) const |
Arithmetic subtraction of two spectrums in one-third Octave. More... | |
virtual OSpectre | subst (const double &valeur) const |
Subtract a constant value to this spectrum. More... | |
virtual OSpectre | mult (const OSpectre &spectre) const |
Multiplication of two spectrums. More... | |
virtual OSpectre | mult (const double &coefficient) const |
Multiply this spectrum par a double scalar. More... | |
virtual OSpectre | div (const OSpectre &spectre) const |
Division of two spectrums. More... | |
virtual OSpectre | div (const double &coefficient) const |
Division of this spectrum by a double scalar. More... | |
virtual OSpectre | invMult (const double &coefficient=1.0) const |
Division of a double constant by this spectrum. More... | |
virtual OSpectre | inv () const |
Division of one by this spectrum. More... | |
virtual OSpectre | power (const double &puissance) const |
Return a spectrum as this spectrum raised to a double power. More... | |
virtual OSpectre | log (const double &base=10.0) const |
Compute the log base n of this spectrum (n=10 by default). More... | |
virtual OSpectre | racine () const |
Compute the root square of this spectrum. More... | |
virtual OSpectre | exp (const double coef=1.0) |
Compute e^(coef * spectre) of this spectrum. More... | |
virtual OSpectre | sin () const |
Compute the sin of this spectrum. More... | |
virtual OSpectre | cos () const |
Compute the cos of this spectrum. More... | |
virtual OSpectre | abs () const |
Return the absolute value of this spectrum. More... | |
virtual OSpectre | sqrt () const |
Return the root square of a spectrum. More... | |
virtual double | valMax () |
Return the maximum value of a spectrum. More... | |
virtual OSpectre | seuillage (const double &min=-200.0, const double max=200.0) |
Limit the spectrum values (min and max) More... | |
virtual double | sigma () |
Sum the values of the spectrum. More... | |
virtual const double | sigma () const |
virtual bool | isTonalite () const |
Existence d'une tonalite marquee. More... | |
virtual OSpectre | toTOct () const |
Converts to one-third Octave. More... | |
virtual OSpectre | toOct () const |
Converts to Octave. More... | |
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 float &freq) |
Return the index associated to a frequency. More... | |
static void | setFMin (const float &fMin) |
Define minimal frequency. More... | |
static void | setFMax (const float &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) |
Protected Attributes | |
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... | |
double | _module [TY_SPECTRE_DEFAULT_NB_ELMT] |
Real values array for module. 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 double | _defaultValue = TY_SPECTRE_DEFAULT_VALUE |
Default value for the spectrum. More... | |
static std::map< double, int > | _mapFreqIndice = setMapFreqIndice() |
Mapping between frequency and array index. More... | |
OSpectre::OSpectre | ( | ) |
Default constructor, the spectrum module is defined by the _defaultValue.
Definition at line 53 of file spectre.cpp.
OSpectre::OSpectre | ( | double | defaultValue | ) |
Constructor, the spectrum module is defined by the defaultValue given in parameter.
Definition at line 61 of file spectre.cpp.
OSpectre::OSpectre | ( | const OSpectre & | other | ) |
Copy constructor.
Definition at line 89 of file spectre.cpp.
OSpectre::OSpectre | ( | const double * | valeurs, |
unsigned | nbVal, | ||
unsigned | decalage | ||
) |
Constructor from an array (needed for the Harmonoise model)
valeurs | Array of values per frequency |
nbVal | Array size |
decalage | Frequency offset relative to the standard band TYMPAN (16-16000) |
Definition at line 69 of file spectre.cpp.
|
virtual |
Destructor.
Definition at line 94 of file spectre.cpp.
|
virtual |
Return the absolute value of this spectrum.
Definition at line 573 of file spectre.cpp.
|
virtual |
Compute the cos of this spectrum.
Definition at line 561 of file spectre.cpp.
Division of two spectrums.
Definition at line 407 of file spectre.cpp.
|
virtual |
Division of this spectrum by a double scalar.
Definition at line 426 of file spectre.cpp.
|
virtual |
Compute e^(coef * spectre) of this spectrum.
Definition at line 537 of file spectre.cpp.
|
static |
Create a physical quantity spectrum.
Definition at line 637 of file spectre.cpp.
|
inlinevirtual |
|
inlinevirtual |
|
inlinestatic |
|
static |
Return a spectrum representating the wavelength associated to each frequency
c | Wave propagating speed |
Definition at line 726 of file spectre.cpp.
|
virtual |
Number of values in the spectrum.
Definition at line 789 of file spectre.cpp.
|
static |
Return the spectrum of the exact frequencies.
Definition at line 654 of file spectre.cpp.
|
virtual |
Get an interval of real values from the frequencies/complex array
[out] | valeurs | Values array. It should be allocated before. |
[in] | nbVal | Number of values to retrieve from the spectrum |
[in] | decalage | Index of the first value to retrieve |
Definition at line 212 of file spectre.cpp.
|
static |
Return the array of exact frequencies. The calling method should free the allocated memory for this array.
Definition at line 644 of file spectre.cpp.
|
inlinevirtual |
XXX These are the modulus to put into the solver model. Get the array of real values
Reimplemented in OSpectreComplex.
Definition at line 112 of file spectre.h.
|
inlinevirtual |
Reimplemented in OSpectreComplex.
Definition at line 113 of file spectre.h.
|
inlinevirtual |
|
virtual |
Get the value for a frequency.
freq | Frequency. |
Definition at line 206 of file spectre.cpp.
|
virtual |
Division of one by this spectrum.
Definition at line 467 of file spectre.cpp.
|
virtual |
Division of a double constant by this spectrum.
Definition at line 446 of file spectre.cpp.
|
virtual |
Existence d'une tonalite marquee.
Definition at line 760 of file spectre.cpp.
|
inlinevirtual |
|
virtual |
Compute the log base n of this spectrum (n=10 by default).
Definition at line 498 of file spectre.cpp.
|
static |
Make a spectrum in Octave.
Definition at line 804 of file spectre.cpp.
Multiplication of two spectrums.
Definition at line 383 of file spectre.cpp.
|
virtual |
Multiply this spectrum par a double scalar.
Definition at line 395 of file spectre.cpp.
|
virtual |
Multiplication by a Spectre spectrum.
Definition at line 137 of file spectre.cpp.
OSpectre OSpectre::operator* | ( | const double & | coefficient | ) | const |
Multiplication by a double coefficient.
Definition at line 148 of file spectre.cpp.
|
virtual |
Add a constant value to all the spectrum.
Definition at line 159 of file spectre.cpp.
Arithmetic sum of two spectrums in one-third Octave.
Definition at line 170 of file spectre.cpp.
Arithmetic subtraction of two spectrums in one-third Octave.
Definition at line 181 of file spectre.cpp.
operator=
Reimplemented in TYSpectre.
Definition at line 98 of file spectre.cpp.
|
virtual |
|
static |
Build a weighted spectrum A.
Definition at line 664 of file spectre.cpp.
|
static |
Build a weighted spectrum B.
Definition at line 685 of file spectre.cpp.
|
static |
Build a weighted spectrum C.
Definition at line 707 of file spectre.cpp.
|
virtual |
Return a spectrum as this spectrum raised to a double power.
Definition at line 486 of file spectre.cpp.
|
virtual |
Print the spectrum.
Definition at line 326 of file spectre.cpp.
|
virtual |
Compute the root square of this spectrum.
Definition at line 518 of file spectre.cpp.
|
virtual |
Initialize a spectrum to a default value.
valeur | Value by default. |
Definition at line 192 of file spectre.cpp.
|
inline |
|
inlinestatic |
|
inlinestatic |
|
static |
Construction du tableau frequence/indice.
Definition at line 625 of file spectre.cpp.
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
Set a new value to the frequencies array.
freq | Frequency to which a new value is given. |
reel | Value. |
Definition at line 200 of file spectre.cpp.
|
virtual |
Limit the spectrum values (min and max)
Definition at line 608 of file spectre.cpp.
|
virtual |
Sum the values of the spectrum.
Definition at line 740 of file spectre.cpp.
|
virtual |
Definition at line 750 of file spectre.cpp.
|
virtual |
Compute the sin of this spectrum.
Definition at line 549 of file spectre.cpp.
|
virtual |
Return the root square of a spectrum.
Definition at line 585 of file spectre.cpp.
Arithmetic subtraction of two spectrums in one-third Octave.
Definition at line 359 of file spectre.cpp.
|
virtual |
Subtract a constant value to this spectrum.
Definition at line 371 of file spectre.cpp.
Arithmetic sum of two spectrums in one-third Octave.
Definition at line 314 of file spectre.cpp.
|
virtual |
Add a constant value to this spectrum.
Definition at line 336 of file spectre.cpp.
Energetic sum of two spectrums in one-third Octave.
Definition at line 348 of file spectre.cpp.
|
virtual |
Converts to dB.
Definition at line 238 of file spectre.cpp.
|
virtual |
Converts to physical quantity.
Definition at line 279 of file spectre.cpp.
|
virtual |
Converts to Octave.
Definition at line 872 of file spectre.cpp.
|
virtual |
Converts to one-third Octave.
Definition at line 811 of file spectre.cpp.
|
virtual |
Compute the global value dB[A] of a one-third Octave spectrum.
Definition at line 232 of file spectre.cpp.
|
virtual |
Compute the global value dB[Lin] of a one-third Octave spectrum.
Definition at line 220 of file spectre.cpp.
|
virtual |
Return the maximum value of a spectrum.
Definition at line 597 of file spectre.cpp.
|
staticprotected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
staticprotected |
Array of center frequencies (Hz) normalized in one-third Octave.
|
staticprotected |
|
protected |
|
protected |