C++ mpi module for stochmagnet_main Package
SM_CrystalStructuresBuilder.h
1 #ifndef SM_CrystalStructuresBuilder_H
2 #define SM_CrystalStructuresBuilder_H
3 
4 //super class header
5 #include "SM_Object.h"
6 
7 
8 //crystal structure header
9 #include "SM_CrystalStructure.h"
10 
18 
19 private:
20 
21 
22 
23 protected:
24  // CONSTRUCTORS
28 
29  }
30 
31 
32  // DESTRUCTORS
36  }
37 
38 public :
39 
40  //Instance building
41  //=================
42 
43 
44 
45  //MEMORY
46 
60  virtual tMemSize getMemorySize() const {
61  return sizeof(*this)+getContentsMemorySize();
62  }
63 
72  virtual tMemSize getContentsMemorySize() const {
73  tMemSize mem=SM_Object::getContentsMemorySize();
74  return mem;
75  }
76 
77  //SET & GET methods
78 
79 
80 public:
81 
93  inline static void RegisterParticle(const tIndex& indexParticle,
94  const std::array<tReal,SM_Constants::DIM>& P,
95  const std::map<tIndex,tIndex>& neighboringParticlesOrderedList,
96  tIndex& nParticles,
97  tIndex*& iParticles,
98  tReal*& iX,
99  tIndex*& iNeighborsNumberPerParticle,
100  tIndex& nNeighboringParticles,
101  tIndex*& iNeighboringParticlesList) {
102 
103  //register the index of particle
104  nParticles++;//number of particles in block
105  (*iParticles)=indexParticle;//grid index of particle + number of cells
106  iParticles++;
107 
108  //register the coordinate
109  for(const auto Pk:P) {
110  (*iX)=Pk;
111  iX++;
112  }
113 
114  // if (incW==1) {
115  // (*iWs)=w;
116  // iWs++;
117  // }
118 
119  //number of neighbors of the point
120  (*iNeighborsNumberPerParticle)=neighboringParticlesOrderedList.size();
121  //total number of neighboring points
122  nNeighboringParticles+=(*iNeighborsNumberPerParticle);
123  iNeighborsNumberPerParticle++;
124  //set the neighboring particles list of P
125  for(const auto& indexCell:neighboringParticlesOrderedList) {
126  (*iNeighboringParticlesList)=indexCell.second;
127  iNeighboringParticlesList++;
128  }
129  }
130 
131 
132 
140  virtual void getNetworkSliceMaxSizeOffset(const SM_CrystalStructure& cStructure,
141  const std::array<tInteger,SM_Constants::DIM>& Ns,
142  const std::array<tBoolean,SM_Constants::DIM>& periodicity,
143  std::valarray<tIndex>& sliceParticlesNumberOffset) const=0;
144 
145 
161  virtual void buildNetworkSliceSet(const tInteger& slicesNumber,
162  const tInteger& sliceIndex,
163  const std::array<tReal,SM_Constants::DIM>& X0,
164  const std::array<tInteger,SM_Constants::DIM>& Ns,
165  const std::array<tReal,SM_Constants::DIM>& Hs,
166  const std::array<tBoolean,SM_Constants::DIM>& periodicity,
167  const std::valarray<tMask>& mask,
168  tIndex& nParticles,
169  tIndex *particles,
170  tReal *X,
171  tIndex *neighborsNumberPerParticle,
172  tIndex& nNeighboringParticles,
173  tIndex *neighboringParticlesList) const=0;
174 
175 
176 
177 
185  virtual tIndex getNetworkGridMaxSize(const SM_CrystalStructure& cStructure,
186  const std::array<tInteger,SM_Constants::DIM>& Ns,
187  const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
188  const std::array<tInteger,SM_Constants::DIM>& gridSize,
189  const std::array<tInteger,SM_Constants::DIM>& gridIndex) const=0;
190 
191 
207  virtual void buildNetworkGridSet(const std::array<tInteger,SM_Constants::DIM>& gridsNumber,
208  const std::array<tInteger,SM_Constants::DIM>& gridIndex,
209  const std::array<tReal,SM_Constants::DIM>& X0,
210  const std::array<tInteger,SM_Constants::DIM>& Ns,
211  const std::array<tReal,SM_Constants::DIM>& Hs,
212  const std::array<tBoolean,SM_Constants::DIM>& periodicity,
213  const std::valarray<tMask>& mask,
214  tIndex& nParticles,
215  tIndex *particles,
216  tReal *X,
217  tIndex *neighborsNumberPerParticle,
218  tIndex& nNeighboringParticles,
219  tIndex *neighboringParticlesList) const=0;
220 
221 
222 };
223 
224 #endif
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278
This class decribe a crystal structure.
Definition: SM_CrystalStructure.h:30
This class is an interface class for method for building a grid of crystal structure.
Definition: SM_CrystalStructuresBuilder.h:17
virtual void buildNetworkGridSet(const std::array< tInteger, SM_Constants::DIM > &gridsNumber, const std::array< tInteger, SM_Constants::DIM > &gridIndex, const std::array< tReal, SM_Constants::DIM > &X0, const std::array< tInteger, SM_Constants::DIM > &Ns, const std::array< tReal, SM_Constants::DIM > &Hs, const std::array< tBoolean, SM_Constants::DIM > &periodicity, const std::valarray< tMask > &mask, tIndex &nParticles, tIndex *particles, tReal *X, tIndex *neighborsNumberPerParticle, tIndex &nNeighboringParticles, tIndex *neighboringParticlesList) const =0
build a network based on a nD paver grid decomposed in grid sets
static void RegisterParticle(const tIndex &indexParticle, const std::array< tReal, SM_Constants::DIM > &P, const std::map< tIndex, tIndex > &neighboringParticlesOrderedList, tIndex &nParticles, tIndex *&iParticles, tReal *&iX, tIndex *&iNeighborsNumberPerParticle, tIndex &nNeighboringParticles, tIndex *&iNeighboringParticlesList)
register particles in network list data
Definition: SM_CrystalStructuresBuilder.h:93
virtual void buildNetworkSliceSet(const tInteger &slicesNumber, const tInteger &sliceIndex, const std::array< tReal, SM_Constants::DIM > &X0, const std::array< tInteger, SM_Constants::DIM > &Ns, const std::array< tReal, SM_Constants::DIM > &Hs, const std::array< tBoolean, SM_Constants::DIM > &periodicity, const std::valarray< tMask > &mask, tIndex &nParticles, tIndex *particles, tReal *X, tIndex *neighborsNumberPerParticle, tIndex &nNeighboringParticles, tIndex *neighboringParticlesList) const =0
build a network based on a decomposed in slice sets
virtual ~SM_CrystalStructuresBuilder(void)
destroy the instance of the class
Definition: SM_CrystalStructuresBuilder.h:35
virtual void getNetworkSliceMaxSizeOffset(const SM_CrystalStructure &cStructure, const std::array< tInteger, SM_Constants::DIM > &Ns, const std::array< tBoolean, SM_Constants::DIM > &periodicity, std::valarray< tIndex > &sliceParticlesNumberOffset) const =0
get the max size of the network
virtual tIndex getNetworkGridMaxSize(const SM_CrystalStructure &cStructure, const std::array< tInteger, SM_Constants::DIM > &Ns, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const std::array< tInteger, SM_Constants::DIM > &gridSize, const std::array< tInteger, SM_Constants::DIM > &gridIndex) const =0
get the max size of the network
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_CrystalStructuresBuilder.h:60
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_CrystalStructuresBuilder.h:72
SM_CrystalStructuresBuilder(void)
create an instance class
Definition: SM_CrystalStructuresBuilder.h:27
This class is a base class for Stoch Microm package.
Definition: SM_Object.h:36