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

#include <TYSpectre.h>

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

Public Member Functions

 TYSpectre (const double &defaultValue=TY_SPECTRE_DEFAULT_VALUE)
 
 TYSpectre (const OSpectre &spectre)
 
 TYSpectre (const OSpectreComplex &spectre)
 Constructeur a partir d'un OSpectreComplex. More...
 
 TYSpectre (const TYSpectre &other)
 
virtual ~TYSpectre ()
 
virtual TYSpectreoperator= (const TYSpectre &other)
 Operateur d'affectation. More...
 
virtual TYSpectreoperator= (const OSpectre &other)
 Operateur d'affectation depuis un OSpectre. More...
 
virtual bool operator== (const TYSpectre &other) const
 Operateur d'egalite. More...
 
virtual bool operator!= (const TYSpectre &otehr) const
 Operateur d'inegalite. More...
 
virtual bool deepCopy (const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
 
virtual std::string toString () const
 
virtual DOM_Element toXML (DOM_Element &domElement)
 
virtual int fromXML (DOM_Element domElement)
 
virtual bool toXML (const std::string &sFilePath)
 
virtual bool fromXML (const std::string &sFilePath)
 
virtual std::string toXMLString ()
 
virtual bool fromXMLString (const std::string &sXMLString)
 
virtual TYSpectreForm getForm ()
 Set/Get de la forme du spectre. More...
 
virtual void setForm (const TYSpectreForm &form)
 
virtual QString getRemarque () const
 Set/Get des remarques. More...
 
virtual void setRemarque (QString rq)
 Set/Get des remarques. More...
 
virtual bool getIsReadOnly ()
 Set/Get du flag de conservation en BDD. More...
 
virtual void setIsReadOnly (bool flag)
 Set/Get du flag _isReadOnly. More...
 
virtual void exportCSV (const std::string &filename)
 Export du spectre au format csv en creant le fichier. More...
 
virtual void exportCSV (std::ofstream &ofs)
 Export du spectre au format csv sur un flux transmis. More...
 
OSpectredowncast_ospectre ()
 : return spectrum casted as OSpectre More...
 
- Public Member Functions inherited from TYElement
void * getAllUses ()
 
void setAllUses (void *allUses)
 
void cleanAllUses ()
 
 TYElement ()
 
 TYElement (TYElement *pParent, bool PutInInstanceList=true)
 
 TYElement (const TYElement &other, bool PutInInstanceList=true)
 
virtual ~TYElement ()
 
void setID (TYUUID id)
 
void setID (const QString &str_id)
 
const TYUUIDgetID () const
 
QString getStringID () const
 
bool hasNullID () const
 
void regenerateID ()
 
void setName (QString name)
 
void setName (std::string name)
 
virtual QString getName () const
 
void setParent (TYElement *pParent)
 
TYElementgetParent () const
 
virtual void setIsAcousticModified (bool isModified)
 
bool getIsAcousticModified ()
 
virtual void setIsGeometryModified (bool isModified)
 
bool getIsGeometryModified ()
 
TYElementoperator= (const TYElement &other)
 
bool operator== (const TYElement &other) const
 
bool operator!= (const TYElement &other) const
 
bool callFromXMLIfEqual (DOM_Element &domElement, int *pRetVal=NULL)
 
std::string getMetierName ()
 
virtual void updateCurrentCalcul (TYListID &listID, bool recursif=true)
 
virtual void getChilds (LPTYElementArray &childs, bool recursif=true)
 
virtual void setInCurrentCalcul (bool state, bool recurschild=true, bool recursparent=true)
 
virtual bool isInCurrentCalcul ()
 
void addCopy ()
 Increment le compteur de nombre de copies. More...
 
void setCopyCount (const unsigned int copyCount)
 Modifie la vaeur du compteur. More...
 
- Public Member Functions inherited from IRefCount
 IRefCount ()
 
virtual ~IRefCount ()
 
virtual int incRef ()
 
virtual int decRef ()
 
int getRefCount () const
 
- Public Member Functions inherited from OPrototype
virtual ~OPrototype ()
 
virtual OPrototypeclone () const =0
 
virtual const char * getClassName () const
 
bool isA (const char *className) const
 
- 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 double *valeurs, unsigned nbVal, unsigned decalage)
 Constructor from an array (needed for the Harmonoise model) More...
 
