C++ mpi module for stochmagnet_main Package
EXPR_Ellipsoid.h
1 #ifndef EXPR_Ellipsoid_H
2 #define EXPR_Ellipsoid_H
3 
4 #include "EXPR_ElementaryGeometryNode.h"
5 
6 
20 
21 private:
22  //attributes
23 
24  //bounding box points
25  static const std::array<tCInt,24> BOUNDING_BOX_POINTS;
26 
27  //center of the ellipoide
28  std::array<tReal,3> mCenter;
29 
30  //axe of the ellipsoide
31  std::array<tReal,3> mU;
32  std::array<tReal,3> mV;
33  std::array<tReal,3> mW;
34 
35 
36  //size of the ellipoide per direction
37  std::array<tReal,3> mSize;
38 
39 
40 private:
41  //associations
42 protected:
43  //builders
44 
48  //deleters
51  virtual ~EXPR_Ellipsoid();
52 
53 public:
54  //MEMORY
55  //======
63  virtual tMemSize getMemorySize() const override {
64  return sizeof(*this)+getContentsMemorySize();
65  }
66 
75  virtual tMemSize getContentsMemorySize() const override {
77  mem+=mCenter.size()*sizeof(tReal);
78  mem+=mU.size()*sizeof(tReal);
79  mem+=mV.size()*sizeof(tReal);
80  mem+=mW.size()*sizeof(tReal);
81  mem+=mSize.size()*sizeof(tReal);
82  return mem;
83  }
84 
85 public:
89  virtual CORE_UniquePointer<EXPR_ElementaryGeometryNode> newInstance() const override {
90  return New();
91  }
92 
96  static inline CORE_UniquePointer<EXPR_Ellipsoid> New() {
97  CORE_UniquePointer<EXPR_Ellipsoid> p(new EXPR_Ellipsoid(),
99 
100  return p;
101  }
102 
106  virtual void copy(const EXPR_Node& node) override {
108  const EXPR_Ellipsoid *cyl=dynamic_cast< const EXPR_Ellipsoid *>(&node);
109  if (cyl!=null) {
110  setCenter(cyl->getCenter());
111 
114 
118 
119  orthogonalize();
120  }
121  }
122 
132  virtual void setArguments(const std::vector<tString>& args) override ;
133 
134 
135  //center
136  //------
140  inline void setCenter(const std::array<tReal,3>& X) {
141  memcpy(mCenter.data(),X.data(),X.size()*sizeof(tReal));
142  }
146  inline void setCenter(std::initializer_list<tReal>&& X) {
147  auto iX=std::cbegin(X);
148  for(auto& Ck:mCenter) {
149  Ck=(*iX);
150  iX++;
151  }
152  }
156  inline const std::array<tReal,3>& getCenter() const {
157  return mCenter;
158  }
159 
160  //Main Direction U
161  //----------------
165  inline void setMainDirection(const std::array<tReal,3>& U) {
166  memcpy(mU.data(),U.data(),U.size()*sizeof(tReal));
167  }
171  inline void setMainDirection(std::initializer_list<tReal>&& U) {
172  auto iU=std::cbegin(U);
173  for(auto& Uk:mU) {
174  Uk=(*iU);
175  iU++;
176  }
177  }
181  inline const std::array<tReal,3>& getMainDirection() const {
182  return mU;
183  }
188  inline void setMainRadius(const tReal& L) {
189  mSize[0]=L;
190  }
191 
196  inline const tReal& getMainRadius() const {
197  return mSize[0];
198  }
199  //Second direction V
200  //------------------
204  inline void setSecondDirection(const std::array<tReal,3>& V) {
205  memcpy(mV.data(),V.data(),V.size()*sizeof(tReal));
206  }
210  inline void setSecondDirection(std::initializer_list<tReal>&& V) {
211  auto iV=std::cbegin(V);
212  for(auto& Vk:mV) {
213  Vk=(*iV);
214  iV++;
215  }
216  }
220  inline const std::array<tReal,3>& getSecondDirection() const {
221  return mV;
222  }
223 
224 
229  inline void setSecondRadius(const tReal& L) {
230  mSize[1]=L;
231  }
236  inline const tReal& getSecondRadius() const {
237  return mSize[1];
238  }
239  //third direction W
240  //------------------
241 
242 
247  inline void setThirdRadius(const tReal& L) {
248  mSize[2]=L;
249  }
254  inline const tReal& getThirdRadius() const {
255  return mSize[2];
256  }
257 
258  //orthogonalize the diections
259  //---------------------------
260 
263  void orthogonalize();
264 
268  virtual void adimensionize(const tReal& L) final ;
269 
270 
271 
272 protected:
277  virtual tBoolean isInsideCanonicalGeometry(const std::array<tReal,3>& p) const final;
278 
283  virtual void computeCanonicalBoundingBox(std::array<tReal,3>& minPoint,std::array<tReal,3>& maxPoint) const final ;
284 
285 
286 public:
290  virtual tString toString() const final;
291 };
292 
293 
294 
295 
296 
297 #endif
298 
299 
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class describes an elementary geometry.
Definition: EXPR_ElementaryGeometryNode.h:20
virtual void copy(const EXPR_Node &node) override
copy
Definition: EXPR_ElementaryGeometryNode.h:80
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: EXPR_ElementaryGeometryNode.h:71
This class describes an ellipsoide ELLIPSOID from.
Definition: EXPR_Ellipsoid.h:19
EXPR_Ellipsoid()
create the class
Definition: EXPR_Ellipsoid.cpp:20
void setSecondDirection(std::initializer_list< tReal > &&V)
set the second direction
Definition: EXPR_Ellipsoid.h:210
void setCenter(std::initializer_list< tReal > &&X)
set the center
Definition: EXPR_Ellipsoid.h:146
void setSecondDirection(const std::array< tReal, 3 > &V)
set the second direction
Definition: EXPR_Ellipsoid.h:204
virtual tBoolean isInsideCanonicalGeometry(const std::array< tReal, 3 > &p) const final
return true if the point is inside the canonical geometry
Definition: EXPR_Ellipsoid.cpp:139
virtual void computeCanonicalBoundingBox(std::array< tReal, 3 > &minPoint, std::array< tReal, 3 > &maxPoint) const final
compute the bounding box of the geometry
Definition: EXPR_Ellipsoid.cpp:206
const tReal & getThirdRadius() const
get the half-length along secund direction
Definition: EXPR_Ellipsoid.h:254
virtual CORE_UniquePointer< EXPR_ElementaryGeometryNode > newInstance() const override
create a new instance of this
Definition: EXPR_Ellipsoid.h:89
void orthogonalize()
orthogonalize the data
Definition: EXPR_Ellipsoid.cpp:100
virtual tString toString() const final
return the string representation of this
Definition: EXPR_Ellipsoid.cpp:293
void setCenter(const std::array< tReal, 3 > &X)
set the center of the botton ellipsoide
Definition: EXPR_Ellipsoid.h:140
void setMainDirection(const std::array< tReal, 3 > &U)
set the main direction
Definition: EXPR_Ellipsoid.h:165
virtual void setArguments(const std::vector< tString > &args) override
set the argument to define the geometry
Definition: EXPR_Ellipsoid.cpp:42
const tReal & getSecondRadius() const
get the half-length along secund direction
Definition: EXPR_Ellipsoid.h:236
void setMainDirection(std::initializer_list< tReal > &&U)
set the main direction
Definition: EXPR_Ellipsoid.h:171
static CORE_UniquePointer< EXPR_Ellipsoid > New()
crete the new instance of this
Definition: EXPR_Ellipsoid.h:96
void setMainRadius(const tReal &L)
set the half-length along main direction
Definition: EXPR_Ellipsoid.h:188
const std::array< tReal, 3 > & getSecondDirection() const
get the second direction
Definition: EXPR_Ellipsoid.h:220
const std::array< tReal, 3 > & getCenter() const
get the center
Definition: EXPR_Ellipsoid.h:156
const tReal & getMainRadius() const
get the half-length along main direction
Definition: EXPR_Ellipsoid.h:196
virtual void copy(const EXPR_Node &node) override
copy
Definition: EXPR_Ellipsoid.h:106
virtual void adimensionize(const tReal &L) final
adimensionize the cylinder
Definition: EXPR_Ellipsoid.cpp:94
const std::array< tReal, 3 > & getMainDirection() const
get the main direction
Definition: EXPR_Ellipsoid.h:181
virtual ~EXPR_Ellipsoid()
delete the class
Definition: EXPR_Ellipsoid.cpp:38
void setSecondRadius(const tReal &L)
set the half-length along secund direction
Definition: EXPR_Ellipsoid.h:229
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: EXPR_Ellipsoid.h:63
void setThirdRadius(const tReal &L)
set the half-length along secund direction
Definition: EXPR_Ellipsoid.h:247
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: EXPR_Ellipsoid.h:75
This class is a base class of the binary tree.
Definition: EXPR_Node.h:16