C++ main module for emicrom Package  1.0
EMMG_CubicAnisotropyOperator.h
Go to the documentation of this file.
1 #ifndef EMMG_CubicAnisotropyOperator_H
2 #define EMMG_CubicAnisotropyOperator_H
3 
4 
6 
18 
20  // ATTRIBUTES
21 
22 
23 
24 protected:
25 
26  // METHODS
27 
28  // CONSTRUCTORS
29 
33  }
34 
35  // DESTRUCTORS
36 
40  }
41 
42 
43 public:
47  inline static SP::EMMG_CubicAnisotropyOperator New() {
48  SP::EMMG_CubicAnisotropyOperator p(new EMMG_CubicAnisotropyOperator(),
50  p->setThis(p);
51  return p;
52  };
53 
54 
55 public:
62  virtual void computeMagneticExcitationField(const EMM_RealArray& sigma,
63  const EMM_RealField& M,
64  EMM_RealField& H) const {
65  // size of the operator
66  tUIndex nCells=M.getSize();
67  const tDimension& dim=M.getDimension();
68 
69  //set the size of the magnetic excitation field
70  H.setSize(nCells);
71 
72  //no computation
73  if (nCells==0) return;
74 
75  //verify the type of M
76  const EMMG_RealField *gM=dynamic_cast<const EMMG_RealField *>(&M);
77  if (gM==null) throw EMM_Exception("generic","EMMG_CubicAnisotropyOperator:: computeMagneticExcitationField(..)",
78  "M is an incompatible real field");
79 
80  //verify the type of H
81  EMMG_RealField *gH=dynamic_cast<EMMG_RealField *>(&H);
82  if (gH==null) throw EMM_Exception("generic","EMMG_CubicAnisotropyOperator:: computeMagneticExcitationField(..)",
83  "H is an incompatible real field");
84 
85 
86  EMM_CubicAnisotropyOperator::computeMagneticExcitationField(nCells,dim,sigma,&(*gM)[0],&(*gH)[0]);
87  }
88 
89 
90 public:
91 
101  const EMM_RealField& M,
102  const EMM_RealField& D,
103  EMM_RealField& gradH) const {
104  // size of the operator
105  tUIndex nCells=M.getSize();
106  const tDimension& dim=M.getDimension();
107 
108  //set the size of the magnetic excitation field
109  gradH.setSize(nCells);
110 
111  //no computation
112  if (nCells==0) return true;
113 
114  //verify the type of M
115  const EMMG_RealField *gM=dynamic_cast<const EMMG_RealField *>(&M);
116  if (gM==null) throw EMM_Exception("generic","EMMG_CubicAnisotropyOperator:: computeMagneticExcitationFieldGradient(..)",
117  "M is an incompatible real field");
118 
119  //verify the type of D
120  const EMMG_RealField *gD=dynamic_cast<const EMMG_RealField *>(&D);
121  if (gD==null) throw EMM_Exception("generic","EMMG_CubicAnisotropyOperator:: computeMagneticExcitationFieldGradient(..)",
122  "D is an incompatible real field");
123  //verify the type of gradH
124  EMMG_RealField *gGradH=dynamic_cast<EMMG_RealField *>(&gradH);
125  if (gGradH==null) throw EMM_Exception("generic","EMMG_CubicAnisotropyOperator:: computeMagneticExcitationFieldGradient(..)",
126  "gradH is an incompatible real field");
127 
128 
129  return EMM_CubicAnisotropyOperator::computeMagneticExcitationFieldGradient(nCells,dim,sigma,&(*gM)[0],&(*gD)[0],&(*gGradH)[0]);
130  }
131 
132 public:
146  const EMM_RealArray& sigma,
147  const EMM_RealField& M,
148  const EMM_RealField& H) const {
149  // size of the operator
150  tUIndex nCells=M.getSize();
151  const tDimension& dim=M.getDimension();
152 
153 
154  //no computation
155  if (nCells==0) return 0;
156 
157  //verify the type of M
158  const EMMG_RealField *gM=dynamic_cast<const EMMG_RealField *>(&M);
159  if (gM==null) throw EMM_Exception("generic","EMMG_CubicAnisotropyOperator:: computeEnergyWithMagneticExcitation(..)",
160  "M is an incompatible real field");
161 
162 
163  return EMM_CubicAnisotropyOperator::computeEnergy(nCells,dim,sigma,&(*gM)[0]);
164  }
182  virtual tReal computeEnergy(const tReal& t, const EMM_RealArray& sigma,const EMM_RealField& M,EMM_RealField& W) const {
183  // size of the operator
184  tUIndex nCells=M.getSize();
185  const tDimension & dim=M.getDimension();
186 
187 
188  //no computation
189  if (nCells==0) return 0;
190 
191  //verify the type of M
192  const EMMG_RealField *gM=dynamic_cast<const EMMG_RealField *>(&M);
193  if (gM==null) throw EMM_Exception("generic","EMMG_CubicAnisotropyOperator:: computeEnergy(..)",
194  "M is an incompatible real field");
195 
196 
197  return EMM_CubicAnisotropyOperator::computeEnergy(nCells,dim,sigma,&(*gM)[0]);
198  }
199 
200 
201 };
202 
203 #endif
204 
virtual tBoolean computeMagneticExcitationFieldGradient(const EMM_RealArray &sigma, const EMM_RealField &M, const EMM_RealField &D, EMM_RealField &gradH) const
compute the gradient of the magnetic excitation field at M in the direction D
Definition: EMMG_CubicAnisotropyOperator.h:100
virtual tUIndex getSize() const =0
return the size of the field
tReal computeEnergy(const tUIndex &nCells, const tDimension &dim, const EMM_RealArray &sigma, const tReal *M) const
compute the energy of the anistropy operator
Definition: EMM_CubicAnisotropyOperator.cpp:23
This class describes a generic real field.
Definition: EMMG_RealField.h:17
virtual tBoolean computeMagneticExcitationFieldGradient(const tUIndex &nCells, const tDimension &dim, const EMM_RealArray &sigma, const tReal *M, const tReal *D, tReal *gradH) const
compute the gradient of the magnetic excitation field at M in the direction D
Definition: EMM_CubicAnisotropyOperator.cpp:431
#define tBoolean
Definition: types.h:139
virtual void computeMagneticExcitationField(const EMM_RealArray &sigma, const EMM_RealField &M, EMM_RealField &H) const
compute the normalized excitation magnetic field at M
Definition: EMMG_CubicAnisotropyOperator.h:62
EMMG_CubicAnisotropyOperator(void)
create
Definition: EMMG_CubicAnisotropyOperator.h:32
#define null
Definition: types.h:144
static SP::EMMG_CubicAnisotropyOperator New()
create a cubic anisotropy operator
Definition: EMMG_CubicAnisotropyOperator.h:47
#define tDimension
Definition: EMM_Types.h:10
virtual tReal computeEnergyWithMagneticExcitation(const tReal &t, const EMM_RealArray &sigma, const EMM_RealField &M, const EMM_RealField &H) const
compute the energy E of the operator
Definition: EMMG_CubicAnisotropyOperator.h:145
DEFINE_SPTR(EMMG_CubicAnisotropyOperator)
This class describes the cubic anistropy operator of the landau lifschitz system EMM_LandauLifschitzS...
Definition: EMM_CubicAnisotropyOperator.h:82
#define tUIndex
Definition: types.h:126
This class describes a real array.
Definition: EMM_RealArray.h:16
const tDimension & getDimension() const
get the dimension
Definition: EMM_RealField.h:553
virtual void computeMagneticExcitationField(const tUIndex &nCells, const tDimension &dim, const EMM_RealArray &sigma, const tReal *M, tReal *H) const
compute the normalized excitation magnetic field at M
Definition: EMM_CubicAnisotropyOperator.cpp:231
this class describes the exceptions raised for E-MicromM package
Definition: EMM_Exception.h:14
virtual ~EMMG_CubicAnisotropyOperator(void)
destroy
Definition: EMMG_CubicAnisotropyOperator.h:39
This class describes a real field.
Definition: EMM_RealField.h:21
virtual tReal computeEnergy(const tReal &t, const EMM_RealArray &sigma, const EMM_RealField &M, EMM_RealField &W) const
compute the energy of the operator
Definition: EMMG_CubicAnisotropyOperator.h:182
virtual void setSize(const tUIndex &n)=0
set the size
#define tReal
Definition: types.h:118
SP_OBJECT(EMMG_CubicAnisotropyOperator)
This class describes the cubic anistropy operator EMM_CubicAnisotropyOperator of the landau lifschitz...
Definition: EMMG_CubicAnisotropyOperator.h:17
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141