C++ mpi module for stochmagnet_main Package
EXPR_RotationFunction.h
1 #ifndef EXPR_RotationFunction_H
2 #define EXPR_RotationFunction_H
3 
4 #include "EXPR_Function.h"
5 
6 //numerics functions headers
7 #include "core_numeric.h"
8 
17 
18 
19 private:
20 
21 
22 private:
23  //associations
24 protected:
25  //builders
26 
30  setName("ROTATION");
31  }
32 
33  //deleters
37  }
38 
39 public:
40  //methods
41 
45  static inline CORE_UniquePointer<EXPR_RotationFunction> New() {
46  CORE_UniquePointer<EXPR_RotationFunction> p(new EXPR_RotationFunction(),
48 
49  return p;
50  }
51 
52  //MEMORY
53  //======
61  virtual tMemSize getMemorySize() const override {
62  return sizeof(*this)+getContentsMemorySize();
63  }
64 
73  virtual tMemSize getContentsMemorySize() const override {
75  return mem;
76  }
77 
78 
79 
84  virtual void apply(const std::vector<tString>& args,
85  EXPR_Node& node) const final {
86  tReal theta;
87  tReal Ux,Uy,Uz;
88  tReal Cx,Cy,Cz;
89  auto iarg=args.cbegin();
90 
91  switch(args.size()) {
92  case 1:
93  core_numeric::parse(*iarg,theta);iarg++;
94  node.rotation(theta);
95  break;
96  case 4:
97  core_numeric::parse(*iarg,theta);iarg++;
98  core_numeric::parse(*iarg,Ux);iarg++;
99  core_numeric::parse(*iarg,Uy);iarg++;
100  core_numeric::parse(*iarg,Uz);iarg++;
101  node.rotation(theta,Ux,Uy,Uz);
102  //cout << "rotation("<<theta<<","<<Ux<<","<<Uy<<","<<Uz<<")\n";
103  break;
104  case 7:
105  core_numeric::parse(*iarg,theta);iarg++;
106  core_numeric::parse(*iarg,Ux);iarg++;
107  core_numeric::parse(*iarg,Uy);iarg++;
108  core_numeric::parse(*iarg,Uz);iarg++;
109  core_numeric::parse(*iarg,Cx);iarg++;
110  core_numeric::parse(*iarg,Cy);iarg++;
111  core_numeric::parse(*iarg,Cz);iarg++;
112  node.rotation(theta,Ux,Uy,Uz,Cx,Cy,Cz);
113  break;
114  }
115  }
116 
117 };
118 
119 #endif
120 
121 
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class described a function.
Definition: EXPR_Function.h:15
void setName(const tString &name)
set the name of the function
Definition: EXPR_Function.h:44
This class is a base class of the binary tree.
Definition: EXPR_Node.h:16
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: EXPR_Object.h:70
This class describes.
Definition: EXPR_RotationFunction.h:16
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: EXPR_RotationFunction.h:73
virtual void apply(const std::vector< tString > &args, EXPR_Node &node) const final
apply the function to the environment
Definition: EXPR_RotationFunction.h:84
virtual ~EXPR_RotationFunction()
delete the class
Definition: EXPR_RotationFunction.h:36
virtual tMemSize getMemorySize() const override
return the memory size of the class
Definition: EXPR_RotationFunction.h:61
static CORE_UniquePointer< EXPR_RotationFunction > New()
return an unique instance of this class
Definition: EXPR_RotationFunction.h:45
EXPR_RotationFunction()
create the class
Definition: EXPR_RotationFunction.h:29