1 #ifndef SM_NetworkGridBuidler_H
2 #define SM_NetworkGridBuilder_H
5 #include "SM_NetworkBuilder.h"
8 #include "SM_Network.h"
11 #include "SM_CrystalStructure.h"
14 #include "functions_array.h"
33 static std::array<tUCInt,SM_Constants::HDIM> HYPERPLAN_MOVES_NUMBER;
35 static std::array<tUCInt,SM_Constants::DIM> SPACE_MOVES_NUMBER;
38 static tBoolean INIT_STATIC_ARRAYS;
59 if (!INIT_STATIC_ARRAYS) {
62 for(
auto& Mk:SPACE_MOVES_NUMBER) {
66 for(
auto& Mk:HYPERPLAN_MOVES_NUMBER) {
70 INIT_STATIC_ARRAYS=
true;
157 static tIndex
BuildBlock(
const std::array<tInteger,SM_Constants::DIM>& nCs,
158 const tInteger *iBlocksNumber,
159 const tInteger *iBlockIndex,
165 tReal *iBlockMinPoint,
166 tReal *iBlockMaxPoint);
178 const tInteger *iBlocksNumber,
179 const tInteger *iBlockIndex) {
187 for(
const auto& Nk:nCs) {
192 I0k/=(*iBlocksNumber);
197 I1k/=(*iBlocksNumber);
201 I1k=(I1k>Nk)?Nk:I1k ;
230 const tReal *iBlockMinPoint,
231 const tReal *iBlockMaxPoint,
238 tBoolean isPInBlock=
true;
239 for(
const auto& Ik:I) {
245 isPInBlock=isPInBlock && ((*iP)>=(*iBlockMinPoint)) && ((*iP)<(*iBlockMaxPoint));
271 const std::array<tDimension,SM_Constants::HDIM>& hyperplanBase,
272 const std::array<tInteger,SM_Constants::DIM>& faceElementIndices,
273 const std::array<tReal,SM_Constants::DIM>& blockMinPoint,
274 const std::array<tReal,SM_Constants::DIM>& blockMaxPoint,
275 std::array<tUCInt,SM_Constants::HDIM>& moveIndices,
276 const std::array<tReal,SM_Constants::DIM>& X0,
277 const std::array<tReal,SM_Constants::DIM>& H,
278 std::array<tReal,SM_Constants::DIM>& P);
299 for(
const auto& Ik:I) {
325 const std::array<tDimension,SM_Constants::HDIM>& hyperplanBase,
326 const std::array<tInteger,SM_Constants::DIM>& faceElementIndices,
327 std::array<tUCInt,SM_Constants::HDIM>& movesIndices,
328 const std::array<tReal,SM_Constants::DIM>& X0,
329 const std::array<tReal,SM_Constants::DIM>& H,
330 std::array<tReal,SM_Constants::DIM>& P);
346 static void GetCellVertices(
const std::array<tInteger,SM_Constants::DIM>& cellIndices,
347 const std::array<tInteger,SM_Constants::DIM>& nPs,
348 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
349 std::array<tUCInt,SM_Constants::DIM>& moveIndices,
350 std::array<tInteger,SM_Constants::DIM>& vertexIndices,
351 std::map<tIndex,tIndex>& vertices);
364 const std::array<tDimension,SM_Constants::HDIM>& hyperplanBase,
365 const std::array<tInteger,SM_Constants::DIM> faceElementIndices,
366 const std::array<tInteger,SM_Constants::DIM>& nPs,
367 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
368 std::array<tUCInt,SM_Constants::HDIM>& moveIndices,
369 std::array<tInteger,SM_Constants::DIM>& vertexIndices,
371 std::map<tIndex,tIndex>& vertices);
385 const std::array<tDimension,SM_Constants::HDIM>& hyperplanBase,
386 const tInteger* iFaceElementIndices,
387 const std::array<tInteger,SM_Constants::DIM>& nCs,
388 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
389 const tBoolean& incMask,
const tMask* vMask,
390 std::array<tInteger,SM_Constants::DIM>& connectedCellIndices);
406 const std::array<tInteger,SM_Constants::DIM>& Ns,
407 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
408 const tBoolean& incMask,
const tMask* vMask,
409 std::array<tUCInt,SM_Constants::DIM>& moveIndices,
410 std::array<tInteger,SM_Constants::DIM>& connectedCellIndices,
411 std::map<tIndex,tIndex>& connectedCells);
425 const std::array<tDimension,SM_Constants::HDIM>& hyperplanBase,
426 const tInteger* iFaceElementIndices,
427 const std::array<tInteger,SM_Constants::DIM>& nCs,
428 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
429 const tBoolean& incMask,
const tMask* vMask,
430 std::array<tInteger,SM_Constants::DIM>& connectedCellIndices,
431 std::map<tIndex,tIndex>& connectedCells);
450 const std::array<tDimension,SM_Constants::HDIM>& hyperplanBase,
451 const std::array<tInteger,SM_Constants::DIM>& facesElementsNumber,
452 const std::array<tInteger,SM_Constants::DIM>& nCs,
453 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
454 const tBoolean& incMask,
const tMask* vMask,
455 std::array<tUCInt,SM_Constants::HDIM>& moveIndices,
456 std::array<tInteger,SM_Constants::DIM>& cellIndices,
458 std::array<tInteger,SM_Constants::DIM>& faceElementIndices,
459 std::map<tIndex,tIndex>& connectedFaces);
477 const std::array<tDimension,SM_Constants::HDIM>& pHyperplanBase,
478 const tInteger* iFaceElementIndices,
480 const std::array<tDimension,SM_Constants::HDIM>& qHyperplanBase,
481 const std::array<tInteger,SM_Constants::DIM>& qFacesElementsNumber,
482 const std::array<tInteger,SM_Constants::DIM>& nCs,
483 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
484 const tBoolean& incMask,
const tMask* vMask,
485 std::array<tInteger,SM_Constants::DIM>& connectedCellIndices,
487 std::array<tInteger,SM_Constants::DIM>& connectedFaceIndices,
488 std::map<tIndex,tIndex>& connectedFaces);
506 const std::array<tInteger,SM_Constants::DIM>& nPs,
507 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
508 const std::valarray<tMask>& mask,
509 tReal *iVerticesWeight,
510 tUCInt *iConnectedCellsNumber,
511 tIndex *iConnectedCells);
525 const std::array<tDimension,SM_Constants::HDIM>& hyperplanBase,
526 const std::array<tInteger,SM_Constants::DIM>& nCs,
527 const std::array<tInteger,SM_Constants::DIM>& nPs,
528 const std::array<tBoolean,SM_Constants::DIM>& isPeriodic,
529 const std::valarray<tMask>& mask,
531 tUCInt *iConnectedCellsNumber,
532 tIndex *iConnectedCells);
541 static void BuildCellsWeight(
const std::array<tInteger,SM_Constants::DIM>& nCs,
542 const std::valarray<tMask>& mask,
544 tUCInt *iConnectedCellsNumber,
545 tIndex *iConnectedCells);
555 const std::valarray<tReal>& elementsWeight,
556 const std::valarray<tUCInt>& elementsConnectedCellsNumber,
557 const std::valarray<tIndex>& elementsConnectedCells,
558 std::valarray<tReal>& cellsParticlesNumber);
567 const std::valarray<tUCInt>& elementsConnectedCellsNumber,
568 const std::valarray<tIndex>& elementsConnectedCells,
569 const std::valarray<tReal>& cellsParticlesNumber,
570 std::valarray<tReal>& elementsVolume);
This class is dedicated to build a network.
Definition: SM_NetworkBuilder.h:28
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_NetworkBuilder.h:86
This class build a network from unit cells defined on grid.
Definition: SM_NetworkGridBuilder.h:21
static void BuildCellsParticlesNumber(const std::array< tInteger, SM_Constants::DIM > Ns, const std::valarray< tReal > &elementsWeight, const std::valarray< tUCInt > &elementsConnectedCellsNumber, const std::valarray< tIndex > &elementsConnectedCells, std::valarray< tReal > &cellsParticlesNumber)
build the number of particles within each cell
Definition: SM_NetworkGridBuilder.cpp:997
static tIndex GetCellsNumberInBlock(const std::array< tInteger, SM_Constants::DIM > &nCs, const tInteger *iBlocksNumber, const tInteger *iBlockIndex)
buid a block within a grid domain
Definition: SM_NetworkGridBuilder.h:177
static void GetConnectedDomainCellsToFace(const tDimension &d, const std::array< tDimension, SM_Constants::HDIM > &hyperplanBase, const tInteger *iFaceElementIndices, const std::array< tInteger, SM_Constants::DIM > &nCs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const tBoolean &incMask, const tMask *vMask, std::array< tInteger, SM_Constants::DIM > &connectedCellIndices, std::map< tIndex, tIndex > &connectedCells)
get the cells in domain and connected to face
Definition: SM_NetworkGridBuilder.cpp:508
static void GetCenterFacePoint(const tDimension &d, const std::array< tDimension, SM_Constants::HDIM > &hyperplanBase, const std::array< tInteger, SM_Constants::DIM > &faceElementIndices, std::array< tUCInt, SM_Constants::HDIM > &movesIndices, const std::array< tReal, SM_Constants::DIM > &X0, const std::array< tReal, SM_Constants::DIM > &H, std::array< tReal, SM_Constants::DIM > &P)
get the point located at center of element of d-surface whith faceElementIndices
Definition: SM_NetworkGridBuilder.cpp:90
static void BuildVerticesWeight(const std::array< tInteger, SM_Constants::DIM > &nCs, const std::array< tInteger, SM_Constants::DIM > &nPs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const std::valarray< tMask > &mask, tReal *iVerticesWeight, tUCInt *iConnectedCellsNumber, tIndex *iConnectedCells)
build the weight of vertex
Definition: SM_NetworkGridBuilder.cpp:839
static void GetConnectedDomainCellsToVertex(const std::array< tInteger, SM_Constants::DIM > &vertexIndices, const std::array< tInteger, SM_Constants::DIM > &Ns, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const tBoolean &incMask, const tMask *vMask, std::array< tUCInt, SM_Constants::DIM > &moveIndices, std::array< tInteger, SM_Constants::DIM > &connectedCellIndices, std::map< tIndex, tIndex > &connectedCells)
get the cells in domain and connected to vertex
Definition: SM_NetworkGridBuilder.cpp:425
static tBoolean GetCenterFacePointInBlock(const tDimension &d, const std::array< tDimension, SM_Constants::HDIM > &hyperplanBase, const std::array< tInteger, SM_Constants::DIM > &faceElementIndices, const std::array< tReal, SM_Constants::DIM > &blockMinPoint, const std::array< tReal, SM_Constants::DIM > &blockMaxPoint, std::array< tUCInt, SM_Constants::HDIM > &moveIndices, const std::array< tReal, SM_Constants::DIM > &X0, const std::array< tReal, SM_Constants::DIM > &H, std::array< tReal, SM_Constants::DIM > &P)
return true if the point at center of face of the d-surface is in [blockMinPoint,blockMaxPoint[
Definition: SM_NetworkGridBuilder.cpp:150
static tBoolean IsPointInBlock(std::array< tInteger, SM_Constants::DIM > &I, const tReal *iBlockMinPoint, const tReal *iBlockMaxPoint, const tReal *iX0, const tReal *iHs, tReal *iP)
return true if the point P=X0+(I+0.5R).Hs is in [blockMinPoint,blockMaxPoint[
Definition: SM_NetworkGridBuilder.h:229
static void GetCellVertices(const std::array< tInteger, SM_Constants::DIM > &cellIndices, const std::array< tInteger, SM_Constants::DIM > &nPs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, std::array< tUCInt, SM_Constants::DIM > &moveIndices, std::array< tInteger, SM_Constants::DIM > &vertexIndices, std::map< tIndex, tIndex > &vertices)
get the vertices at summit of cells
Definition: SM_NetworkGridBuilder.cpp:225
virtual ~SM_NetworkGridBuilder(void)
destroy
Definition: SM_NetworkGridBuilder.h:78
virtual tMemSize getMemorySize() const
return the memory size of the class and the memory size of all its attributes/associations
Definition: SM_NetworkGridBuilder.h:105
static tIndex BuildBlock(const std::array< tInteger, SM_Constants::DIM > &nCs, const tInteger *iBlocksNumber, const tInteger *iBlockIndex, const tReal &margin, const tReal *iX0, const tReal *iHs, tInteger *iI0, tInteger *iI1, tReal *iBlockMinPoint, tReal *iBlockMaxPoint)
buid a block within a grid domain
Definition: SM_NetworkGridBuilder.cpp:21
static void GetConnectedDomainFacesToFace(const tDimension &p, const std::array< tDimension, SM_Constants::HDIM > &pHyperplanBase, const tInteger *iFaceElementIndices, const tDimension &q, const std::array< tDimension, SM_Constants::HDIM > &qHyperplanBase, const std::array< tInteger, SM_Constants::DIM > &qFacesElementsNumber, const std::array< tInteger, SM_Constants::DIM > &nCs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const tBoolean &incMask, const tMask *vMask, std::array< tInteger, SM_Constants::DIM > &connectedCellIndices, tIndex &cellIndex, std::array< tInteger, SM_Constants::DIM > &connectedFaceIndices, std::map< tIndex, tIndex > &connectedFaces)
get the faces in q-surfaces domain and connected to face in p-surface
Definition: SM_NetworkGridBuilder.cpp:703
static void BuildFacesWeight(const tDimension &d, const std::array< tDimension, SM_Constants::HDIM > &hyperplanBase, const std::array< tInteger, SM_Constants::DIM > &nCs, const std::array< tInteger, SM_Constants::DIM > &nPs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const std::valarray< tMask > &mask, tReal *iFacesWeight, tUCInt *iConnectedCellsNumber, tIndex *iConnectedCells)
build the weight of vertex at center of faces
Definition: SM_NetworkGridBuilder.cpp:891
static void GetFaceVertices(const tDimension &d, const std::array< tDimension, SM_Constants::HDIM > &hyperplanBase, const std::array< tInteger, SM_Constants::DIM > faceElementIndices, const std::array< tInteger, SM_Constants::DIM > &nPs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, std::array< tUCInt, SM_Constants::HDIM > &moveIndices, std::array< tInteger, SM_Constants::DIM > &vertexIndices, tIndex &vertexIndex, std::map< tIndex, tIndex > &vertices)
get the vertices at summit of face
Definition: SM_NetworkGridBuilder.cpp:289
SM_NetworkGridBuilder(void)
create a network class
Definition: SM_NetworkGridBuilder.h:55
static tBoolean IsFaceInDomain(const tDimension &d, const std::array< tDimension, SM_Constants::HDIM > &hyperplanBase, const tInteger *iFaceElementIndices, const std::array< tInteger, SM_Constants::DIM > &nCs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const tBoolean &incMask, const tMask *vMask, std::array< tInteger, SM_Constants::DIM > &connectedCellIndices)
return true if the face is in domain
Definition: SM_NetworkGridBuilder.cpp:361
static void GetConnectedDomainFacesToVertex(const std::array< tInteger, SM_Constants::DIM > &vertexIndices, const tDimension &d, const std::array< tDimension, SM_Constants::HDIM > &hyperplanBase, const std::array< tInteger, SM_Constants::DIM > &facesElementsNumber, const std::array< tInteger, SM_Constants::DIM > &nCs, const std::array< tBoolean, SM_Constants::DIM > &isPeriodic, const tBoolean &incMask, const tMask *vMask, std::array< tUCInt, SM_Constants::HDIM > &moveIndices, std::array< tInteger, SM_Constants::DIM > &cellIndices, tIndex &index, std::array< tInteger, SM_Constants::DIM > &faceElementIndices, std::map< tIndex, tIndex > &connectedFaces)
get the faces in domain and connected to vertex
Definition: SM_NetworkGridBuilder.cpp:580
static tUCInt N_HYPERPLAN_MOVES
number of moves per hyperplan
Definition: SM_NetworkGridBuilder.h:43
static tUCInt N_SPACE_MOVES
number of moves in space
Definition: SM_NetworkGridBuilder.h:46
static void GetPointWithIndices(std::array< tInteger, SM_Constants::DIM > &I, const tReal *iX0, const tReal *iHs, tReal *iP)
get the point with indices within the cell of indices I with relative position R in {0,...
Definition: SM_NetworkGridBuilder.h:293
static void BuildCellsWeight(const std::array< tInteger, SM_Constants::DIM > &nCs, const std::valarray< tMask > &mask, tReal *iCellsWeight, tUCInt *iConnectedCellsNumber, tIndex *iConnectedCells)
build the weight of vertex at center of cells
Definition: SM_NetworkGridBuilder.cpp:947
virtual tMemSize getContentsMemorySize() const
return the memory size of the included associations
Definition: SM_NetworkGridBuilder.h:117
static void BuildElementsVolume(const std::valarray< tReal > &elementsWeight, const std::valarray< tUCInt > &elementsConnectedCellsNumber, const std::valarray< tIndex > &elementsConnectedCells, const std::valarray< tReal > &cellsParticlesNumber, std::valarray< tReal > &elementsVolume)
build the volume of each element
Definition: SM_NetworkGridBuilder.cpp:1038