virtual ~OSpectre ()
 Destructor. 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 TYSpectre getEmptyLinSpectre (const double &valInit=1.0E-20)
 Cree un spectre en lin. More...
 
static TYSpectre pondA ()
 Construit un spectre de ponderation A. More...
 
static TYSpectre pondB ()
 Construit un spectre de ponderation B. More...
 
static TYSpectre pondC ()
 Construit un spectre de ponderation C. More...
 
static TYSpectre getLambda (const double &c)
 
static void setXMLPrecision (const int precision=1)
 Get/Set de la precision de stockage des resultats (XML) More...
 
static int getXMLPrecision ()
 Get/Set de la precision de stockage des resultats (XML) More...
 
static const TYTabFreq getTabFreqNorm (TYSpectreForm form=SPECTRE_FORM_TIERS)
 
static const float getFreqNorm (int freqIndex)
 
- Static Public Member Functions inherited from TYElement
static LPTYElementArray findTypeCollectionAndCallFromXML (DOM_Element parentElem, const char *type)
 
static void setLogInstances (bool log)
 
static bool getLogInstances ()
 
static TYElementgetInstance (TYUUID uuid)
 
static void purgeInstances ()
 
static bool testId (const TYUUID &id, const TYElement *pElem)
 
static TYUUID newID ()
 
static TYUUID fromString (QString id)
 
static QString toString (TYUUID &uuid)
 
static uint64 getConstructorCount ()
 
static uint64 getDestructorCount ()
 
static uint64 getIdGenerationCount ()
 
static bool getIsSavedOk ()
 
static void setIsSavedOk (const bool &toSave)
 
static void setRegenerateID (const bool &bRegenerate)
 
static bool getRegenerateID ()
 
- Static Public Member Functions inherited from OPrototype
static OPrototypefindAndClone (const char *className)
 
static int findPrototype (const char *className)
 
static OPrototypesafeDownCast (OPrototype *pObject)
 
static void add_factory (const char *, IOProtoFactory::ptr_type factory)
 
- 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 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 _isReadOnly
 Indique si la widget du spectre est read-only. More...
 
QString _remarque
 Remarques. More...
 
- Protected Attributes inherited from TYElement
QString _name
 Nom courant de l'element. More...
 
TYElement_pParent
 Reference sur l'element parent. More...
 
bool _bPutInInstanceList
 
unsigned int _copyCount
 
bool _inCurrentCalcul
 Indique si cet element est actif dans le Calcul courant. More...
 
bool _isAcousticModified
 Indicateur de modification acoustique. More...
 
bool _isGeometryModified
 Indicateur de modification de la geometrie. More...
 
LPTYElementGraphic _pGraphicObject
 L'object graphique metier associe a cet element. More...
 
void * _allUses
 Multi purpose void pointer (use for compatibility actually) More...
 
- Protected Attributes inherited from IRefCount
int m_refCount
 The reference counter. More...
 
- Protected Attributes inherited from OSpectre
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 int _XMLprecision = 1
 Precision de stockage des resultats. More...
 
- 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 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...
 

Additional Inherited Members

- Protected Member Functions inherited from OPrototype
 OPrototype ()
 

Detailed Description

Permet de stocker des valeurs de puissance accoustique pour differentes frequences.

Definition at line 32 of file TYSpectre.h.

Constructor & Destructor Documentation

◆ TYSpectre() [1/4]

TYSpectre::TYSpectre ( const double &  defaultValue = TY_SPECTRE_DEFAULT_VALUE)

Constructeur par defaut.

Definition at line 31 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ TYSpectre() [2/4]

TYSpectre::TYSpectre ( const OSpectre spectre)

Constructeur a partir d'un OSpectre

Definition at line 44 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ TYSpectre() [3/4]

