Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYDirectivity.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 /*
17  *
18  */
19 
20 #ifndef __TY_DIRECTIVITY__
21 #define __TY_DIRECTIVITY__
22 
25 
27 {
28  double Theta;
29  double Phi;
31 
33  {
34  if (this != &other)
35  {
36  Theta = other.Theta;
37  Phi = other.Phi;
38  Coefficients = other.Coefficients;
39  }
40  return *this;
41  }
42 
44  bool operator==(const ConstraintDirectivityElement& other) const
45  {
46  if (this != &other)
47  {
48  if (Theta != other.Theta)
49  {
50  return false;
51  }
52  if (Phi != other.Phi)
53  {
54  return false;
55  }
56  if (Coefficients != other.Coefficients)
57  {
58  return false;
59  }
60  }
61  return true;
62  }
63 };
64 
65 typedef std::vector<ConstraintDirectivityElement> ConstraintDirectivityDefinition;
66 
70 class TYDirectivity : public TYElement
71 {
74 
75  // Methodes
76 public:
80  TYDirectivity();
85  TYDirectivity(const TYDirectivity& other);
89  virtual ~TYDirectivity();
91  TYDirectivity& operator=(const TYDirectivity& other);
93  bool operator==(const TYDirectivity& other) const;
95  bool operator!=(const TYDirectivity& other) const;
96 
110  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
111  virtual std::string toString() const;
112 
113  virtual DOM_Element toXML(DOM_Element& domElement);
114  virtual int fromXML(DOM_Element domElement);
115 
117 };
118 
120 {
121 public:
126 
127  virtual DOM_Element toXML(DOM_Element& domElement);
128  virtual int fromXML(DOM_Element domElement);
129  void LoadFromCsv(std::string fileName);
131  {
132  DirectivityTable = table_;
133  };
135  {
136  return DirectivityTable;
137  }
138  void buildSolverTable(int sampleStep, void* tableToBuild);
139 
140 private:
141  ConstraintDirectivityElement readValuesFromCSV(std::deque<double>& line_array);
142 
144 };
145 
147 {
148 public:
149  enum
150  {
154  };
155 
157  TYComputedDirectivity(OVector3D& vec, int type, double size)
158  : TYDirectivity(vec), Type(type), SpecificSize(size)
159  {
160  }
161  TYComputedDirectivity(const TYComputedDirectivity& directivity);
163  virtual DOM_Element toXML(DOM_Element& domElement);
164  virtual int fromXML(DOM_Element domElement);
165 
166  int Type;
167  double SpecificSize;
168 };
169 
170 template <typename T> T* downcast_tydirectivity(TYDirectivity* dir)
171 {
172  return dynamic_cast<T*>(dir);
173 }
174 
175 #endif // __TY_DIRECTIVITY__
QDomElement DOM_Element
Definition: QT2DOM.h:30
T * downcast_tydirectivity(TYDirectivity *dir)
std::vector< ConstraintDirectivityElement > ConstraintDirectivityDefinition
Definition: TYDirectivity.h:65
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
The 3D vector class.
Definition: 3d.h:298
virtual int fromXML(DOM_Element domElement)
TYComputedDirectivity(OVector3D &vec, int type, double size)
virtual DOM_Element toXML(DOM_Element &domElement)
TYDirectivity(OVector3D &vec)
Definition: TYDirectivity.h:81
TYDirectivity & operator=(const TYDirectivity &other)
Operateur =.
virtual ~TYDirectivity()
virtual DOM_Element toXML(DOM_Element &domElement)
bool operator==(const TYDirectivity &other) const
Operateur ==.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
bool operator!=(const TYDirectivity &other) const
Operateur !=.
virtual std::string toString() const
virtual int fromXML(DOM_Element domElement)
OVector3D DirectivityVector
ConstraintDirectivityDefinition & getDirectivityTable()
void buildSolverTable(int sampleStep, void *tableToBuild)
TYUserDefinedDirectivity(OVector3D &vec)
ConstraintDirectivityElement readValuesFromCSV(std::deque< double > &line_array)
void LoadFromCsv(std::string fileName)
ConstraintDirectivityDefinition DirectivityTable
virtual DOM_Element toXML(DOM_Element &domElement)
virtual int fromXML(DOM_Element domElement)
void setDirectivityTable(const ConstraintDirectivityDefinition &table_)
bool operator==(const ConstraintDirectivityElement &other) const
Operateur de comparaison.
Definition: TYDirectivity.h:44
ConstraintDirectivityElement & operator=(const ConstraintDirectivityElement &other)
Definition: TYDirectivity.h:32