Dendro  5.01
Dendro in Greek language means tree. The Dendro library is a large scale (262K cores on ORNL's Titan) distributed memory adaptive octree framework. The main goal of Dendro is to perform large scale multiphysics simulations efficeiently in mordern supercomputers. Dendro consists of efficient parallel data structures and algorithms to perform variational ( finite element) methods and finite difference mthods on 2:1 balanced arbitary adaptive octrees which enables the users to perform simulations raning from black holes (binary black hole mergers) to blood flow in human body, where applications ranging from relativity, astrophysics to biomedical engineering.
mesh.h
1 //
2 // Created by milinda on 9/2/16.
3 
19 //
20 
21 #ifndef SFCSORTBENCH_MESH_H
22 #define SFCSORTBENCH_MESH_H
23 
24 #include <vector>
25 #include "mpi.h"
26 #include "octUtils.h"
27 #include "treenode2vtk.h"
28 #include "TreeNode.h"
29 #include "sfcSort.h"
30 #include "sfcSearch.h"
31 #include "testUtils.h"
32 
33 #include <memory>
34 #include <fdCoefficient.h>
35 #include "refel.h"
36 #include "block.h"
37 #include "stencil.h"
38 #include "key.h"
39 #include "skey.h"
40 #include "node.h"
41 #include "dendro.h"
42 #include "asyncExchangeContex.h"
43 
44 #include "wavelet.h"
45 #include "dendroProfileParams.h" // only need to profile unzip_asyn for bssn. remove this header file later.
46 
47 extern double t_e2e; // e2e map generation time
48 extern double t_e2n; // e2n map generation time
49 extern double t_sm; // sm map generation time
50 extern double t_blk;
51 
52 extern double t_e2e_g[3];
53 extern double t_e2n_g[3];
54 extern double t_sm_g[3];
55 extern double t_blk_g[3];
56 
57 #include "dendroProfileParams.h"
58 
75 enum KeyType
76 {
77  NONE,
78  SPLITTER,
79  UP,
80  DOWN,
81  FRONT,
82  BACK,
83  LEFT,
84  RIGHT
85 };
86 
93 enum NeighbourLevel
94 {
95  COARSE,
96  SAME,
97  REFINE
98 };
99 
100 //#define DEBUG_MESH_GENERATION
101 
102 #define KS_MAX 31 // maximum number of points in any direction that wavelet DA supports.
103 #define KEY_DIR_OFFSET 7
104 #define CHAINED_GHOST_OFFSET 5u
105 
106 #define OCT_NO_CHANGE 0u
107 #define OCT_SPLIT 1u
108 #define OCT_COARSE 2u
109 
110 namespace ot
111 {
112 
115 {
116  FDM = 0, // Finite Difference Method
117  FEM_CG, // Continous Galerkin methods
118  FEM_DG, // Discontinous Galerkin methods
119  E2E_ONLY // only builds the e2e maps.
120 };
121 
122 enum EType
123 {
124  INDEPENDENT, // all the elemental nodal values, are local.
125  W_DEPENDENT, // element is writable but has ghost nodal values as well. (note that the writable would be Independent U W_dependent)
126  UNKWON
127 };
128 
129 namespace WaveletDA
130 {
131 enum LoopType
132 {
133  ALL,
134  INDEPENDENT,
135  DEPENDENT
136 };
137 }
138 
139 } // namespace ot
140 
141 namespace ot
142 {
144 struct NodeTuple
145 {
146 private:
148  unsigned int i;
150  unsigned int j;
152  unsigned int k;
154  unsigned int e;
155 
156 public:
157  NodeTuple(unsigned int xi, unsigned int yj, unsigned int zk, unsigned int owner)
158  {
159  i = xi;
160  j = yj;
161  k = zk;
162  e = owner;
163  }
164  inline unsigned int getX() const { return i; }
165  inline unsigned int getY() const { return j; }
166  inline unsigned int getZ() const { return k; }
167  inline unsigned int getLevel() const { return e; }
168 };
169 
170 } // namespace ot
171 
172 namespace ot
173 {
174 
179 class Mesh
180 {
181 
182 private:
184  std::vector<unsigned int> m_uiE2EMapping;
186  std::vector<unsigned int> m_uiE2NMapping_CG;
188  std::vector<unsigned int> m_uiE2NMapping_DG;
190  std::vector<unsigned int> m_uiCG2DG;
192  std::vector<unsigned int> m_uiDG2CG;
193 
195  std::vector<ot::TreeNode> m_uiLocalSplitterElements; // used to spit the keys to the correct nodes.
196 
198  ot::TreeNode *m_uiSplitterNodes;
199 
200  // Pre and Post ghost octants.
201 
203  std::vector<ot::TreeNode> m_uiPreGhostOctants;
205  std::vector<ot::TreeNode> m_uiPostGhostOctants;
206 
207  // Keys Related attributes
209  std::vector<Key> m_uiKeys;
210 
212  std::vector<Key> m_uiGhostKeys;
213 
215  std::vector<Key> m_uiKeysDiag;
216 
218  std::vector<ot::TreeNode> m_uiEmbeddedOctree;
219 
221  std::vector<ot::TreeNode> m_uiGhostOctants;
222 
229  std::vector<unsigned int> m_uiGhostElementRound1Index;
230 
232  std::vector<ot::TreeNode> m_uiAllElements;
234  std::vector<ot::TreeNode> m_uiAllLocalNode;
235 
237  std::vector<ot::Block> m_uiLocalBlockList;
238 
240  unsigned int m_uiDmin;
242  unsigned int m_uiDmax;
243 
245  unsigned int m_uiElementPreGhostBegin = 0; // Not mandatory to store this.
247  unsigned int m_uiElementPreGhostEnd;
249  unsigned int m_uiElementLocalBegin;
251  unsigned int m_uiElementLocalEnd;
253  unsigned int m_uiElementPostGhostBegin;
255  unsigned int m_uiElementPostGhostEnd;
257  unsigned int m_uiFElementPreGhostBegin;
259  unsigned int m_uiFElementPreGhostEnd;
261  unsigned int m_uiFElementLocalBegin;
263  unsigned int m_uiFElementLocalEnd;
265  unsigned int m_uiFElementPostGhostBegin;
267  unsigned int m_uiFElementPostGhostEnd;
268 
270  unsigned int m_uiMeshDomain_min;
272  unsigned int m_uiMeshDomain_max;
273 
275  unsigned int m_uiNumLocalElements;
277  unsigned int m_uiNumPreGhostElements;
279  unsigned int m_uiNumPostGhostElements;
280 
281  /*** Total number of actual elements in the mesh (preG+ local + postG ) */
282  unsigned int m_uiNumTotalElements;
283 
285  unsigned int m_uiNumActualNodes;
286 
288  DendroIntL m_uiUnZippedVecSz;
289 
291  unsigned int m_uiNumFakeNodes;
292 
294  unsigned int m_uiNodePreGhostBegin;
296  unsigned int m_uiNodePreGhostEnd;
298  unsigned int m_uiNodeLocalBegin;
300  unsigned int m_uiNodeLocalEnd;
302  unsigned int m_uiNodePostGhostBegin;
304  unsigned int m_uiNodePostGhostEnd;
305 
306  // Stuff for communication and synchronization ...
307  //-------------------------------------------------------------------------
308 
310  int m_uiActiveRank;
312  int m_uiActiveNpes;
313 
315  MPI_Comm m_uiCommActive;
316 
318  MPI_Comm m_uiCommGlobal;
319 
321  int m_uiGlobalRank;
323  int m_uiGlobalNpes;
324 
326  bool m_uiIsActive;
327 
329  unsigned int *m_uiSendKeyCount;
331  unsigned int *m_uiRecvKeyCount;
333  unsigned int *m_uiSendKeyOffset;
335  unsigned int *m_uiRecvKeyOffset;
336 
338  unsigned int *m_uiSendKeyDiagCount;
340  unsigned int *m_uiRecvKeyDiagCount;
342  unsigned int *m_uiSendKeyDiagOffset;
344  unsigned int *m_uiRecvKeyDiagOffset;
345 
348  unsigned int *m_uiSendOctCountRound1;
350  unsigned int *m_uiRecvOctCountRound1;
352  unsigned int *m_uiSendOctOffsetRound1;
354  unsigned int *m_uiRecvOctOffsetRound1;
355 
356  unsigned int *m_uiSendOctCountRound1Diag;
358  unsigned int *m_uiRecvOctCountRound1Diag;
360  unsigned int *m_uiSendOctOffsetRound1Diag;
362  unsigned int *m_uiRecvOctOffsetRound1Diag;
363 
366  unsigned int *m_uiSendOctCountRound2;
368  unsigned int *m_uiRecvOctCountRound2;
370  unsigned int *m_uiSendOctOffsetRound2;
372  unsigned int *m_uiRecvOctOffsetRound2;
373 
375  std::vector<unsigned int> m_uiSendNodeCount;
377  std::vector<unsigned int> m_uiRecvNodeCount;
379  std::vector<unsigned int> m_uiSendNodeOffset;
381  std::vector<unsigned int> m_uiRecvNodeOffset;
382 
384  std::vector<unsigned int> m_uiSendProcList;
385 
387  std::vector<unsigned int> m_uiRecvProcList;
388 
390  std::vector<unsigned int> m_uiGhostElementIDsToBeSent;
392  std::vector<unsigned int> m_uiGhostElementIDsToBeRecv;
393 
395  std::vector<unsigned int> m_uiPreGhostHangingNodeCGID;
396 
398  std::vector<unsigned int> m_uiPostGhostHangingNodeCGID;
399 
401  std::vector<ot::TreeNode> m_uiSendBufferElement;
402 
404  std::vector<double> m_uiSendBufferNodes;
406  std::vector<double> m_uiRecvBufferNodes;
407 
412  std::vector<unsigned int> m_uiScatterMapElementRound1;
413 
415  std::vector<unsigned int> m_uiScatterMapActualNodeSend;
416 
418  std::vector<unsigned int> m_uiScatterMapActualNodeRecv;
419 
420  // variables to manage loop access over elements.
422  unsigned int m_uiEL_i;
423 
425  unsigned int m_uiElementOrder;
426 
428  unsigned int m_uiNpE;
429 
431  unsigned int m_uiStensilSz;
432 
434  unsigned int m_uiNumDirections;
435 
437  RefElement m_uiRefEl;
438 
440  std::vector<unsigned int> m_uiFEMGhostLev1IDs;
441 
442  //===== maps needed for DG computations.
443 
445  std::vector<unsigned int> m_uiF2EMap;
446 
448  bool m_uiIsBlockSetup;
449 
451  SM_TYPE m_uiScatterMapType;
452 
454  bool m_uiIsF2ESetup;
455 
457  std::vector<AsyncExchangeContex> m_uiMPIContexts;
458 
460  unsigned int m_uiCommTag=0;
461 
463  std::vector<bool> m_uiIsNodalMapValid;
464 
465  // --
466  //Note : These are special data stored to search the 3rd point in Dendro-GR unzip with 4th order.
467  //
468 
470  std::vector<ot::Key> m_uiUnzip_3pt_keys;
471 
472  std::vector<ot::Key> m_uiUnzip_3pt_ele;
473 
474  std::vector<ot::Key> m_uiUnzip_3pt_recv_keys;
475 
477  std::vector<unsigned int> m_uiSendCountRePt;
478 
480  std::vector<unsigned int> m_uiSendOffsetRePt;
481 
483  std::vector<unsigned int> m_uiRecvCountRePt;
484 
486  std::vector<unsigned int> m_uiRecvOffsetRePt;
487 
489  std::vector<unsigned int> m_uiReqSendProcList;
490 
492  std::vector<unsigned int> m_uiReqRecvProcList;
493 
495  std::vector<unsigned int> m_uiSendNodeReqPtSM;
496 
497 
498 private:
500  void buildFEM_E2N();
501 
507  void generateSearchKeys();
508 
514  void generateGhostElementSearchKeys();
515 
520  void generateBdyElementDiagonalSearchKeys();
521 
529  void buildE2EMap(std::vector<ot::TreeNode> &in, MPI_Comm comm);
530 
531  void computeElementOwnerRanks(std::vector<unsigned int> &elementOwner);
532 
539  void buildE2EMap(std::vector<ot::TreeNode> &in);
540 
549  void buildE2NMap();
550 
557  void shrinkE2EAndE2N();
558 
566  void generateFakeElementsAndUpdateE2EAndE2N();
567 
579  inline bool computeOveralppingNodes(const ot::TreeNode &parent, const ot::TreeNode &child, int *idx, int *idy, int *idz);
580 
590  void computeNodeScatterMaps(MPI_Comm comm);
591 
596  void computeNodalScatterMap(MPI_Comm comm);
597 
603  void computeNodalScatterMap1(MPI_Comm comm);
604 
610  void computeNodalScatterMap2(MPI_Comm comm);
611 
617  void computeNodalScatterMap3(MPI_Comm comm);
618 
624  void computeNodalScatterMap4(MPI_Comm comm);
625 
630  /*
631  * NOTE: These private functions does not check for m_uiIsActive
632  * sicne they are called in buildE2E and buildE2N mappings.
633  *
634  * */
635 
644  inline void OCT_DIR_LEFT_INTERNAL_EDGE_MAP(unsigned int child, unsigned int parent, bool parentChildLevEqual, std::vector<unsigned int> &edgeChildIndex, std::vector<unsigned int> &edgeOwnerIndex);
653  inline void OCT_DIR_RIGHT_INTERNAL_EDGE_MAP(unsigned int child, unsigned int parent, bool parentChildLevEqual, std::vector<unsigned int> &edgeChildIndex, std::vector<unsigned int> &edgeOwnerIndex);
662  inline void OCT_DIR_DOWN_INTERNAL_EDGE_MAP(unsigned int child, unsigned int parent, bool parentChildLevEqual, std::vector<unsigned int> &edgeChildIndex, std::vector<unsigned int> &edgeOwnerIndex);
671  inline void OCT_DIR_UP_INTERNAL_EDGE_MAP(unsigned int child, unsigned int parent, bool parentChildLevEqual, std::vector<unsigned int> &edgeChildIndex, std::vector<unsigned int> &edgeOwnerIndex);
680  inline void OCT_DIR_FRONT_INTERNAL_EDGE_MAP(unsigned int child, unsigned int parent, bool parentChildLevEqual, std::vector<unsigned int> &edgeChildIndex, std::vector<unsigned int> &edgeOwnerIndex);
689  inline void OCT_DIR_BACK_INTERNAL_EDGE_MAP(unsigned int child, unsigned int parent, bool parentChildLevEqual, std::vector<unsigned int> &edgeChildIndex, std::vector<unsigned int> &edgeOwnerIndex);
690 
699  void SET_FACE_TO_ELEMENT_MAP(unsigned int ele, unsigned int dir, unsigned int dirOp, unsigned int dir1, unsigned int dir2);
700 
705  inline void CORNER_NODE_MAP(unsigned int child);
706 
710  inline void OCT_DIR_DIAGONAL_E2E(unsigned int elementID, unsigned int face1, unsigned int face2, unsigned int &lookUp) const;
711 
720  template <typename pKey, typename pNode>
721  void searchKeys(std::vector<pKey> &pKeys, std::vector<pNode> &pNodes);
722 
726  inline unsigned int getDIROfANode(unsigned int ii_x, unsigned int jj_y, unsigned int kk_z);
727 
732  inline void directionToIJK(unsigned int direction, std::vector<unsigned int> &ii_x, std::vector<unsigned int> &jj_y, std::vector<unsigned int> &kk_z);
733 
748  template <typename T>
749  inline void interpUpWind(const double *upWind, const unsigned int element, const unsigned int lookup, T *vecLookUp, const unsigned int cnum, const T *parentInterpIn, T *parentInterpOut, const unsigned int padDir, const unsigned int padWidth, const T *zippedVec, T *out);
750 
765  template <typename T>
766  inline void interpDownWind(const double *downWind, const unsigned int element, const unsigned int lookup, T *vecLookUp, const unsigned int cnum, const T *parentInterpIn, T *parentInterpOut, const unsigned int padDir, const unsigned int padWidth, const T *zippedVec, T *out);
767 
773  template <typename T>
774  void blockDiagonalUnZip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
775 
781  template <typename T>
782  void blockVertexUnZip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
783 
789  template <typename T>
790  void OCT_DIR_LEFT_DOWN_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
791 
797  template <typename T>
798  void OCT_DIR_LEFT_UP_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
799 
805  template <typename T>
806  void OCT_DIR_LEFT_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
807 
813  template <typename T>
814  void OCT_DIR_LEFT_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
815 
821  template <typename T>
822  void OCT_DIR_RIGHT_DOWN_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
823 
829  template <typename T>
830  void OCT_DIR_RIGHT_UP_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
831 
837  template <typename T>
838  void OCT_DIR_RIGHT_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
839 
845  template <typename T>
846  void OCT_DIR_RIGHT_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
847 
853  template <typename T>
854  void OCT_DIR_UP_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
855 
861  template <typename T>
862  void OCT_DIR_UP_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
863 
869  template <typename T>
870  void OCT_DIR_DOWN_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
871 
877  template <typename T>
878  void OCT_DIR_DOWN_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
879 
885  template <typename T>
886  void OCT_DIR_LEFT_DOWN_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
887 
893  template <typename T>
894  void OCT_DIR_RIGHT_DOWN_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
895 
901  template <typename T>
902  void OCT_DIR_LEFT_UP_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
903 
909  template <typename T>
910  void OCT_DIR_RIGHT_UP_BACK_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
911 
917  template <typename T>
918  void OCT_DIR_LEFT_DOWN_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
919 
925  template <typename T>
926  void OCT_DIR_RIGHT_DOWN_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
927 
933  template <typename T>
934  void OCT_DIR_LEFT_UP_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
935 
941  template <typename T>
942  void OCT_DIR_RIGHT_UP_FRONT_Unzip(const ot::Block &blk, const T *zippedVec, T *unzippedVec);
943 
944  //---Note: These functions are specifically written for find missing 3rd block unzip points for the GR application
945 
950  void computeSMSpecialPts();
951 
957  template <typename T>
958  void readSpecialPtsBegin(const T *in);
959 
960  template <typename T>
961  void readSpecialPtsEnd(const T *in, T* out);
962 
963  // --- 3rd point exchange function end.
964 
965 public:
973  Mesh(std::vector<ot::TreeNode> &in, unsigned int k_s, unsigned int pOrder, unsigned int activeNpes, MPI_Comm comm, bool pBlockSetup = true, SM_TYPE smType = SM_TYPE::FDM, unsigned int grainSz = DENDRO_DEFAULT_GRAIN_SZ, double ld_tol = DENDRO_DEFAULT_LB_TOL, unsigned int sf_k = DENDRO_DEFAULT_SF_K);
974 
984  Mesh(std::vector<ot::TreeNode> &in, unsigned int k_s, unsigned int pOrder, MPI_Comm comm, bool pBlockSetup = true, SM_TYPE smType = SM_TYPE::FDM, unsigned int grainSz = DENDRO_DEFAULT_GRAIN_SZ, double ld_tol = DENDRO_DEFAULT_LB_TOL, unsigned int sf_k = DENDRO_DEFAULT_SF_K);
985 
987  ~Mesh();
988 
993  void performBlocksSetup();
994 
999  void buildF2EMap();
1000 
1001  /*** @brief: perform block dependancy flags */
1002  void flagBlocks();
1003 
1005  inline bool isBlockSetep() { return m_uiIsBlockSetup; }
1006 
1008  inline SM_TYPE getScatterMapType() { return m_uiScatterMapType; }
1009 
1010  // Setters and getters.
1012  inline unsigned int getNumLocalMeshElements() const { return m_uiNumLocalElements; }
1014  inline unsigned int getNumPreGhostElements() const { return m_uiNumPreGhostElements; }
1016  inline unsigned int getNumPostGhostElements() const { return m_uiNumPostGhostElements; }
1017  // get nodal information.
1018 
1020  inline unsigned int getNumLocalMeshNodes() const { return (m_uiNodeLocalEnd - m_uiNodeLocalBegin); }
1022  inline unsigned int getNumPreMeshNodes() const { return (m_uiNodePreGhostEnd - m_uiNodePreGhostBegin); }
1024  inline unsigned int getNumPostMeshNodes() const { return (m_uiNodePostGhostEnd - m_uiNodePostGhostBegin); }
1026  inline unsigned int getElementPreGhostBegin() const { return m_uiElementPreGhostBegin; }
1028  inline unsigned int getElementPreGhostEnd() const { return m_uiElementPreGhostEnd; }
1030  inline unsigned int getElementLocalBegin() const { return m_uiElementLocalBegin; }
1032  inline unsigned int getElementLocalEnd() const { return m_uiElementLocalEnd; }
1034  inline unsigned int getElementPostGhostBegin() const { return m_uiElementPostGhostBegin; }
1036  inline unsigned int getElementPostGhostEnd() const { return m_uiElementPostGhostEnd; }
1037 
1039  inline unsigned int getNodePreGhostBegin() const { return m_uiNodePreGhostBegin; }
1041  inline unsigned int getNodePreGhostEnd() const { return m_uiNodePreGhostEnd; }
1043  inline unsigned int getNodeLocalBegin() const { return m_uiNodeLocalBegin; }
1045  inline unsigned int getNodeLocalEnd() const { return m_uiNodeLocalEnd; }
1047  inline unsigned int getNodePostGhostBegin() const { return m_uiNodePostGhostBegin; }
1049  inline unsigned int getNodePostGhostEnd() const { return m_uiNodePostGhostEnd; }
1050 
1052  inline unsigned int getDegOfFreedom() const { return m_uiNumActualNodes; }
1053 
1055  inline unsigned int getDegOfFreedomUnZip() const { return m_uiUnZippedVecSz; }
1056 
1058  inline const std::vector<ot::TreeNode> &getAllElements() const { return m_uiAllElements; }
1059 
1061  inline const std::vector<unsigned int> &getLevel1GhostElementIndices() const { return m_uiGhostElementRound1Index; }
1062 
1064  inline const std::vector<ot::TreeNode> &getSplitterElements() const { return m_uiLocalSplitterElements; }
1065 
1067  inline const std::vector<ot::TreeNode> &getAllLocalNodes() const { return m_uiAllLocalNode; }
1068 
1070  inline const std::vector<unsigned int> &getE2EMapping() const { return m_uiE2EMapping; }
1071 
1073  inline const std::vector<unsigned int> &getE2NMapping() const { return m_uiE2NMapping_CG; }
1074 
1076  inline const std::vector<unsigned int> &getDG2CGMap() const { return m_uiDG2CG; }
1077 
1079  inline const std::vector<unsigned int> &getCG2DGMap() const { return m_uiCG2DG; }
1080 
1082  inline const std::vector<unsigned int> &getE2NMapping_DG() const { return m_uiE2NMapping_DG; }
1084  inline const std::vector<ot::Block> &getLocalBlockList() const { return m_uiLocalBlockList; }
1085 
1087  inline unsigned int getNumDirections() const { return m_uiNumDirections; }
1088 
1090  inline unsigned int getNumNodesPerElement() const { return m_uiNpE; }
1091 
1093  inline unsigned int getElementOrder() const { return m_uiElementOrder; }
1094 
1096  inline MPI_Comm getMPICommunicator() const { return m_uiCommActive; }
1097 
1099  inline MPI_Comm getMPIGlobalCommunicator() const { return m_uiCommGlobal; }
1100 
1102  inline unsigned int getMPIRankGlobal() const { return m_uiGlobalRank; }
1103 
1105  inline unsigned int getMPICommSizeGlobal() const { return m_uiGlobalNpes; }
1106 
1108  inline unsigned int getMPIRank() const { return m_uiActiveRank; }
1109 
1111  inline unsigned int getMPICommSize() const { return m_uiActiveNpes; }
1112 
1114  inline const RefElement *getReferenceElement() const { return &m_uiRefEl; }
1115 
1117  inline const unsigned int getSendProcListSize() const { return m_uiSendProcList.size(); }
1118 
1120  inline const unsigned int getRecvProcListSize() const { return m_uiRecvProcList.size(); }
1121 
1123  inline const std::vector<unsigned int> &getNodalSendCounts() const { return m_uiSendNodeCount; }
1124 
1126  inline const std::vector<unsigned int> &getNodalSendOffsets() const { return m_uiSendNodeOffset; }
1127 
1129  inline const std::vector<unsigned int> &getNodalRecvCounts() const { return m_uiRecvNodeCount; }
1130 
1132  inline const std::vector<unsigned int> &getNodalRecvOffsets() const { return m_uiRecvNodeOffset; }
1133 
1135  inline const std::vector<unsigned int> &getSendProcList() const { return m_uiSendProcList; }
1136 
1138  inline const std::vector<unsigned int> &getRecvProcList() const { return m_uiRecvProcList; }
1139 
1141  inline const std::vector<unsigned int> &getSendNodeSM() const { return m_uiScatterMapActualNodeSend; }
1142 
1144  inline const std::vector<unsigned int> &getRecvNodeSM() const { return m_uiScatterMapActualNodeRecv; }
1145 
1147  inline void dg2eijk(unsigned int dg_index, unsigned int &e, unsigned int &i, unsigned int &j, unsigned int &k) const
1148  {
1149  e = dg_index / m_uiNpE;
1150  k = 0;
1151  j = 0;
1152  i = 0;
1153 
1154  //std::cout<<"e: "<<e<<std::endl;
1155  if (dg_index > e * m_uiNpE)
1156  k = (dg_index - e * m_uiNpE) / ((m_uiElementOrder + 1) * (m_uiElementOrder + 1));
1157  //std::cout<<"k: "<<k<<std::endl;
1158  if ((dg_index + k * ((m_uiElementOrder + 1) * (m_uiElementOrder + 1))) > (e * m_uiNpE))
1159  j = (dg_index - e * m_uiNpE - k * ((m_uiElementOrder + 1) * (m_uiElementOrder + 1))) / (m_uiElementOrder + 1);
1160  //std::cout<<"j: "<<j<<std::endl;
1161  if ((dg_index + k * ((m_uiElementOrder + 1) * (m_uiElementOrder + 1)) + j * (m_uiElementOrder + 1)) > (e * m_uiNpE))
1162  i = (dg_index - e * m_uiNpE - k * ((m_uiElementOrder + 1) * (m_uiElementOrder + 1)) - j * (m_uiElementOrder + 1));
1163  //std::cout<<"i: "<<i<<std::endl;
1164  }
1165 
1167  inline unsigned int getMortonchildNum(unsigned int eleID) const
1168  {
1169  return m_uiAllElements[eleID].getMortonIndex();
1170  }
1171 
1173  inline bool isActive() const { return m_uiIsActive; }
1174 
1176  inline void waitAll() const { MPI_Barrier(m_uiCommGlobal); }
1177 
1185  void setOctreeRefineFlags(unsigned int *flags, unsigned int sz);
1186 
1194  void getElementalFaceNeighbors(const unsigned int eID, const unsigned int dir, unsigned int *lookup) const;
1202  void getElementalEdgeNeighbors(const unsigned int eID, const unsigned int dir, unsigned int *lookup) const;
1209  void getElementalVertexNeighbors(const unsigned int eID, const unsigned int dir, unsigned int *lookup) const;
1210 
1217  void getElementQMat(unsigned int currentId, double *&qMat, bool isAllocated = true) const;
1218 
1219 
1230  template<typename T>
1231  void getUnzipElementalNodalValues(const T* uzipVec, unsigned int blkID, unsigned int ele, T*out, bool isPadded=true) const;
1232 
1233  // Wavelet Init functions
1237  template <ot::WaveletDA::LoopType type>
1238  void init();
1239 
1244  template <ot::WaveletDA::LoopType type>
1245  bool nextAvailable();
1246 
1251  template <ot::WaveletDA::LoopType type>
1252  void next();
1253 
1257  inline const ot::TreeNode &currentOctant();
1258 
1262  inline unsigned int currentIndex();
1263 
1268  inline void currentElementNeighbourIndexList(unsigned int *neighList);
1269 
1275  inline void currentElementNodeList(unsigned int *nodeList);
1276 
1282  inline void currentElementNodeList_DG(unsigned int *nodeList);
1283 
1284  // functions to access, faces and edges of a given element.
1285 
1294  inline void faceNodesIndex(unsigned int elementID, unsigned int face, std::vector<unsigned int> &index,
1295  bool isInternal) const;
1296 
1306  inline void edgeNodeIndex(unsigned int elementID, unsigned int face1, unsigned int face2, std::vector<unsigned int> &index, bool isInternal) const;
1307 
1315  inline void cornerNodeIndex(unsigned int elementID, unsigned int mortonIndex, unsigned int &index) const;
1316 
1326  inline void elementNodeIndex(unsigned int elementID, std::vector<unsigned int> &index, bool isInternal) const;
1327 
1333  bool isEdgeHanging(unsigned int elementId, unsigned int edgeId, unsigned int &cnum) const;
1334 
1340  bool isFaceHanging(unsigned int elementId, unsigned int faceId, unsigned int &cnum) const;
1341 
1349  bool isNodeHanging(unsigned int eleID, unsigned int ix, unsigned int jy, unsigned int kz) const;
1350 
1358  inline bool isNodeLocal(unsigned int eleID, unsigned int ix, unsigned int jy, unsigned int kz) const
1359  {
1360  return ((m_uiE2NMapping_CG[eleID * m_uiNpE + kz * (m_uiElementOrder + 1) * (m_uiElementOrder + 1) + jy * (m_uiElementOrder + 1) + ix] >= m_uiNodeLocalBegin) && (m_uiE2NMapping_CG[eleID * m_uiNpE + kz * (m_uiElementOrder + 1) * (m_uiElementOrder + 1) + jy * (m_uiElementOrder + 1) + ix] < m_uiNodeLocalEnd));
1361  };
1362 
1363  inline bool isBoundaryOctant(unsigned int ele) const
1364  {
1365  assert(ele < m_uiAllElements.size() );
1366  return (m_uiAllElements[ele].minX() ==0 || m_uiAllElements[ele].minY() ==0 || m_uiAllElements[ele].minZ()==0 || m_uiAllElements[ele].maxX() == 1u<<(m_uiMaxDepth) || m_uiAllElements[ele].maxY() == 1u<<(m_uiMaxDepth) || m_uiAllElements[ele].maxZ() == 1u<<(m_uiMaxDepth) );
1367  }
1368 
1369  inline DendroIntL getGhostExcgTotalSendNodeCount() const
1370  {
1371  if (m_uiGlobalNpes == 1)
1372  return 0;
1373 
1374  if (m_uiIsActive)
1375  return (m_uiSendNodeOffset[m_uiActiveNpes - 1] + m_uiSendNodeCount[m_uiActiveNpes - 1]);
1376  else
1377  return 0;
1378  }
1379 
1380  inline DendroIntL getGhostExcgTotalRecvNodeCount() const
1381  {
1382  if (m_uiGlobalNpes == 1)
1383  return 0;
1384 
1385  if (m_uiIsActive)
1386  return (m_uiRecvNodeOffset[m_uiActiveNpes - 1] + m_uiRecvNodeCount[m_uiActiveNpes - 1]);
1387  else
1388  return 0;
1389  }
1390 
1392  inline const ot::TreeNode *getNodalSplitterNodes() const { return m_uiSplitterNodes; }
1393 
1394  // Methods needed for PDE & ODE and other solvers.
1396  template <typename T>
1397  T *createVector() const;
1398 
1400  template <typename T>
1401  void createVector(std::vector<T> &vec) const;
1402 
1406  template <typename T>
1407  T *createVector(const T initValue) const;
1408 
1412  template <typename T>
1413  T *createVector(std::function<T(T, T, T)> func) const;
1414 
1419  template <typename T>
1420  void createVector(std::vector<T> &vec, const T initValue) const;
1421 
1427  template <typename T>
1428  void createVector(std::vector<T> &vec, std::function<T(T, T, T)> func) const;
1429 
1435  template <typename T>
1436  void createUnZippedVector(std::vector<T> &uvec) const;
1437 
1443  template <typename T>
1444  T *createUnZippedVector() const;
1445 
1450  template <typename T>
1451  void createUnZippedVector(std::vector<T> &uvec, const T initValue) const;
1452 
1457  template <typename T>
1458  T *createUnZippedVector(const T initValue) const;
1459 
1469  inline void parent2ChildInterpolation(const double *in, double *out, unsigned int cnum, unsigned int dim = 3) const;
1470 
1480  inline void child2ParentInterpolation(const double *in, double *out, unsigned int cnum, unsigned int dim = 3) const;
1481 
1489  inline void child2ParentInjection(double *in, double *out, bool *isHanging) const;
1490 
1498  template <typename T>
1499  void unzip(const T *zippedVec, T *unzippedVec);
1500 
1507  template <typename T>
1508  void unzip_async(T *zippedVec, T *unzippedVec, MPI_Request *send_reqs, MPI_Request *recv_reqs, MPI_Status *send_sts, MPI_Status *recv_sts);
1509 
1515  template <typename T>
1516  void zip(const T *unzippedVec, T *zippedVec);
1517 
1527  template <typename T, unsigned int length, unsigned int offsetCentered, unsigned int offsetBackward, unsigned int offsetForward>
1528  void applyStencil(const std::vector<T> &in, std::vector<T> &out,
1529  const Stencil<T, length, offsetCentered> &centered,
1530  const Stencil<T, length, offsetBackward> &backward,
1531  const Stencil<T, length, offsetForward> &forward);
1532 
1537  template <typename T>
1538  void performGhostExchange(std::vector<T> &vec);
1539 
1544  template <typename T>
1545  void performGhostExchange(T *vec);
1546 
1552  template <typename T>
1553  void ghostExchangeStart(T *vec, T *sendNodeBuffer, T *recvNodeBuffer, MPI_Request *send_reqs, MPI_Request *recv_reqs);
1554 
1561  template <typename T>
1562  void ghostExchangeRecvSync(T *vec, T *recvNodeBuffer, MPI_Request *recv_reqs, MPI_Status *recv_sts);
1563 
1570  inline void ghostExchangeSendSync(MPI_Request *send_reqs, MPI_Status *send_sts)
1571  {
1572  MPI_Waitall(m_uiSendProcList.size(), send_reqs, send_sts);
1573  }
1574 
1580  template <typename T>
1581  void vectorToVTK(const std::vector<T> &vec, char *fprefix, double pTime = 0.0, unsigned int nCycle = 0) const;
1582 
1594  template <typename T>
1595  bool isReMesh(const T **vec, const unsigned int *varIds, const unsigned int numVars, double tol, double amr_coarse_fac = DENDRO_AMR_COARSEN_FAC);
1596 
1607  template <typename T>
1608  bool isReMeshUnzip(const T **unzippedVec, const unsigned int *varIds, const unsigned int numVars, std::function<double(double, double, double)> wavelet_tol, double amr_coarse_fac = DENDRO_AMR_COARSEN_FAC, double coarsen_hx = DENDRO_REMESH_UNZIP_SCALE_FAC);
1609 
1619  ot::Mesh *ReMesh(unsigned int grainSz = DENDRO_DEFAULT_GRAIN_SZ, double ld_tol = DENDRO_DEFAULT_LB_TOL, unsigned int sfK = DENDRO_DEFAULT_SF_K,unsigned int (*getWeight)(const ot::TreeNode *)=NULL);
1620 
1627  template <typename T>
1628  void interGridTransfer(std::vector<T> &vec, const ot::Mesh *pMesh);
1629 
1636  template <typename T>
1637  void interGridTransfer(T *&vec, const ot::Mesh *pMesh);
1638 
1647  template<typename T>
1648  void interGridTransferUnzip(T*& unzip, T*& vec, const ot::Mesh *pMesh);
1649 
1657  template <typename T>
1658  void getElementNodalValues(const T *vec, T *nodalValues, unsigned int elementID) const;
1659 
1672  template <typename T>
1673  void computeElementalContribution(const T *in, T *out, unsigned int elementID) const;
1674 
1682  void getElementCoordinates(unsigned int eleID, double *coords) const;
1683 
1695  template <typename T>
1696  int getFaceNeighborValues(unsigned int eleID, const T *in, T *out, T *coords, unsigned int *neighID, unsigned int face, NeighbourLevel &level) const;
1697 
1700  EType getElementType(unsigned int eleID);
1701 
1712  int getBlkBdyParentNodeIndices(unsigned int blkId, unsigned int eleId, unsigned int dir, unsigned int* nid, unsigned int* child, unsigned int* fid, unsigned int* cid);
1713 
1714 };
1715 
1716 template <>
1717 inline void Mesh::init<WaveletDA::LoopType ::ALL>()
1718 {
1719  m_uiEL_i = m_uiElementPreGhostBegin;
1720 }
1721 
1722 template <>
1723 inline void Mesh::init<WaveletDA::INDEPENDENT>()
1724 {
1725  m_uiEL_i = m_uiElementLocalBegin;
1726 }
1727 
1728 template <>
1729 inline void Mesh::init<WaveletDA::DEPENDENT>()
1730 {
1731  m_uiEL_i = m_uiElementPreGhostBegin;
1732 }
1733 
1734 template <>
1735 inline bool Mesh::nextAvailable<WaveletDA::ALL>()
1736 {
1737  return (m_uiEL_i < m_uiElementPostGhostEnd);
1738 }
1739 
1740 template <>
1741 inline bool Mesh::nextAvailable<WaveletDA::INDEPENDENT>()
1742 {
1743  return (m_uiEL_i < m_uiElementLocalEnd);
1744 }
1745 template <>
1746 
1747 inline bool Mesh::nextAvailable<WaveletDA::DEPENDENT>()
1748 {
1749  return (m_uiEL_i < m_uiElementPreGhostEnd) || ((m_uiEL_i > m_uiElementLocalEnd) && m_uiEL_i < m_uiElementPostGhostEnd);
1750 }
1751 
1752 template <>
1753 inline void Mesh::next<WaveletDA::ALL>()
1754 {
1755  // interpolation should come here.
1756  m_uiEL_i++;
1757 }
1758 
1759 template <>
1760 inline void Mesh::next<WaveletDA::INDEPENDENT>()
1761 {
1762  // interpolation should come here.
1763  m_uiEL_i++;
1764 }
1765 
1766 template <>
1767 inline void Mesh::next<WaveletDA::DEPENDENT>()
1768 {
1769  // interpolation should come here.
1770  m_uiEL_i++;
1771  if (m_uiEL_i == m_uiElementPreGhostEnd)
1772  m_uiEL_i = m_uiElementPostGhostBegin;
1773 }
1774 
1776 {
1777  return m_uiAllElements[m_uiEL_i];
1778 }
1779 
1780 inline unsigned int Mesh::currentIndex() { return m_uiEL_i; }
1781 
1782 inline void Mesh::currentElementNeighbourIndexList(unsigned int *neighList)
1783 {
1784  if (!m_uiIsActive)
1785  return;
1786 
1787  for (unsigned int k = 0; k < m_uiNumDirections; k++)
1788  neighList[k] = m_uiE2EMapping[m_uiEL_i * m_uiNumDirections + k];
1789 }
1790 
1791 inline void Mesh::currentElementNodeList(unsigned int *nodeList)
1792 {
1793  if (!m_uiIsActive)
1794  return;
1795 
1796  for (unsigned int k = 0; k < m_uiNpE; k++)
1797  {
1798  nodeList[k] = m_uiE2NMapping_CG[m_uiEL_i * m_uiNpE + k];
1799  }
1800 }
1801 
1802 inline void Mesh::currentElementNodeList_DG(unsigned int *nodeList)
1803 {
1804  if (!m_uiIsActive)
1805  return;
1806 
1807  for (unsigned int k = 0; k < m_uiNpE; k++)
1808  {
1809  nodeList[k] = m_uiE2NMapping_DG[m_uiEL_i * m_uiNpE + k];
1810  }
1811 }
1812 
1813 inline void Mesh::parent2ChildInterpolation(const double *in, double *out, unsigned int cnum, unsigned int dim) const
1814 {
1815 
1816  dendro::timer::t_unzip_p2c.start();
1817  if (dim == 3)
1818  m_uiRefEl.I3D_Parent2Child(in, out, cnum);
1819  else if (dim == 2)
1820  m_uiRefEl.I2D_Parent2Child(in, out, cnum);
1821  else if (dim == 1)
1822  m_uiRefEl.I1D_Parent2Child(in, out, cnum);
1823  dendro::timer::t_unzip_p2c.stop();
1824 }
1825 
1826 inline void Mesh::child2ParentInterpolation(const double *in, double *out, unsigned int cnum, unsigned int dim) const
1827 {
1828 
1829  if (dim == 3)
1830  m_uiRefEl.I3D_Child2Parent(in, out, cnum);
1831  else if (dim == 2)
1832  m_uiRefEl.I2D_Child2Parent(in, out, cnum);
1833  else if (dim == 1)
1834  m_uiRefEl.I1D_Child2Parent(in, out, cnum);
1835 }
1836 
1837 inline void Mesh::child2ParentInjection(double *in, double *out, bool *isHanging) const
1838 {
1839 
1840  assert(m_uiElementOrder % 2 == 0 || m_uiElementOrder == 1);
1841  if (m_uiElementOrder == 1)
1842  { // special case
1843  for (unsigned int child = 0; child < NUM_CHILDREN; child++)
1844  {
1845  for (unsigned int k = 0; k < (m_uiElementOrder + 1); k++)
1846  for (unsigned int j = 0; j < (m_uiElementOrder + 1); j++)
1847  for (unsigned int i = 0; i < (m_uiElementOrder + 1); i++)
1848  out[k * (m_uiElementOrder + 1) * (m_uiElementOrder + 1) + j * (m_uiElementOrder + 1) + i] = in[child * m_uiNpE + k * (m_uiElementOrder + 1) + j * (m_uiElementOrder + 1) + i];
1849  }
1850  }
1851  else
1852  {
1853 
1854  for (unsigned int child = 0; child < NUM_CHILDREN; child++)
1855  {
1856 
1857  for (unsigned int k = 0; k < (m_uiElementOrder + 1); k++)
1858  for (unsigned int j = 0; j < (m_uiElementOrder + 1); j++)
1859  for (unsigned int i = 0; i < (m_uiElementOrder + 1); i++)
1860  {
1861  if ((i % 2 == 0) && (j % 2 == 0) && (k % 2 == 0) && isHanging[k * (m_uiElementOrder + 1) * (m_uiElementOrder + 1) + j * (m_uiElementOrder + 1) + i])
1862  {
1863  out[((((child & 4u) >> 2u) * m_uiElementOrder + k) >> 1) * (m_uiElementOrder + 1) * (m_uiElementOrder + 1) + ((((child & 2u) >> 1u) * m_uiElementOrder + j) >> 1) * (m_uiElementOrder + 1) + (((((child & (1u))) * m_uiElementOrder + i) >> 1))] = in[child * m_uiNpE + k * (m_uiElementOrder + 1) * (m_uiElementOrder + 1) + j * (m_uiElementOrder + 1) + i];
1864  //if(!m_uiActiveRank) std::cout<<"rank: "<<m_uiActiveRank<<" child: "<<child<<" i: "<<i<<" j: "<<j<<" k: "<<k<<" inserted to node : "<<((((child & 4u)>>2u)*m_uiElementOrder+k)>>1)*(m_uiElementOrder+1)*(m_uiElementOrder+1)+((((child & 2u)>>1u)*m_uiElementOrder+j)>>1)*(m_uiElementOrder+1)+(((((child & (1u)))*m_uiElementOrder+i)>>1))<<std::endl;
1865  }
1866  }
1867  }
1868  }
1869 }
1870 
1871 inline bool Mesh::computeOveralppingNodes(const ot::TreeNode &parent, const ot::TreeNode &child, int *idx, int *idy, int *idz)
1872 {
1873 
1874  unsigned int Lp = 1u << (m_uiMaxDepth - parent.getLevel());
1875  unsigned int Lc = 1u << (m_uiMaxDepth - child.getLevel());
1876  //intilize the mapping to -1. -1 denotes that mapping is not defined for given k value.
1877 
1878  unsigned int dp, dc;
1879  dp = (m_uiElementOrder);
1880  dc = m_uiElementOrder;
1881 
1882  assert(Lp % dp == 0);
1883  assert(Lc % dc == 0);
1884 
1885  for (unsigned int k = 0; k < (m_uiElementOrder + 1); k++)
1886  {
1887  idx[k] = -1;
1888  idy[k] = -1;
1889  idz[k] = -1;
1890  }
1891  bool state = false;
1892  bool stateX = false;
1893  bool stateY = false;
1894  bool stateZ = false;
1895  if (parent == child)
1896  {
1897  for (unsigned int k = 0; k < (m_uiElementOrder + 1); k++)
1898  {
1899  idx[k] = k;
1900  idy[k] = k;
1901  idz[k] = k;
1902  }
1903  return true;
1904  }
1905  else if (parent.isAncestor(child))
1906  {
1907 
1908  /*if((((child.getX()-parent.getX())*m_uiElementOrder)%Lp) || (((child.getY()-parent.getY())*m_uiElementOrder)%Lp) || (((child.getZ()-parent.getZ())*m_uiElementOrder)%Lp)) return false;
1909  else*/
1910  {
1911  unsigned int index[3];
1912  for (unsigned int k = 0; k < (m_uiElementOrder + 1); k++)
1913  {
1914 
1915  index[0] = (m_uiElementOrder + 1);
1916  index[1] = (m_uiElementOrder + 1);
1917  index[2] = (m_uiElementOrder + 1);
1918 
1919  if (!(((child.getX() - parent.getX()) * dp * dc + k * Lc * dp) % (Lp * dc)))
1920  index[0] = ((child.getX() - parent.getX()) * dp * dc + k * Lc * dp) / (Lp * dc); //((child.getX()-parent.getX())*m_uiElementOrder + k*Lc)/Lp;
1921 
1922  if (!(((child.getY() - parent.getY()) * dp * dc + k * Lc * dp) % (Lp * dc)))
1923  index[1] = ((child.getY() - parent.getY()) * dp * dc + k * Lc * dp) / (Lp * dc); //((child.getY()-parent.getY())*m_uiElementOrder + k*Lc)/Lp;
1924 
1925  if (!(((child.getZ() - parent.getZ()) * dp * dc + k * Lc * dp) % (Lp * dc)))
1926  index[2] = ((child.getZ() - parent.getZ()) * dp * dc + k * Lc * dp) / (Lp * dc); //((child.getZ()-parent.getZ())*m_uiElementOrder + k*Lc)/Lp;
1927 
1928  if (!stateX && index[0] < (m_uiElementOrder + 1))
1929  stateX = true;
1930 
1931  if (!stateY && index[1] < (m_uiElementOrder + 1))
1932  stateY = true;
1933 
1934  if (!stateZ && index[2] < (m_uiElementOrder + 1))
1935  stateZ = true;
1936 
1937  if (index[0] < (m_uiElementOrder + 1))
1938  {
1939  idx[k] = index[0];
1940  assert((parent.getX() + idx[k] * Lp / dp) == (child.getX() + k * Lc / dc));
1941  }
1942  if (index[1] < (m_uiElementOrder + 1))
1943  {
1944  idy[k] = index[1];
1945  assert((parent.getY() + idy[k] * Lp / dp) == (child.getY() + k * Lc / dc));
1946  }
1947  if (index[2] < (m_uiElementOrder + 1))
1948  {
1949  idz[k] = index[2];
1950  assert((parent.getZ() + idz[k] * Lp / dp) == (child.getZ() + k * Lc / dc));
1951  }
1952  }
1953  state = stateX & stateY & stateZ;
1954  return state;
1955  }
1956  }
1957  else
1958  {
1959  return false;
1960  }
1961 }
1962 
1963 } // namespace ot
1964 
1965 #include "mesh.tcc"
1966 #include "meshE2NUtils.tcc"
1967 
1968 #endif //SFCSORTBENCH_MESH_H
void currentElementNodeList(unsigned int *nodeList)
: Returns the node index list belongs to current element. NodeList size should be m_uiNpE; ...
Definition: mesh.h:1791
MPI_Comm getMPIGlobalCommunicator() const
returns the global communicator
Definition: mesh.h:1099
Simple class to manage async data transfer in the ODA class.
Definition: asyncExchangeContex.h:16
unsigned int getNodePreGhostEnd() const
return the end location of pre ghost nodes
Definition: mesh.h:1041
const std::vector< unsigned int > & getSendNodeSM() const
return Scatter map for node send
Definition: mesh.h:1141
bool isBlockSetep()
: returns if the block setup has performed or not
Definition: mesh.h:1005
unsigned int getNumPostMeshNodes() const
return the number of post ghost mesh nodes
Definition: mesh.h:1024
const std::vector< unsigned int > & getLevel1GhostElementIndices() const
returns the Level 1 ghost element indices.
Definition: mesh.h:1061
unsigned int getElementPreGhostEnd() const
return the end location of element pre ghost
Definition: mesh.h:1028
const std::vector< unsigned int > & getNodalSendCounts() const
returns the nodal send counts
Definition: mesh.h:1123
void child2ParentInjection(double *in, double *out, bool *isHanging) const
Performs child to parent injection.
Definition: mesh.h:1837
Definition: block.h:35
const std::vector< ot::TreeNode > & getSplitterElements() const
returns the splitter elements of the mesh local elements.
Definition: mesh.h:1064
A class to manage octants.
Definition: TreeNode.h:35
unsigned int getMortonchildNum(unsigned int eleID) const
returns the morton child number
Definition: mesh.h:1167
Definition: mesh.h:179
void currentElementNeighbourIndexList(unsigned int *neighList)
Returns the current neighbour list (Element) information. Note that for 3D it is 8 neighbours for eac...
Definition: mesh.h:1782
unsigned int getNumDirections() const
return the number of directions in the E2E mapping.
Definition: mesh.h:1087
const std::vector< unsigned int > & getE2NMapping_DG() const
Definition: mesh.h:1082
unsigned int getNodeLocalBegin() const
return the location of local node begin
Definition: mesh.h:1043
bool isNodeLocal(unsigned int eleID, unsigned int ix, unsigned int jy, unsigned int kz) const
: Returns true if the specified node (e,i,j,k) is local.
Definition: mesh.h:1358
unsigned int getMPICommSizeGlobal() const
returns the comm size w.r.t. global comm
Definition: mesh.h:1105
unsigned int getElementLocalBegin() const
return the begin location of element local
Definition: mesh.h:1030
const std::vector< unsigned int > & getNodalRecvOffsets() const
returns the nodal recv offsets
Definition: mesh.h:1132
const unsigned int getSendProcListSize() const
returns the send proc list size
Definition: mesh.h:1117
Definition: mesh.h:144
unsigned int getElementPostGhostEnd() const
return the end location of element post ghost
Definition: mesh.h:1036
void waitAll() const
waiting for all the mesh instances both active and inactive. This should not be called if not needed...
Definition: mesh.h:1176
unsigned int getNumPreGhostElements() const
Definition: mesh.h:1014
void currentElementNodeList_DG(unsigned int *nodeList)
Returns the node index list belogns to the currentl element in DG indexing. NodeList size should be m...
Definition: mesh.h:1802
const std::vector< unsigned int > & getRecvProcList() const
returns the recv proc. list
Definition: mesh.h:1138
unsigned int getNumPreMeshNodes() const
return the number of pre ghost mesh nodes
Definition: mesh.h:1022
const std::vector< ot::TreeNode > & getAllElements() const
returns the pointer to All elements array.
Definition: mesh.h:1058
unsigned int getNumLocalMeshNodes() const
return the number of nodes local to the mesh
Definition: mesh.h:1020
unsigned int getNumPostGhostElements() const
Returns the number of post-ghost elements.
Definition: mesh.h:1016
unsigned int getNumNodesPerElement() const
return the number of nodes per element.
Definition: mesh.h:1090
const RefElement * getReferenceElement() const
returns const pointer to reference element
Definition: mesh.h:1114
unsigned int getNodePostGhostBegin() const
return the location of post node begin
Definition: mesh.h:1047
const std::vector< unsigned int > & getCG2DGMap() const
returns cg to dg map
Definition: mesh.h:1079
const std::vector< unsigned int > & getDG2CGMap() const
returns dg to cg map
Definition: mesh.h:1076
unsigned int getNodePreGhostBegin() const
return the begin location of pre ghost nodes
Definition: mesh.h:1039
unsigned int getDegOfFreedom() const
returns the dof for a partition
Definition: mesh.h:1052
unsigned int getMPIRank() const
returns the rank
Definition: mesh.h:1108
unsigned int getLevel() const
return the level of the of the octant
Definition: TreeNode.h:387
SM_TYPE getScatterMapType()
: returns if the scatter map typed set
Definition: mesh.h:1008
const unsigned int getRecvProcListSize() const
returns the recv proc list size
Definition: mesh.h:1120
const ot::TreeNode & currentOctant()
Return the current element as an octant.
Definition: mesh.h:1775
unsigned int getElementPreGhostBegin() const
return the begin location of element pre ghost
Definition: mesh.h:1026
SM_TYPE
type of the scatter map, based on numerical computation method
Definition: mesh.h:114
unsigned int currentIndex()
Returns the current element index.
Definition: mesh.h:1780
const std::vector< unsigned int > & getSendProcList() const
returns the send proc. list
Definition: mesh.h:1135
const std::vector< unsigned int > & getE2NMapping() const
Definition: mesh.h:1073
bool isActive() const
returns true if mesh is active
Definition: mesh.h:1173
void ghostExchangeSendSync(MPI_Request *send_reqs, MPI_Status *send_sts)
Perform the wait on the recv requests.
Definition: mesh.h:1570
const std::vector< unsigned int > & getNodalRecvCounts() const
returns the nodal recv counts
Definition: mesh.h:1129
unsigned int getMPIRankGlobal() const
returns the rank w.r.t. global comm
Definition: mesh.h:1102
A Set of utilities to test octrees.
const std::vector< unsigned int > & getRecvNodeSM() const
return Scatter map for node send
Definition: mesh.h:1144
void parent2ChildInterpolation(const double *in, double *out, unsigned int cnum, unsigned int dim=3) const
Performs all parent to child interpolations for the m_uiEl_i element in order to apply the stencil...
Definition: mesh.h:1813
unsigned int getX() const
get integer values of the octree coordinates.
Definition: TreeNode.h:366
unsigned int getNodeLocalEnd() const
return the location of local node end
Definition: mesh.h:1045
const std::vector< ot::Block > & getLocalBlockList() const
returns const list of local blocks (regular grids) for the consdering mesh.
Definition: mesh.h:1084
const std::vector< unsigned int > & getE2EMapping() const
returns const e2e mapping instance.
Definition: mesh.h:1070
unsigned int getNumLocalMeshElements() const
Definition: mesh.h:1012
void child2ParentInterpolation(const double *in, double *out, unsigned int cnum, unsigned int dim=3) const
performs the child to parent contribution (only from a single child).
Definition: mesh.h:1826
unsigned int getNodePostGhostEnd() const
return the location of post node end
Definition: mesh.h:1049
const ot::TreeNode * getNodalSplitterNodes() const
get plitter nodes for each processor.
Definition: mesh.h:1392
void dg2eijk(unsigned int dg_index, unsigned int &e, unsigned int &i, unsigned int &j, unsigned int &k) const
: Decompose the DG index to element id and it&#39;s i,j,k values.
Definition: mesh.h:1147
unsigned int getElementOrder() const
returns the order of an element
Definition: mesh.h:1093
MPI_Comm getMPICommunicator() const
returns the communicator (acitve)
Definition: mesh.h:1096
const std::vector< unsigned int > & getNodalSendOffsets() const
returns the nodal send offsets
Definition: mesh.h:1126
unsigned int getElementLocalEnd() const
return the end location of element local
Definition: mesh.h:1032
Definition: stencil.h:26
unsigned int getElementPostGhostBegin() const
return the begin location of element post ghost
Definition: mesh.h:1034
Definition: refel.h:69
unsigned int getMPICommSize() const
returns the comm size:
Definition: mesh.h:1111
const std::vector< ot::TreeNode > & getAllLocalNodes() const
returns all local nodes(vertices)
Definition: mesh.h:1067
unsigned int getDegOfFreedomUnZip() const
returns the dof for a partition
Definition: mesh.h:1055