TYSpectre::TYSpectre ( const OSpectreComplex spectre)

Constructeur a partir d'un OSpectreComplex.

Definition at line 52 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ TYSpectre() [4/4]

TYSpectre::TYSpectre ( const TYSpectre other)

Constructeur par copie.

Definition at line 39 of file TYSpectre.cpp.

◆ ~TYSpectre()

TYSpectre::~TYSpectre ( )
virtual

Destructeur.

Definition at line 62 of file TYSpectre.cpp.

Member Function Documentation

◆ deepCopy()

bool TYSpectre::deepCopy ( const TYElement pOther,
bool  copyId = true,
bool  pUseCopyTag = false 
)
virtual

Effectue une copie en allouant de la memoire (deep copy) et non pas en copiant seulement les pointeurs (shallow copy). Cette methode s'utilise comme l'operateur egal. L'ID peut ne pas etre copie, le parent n'est jamais copie.

Parameters
pOtherL'element a copier.
copyIdCopie l'identifiant unique ou pas.
Returns
true si la copie est possible; false sinon.

Reimplemented from TYElement.

Definition at line 110 of file TYSpectre.cpp.

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

◆ downcast_ospectre()

OSpectre* TYSpectre::downcast_ospectre ( )
inline

: return spectrum casted as OSpectre

Definition at line 164 of file TYSpectre.h.

◆ exportCSV() [1/2]

void TYSpectre::exportCSV ( const std::string &  filename)
virtual

Export du spectre au format csv en creant le fichier.

Definition at line 356 of file TYSpectre.cpp.

Here is the caller graph for this function:

◆ exportCSV() [2/2]

void TYSpectre::exportCSV ( std::ofstream &  ofs)
virtual

Export du spectre au format csv sur un flux transmis.

Definition at line 367 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ fromXML() [1/2]

int TYSpectre::fromXML ( DOM_Element  domElement)
virtual

Extrait les informations a partir du noeud DOM passe afin de recuperer les parametres de la classe.

Parameters
domElementLe noeud DOM a partir duquel les parametres doivent etre recuperes.
Returns
1 si la recuperation des parametres a reussie.

Reimplemented from TYElement.

Definition at line 171 of file TYSpectre.cpp.

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

◆ fromXML() [2/2]

bool TYSpectre::fromXML ( const std::string &  sFilePath)
virtual

Definition at line 289 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ fromXMLString()

bool TYSpectre::fromXMLString ( const std::string &  sXMLString)
virtual

Definition at line 331 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ getEmptyLinSpectre()

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

Cree un spectre en lin.

Definition at line 418 of file TYSpectre.cpp.

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

◆ getForm()

virtual TYSpectreForm TYSpectre::getForm ( )
inlinevirtual

Set/Get de la forme du spectre.

Definition at line 92 of file TYSpectre.h.

Here is the caller graph for this function:

◆ getFreqNorm()

const float TYSpectre::getFreqNorm ( int  freqIndex)
static

Retourne la frequence correspondant a l'index freqIndex.

Definition at line 408 of file TYSpectre.cpp.

Here is the caller graph for this function:

◆ getIsReadOnly()

virtual bool TYSpectre::getIsReadOnly ( )
inlinevirtual

Set/Get du flag de conservation en BDD.

Set/Get du flag de conservation en BDD. Set/Get du flag _isReadOnly.

Definition at line 108 of file TYSpectre.h.

Here is the caller graph for this function:

◆ getLambda()

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

Retourne un spectre representant la longueur d'onde associee a chaque frequence

Parameters
cVitesse de propagation de l'onde
Returns
un TYSpectre

Definition at line 446 of file TYSpectre.cpp.

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

◆ getRemarque()

virtual QString TYSpectre::getRemarque ( ) const
inlinevirtual

Set/Get des remarques.

Definition at line 96 of file TYSpectre.h.

Here is the caller graph for this function:

◆ getTabFreqNorm()

const TYTabFreq TYSpectre::getTabFreqNorm ( TYSpectreForm  form = SPECTRE_FORM_TIERS)
static

