C++ mpi module for stochmagnet_main Package
EXPR_Cylinder.h
1 #ifndef EXPR_Cylinder_H
2 #define EXPR_Cylinder_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> mK;
34 
35  //size in each direction U,V,W
36  std::array<tReal,3> mSize;
37 
38 private:
39  //associations
40 protected:
41  //builders
42 
45  EXPR_Cylinder();
46  //deleters
49  virtual ~EXPR_Cylinder();
50 
51 public:
52  //MEMORY
53  //======
61  virtual tMemSize getMemorySize() const override {
62  return sizeof(*this)+getContentsMemorySize();
63  }
64 
73  virtual tMemSize getContentsMemorySize() const override {
75  mem+=mCenter.size()*sizeof(tReal);
76  mem+=mU.size()*sizeof(tReal);
77  mem+=mV.size()*sizeof(tReal);
78  mem+=mK.size()*sizeof(tReal);
79  mem+=mSize.size()*sizeof(tReal);
80  return mem;
81  }
82 
83 public:
87  virtual CORE_UniquePointer<EXPR_ElementaryGeometryNode> newInstance() const override {
88  return New();
89  }
90 
94  static inline CORE_UniquePointer<EXPR_Cylinder> New() {
95  CORE_UniquePointer<EXPR_Cylinder> p(new EXPR_Cylinder(),
97 
98  return p;
99  }
100 
104  virtual void copy(const EXPR_Node& node) override {
106  const EXPR_Cylinder *cyl=dynamic_cast< const EXPR_Cylinder *>(&node);
107  if (cyl!=null) {
108  setCenter(cyl->getCenter());
111  setLength(cyl->getLength());
114  orthogonalize();
115  }
116  }
117 
128  virtual void setArguments(const std::vector<tString>& args) override ;
129 
133  inline void setCenter(const std::array<tReal,3>& X) {
134  memcpy(mCenter.data(),X.data(),X.size()*sizeof(tReal));
135  }
139  inline void setCenter(std::initializer_list<tReal>&& X) {
140  auto iX=std::cbegin(X);
141  for(auto& Ck:mCenter) {
142  Ck=(*iX);
143  iX++;
144  }
145  }
149  inline const std::array<tReal,3>& getCenter() const {
150  return mCenter;
151  }
155  inline void setMainDirection(const std::array<tReal,3>& U) {
156  memcpy(mU.data(),U.data(),U.size()*sizeof(tReal));
157  }
161  inline void setMainDirection(std::initializer_list<tReal>&& U) {
162  auto iU=std::cbegin(U);
163  for(auto& Uk:mU) {
164  Uk=(*iU);
165  iU++;
166  }
167  }
171  inline const std::array<tReal,3>& getMainDirection() const {
172  return mU;
173  }
177  inline void setSecondDirection(const std::array<tReal,3>& U) {
178  memcpy(mV.data(),U.data(),U.size()*sizeof(tReal));
179  }
183  inline void setSecondDirection(std::initializer_list<tReal>&& U) {
184  auto iU=std::cbegin(U);
185  for(auto& Uk:mV) {
186  Uk=(*iU);
187  iU++;
188  }
189  }
193  inline const std::array<tReal,3>& getSecondDirection() const {
194  return mV;
195  }
200  void setLength(const tReal& L) {
201  mSize[2]=L;
202  }
203 
207  inline const tReal& getLength() const {
208  return mSize[2];
209  }
210 
211 
216  inline void setMainRadius(const tReal& L) {
217  mSize[0]=L;
218  }
223  inline const tReal& getMainRadius() const {
224  return mSize[0];
225  }
230  inline void setSecondRadius(const tReal& L) {
231  mSize[1]=L;
232  }
237  inline const tReal& getSecondRadius() const {
238  return mSize[1];
239  }
240 
243  void orthogonalize();
244 
248  virtual void adimensionize(const tReal& L) final ;
249 
250 
251 
252 protected:
257  virtual tBoolean isInsideCanonicalGeometry(const std::array<tReal,3>& P) const final;
258 
263  virtual void computeCanonicalBoundingBox(std::array<tReal,3>& minPoint,std::array<tReal,3>& maxPoint) const final ;
264 
265 
266 public:
270  virtual tString toString() const final;
271 };
272 
273 
274 
275 
276 
277 #endif
278 
279 
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class describes an ellipsoide CYLINDER from.
Definition: EXPR_Cylinder.h:19
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: EXPR_Cylinder.h:61
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: EXPR_Cylinder.h:73
virtual void adimensionize(const tReal &L) final
adimensionize the cylinder
Definition: EXPR_Cylinder.cpp:89
virtual ~EXPR_Cylinder()
delete the class
Definition: EXPR_Cylinder.cpp:34
void setMainRadius(const tReal &L)
set the half-length along main direction
Definition: EXPR_Cylinder.h:216
void setMainDirection(const std::array< tReal, 3 > &U)
set the main direction
Definition: EXPR_Cylinder.h:155
void setMainDirection(std::initializer_list< tReal > &&U)
set the main direction
Definition: EXPR_Cylinder.h:161
void setSecondDirection(std::initializer_list< tReal > &&U)
set the second direction
Definition: EXPR_Cylinder.h:183
void setCenter(const std::array< tReal, 3 > &X)
set the center of the botton ellipsoide
Definition: EXPR_Cylinder.h:133
void setSecondRadius(const tReal &L)
set the half-length along secund direction
Definition: EXPR_Cylinder.h:230
void orthogonalize()
orthogonalize the data
Definition: EXPR_Cylinder.cpp:94
virtual CORE_UniquePointer< EXPR_ElementaryGeometryNode > newInstance() const override
create a new instance of this
Definition: EXPR_Cylinder.h:87
const tReal & getMainRadius() const
get the half-length along main direction
Definition: EXPR_Cylinder.h:223
virtual tString toString() const final
return the string representation of this
Definition: EXPR_Cylinder.cpp:287
const tReal & getLength() const
get the length of the cylinder
Definition: EXPR_Cylinder.h:207
const std::array< tReal, 3 > & getSecondDirection() const
get the second direction
Definition: EXPR_Cylinder.h:193
EXPR_Cylinder()
create the class
Definition: EXPR_Cylinder.cpp:19
void setCenter(std::initializer_list< tReal > &&X)
set the center
Definition: EXPR_Cylinder.h:139
virtual tBoolean isInsideCanonicalGeometry(const std::array< tReal, 3 > &P) const final
return true if the point is inside the canonical geometry
Definition: EXPR_Cylinder.cpp:131
void setSecondDirection(const std::array< tReal, 3 > &U)
set the second direction
Definition: EXPR_Cylinder.h:177
const std::array< tReal, 3 > & getMainDirection() const
get the main direction
Definition: EXPR_Cylinder.h:171
const tReal & getSecondRadius() const
get the half-length along secund direction
Definition: EXPR_Cylinder.h:237
virtual void setArguments(const std::vector< tString > &args) override
set the argument to define the geometry
Definition: EXPR_Cylinder.cpp:38
void setLength(const tReal &L)
set the length of the cylinder
Definition: EXPR_Cylinder.h:200
virtual void copy(const EXPR_Node &node) override
copy
Definition: EXPR_Cylinder.h:104
virtual void computeCanonicalBoundingBox(std::array< tReal, 3 > &minPoint, std::array< tReal, 3 > &maxPoint) const final
compute the bounding box of the geometry
Definition: EXPR_Cylinder.cpp:200
const std::array< tReal, 3 > & getCenter() const
get the center
Definition: EXPR_Cylinder.h:149
static CORE_UniquePointer< EXPR_Cylinder > New()
crete the new instance of this
Definition: EXPR_Cylinder.h:94
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 is a base class of the binary tree.
Definition: EXPR_Node.h:16