C++ main module for emicrom Package  1.0
EMM_SLElementaryDemagnetizedMatrix.h
Go to the documentation of this file.
1 #ifndef EMM_SLElementaryDemagnetizedMatrix_H
2 #define EMM_SLElementaryDemagnetizedMatrix_H
3 
4 #include "CORE_Object.h"
5 
14 
16 
17 
19 
20  // ATTRIBUTES
21 
22 
23 
24  private:
25  static const tReal m4GaussianWeights[];
26  static const tReal m4GaussianPoints[];
27 
28  protected:
29  // METHODS
30 
31  // CONSTRUCTORS
32 
36 
37 
38 
39  // DESTRUCTORS
40 
41 
45 
46 
47  private:
48 
49  // CONSTRUCTORS
50 
51  public:
54  inline static SP::EMM_SLElementaryDemagnetizedMatrix New() {
55  SP::EMM_SLElementaryDemagnetizedMatrix ret(new EMM_SLElementaryDemagnetizedMatrix(),
57  ret->setThis(ret);
58  return ret;
59  };
60 
61 
62 
63  public:
64 
65 
66  // SET methods
67 
68  // GET methods
69 
70  tReal KaaG(const int& x,
71  const int& y,
72  const int& z,
73  const int& dx,
74  const int& dy,
75  const int& dz,
76  tBoolean& succeeds) const;
77 
78  tReal KabG(const int& x,
79  const int& y,
80  const int& z,
81  const int& dx,
82  const int& dy,
83  const int& dz,
84  tBoolean& succeeds) const;
85 
86  tReal KabDG(const int& dx,
87  const int& dy,
88  const int& dz,
89  tBoolean& succeeds) const;
90 
91  tReal KaaDG(const int& dx,
92  const int& dy,
93  const int& dz,
94  tBoolean& suceeds) const;
95 
96 
97 public:
98  static inline tReal integrateKxx(const int& index,const int& dx,const int& dy,const int& dz,
99  const int& r,const int& s,const int& t,
100  tReal work[4]) {
101  tReal int01Kxx=0;
102  int i,j,k;
103  for (i=0;i<4;i++) {
104  for (j=0;j<4;j++) {
105  for (k=0;k<4;k++) {
106  work[0]=(m4GaussianPoints[i]-1)/2;
107  work[1]=(m4GaussianPoints[j]-1)/2;
108  work[2]=(m4GaussianPoints[k]-1)/2;
109  int01Kxx+=(m4GaussianWeights[i]*m4GaussianWeights[j]*m4GaussianWeights[k]/8)*
110  Kxx(index,dx,dy,dz,work,r,s,t);
111 
112  }
113  }
114  }
115  return int01Kxx;
116  }
117  static inline tReal integrateKxy(const int& index,const int& dx,const int& dy,const int& dz,
118  const int& r,const int& s,const int& t,
119  tReal work[4]) {
120  tReal int01Kxy=0;
121  int i,j,k;
122  for (i=0;i<4;i++) {
123  for (j=0;j<4;j++) {
124  for (k=0;k<4;k++) {
125  work[0]=(m4GaussianPoints[i]-1)/2;
126  work[1]=(m4GaussianPoints[j]-1)/2;
127  work[2]=(m4GaussianPoints[k]-1)/2;
128  int01Kxy+=(m4GaussianWeights[i]*m4GaussianWeights[j]*m4GaussianWeights[k]/8)*
129  Kxy(index,dx,dy,dz,work,r,s,t);
130  }
131  }
132  }
133  return int01Kxy;
134  }
135 
136  static inline tReal Kxx(const int& k,
137  const int &dx,
138  const int &dy,
139  const int &dz,
140  tReal x[4],
141  const int& r,
142  const int& s,
143  const int& t) {
144  x[0]=dx+x[0]+r;
145  x[1]=dy+x[1]+s;
146  x[2]=dz+x[2]+t;
147 
148  x[3]=x[k]*sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2]);
149 
150  tReal kxx=1.;
151  if (x[k]!=0) {
152  kxx=-atan(x[(k+1)%3]*x[(k+2)%3]/x[3]);
153  }else {
154  kxx=-M_PI/2;
155  }
156 
157  if ((r+s+t)%2==1) {//(-1)^{r+s+t}=-1
158  kxx*=-1;
159  }
160  return kxx;
161  }
162  static inline tReal Kxy(const int& k,
163  const int &dx,
164  const int &dy,
165  const int &dz,
166  tReal x[4],
167  const int& r,
168  const int& s,
169  const int& t) {
170  x[0]=dx+x[0]+r;
171  x[1]=dy+x[1]+s;
172  x[2]=dz+x[2]+t;
173 
174  //x[3]=x[0]*x[0]+x[1]*x[1]
175  x[3]=x[(k+1)%3];
176  x[3]*=x[3];
177  x[3]+=x[k]*x[k];
178 
179 
180  tReal kxy=x[(k+2)%3];//kxy=x[2]
181 
182  if (x[3]>0) {
183  //kyx=x[2]+sqrt(x[2]*x[2]+x[0]*x[0]+x[1]*x[1])
184  kxy+=sqrt(kxy*kxy+x[3]);
185  //kxy=log((x[2]+sqrt(x[2]*x[2]+x[0]*x[0]+x[1]*x[1]))/sqrt(x[0]*x[0]+x[1]*x[1]))
186  kxy=log(kxy/sqrt(x[3]));
187  } else {
188  if (kxy>0) {
189  kxy=log(2*kxy);
190  } else {
192  }
193  }
194 
195  if ((r+s+t)%2==1) {//(-1)^{r+s+t}=-1
196  kxy*=-1;
197  }
198 
199  return kxy;
200  }
201 
202  public:
203  // OTHERS methods
204 
205 
206 
207 
208 
209 };
210 
211 #endif
static tReal integrateKxx(const int &index, const int &dx, const int &dy, const int &dz, const int &r, const int &s, const int &t, tReal work[4])
Definition: EMM_SLElementaryDemagnetizedMatrix.h:98
static tReal Kxy(const int &k, const int &dx, const int &dy, const int &dz, tReal x[4], const int &r, const int &s, const int &t)
Definition: EMM_SLElementaryDemagnetizedMatrix.h:162
tReal KaaG(const int &x, const int &y, const int &z, const int &dx, const int &dy, const int &dz, tBoolean &succeeds) const
compute
Definition: EMM_SLElementaryDemagnetizedMatrix.cpp:25
static tReal getRealInfinity()
get the infinity value
Definition: CORE_Object.h:633
EMM_SLElementaryDemagnetizedMatrix(void)
create
Definition: EMM_SLElementaryDemagnetizedMatrix.cpp:16
static const tReal m4GaussianPoints[]
Definition: EMM_SLElementaryDemagnetizedMatrix.h:26
tReal KaaDG(const int &dx, const int &dy, const int &dz, tBoolean &suceeds) const
Definition: EMM_SLElementaryDemagnetizedMatrix.cpp:225
#define tBoolean
Definition: types.h:139
This class describes gaussian interpolation.
Definition: EMM_SLElementaryDemagnetizedMatrix.h:15
DEFINE_SPTR(EMM_SLElementaryDemagnetizedMatrix)
tReal KabDG(const int &dx, const int &dy, const int &dz, tBoolean &succeeds) const
Definition: EMM_SLElementaryDemagnetizedMatrix.cpp:165
static SP::EMM_SLElementaryDemagnetizedMatrix New()
build a new instance of class
Definition: EMM_SLElementaryDemagnetizedMatrix.h:54
abstract base class for most classes.
Definition: CORE_Object.h:53
static tReal Kxx(const int &k, const int &dx, const int &dy, const int &dz, tReal x[4], const int &r, const int &s, const int &t)
Definition: EMM_SLElementaryDemagnetizedMatrix.h:136
SP_OBJECT(EMM_SLElementaryDemagnetizedMatrix)
tReal KabG(const int &x, const int &y, const int &z, const int &dx, const int &dy, const int &dz, tBoolean &succeeds) const
Definition: EMM_SLElementaryDemagnetizedMatrix.cpp:98
static tReal integrateKxy(const int &index, const int &dx, const int &dy, const int &dz, const int &r, const int &s, const int &t, tReal work[4])
Definition: EMM_SLElementaryDemagnetizedMatrix.h:117
#define tReal
Definition: types.h:118
static const tReal m4GaussianWeights[]
Definition: EMM_SLElementaryDemagnetizedMatrix.h:25
virtual ~EMM_SLElementaryDemagnetizedMatrix(void)
destroy
Definition: EMM_SLElementaryDemagnetizedMatrix.cpp:20
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141