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.
block.h
1 //
2 // Created by milinda on 4/21/17.
13 #ifndef SFCSORTBENCH_BLOCK_H
14 #define SFCSORTBENCH_BLOCK_H
15 
16 #include "dendro.h"
17 #include "TreeNode.h"
18 #include <assert.h>
19 #include <treenode2vtk.h>
20 #define GHOST_WIDTH 3
21 
22 namespace ot
23 {
33  enum BlockType{UNSPECIFIED=0, INTRNL_INDEPENDENT, INTRNL_DEPENDENT, FULLY_INDEPENDENT, FULLY_DEPENDENT};
34 
35  class Block
36  {
37 
38 
39 
40  private:
42  ot::TreeNode m_uiBlockNode;
43 
45  unsigned int m_uiRotID;
46 
48  unsigned int m_uiRegGridLev;
49 
51  DendroIntL m_uiLocalElementBegin;
52 
54  DendroIntL m_uiLocalElementEnd;
55 
57  DendroIntL m_uiOffset;
58 
60  unsigned int m_uiSize1D;
61 
63  unsigned int m_uiPaddingWidth;
64 
66  unsigned int m_uiEleOrder;
67 
69  unsigned int m_uiSzX;
70 
72  unsigned int m_uiSzY;
73 
75  unsigned int m_uiSzZ;
76 
78  std::vector<unsigned int> m_uiBLK2DIAG;
79 
81  std::vector<unsigned int> m_uiBLKVERTX;
82 
84  unsigned int m_uiBlkElem_1D;
85 
87  bool m_uiIsInternal;
88 
90  BlockType m_uiBlkType;
91 
92 
93  public:
95  Block();
96 
106  Block(ot::TreeNode pNode, unsigned int rotID ,unsigned int regLev, unsigned int regEleBegin,unsigned int regEleEnd,unsigned int eleOrder);
107 
108  ~Block();
109 
113  inline ot::TreeNode getBlockNode()const {return m_uiBlockNode;}
114 
119  inline unsigned int getRegularGridLev()const {return m_uiRegGridLev;}
120 
122  inline unsigned int getRotationID()const {return m_uiRotID;}
123 
127  inline DendroIntL getLocalElementBegin()const {return m_uiLocalElementBegin;}
128 
133  inline DendroIntL getLocalElementEnd()const {return m_uiLocalElementEnd;}
134 
136  inline unsigned int get1DPadWidth()const {return m_uiPaddingWidth;}
137 
139  inline unsigned int getElementOrder() const {return m_uiEleOrder;}
140 
142  void setOffset(DendroIntL offset);
143 
144  inline void setBlk2DiagMap(unsigned int owner,unsigned int dir, unsigned int id){m_uiBLK2DIAG[dir*(2*m_uiBlkElem_1D)+owner]=id;}
145 
146  inline void setBlk2VertexMap(unsigned int dir, unsigned int id){m_uiBLKVERTX[dir]=id;}
147 
148  inline void setIsInternal(bool isInternal){m_uiIsInternal=isInternal;}
149 
150  inline void setBlkType(BlockType btype) { m_uiBlkType = btype; }
151 
152  inline BlockType getBlockType() const {return m_uiBlkType;}
153 
154  inline bool isInternal(){return m_uiIsInternal;}
155 
157  inline void setBlkNodeFlag(unsigned int flag){m_uiBlockNode.setFlag(flag);};
158 
160  inline unsigned int getBlkNodeFlag() const { return (m_uiBlockNode.getFlag()>>NUM_LEVEL_BITS);};
161 
163  inline DendroIntL getOffset() const {return m_uiOffset;}
164 
166  inline unsigned int get1DArraySize() const {return m_uiSize1D ;}
167 
169  inline unsigned int getAllocationSzX() const {return m_uiSzX;}
170 
172  inline unsigned int getAllocationSzY() const {return m_uiSzY;}
173 
175  inline unsigned int getAllocationSzZ() const {return m_uiSzZ;}
176 
178  inline unsigned int getAlignedBlockSz() const
179  {
180  unsigned int tmp;
181  ((m_uiSzX & ((1u<<DENDRO_BLOCK_ALIGN_FACTOR_LOG)-1))==0)? tmp=m_uiSzX : tmp=((m_uiSzX/(1u<<DENDRO_BLOCK_ALIGN_FACTOR_LOG))+1)*(1u<<DENDRO_BLOCK_ALIGN_FACTOR_LOG);
182  return tmp*m_uiSzY*m_uiSzZ;
183  }
184 
185 
186  inline const unsigned int * getBlk2DiagMap() const {return &(*(m_uiBLK2DIAG.begin()));}
187 
188  inline const unsigned int * getBlk2VertexMap() const {return &(*(m_uiBLKVERTX.begin()));}
189 
190  inline void setAllocationSzX(unsigned int sz) {m_uiSzX=sz;}
191  inline void setAllocationSzY(unsigned int sz) {m_uiSzY=sz;}
192  inline void setAllocationSzZ(unsigned int sz) {m_uiSzZ=sz;}
193  inline void setSiz1D(unsigned int sz){m_uiSize1D=sz;}
194 
195  inline unsigned int getElemSz1D() const { return m_uiBlkElem_1D;}
196 
197 
198  inline const std::vector<unsigned int >& getBlk2DiagMap_vec() const {return m_uiBLK2DIAG;}
199  inline const std::vector<unsigned int >& getBlk2VertexMap_vec() const {return m_uiBLKVERTX;}
200 
202  double computeGridDx () const;
203 
205  double computeGridDy () const;
206 
208  double computeGridDz () const;
209 
211  double computeDx(const Point & d_min,const Point & d_max) const ;
213  double computeDy(const Point & d_min,const Point & d_max) const ;
215  double computeDz(const Point & d_min,const Point & d_max) const ;
216 
217  /*** @brief initialize the block diagonal map. */
218  void initializeBlkDiagMap(const unsigned int value);
219 
220  /*** @brief initialize the block vertex neighbour map. */
221  void initializeBlkVertexMap(const unsigned int value);
222 
223 
224 
225 
226  };
227 
228 } // end of namespace ot
229 
230 
231 
232 
233 
234 #endif //SFCSORTBENCH_BLOCK_H
unsigned int getRegularGridLev() const
returns the regular grid lev (m_uiRegGridLev) value. note: In octree2BlockDecomposition m_uiRegGridLe...
Definition: block.h:119
double computeDx(const Point &d_min, const Point &d_max) const
computes and returns the space discretization on x direction (problem domain)
Definition: block.cpp:85
double computeDz(const Point &d_min, const Point &d_max) const
computes and returns the space discretization on x direction (problem domain)
Definition: block.cpp:95
Simple class to manage async data transfer in the ODA class.
Definition: asyncExchangeContex.h:16
unsigned int getFlag() const
get the m_uiFlag value. Which is used to store the level and other aditional info.
Definition: TreeNode.h:402
Definition: block.h:35
unsigned int getBlkNodeFlag() const
set the blkFlag with the correct bdy
Definition: block.h:160
A class to manage octants.
Definition: TreeNode.h:35
ot::TreeNode getBlockNode() const
Return the block node.
Definition: block.h:113
void setOffset(DendroIntL offset)
set the block offset
Definition: block.cpp:101
A point class.
Definition: point.h:36
DendroIntL getLocalElementEnd() const
returns the local element end for the block.
Definition: block.h:133
unsigned int getAlignedBlockSz() const
align the total block size
Definition: block.h:178
unsigned int getAllocationSzZ() const
allocation length on Z direction
Definition: block.h:175
unsigned int getAllocationSzX() const
allocation length on X direction
Definition: block.h:169
void setBlkNodeFlag(unsigned int flag)
set the blkFlag with the correct bdy
Definition: block.h:157
Block()
Default constructor.
Definition: block.cpp:13
BlockType
Block type UNSPECIFIED : block flag type is not set INTRNL_INDEPENDENT: Block internal is independent...
Definition: block.h:33
unsigned int getAllocationSzY() const
allocation length on Y direction
Definition: block.h:172
unsigned int getElementOrder() const
returns the element order
Definition: block.h:139
double computeDy(const Point &d_min, const Point &d_max) const
computes and returns the space discretization on x direction (problem domain)
Definition: block.cpp:90
double computeGridDx() const
computes and returns the space discretization (grid domain)
Definition: block.cpp:70
unsigned int getRotationID() const
returns the rotation id of the block
Definition: block.h:122
unsigned int get1DPadWidth() const
returns 1D padding width
Definition: block.h:136
unsigned int get1DArraySize() const
returns the 1D array size
Definition: block.h:166
DendroIntL getOffset() const
get offset
Definition: block.h:163
void setFlag(unsigned int flag)
set the m_uiFlag value. Which is used to store the level and other aditional info.
Definition: TreeNode.h:401
double computeGridDz() const
computes and returns the space discretization (grid domain)
Definition: block.cpp:80
double computeGridDy() const
computes and returns the space discretization (grid domain)
Definition: block.cpp:75
DendroIntL getLocalElementBegin() const
returns the local element begin for the block.
Definition: block.h:127