C++ main module for emicrom Package  1.0
EMM_Grid3D.h
Go to the documentation of this file.
1 #ifndef EMM_Grid3D_H
2 #define EMM_Grid3D_H
3 
4 #include "EMM_Object.h"
5 #include "EMM_Array.h"
6 #include "CORE_MorseArray.h"
7 
8 class EMM_MatterField;
9 
48 class EMM_Grid3D : public EMM_Object {
49 
51  // ATTRIBUTES
52 
53 public:
57 
58  //limit condition types
63 
64 
65  //points of mesh
66  static const tFlag POINT=0;
67 
68  //element of mesh
69  static const tFlag ELEMENT=1;
70 
71  //indicator for element in the interior of domain pow(2,FACES_NUMBER_PER_ELEMENT+1)-1=127
72  //all bits in {0,1,2,3,n4,5} is 1
74 
75  //min indicator for element in magnetized domain pow(2,FACES_NUMBER_PER_ELEMENT)=64
77 
78 
79  //number of faces per element
81 
82  //number of points by element
84 
85  //number of points by face
87 
91  static const tBoolean ELEMENT_POINTS[];
92 
96  static const tUCInt FACE_POINTS[];
97 
101  static const tCInt EDGE_POINTS[];
102 
103 private:
104 
105 
106 
107 
108  //2^iFace iFace in [0,6[
109  static const tCellFlag TWO_POWER_FACES[];
110 
114 
118 
122 
129 
133 
143 
147 
151 
155 
156 
160 
164 
168 
169 
170  //temporary index
171  mutable tUIndex mWorkIndex;
172 
173 protected:
174  // METHODS
175 
176  // CONSTRUCTORS
177 
181  EMM_Grid3D(void);
182 
183  // DESTRUCTORS
184 
185 
188  virtual ~EMM_Grid3D(void);
189 
190 
191 public:
195  inline static SP::EMM_Grid3D New() {
196  SP::EMM_Grid3D p(new EMM_Grid3D(),EMM_Grid3D::Delete());
197  p->setThis(p);
198  return p;
199  };
200 
201 
202 
203  //builder methods
204  //===============
205 private:
212 
213 public:
218 
219 
220 public:
221 
222  //Segments number manipulation
223  //=============================
224 
230  inline void setSegmentsNumber(const tUInteger& nx,const tUInteger& ny,const tUInteger& nz) {
231  mSegmentsNumber[0]=nx;
232  mSegmentsNumber[1]=ny;
233  mSegmentsNumber[2]=nz;
234  mElementsNumber=nx*ny*nz;
235  mNeighborsIndicators->setSize(mElementsNumber);
237  };
238 
244  inline void getSegmentsNumber(tUInteger& nx,tUInteger& ny,tUInteger& nz) const {
245  nx=mSegmentsNumber[0];
246  ny=mSegmentsNumber[1];
247  nz=mSegmentsNumber[2];
248 
249  }
253  inline const tUInteger* getSegmentsNumber() const {
254  return mSegmentsNumber;
255  }
256 
261  inline const tUInteger& getSegmentsNumber(const tUSInt& d) const {
262  return mSegmentsNumber[d];
263  }
264 
265 
272  inline tUIndex getElementIndex(const tUIndex& i,const tUIndex& j,const tUIndex& k) const {
273  return i+mSegmentsNumber[0]*(j+mSegmentsNumber[1]*k);
274  }
282  inline void getElementSegmentIndices(const tUIndex& index,tUIndex& i,tUIndex& j,tUIndex& k) const {
283  i=index%mSegmentsNumber[0];
284  mWorkIndex=index/mSegmentsNumber[0];//mWorkIndex=j+k.Ny
285  j=mWorkIndex%mSegmentsNumber[1];
286  k=mWorkIndex/mSegmentsNumber[1];
287  }
293  inline tUIndex getElementSegmentIndex(const tUIndex& index,const tUSInt& d) const {
294  switch(d) {
295  case 0:
296  return index%mSegmentsNumber[0];
297  case 1:
298  return (index/mSegmentsNumber[0])%mSegmentsNumber[1];
299  case 2:
300  default:
301  return (index/mSegmentsNumber[0])/mSegmentsNumber[1];
302  }
303  }
304 
305 
309  inline tUIndex getElementsNumber()const{
310  return mSegmentsNumber[0]*mSegmentsNumber[1]*mSegmentsNumber[2];
311  };
312 
316  inline tUIndex getVerticesNumber()const{
317  return (mSegmentsNumber[0]+1)*(mSegmentsNumber[1]+1)*(mSegmentsNumber[2]+1);
318  };
319 
320  //step size methods
321  //=================
322 
323 public:
329  inline void setStepsSize(const tReal& lx,const tReal& ly,const tReal& lz) {
330  mSegmentsSize[0]=lx;
331  mSegmentsSize[1]=ly;
332  mSegmentsSize[2]=lz;
333  };
334 
335 
339  inline void setStepSize(const tReal& l) {
340  setStepsSize(l,l,l);
341  };
345  inline const tReal* getStepsSize() const {
346  return mSegmentsSize;
347  }
351  inline const tReal& getStepSize(const tUSInt& d) const {
352  return mSegmentsSize[d];
353  }
357  inline tReal getMinStepSize() const {
358  tReal dx=mSegmentsSize[0];
359  for (tUSInt i=1;i<3;i++) dx=(dx<mSegmentsSize[i])?dx:mSegmentsSize[i];
360  return dx;
361  }
365  inline tReal getMaxStepSize() const {
366  tReal dx=mSegmentsSize[0];
367  for (tUSInt i=1;i<3;i++) dx=(dx>mSegmentsSize[i])?dx:mSegmentsSize[i];
368  return dx;
369  }
373  inline const tReal* getAdimensionizedSegmentsSize() const {
375  }
376 
379  inline const tReal & getReferenceLength() const {
380  return mL;
381  }
384  inline const tReal & getMaxElementSize() const {
385  return mLmax;
386  }
389  inline const tReal & getMinElementSize() const {
390  return mLmin;
391  }
395  inline const tReal* getSegmentsSize() const {
396  return mSegmentsSize;
397  }
398 
402  inline tBoolean isCubicVolume() const {
404  const tReal *l =&mAdimensionizedSegmentsSize[2];
405  tBoolean ok=true;
406  for (tUSInt k=0;k<2;k++) {
407  ok=ok && (fabs(1.-(*lk)/(*l))<CORE_Object::computeEpsilon<tReal>());
408  lk++;
409  }
410  return ok;
411  }
412 
413 
418  inline tReal adimensionize() {
419  tUSInt k=0;
420  //get the max size of the element
421  mLmax=mSegmentsSize[0];
422  //get the min size of the element
423  mLmin=mSegmentsSize[0];
424  for (k=1;k<3;k++) {
425  if (mSegmentsSize[k]>mLmax) {
426  mLmax=mSegmentsSize[k];
427  }
428  if (mSegmentsSize[k]<mLmin) {
429  mLmin=mSegmentsSize[k];
430  }
431  }
432 
433  //reference length is the max cell size
434  mL=mLmax;
435  //normalize the element
436  mAdimensionizedVolume=1.;
437  for (k=0;k<3;k++) {
438  mAdimensionizedSegmentsSize[k]=mSegmentsSize[k]/mL;
439  mAdimensionizedVolume*=mAdimensionizedSegmentsSize[k];
440  }
441  return mL;
442 
443  }
444 
448  inline const tReal& getAdimensionizedVolume() const {
449  return mAdimensionizedVolume;
450  }
451 
459 
460 
461 
462 
463  // PERIODICITY
464  //=============
465 
468  inline void setIsPeriodic(const tBoolean v[3]) {
469  mIsPeriodic=false;
470  for (tUSInt i=0;i<3;i++) {
471  mIsPeriodic=mIsPeriodic || v[i];
472  mIsDirectionPeriodic[i]=v[i];
473  }
474  }
477  inline void setIsDirectionPeriodic(const tUSInt& k,const tBoolean& v) {
478  mIsDirectionPeriodic[k]=v;
479  mIsPeriodic=false;
480  for (tUSInt i=0;i<3;i++) {
481  mIsPeriodic=mIsPeriodic || mIsDirectionPeriodic[i];
482  }
483  }
484 
488  inline const tBoolean* isDirectionPeriodic() const {
489  return mIsDirectionPeriodic;
490  }
495  inline const tBoolean& isDirectionPeriodic(const tFlag& d) const {
496  ASSERT_IN(d<3);
497  return mIsDirectionPeriodic[d];
498  }
501  inline const tBoolean& isPeriodic() const {
502  return mIsPeriodic;
503  }
504 
509  return getPeriodicIndicator(mIsDirectionPeriodic);
510  };
514  inline static tCellFlag getPeriodicIndicator(const tBoolean periodicity[]) {
515  return 3*periodicity[0]+4*periodicity[1]+16*periodicity[2];
516  };
517 
518 
519 
520 
521  // cell methods
522  //=============
523 
527  inline const tUIndex& getMagnetizedElementsNumber() const {
529  }
530 
535  inline tBoolean isElementMagnetized(const tUIndex& index)const{
536  return ((*mNeighborsIndicators.get())[index]>=MAGNETIZED_ELEMENT_MIN_INDICATOR);
537  };
538 
546  static inline tBoolean IS_ELEMENT_MAGNETIZED(const tCellFlag& v) {
547  return ((64&v)!=0);
548  }
549 
554  inline tBoolean isInMagnetizedDomainInterior(const tUIndex& index)const{
555  return ((*mNeighborsIndicators.get())[index]==MAGNETIZED_DOMAIN_INTERIOR_INDICATOR);
556  };
557 
562  void buildMagnetizedElements(const EMM_MatterField &matters,
563  CORE_BooleanMorseArray& magnetizedElements) const;
564 
565 
566  //neighbor methods
567  //=================
568 
577  inline tBoolean hasNeighborToFace(const tUIndex& iElement,
578  const tUSInt& iFace) const {
579  if (iFace>=FACES_NUMBER_PER_ELEMENT)
580  throw EMM_Exception("EMM_Grid3D","hasNeighborToFace",
581  "index of local face is greater than the max faces number in elements");
582  tCellFlag p=TWO_POWER_FACES[iFace];
583  return (iand((*mNeighborsIndicators.get())[iElement],p)==p);
584  };
585 
586 
587 
597  tUIndex getNeighborElement(const tUIndex& index,const tUCInt& iFace) const;
598 
609  tUIndex getNeighborElement(const tUIndex& iCell,
610  const tCellFlag& N,
611  const tBoolean isPeriodic[3],
612  const tUCInt &f) const;
613 
614 
615 
623  return mNeighborsIndicators;
624  }
625 
633  return *mNeighborsIndicators.get();
634  }
635 
643  return *mNeighborsIndicators.get();
644  }
645 
646 
651  inline const tCellFlag& getNeighborIndicator(const tUIndex& index) const {
652  return (*mNeighborsIndicators.get())[index];
653  }
654 
663  void buildNeighborsIndices(const EMM_MatterField &matters,
664  CORE_UIndexMorseArray& neighbors) const;
665 
671  CORE_UIndexMorseArray& neighbors) const;
672 
673 
674  //boundary faces methods
675  //======================
676 
677 
692  static tBoolean isFaceOnDirichletBoundary(const tCellFlag& periodicity,
693  const tUInteger& xCell,
694  const tUInteger& yCell,
695  const tUInteger& zCell,
696  const tUCInt& f,
697  const tUInteger& nPx,
698  const tUInteger& nPy,
699  const tUInteger& nPz,
700  const tLimitCondition* dirichletPoints);
701 
716  static tBoolean isFaceOnNeumannBoundary(const tCellFlag& periodicity,
717  const tUInteger& xCell,
718  const tUInteger& yCell,
719  const tUInteger& zCell,
720  const tUCInt& f,
721  const tUInteger& nPx,
722  const tUInteger& nPy,
723  const tUInteger& nPz,
724  const tLimitCondition* dirichletPoints);
725 
726 
738  static inline tBoolean GET_MASTER_PERIODIC_POINT(const tCellFlag& periodicity,
739  const tUIndex& Nx,const tUIndex& Ny,const tUIndex& Nz,
740  tUIndex& iQ,tUIndex& jQ,tUIndex& kQ) {
741  tBoolean moved=false;
742  if ((periodicity&3)!=0) {
743  //x-direction is periodic
744  if (iQ>=Nx) {
745  iQ-=Nx;
746  moved=true;
747  }
748 
749 
750  }
751  if ((periodicity&12)!=0) {
752  //y-direction is periodic
753  if (jQ>=Ny) {
754  jQ-=Ny;
755  moved=true;
756  }
757 
758 
759  }
760  if ((periodicity&48)!=0) {
761  //z-direction is periodic
762  if (kQ>=Nz) {
763  kQ-=Nz;
764  moved=true;
765  }
766 
767  }
768  return moved;
769  }
770 
771 
772 
788  static inline tBoolean IS_POINT_IN_BOUNDARY(const tBoolean x[],
789  const tCellFlag& N,
790  const tBoolean periodicity[]) {
791  return IS_POINT_IN_BOUNDARY(21+(*x)+4*x[1]+16*x[2],
792  N,
793  3*((*periodicity)+4*periodicity[1]+16*periodicity[2]));
794  }
795 
807  static inline tBoolean IS_POINT_IN_BOUNDARY(const tCellFlag& X,
808  const tCellFlag& N,
809  const tCellFlag& P) {
810  return ((X&((~N)&(~P)))!=0);
811  }
812 
824  const tCellFlag& N,
825  const tBoolean periodicity[]) {
826  //Pf=X0.2 +(1-X0).1+
827  // X1.8 +(1-x1).4+
828  // X2.32+(1-x2).16
829  // = 21+x0+4.x1+16.X2
830  return IS_POINT_IN_PERIODIC_BOUNDARY(21+(*x)+4*x[1]+16*x[2],
831  N,
832  3*((*periodicity)+4*(periodicity[1]+4*periodicity[2])));
833  }
845  const tCellFlag& N,
846  const tCellFlag& P) {
847  return ((X&((~N)&(P)))!=0);
848  }
861  const tCellFlag& N,
862  const tBoolean periodicity[]) {
863 
864  return IS_POINT_IN_SLAVE_PERIODIC_BOUNDARY(21+(*x)+4*x[1]+16*x[2],
865  N,
866  3*((*periodicity)+4*(periodicity[1]+4*periodicity[2])));
867 
868  }
869 
882  const tCellFlag& N,
883  const tCellFlag& P) {
884  return ((X&((~N)&(P))&(42))!=0);
885  }
886 
887  //limit conditions
888  //=================
889 
890 
904 
905 
906 
907 
908  // GEO File saver & loader
909  // ========================
910 public:
915  tBoolean loadFromFile(const tString& fileName);
916 
921  tBoolean saveToFile(const tString& fileName) const;
922 
923 
924 
925 private:
930  tBoolean loadFromGEOFile(const tString& fileName);
931 
936  tBoolean saveToGEOFile(const tString& fileName) const;
937 
945  tBoolean loadHeaderFromGEOStream(ifstream& f,tUInteger& nReadLines,tUInteger& nReadProperties);
951  tBoolean loadFromGEOStream(ifstream& f,tUInteger& nReadLines);
952 
960  tBoolean loadFooterFromGEOStream(ifstream& f,tUInteger& nReadLines,tUInteger& nReadProperties);
961 
962 
963  //STRING REPRESENTATION
964 public:
968  virtual tString toString() const;
969 
970 };
971 
972 
973 #endif
static const tFlag POINT
Definition: EMM_Grid3D.h:66
This class is a base class of E-MicromM core package.
Definition: EMM_Object.h:21
static tBoolean IS_POINT_IN_PERIODIC_BOUNDARY(const tCellFlag &X, const tCellFlag &N, const tCellFlag &P)
test if the local point is in periodical boundary
Definition: EMM_Grid3D.h:844
tIndex mNextElementTranslation[FACES_NUMBER_PER_ELEMENT]
get the index translation in each direction to have the previous or next element
Definition: EMM_Grid3D.h:150
This class describes a grid3d mesh.
Definition: EMM_Grid3D.h:48
const tReal & getMaxElementSize() const
get the max length of the cell
Definition: EMM_Grid3D.h:384
tReal mL
reference length
Definition: EMM_Grid3D.h:142
tBoolean saveToFile(const tString &fileName) const
save to a file
Definition: EMM_Grid3D.cpp:1095
#define iand(a, b)
Definition: types.h:159
static const tUCInt FACES_NUMBER_PER_ELEMENT
Definition: EMM_Grid3D.h:80
static const tLimitCondition DIRICHLET_LIMIT_CONDITION
Definition: EMM_Grid3D.h:59
static const tLimitCondition NEUMANN_LIMIT_CONDITION
Definition: EMM_Grid3D.h:60
tReal getMaxStepSize() const
get the max step size
Definition: EMM_Grid3D.h:365
#define tLimitCondition
Definition: EMM_Types.h:19
const tUInteger * getSegmentsNumber() const
get the segments number in all directions
Definition: EMM_Grid3D.h:253
static tBoolean GET_MASTER_PERIODIC_POINT(const tCellFlag &periodicity, const tUIndex &Nx, const tUIndex &Ny, const tUIndex &Nz, tUIndex &iQ, tUIndex &jQ, tUIndex &kQ)
get the index of master point in [0,pointsNumber[. The master point is the point in pair face in the ...
Definition: EMM_Grid3D.h:738
tBoolean saveToGEOFile(const tString &fileName) const
save to a geo file
Definition: EMM_Grid3D.cpp:1108
static tBoolean IS_POINT_IN_PERIODIC_BOUNDARY(const tBoolean x[], const tCellFlag &N, const tBoolean periodicity[])
test if the local point is in a periodical boundary
Definition: EMM_Grid3D.h:823
tReal mSegmentsSize[3]
segments size
Definition: EMM_Grid3D.h:125
#define tUInteger
Definition: types.h:91
static const tUIndex UNMAGNETIZED_ELEMENT
return the index of the unmagnetized element
Definition: EMM_Grid3D.h:56
tReal getMinStepSize() const
get the min step size
Definition: EMM_Grid3D.h:357
static const tDimension X
Definition: EMM_Object.h:33
static tBoolean IS_POINT_IN_BOUNDARY(const tBoolean x[], const tCellFlag &N, const tBoolean periodicity[])
test if the local point is in magnetized boundary.
Definition: EMM_Grid3D.h:788
tIndex mPeriodicElementTranslation[FACES_NUMBER_PER_ELEMENT]
get the index translation in each direction to have the periodic element
Definition: EMM_Grid3D.h:154
This class describes a general morse array of size N. A morse array is composed by.
Definition: CORE_MorseArray.h:31
virtual tString toString() const
turn the mesh into string
Definition: EMM_Grid3D.cpp:1158
tUIndex mElementsNumber
number of elements
Definition: EMM_Grid3D.h:167
tReal adimensionize()
compute the adimensionized constants
Definition: EMM_Grid3D.h:418
SP_OBJECT(EMM_Grid3D)
static const tUCInt FACE_POINTS[]
points index of elements get the local index of the points in face : FACE_POINTS[f*POINTS_NUMBER_PER_...
Definition: EMM_Grid3D.h:96
T & get(const tUIndex &i)
get the value of the array at index i
Definition: CORE_Array.h:555
static SP::EMM_Grid3D New()
create a Grid3D object
Definition: EMM_Grid3D.h:195
const tReal & getReferenceLength() const
get the reference length
Definition: EMM_Grid3D.h:379
void updateElementTranslations()
update the values of private arrays depending on the discretization of the domain : ...
Definition: EMM_Grid3D.cpp:93
#define tUCInt
Definition: types.h:21
#define tUSInt
Definition: types.h:28
SP::EMM_CellFlagArray mNeighborsIndicators
mNeigbor indicator for each element
Definition: EMM_Grid3D.h:159
#define tBoolean
Definition: types.h:139
tBoolean mIsPeriodic
true if the mesh is periodic in one direction
Definition: EMM_Grid3D.h:117
const tReal & getAdimensionizedVolume() const
get the adimensionized element volume <=1
Definition: EMM_Grid3D.h:448
void setStepsSize(const tReal &lx, const tReal &ly, const tReal &lz)
set the step size in the direction x,y,z : length of segment in each direction
Definition: EMM_Grid3D.h:329
const tReal & getStepSize(const tUSInt &d) const
get the step size in the direction d
Definition: EMM_Grid3D.h:351
tBoolean isCubicVolume() const
return true if the element is cubic
Definition: EMM_Grid3D.h:402
static tBoolean isFaceOnNeumannBoundary(const tCellFlag &periodicity, const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUCInt &f, const tUInteger &nPx, const tUInteger &nPy, const tUInteger &nPz, const tLimitCondition *dirichletPoints)
return tue if the face f of the magnetized cell (xCell,yCell,zCell) is on Neumann boundary ...
Definition: EMM_Grid3D.cpp:577
static const tCellFlag MAGNETIZED_DOMAIN_INTERIOR_INDICATOR
Definition: EMM_Grid3D.h:73
static tBoolean IS_POINT_IN_SLAVE_PERIODIC_BOUNDARY(const tCellFlag &X, const tCellFlag &N, const tCellFlag &P)
test if the local point is in slave periodical boundary
Definition: EMM_Grid3D.h:881
static tCellFlag getPeriodicIndicator(const tBoolean periodicity[])
get the periodic indicator by face with if face f is periodic
Definition: EMM_Grid3D.h:514
static const tFlag ELEMENT
Definition: EMM_Grid3D.h:69
static const tCellFlag MAGNETIZED_ELEMENT_MIN_INDICATOR
Definition: EMM_Grid3D.h:76
static tBoolean IS_POINT_IN_BOUNDARY(const tCellFlag &X, const tCellFlag &N, const tCellFlag &P)
test if the local point is in magnetized boundary
Definition: EMM_Grid3D.h:807
void getSegmentsNumber(tUInteger &nx, tUInteger &ny, tUInteger &nz) const
get the segments number in all directions
Definition: EMM_Grid3D.h:244
EMM_Array< tCellFlag > EMM_CellFlagArray
Definition: EMM_Array.h:278
tBoolean isElementMagnetized(const tUIndex &index) const
Definition: EMM_Grid3D.h:535
void setIsDirectionPeriodic(const tUSInt &k, const tBoolean &v)
set if the mesh is periodic on all directions
Definition: EMM_Grid3D.h:477
static const tCellFlag TWO_POWER_FACES[]
Definition: EMM_Grid3D.h:109
static tBoolean isFaceOnDirichletBoundary(const tCellFlag &periodicity, const tUInteger &xCell, const tUInteger &yCell, const tUInteger &zCell, const tUCInt &f, const tUInteger &nPx, const tUInteger &nPy, const tUInteger &nPz, const tLimitCondition *dirichletPoints)
return tue if the face f of the magnetized cell (xCell,yCell,zCell) is on Dirichlet boundary ...
Definition: EMM_Grid3D.cpp:504
static tBoolean IS_ELEMENT_MAGNETIZED(const tCellFlag &v)
test if the element woth neighbor indicator v is magnetized
Definition: EMM_Grid3D.h:546
void updateLimitConditionOnPoints(EMM_LimitConditionArray &lc) const
update the limit condition of each point.
Definition: EMM_Grid3D.cpp:656
static const tLimitCondition NO_LIMIT_CONDITION
Definition: EMM_Grid3D.h:61
const tReal * getAdimensionizedSegmentsSize() const
return the adimensionized segments size
Definition: EMM_Grid3D.h:373
tBoolean loadFromFile(const tString &fileName)
load from a file
Definition: EMM_Grid3D.cpp:884
void buildMagnetizedNeighborsIndices(const EMM_MatterField &matters, CORE_UIndexMorseArray &neighbors) const
build the neighbors : for each element i build all the magnetized neighbors of element i ...
Definition: EMM_Grid3D.cpp:399
tUInteger mSegmentsNumber[3]
segments number
Definition: EMM_Grid3D.h:121
#define tCellFlag
Definition: EMM_Types.h:16
tUIndex getVerticesNumber() const
get the vertices number of the grid
Definition: EMM_Grid3D.h:316
#define tIndex
Definition: types.h:129
static const tBoolean ELEMENT_POINTS[]
points coordinate of elements get the local coodinates of the points in {0,1} : ELEMENT_POINTS[i*3] i...
Definition: EMM_Grid3D.h:91
const tBoolean & isDirectionPeriodic(const tFlag &d) const
get if the mesh is periodic on direction d
Definition: EMM_Grid3D.h:495
static const tUCInt POINTS_NUMBER_PER_FACE
Definition: EMM_Grid3D.h:86
tUIndex getElementIndex(const tUIndex &i, const tUIndex &j, const tUIndex &k) const
return the element index of the element located at (i,j,k) coordinates on segments number ...
Definition: EMM_Grid3D.h:272
tBoolean loadFromGEOStream(ifstream &f, tUInteger &nReadLines)
load the neighbors from geo stream
Definition: EMM_Grid3D.cpp:1040
tUIndex mWorkIndex
Definition: EMM_Grid3D.h:171
tUIndex mBoundElement[FACES_NUMBER_PER_ELEMENT]
get the index in [0,mSegmentsNumber[k][ of the 2 bound elements at each direction ...
Definition: EMM_Grid3D.h:146
tUIndex getElementSegmentIndex(const tUIndex &index, const tUSInt &d) const
return the element coordinates on segment number on d direction
Definition: EMM_Grid3D.h:293
#define tCInt
Definition: types.h:24
tBoolean loadFromGEOFile(const tString &fileName)
load from a geo file
Definition: EMM_Grid3D.cpp:894
This class describes the field of matters.
Definition: EMM_MatterField.h:34
tBoolean mIsDirectionPeriodic[3]
priodicity of direction the mesh
Definition: EMM_Grid3D.h:113
const tReal * getSegmentsSize() const
return the segments size
Definition: EMM_Grid3D.h:395
tCellFlag getPeriodicIndicator() const
get the periodic indicator by face with if face f is periodic
Definition: EMM_Grid3D.h:508
virtual ~EMM_Grid3D(void)
destroy a Grid3D
Definition: EMM_Grid3D.cpp:88
void setIsPeriodic(const tBoolean v[3])
set if the mesh is periodic on all directions
Definition: EMM_Grid3D.h:468
tUIndex getElementsNumber() const
get the elements number of the grid
Definition: EMM_Grid3D.h:309
#define tUIndex
Definition: types.h:126
tUIndex getNeighborElement(const tUIndex &index, const tUCInt &iFace) const
return the index of the element which is next to the element iElement with iFace in common ...
Definition: EMM_Grid3D.cpp:267
void computeNormalFaceAdimensionizedLength(tReal *L2) const
build the adimensionized length for each face in its normal direction
Definition: EMM_Grid3D.cpp:135
void setStepSize(const tReal &l)
set the step size in the direction x,y,z when it&#39;s the same for the 3 directions
Definition: EMM_Grid3D.h:339
EMM_Grid3D(void)
create a grid 3D
Definition: EMM_Grid3D.cpp:70
#define tString
Definition: types.h:135
tBoolean loadFooterFromGEOStream(ifstream &f, tUInteger &nReadLines, tUInteger &nReadProperties)
load header from geo stream
Definition: EMM_Grid3D.cpp:1091
static const tUCInt POINTS_NUMBER_PER_ELEMENT
Definition: EMM_Grid3D.h:83
const tReal & getMinElementSize() const
get the min length of the cell
Definition: EMM_Grid3D.h:389
tReal mLmax
max size of the cell
Definition: EMM_Grid3D.h:139
static const tCInt EDGE_POINTS[]
points index of edge get the local index of the points in edge between face l & r (r>l...
Definition: EMM_Grid3D.h:101
const tBoolean * isDirectionPeriodic() const
get if the mesh is periodic
Definition: EMM_Grid3D.h:488
void buildMagnetizedElements(const EMM_MatterField &matters, CORE_BooleanMorseArray &magnetizedElements) const
build the magnetized element morse array
Definition: EMM_Grid3D.cpp:167
static const tLimitCondition SLAVE_LIMIT_CONDITION
Definition: EMM_Grid3D.h:62
const tUInteger & getSegmentsNumber(const tUSInt &d) const
get the segments number in direction d
Definition: EMM_Grid3D.h:261
const tBoolean & isPeriodic() const
get if the mesh is periodic in one direction
Definition: EMM_Grid3D.h:501
this class describes the exceptions raised for E-MicromM package
Definition: EMM_Exception.h:14
EMM_CellFlagArray & getNeighborsIndicators()
get the neighbor elements for writing
Definition: EMM_Grid3D.h:642
tReal mAdimensionizedSegmentsSize[3]
adimensionized segments size
Definition: EMM_Grid3D.h:128
void buildNeighborsIndices(const EMM_MatterField &matters, CORE_UIndexMorseArray &neighbors) const
build the neighbors index: for each element i build all the (magnetized or not) neighbors of element ...
Definition: EMM_Grid3D.cpp:307
tReal mAdimensionizedVolume
the adimensionized volume
Definition: EMM_Grid3D.h:132
const EMM_CellFlagArray & getNeighborsIndicators() const
get the neighbors indicator for each element for reading
Definition: EMM_Grid3D.h:632
tBoolean loadHeaderFromGEOStream(ifstream &f, tUInteger &nReadLines, tUInteger &nReadProperties)
load header from geo stream
Definition: EMM_Grid3D.cpp:932
const tCellFlag & getNeighborIndicator(const tUIndex &index) const
get the neighbor indicator of the element at index
Definition: EMM_Grid3D.h:651
tBoolean hasNeighborToFace(const tUIndex &iElement, const tUSInt &iFace) const
return true if the element at index iElement have a magnetized neighbor with common face iFace in [0...
Definition: EMM_Grid3D.h:577
DEFINE_SPTR(EMM_Grid3D)
const tUIndex & getMagnetizedElementsNumber() const
get the number of magnetized elements
Definition: EMM_Grid3D.h:527
static tBoolean IS_POINT_IN_SLAVE_PERIODIC_BOUNDARY(const tBoolean x[], const tCellFlag &N, const tBoolean periodicity[])
test if the local point is in slave periodical boundary
Definition: EMM_Grid3D.h:860
#define tReal
Definition: types.h:118
void updateMagnetizedElementsNumber()
compute the magnetized elements number form neighbors array the number of magnetized elements is retu...
Definition: EMM_Grid3D.cpp:117
SPC::EMM_CellFlagArray getNeighborsIndicatorsByReference() const
get the neighbor elements for reading
Definition: EMM_Grid3D.h:622
tUIndex mMagnetizedElementsNumber
number of magnetized element
Definition: EMM_Grid3D.h:163
void setSegmentsNumber(const tUInteger &nx, const tUInteger &ny, const tUInteger &nz)
set the segments number in all directions
Definition: EMM_Grid3D.h:230
void getElementSegmentIndices(const tUIndex &index, tUIndex &i, tUIndex &j, tUIndex &k) const
return the element coordinates on segments number
Definition: EMM_Grid3D.h:282
const tReal * getStepsSize() const
get the step size in all directions
Definition: EMM_Grid3D.h:345
tReal mLmin
min size of the cell
Definition: EMM_Grid3D.h:136
#define ASSERT_IN(a)
Definition: types.h:196
tBoolean isInMagnetizedDomainInterior(const tUIndex &index) const
Definition: EMM_Grid3D.h:554
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141
#define tFlag
Definition: types.h:74