C++ main module for emicrom Package  1.0
EMMG_DemagnetizedOperator.h
Go to the documentation of this file.
1 #ifndef EMMG_DemagnetizedOperator_H
2 #define EMMG_DemagnetizedOperator_H
3 
4 
6 
7 
8 
20 
22  // ATTRIBUTES
23 
24 
25 private:
26 
27 
28 
29 
30 
31 public:
32 
33 
34 
35 
36 protected:
37 
38  // METHODS
39 
40  // CONSTRUCTORS
41 
45  }
46 
47  // DESTRUCTORS
48 
52  }
53 
54 
55 public:
56 
60  inline static SP::EMMG_DemagnetizedOperator New() {
61  SP::EMMG_DemagnetizedOperator p(new EMMG_DemagnetizedOperator(),
63  p->setThis(p);
64  return p;
65  };
66 
67  // SET methods
68  // ===========
69 
70 
71 
72  // GET methods
73  // ===========
74 
75 
76 
77 
78 
79 public:
86  virtual void computeMagneticExcitationField(const EMM_RealArray& sigma,
87  const EMM_RealField& M,
88  EMM_RealField& H) const {
89  // size of the operator
90  tUIndex nCells=M.getSize();
91 
92  //set the size of the magnetic excitation field
94  H.setSize(nCells);
95 
96  //no computation
97  if (nCells==0) return;
98 
99  //verify the type of H
100  const EMMG_RealField *gM=dynamic_cast<const EMMG_RealField *>(&M);
101  if (gM==null) throw EMM_Exception("generic","EMMG_DemagnetizedOperator:: computeMagneticExcitationField(..)",
102  "M is an incompatible real field");
103 
104  //verify the type of H
105  EMMG_RealField *gH=dynamic_cast<EMMG_RealField *>(&H);
106  if (gH==null) throw EMM_Exception("generic","EMMG_DemagnetizedOperator:: computeMagneticExcitationField(..)",
107  "H is an incompatible real field");
108 
109 
110 
111  //H=Ad.(sigma.M)
112  if (sigma.getSize()>1) {
113 
114  H.initField(sigma,M);
116  &(*gH)[0],&(*gH)[0]);
117  } else {
119  &(*gM)[0],&(*gH)[0]);
120  }
121 
122  }
123 
124 
125 
126 };
127 
128 #endif
129 
const tUIndex & getSize() const
return the size of the array for reading
Definition: CORE_Array.h:1018
virtual tUIndex getSize() const =0
return the size of the field
This class describes a generic real field.
Definition: EMMG_RealField.h:17
This class describes the linear demagnetized operator of the Landau Lifschitz system EMM_LandauLifsch...
Definition: EMM_DemagnetizedOperator.h:81
virtual ~EMMG_DemagnetizedOperator(void)
destroy the class
Definition: EMMG_DemagnetizedOperator.h:51
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_DemagnetizedOperator.h:86
SP_OBJECT(EMMG_DemagnetizedOperator)
This class describes the linear demagnetized operator EMM_DemagnetizedOperator of the Landau Lifschit...
Definition: EMMG_DemagnetizedOperator.h:19
#define null
Definition: types.h:144
DEFINE_SPTR(EMMG_DemagnetizedOperator)
virtual void initField(const tReal &f)=0
init the field to uniform value in each direction
static SP::EMMG_DemagnetizedOperator New()
create a demagnetized operator
Definition: EMMG_DemagnetizedOperator.h:60
virtual void computeMagneticExcitationField(const tUIndex &nCells, const tDimension &dim, const tReal *sigmaM, tReal *H) const
compute the excitation magnetic field at M
Definition: EMM_DemagnetizedOperator.cpp:258
#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
this class describes the exceptions raised for E-MicromM package
Definition: EMM_Exception.h:14
EMMG_DemagnetizedOperator(void)
create the class
Definition: EMMG_DemagnetizedOperator.h:44
void setDimension(const tDimension &d)
set the dimension
Definition: EMM_RealField.h:158
This class describes a real field.
Definition: EMM_RealField.h:21
virtual void setSize(const tUIndex &n)=0
set the size
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141