C++ main module for emicrom Package  1.0
EMM_AnisotropyDirectionsField.h
Go to the documentation of this file.
1 #ifndef EMM_AnisotropyDirectionsField_H
2 #define EMM_AnisotropyDirectionsField_H
3 
4 #include "EMM_Object.h"
5 
6 #include "EMM_RealArray.h"
7 
8 #include "CORE_MorseArray.h"
11 
12 class EMM_MatterField;
13 class EMM_Matter;
14 
35 class EMM_AnisotropyDirectionsField : public virtual EMM_Object {
36 
38  // ATTRIBUTES
39 
40 public:
41 
42 private:
43 
44  //directions of the matters
46 
47 
48 protected:
49  // METHODS
50 
51  // CONSTRUCTORS
52 
56 
57 
58  // DESTRUCTORS
59 
62  virtual ~EMM_AnisotropyDirectionsField(void);
63  // NEW method
64 
65 public:
69  inline static SP::EMM_AnisotropyDirectionsField New() {
70  SP::EMM_AnisotropyDirectionsField p(new EMM_AnisotropyDirectionsField(),
72  p->setThis(p);
73  return p;
74  };
75 
76 
77 
78 public:
79 
80  // OPERATOR
81 
82 
88  inline const tReal* operator()(const tUIndex& i,const tUSInt& k) const {
89  return &mDirections[i][3*k];
90  }
96  inline tReal* operator()(const tUIndex& i,const tUSInt& k) {
97  return &mDirections[i][3*k];
98  }
99 
103  inline const tReal* operator[](const tUIndex& index) const {
104  return &mDirections.getValues()[index];
105  }
109  inline tReal* operator[](const tUIndex& index) {
110  return &mDirections.getValues()[index];
111  }
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123  // SET methods
124  // ===========
127  inline void clear(){
128  mDirections.clear();
129  }
130 
134  inline void setSize(const tUIndex& nCells) {
135  //the max memory size of directions per cell is 3x3
136  mDirections.setSize(nCells,9);
137  }
138 
139 
140 
145  void setAnisotropyDirections(const tUIndex& nCells,const EMM_Matter& matter);
146 
147  // GET methods
148  // ==========
149 
150 
151 
152 public:
155  inline tBoolean isUniform() const {
156  return mDirections.isUniform();
157  }
158 
163  inline tUSInt getDirectionsNumber(const tUIndex& i) const {
164  return mDirections.getSize(i)/3;
165  }
170  inline tUSInt getDirectionsSize(const tUIndex& i) const {
171  return mDirections.getSize(i);
172  }
176  inline tUIndex getDirectionsSize() const {
177  return mDirections.getValues().getSize();
178  }
179 
183  inline const tUIndex& getCellsNumber() const {
184  return mDirections.getSize();
185  }
186 
187 
191  inline const CORE_RealMorseArray& getDirections() const {
192  return mDirections;
193  }
194 
199  return mDirections;
200  }
201 
202 
203 
204 public:
205  // IO Methods
206  // ==========
214  void loadFromMattersField(const EMM_MatterField& matterF);
215 
236  tBoolean loadFromFile(const EMM_MatterField& matterF,const tString& fileName);
237 
238 
239 
251  tBoolean saveToFile(const tString& fileName) const;
252 
253 
254 
255 public:
256 
259  virtual tString toString() const;
260 
261 
262 
263 };
264 
265 #endif
This class is a base class of E-MicromM core package.
Definition: EMM_Object.h:21
const CORE_RealMorseArray & getDirections() const
get the directions
Definition: EMM_AnisotropyDirectionsField.h:191
const tUIndex & getSize() const
return the size of the array for reading
Definition: CORE_Array.h:1018
tUIndex getDirectionsSize() const
get the memory size of the directions for all the cells
Definition: EMM_AnisotropyDirectionsField.h:176
virtual ~EMM_AnisotropyDirectionsField(void)
destroy
Definition: EMM_AnisotropyDirectionsField.cpp:13
#define tUSInt
Definition: types.h:28
#define tBoolean
Definition: types.h:139
void setAnisotropyDirections(const tUIndex &nCells, const EMM_Matter &matter)
set the uniform anistropy directions
Definition: EMM_AnisotropyDirectionsField.cpp:16
SP_OBJECT(EMM_AnisotropyDirectionsField)
tUSInt getDirectionsNumber(const tUIndex &i) const
get the number of directions of the cell i param i: index of the cell
Definition: EMM_AnisotropyDirectionsField.h:163
const tReal * operator()(const tUIndex &i, const tUSInt &k) const
get the k direction of the cell i
Definition: EMM_AnisotropyDirectionsField.h:88
tBoolean loadFromFile(const EMM_MatterField &matterF, const tString &fileName)
load the direction of anisotropy and the index of matters for cells
Definition: EMM_AnisotropyDirectionsField.cpp:204
This class describes the field of directions of anisotropy This fields contains 2 arrays : ...
Definition: EMM_AnisotropyDirectionsField.h:35
tBoolean saveToFile(const tString &fileName) const
write the matters into a file
Definition: EMM_AnisotropyDirectionsField.cpp:444
This class describes a matter for E-MicroM package.
Definition: EMM_Matter.h:34
CORE_RealMorseArray mDirections
Definition: EMM_AnisotropyDirectionsField.h:45
tReal * operator()(const tUIndex &i, const tUSInt &k)
get the k direction of the cell i
Definition: EMM_AnisotropyDirectionsField.h:96
const CORE_Array< T > & getValues() const
get the values of the morse array
Definition: CORE_MorseArray.h:437
tBoolean isUniform() const
return true if the morse array is unifom
Definition: CORE_MorseArray.h:518
tReal * operator[](const tUIndex &index)
get the dierction at index
Definition: EMM_AnisotropyDirectionsField.h:109
void clear()
clear the morse array : desallocate the data.
Definition: CORE_MorseArray.h:318
const tUIndex & getCellsNumber() const
get the number of cells of the field
Definition: EMM_AnisotropyDirectionsField.h:183
This class describes the field of matters.
Definition: EMM_MatterField.h:34
EMM_AnisotropyDirectionsField(void)
create
Definition: EMM_AnisotropyDirectionsField.cpp:10
const tUIndex & getSize() const
get the number of elements of the array
Definition: CORE_MorseArray.h:404
const tReal * operator[](const tUIndex &index) const
get the direction values at index
Definition: EMM_AnisotropyDirectionsField.h:103
static SP::EMM_AnisotropyDirectionsField New()
create a shared pointer to the field of anisotropy direction
Definition: EMM_AnisotropyDirectionsField.h:69
void loadFromMattersField(const EMM_MatterField &matterF)
load the anisotropy directions from matters field
Definition: EMM_AnisotropyDirectionsField.cpp:37
tBoolean isUniform() const
return true if the field is uniform
Definition: EMM_AnisotropyDirectionsField.h:155
void setSize(const tUIndex &nCells)
set the size of the field
Definition: EMM_AnisotropyDirectionsField.h:134
#define tUIndex
Definition: types.h:126
#define tString
Definition: types.h:135
void clear()
clear matters
Definition: EMM_AnisotropyDirectionsField.h:127
tUSInt getDirectionsSize(const tUIndex &i) const
get the memory size of the directions of the cell i param i: index of the cell
Definition: EMM_AnisotropyDirectionsField.h:170
virtual tString toString() const
return a string representation
Definition: EMM_AnisotropyDirectionsField.cpp:493
#define tReal
Definition: types.h:118
CORE_RealMorseArray & getDirections()
get the directions
Definition: EMM_AnisotropyDirectionsField.h:198
DEFINE_SPTR(EMM_AnisotropyDirectionsField)
void setSize(const tUIndex &n, const tUIndex &m, const tUInteger &p)
set the size of the morse array
Definition: CORE_MorseArray.h:342
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141