Retourne le tableau des frequences normalisees. L'appelant ne doit pas liberer la memoire allouee pour creer ce tableau.

Returns
Le tableau des frequences normalisees.

Definition at line 386 of file TYSpectre.cpp.

Here is the caller graph for this function:

◆ getXMLPrecision()

static int TYSpectre::getXMLPrecision ( )
inlinestatic

Get/Set de la precision de stockage des resultats (XML)

Definition at line 145 of file TYSpectre.h.

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

◆ operator!=()

bool TYSpectre::operator!= ( const TYSpectre otehr) const
virtual

Operateur d'inegalite.

Definition at line 105 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ operator=() [1/2]

TYSpectre & TYSpectre::operator= ( const TYSpectre other)
virtual

Operateur d'affectation.

Definition at line 66 of file TYSpectre.cpp.

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

◆ operator=() [2/2]

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

Operateur d'affectation depuis un OSpectre.

Reimplemented from OSpectre.

Definition at line 80 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ operator==()

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

Operateur d'egalite.

Definition at line 91 of file TYSpectre.cpp.

Here is the caller graph for this function:

◆ pondA()

TYSpectre TYSpectre::pondA ( )
static

Construit un spectre de ponderation A.

Definition at line 424 of file TYSpectre.cpp.

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

◆ pondB()

TYSpectre TYSpectre::pondB ( )
static

Construit un spectre de ponderation B.

Definition at line 430 of file TYSpectre.cpp.

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

◆ pondC()

TYSpectre TYSpectre::pondC ( )
static

Construit un spectre de ponderation C.

Definition at line 436 of file TYSpectre.cpp.

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

◆ setForm()

virtual void TYSpectre::setForm ( const TYSpectreForm form)
inlinevirtual

Definition at line 93 of file TYSpectre.h.

Here is the caller graph for this function:

◆ setIsReadOnly()

virtual void TYSpectre::setIsReadOnly ( bool  flag)
inlinevirtual

Set/Get du flag _isReadOnly.

Definition at line 111 of file TYSpectre.h.

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

◆ setRemarque()

virtual void TYSpectre::setRemarque ( QString  rq)
inlinevirtual

Set/Get des remarques.

Definition at line 99 of file TYSpectre.h.

◆ setXMLPrecision()

static void TYSpectre::setXMLPrecision ( const int  precision = 1)
inlinestatic

Get/Set de la precision de stockage des resultats (XML)

Definition at line 142 of file TYSpectre.h.

Here is the caller graph for this function:

◆ toString()

std::string TYSpectre::toString ( ) const
virtual

Retourne une chaine de caractere donnant des informations sur cet objet (utile pour le debugage).

Returns
Une chaine de caractere informative sur cet objet.

Reimplemented from TYElement.

Definition at line 124 of file TYSpectre.cpp.

◆ toXML() [1/2]

DOM_Element TYSpectre::toXML ( DOM_Element domElement)
virtual

Construit une arborescence DOM a partir du noeud passe afin de sauvegarder les parametres au format XML.

Parameters
domElementLe noeud DOM parent a partir duquel l'arborescence doit etre creee.
Returns
Le noeud DOM nouvellement cree.

Reimplemented from TYElement.

Definition at line 130 of file TYSpectre.cpp.

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

◆ toXML() [2/2]

bool TYSpectre::toXML ( const std::string &  sFilePath)
virtual

Definition at line 253 of file TYSpectre.cpp.

Here is the call graph for this function:

◆ toXMLString()

std::string TYSpectre::toXMLString ( )
virtual

Definition at line 319 of file TYSpectre.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _isReadOnly

bool TYSpectre::_isReadOnly
protected

Indique si la widget du spectre est read-only.

Definition at line 176 of file TYSpectre.h.

◆ _remarque

QString TYSpectre::_remarque
protected

Remarques.

Definition at line 179 of file TYSpectre.h.

◆ _XMLprecision

int TYSpectre::_XMLprecision = 1
staticprotected

Precision de stockage des resultats.

Definition at line 173 of file TYSpectre.h.


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