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.
node.h
1 //
2 // Created by milinda on 9/11/17.
8 //
9 
10 #ifndef SFCSORTBENCH_NODE_H
11 #define SFCSORTBENCH_NODE_H
12 
13 #include "TreeNode.h"
14 #include <iostream>
15 #include <vector>
16 #include <climits>
17 #include <memory>
18 
19 namespace ot {
20 
21 
25  class Node : public ot::TreeNode {
26 
27  protected:
28  int m_uiOwner; // set to -1 by default.
29 
30  public:
31  Node()
32  {
33  m_uiX=0;
34  m_uiY=0;
35  m_uiZ=0;
36  m_uiLevel=0;
37  m_uiOwner=-1;
38 
39  }
40 
41  Node(unsigned int px, unsigned int py, unsigned int pz, unsigned int plevel,unsigned int pDim,unsigned int pMaxDepth)/*: ot::TreeNode(px,py,pz,plevel,pDim,pMaxDepth)*/
42  {
43  m_uiX=px;
44  m_uiY=py;
45  m_uiZ=pz;
46  m_uiLevel=plevel;
47  m_uiOwner=-1;
48 
49  }
50 
51  Node(unsigned int pLevel, unsigned int pMaxDepth)
52  {
53  m_uiX=0;
54  m_uiY=0;
55  m_uiZ=0;
56  m_uiLevel=pLevel;
57  m_uiOwner=-1;
58  }
59 
60  Node(const ot::TreeNode node)
61  {
62  m_uiX=node.getX();
63  m_uiY=node.getY();
64  m_uiZ=node.getZ();
65  m_uiLevel=node.getFlag();
66  m_uiOwner=-1;
67 
68  }
69 
70  ~Node()
71  {
72  // need to delete the allocated variables
73  }
74 
75  inline void setOwner(unsigned int ownerID) {m_uiOwner=ownerID;}
76 
77  inline void operator= (const Node& node )
78  {
79  m_uiX=node.getX();
80  m_uiY=node.getY();
81  m_uiZ=node.getZ();
82  m_uiLevel=node.getFlag();
83  m_uiOwner=node.m_uiOwner;
84 
85  }
86 
87  inline void operator= ( const ot::TreeNode & node )
88 
89  {
90  m_uiX=node.getX();
91  m_uiY=node.getY();
92  m_uiZ=node.getZ();
93  m_uiLevel=node.getFlag();
94  m_uiOwner=-1;
95 
96  }
97  inline int getOwner(){return m_uiOwner;}
98 
99  };
100 
101 }
102 
103 
104 namespace par {
105 
106  //Forward Declaration
107  template <typename T>
108  class Mpi_datatype;
109 
114  template <>
115  class Mpi_datatype< ot::Node > {
116 
117 // static void Node_MAX_LEVEL(void *in, void *inout, int* len, MPI_Datatype * dptr) {
118 // for(int i = 0; i < (*len); i++) {
119 // ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
120 // ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
121 // (static_cast<ot::TreeNode*>(inout))[i] =
122 // ( ( (first.getLevel()) > (second.getLevel()) )? first : second );
123 // }//end for
124 // }//end function
125 //
126 // static void Node_MAX(void *in, void *inout, int* len, MPI_Datatype * dptr) {
127 // for(int i = 0; i < (*len); i++) {
128 // ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
129 // ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
130 // (static_cast<ot::TreeNode*>(inout))[i] = ( ( first > second )? first : second );
131 // }//end for
132 // }//end function
133 //
134 // static void Node_MIN(void *in, void *inout, int* len, MPI_Datatype * dptr) {
135 // for(int i = 0; i < (*len); i++) {
136 // ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
137 // ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
138 // (static_cast<ot::TreeNode*>(inout))[i] = ( ( first < second )? first : second );
139 // }//end for
140 // }//end function
141 //
142 // /* static void Node_NCA(void *in, void *inout, int* len, MPI_Datatype * dptr) {
143 // for(int i = 0; i < (*len); i++) {
144 // ot::TreeNode first = (static_cast<ot::TreeNode*>(in))[i];
145 // ot::TreeNode second = (static_cast<ot::TreeNode*>(inout))[i];
146 // if( first != second ) {
147 // (static_cast<ot::TreeNode*>(inout))[i] = ot::getNCA(first, second);
148 // }//end if
149 // }//end for
150 // }//end function*/
151 
152  public:
157  /*static MPI_Op MAX_LEVEL(){
158  static bool first = true;
159  static MPI_Op maxLev;
160  if (first) {
161  first = false;
162  MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_MAX_LEVEL ,true ,&maxLev);
163  }
164  return maxLev;
165  }*/
166 
172 // static MPI_Op _MAX() {
173 // static bool first = true;
174 // static MPI_Op max;
175 // if (first) {
176 // first = false;
177 // MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_MAX ,true ,&max);
178 // }
179 // return max;
180 // }
181 
187 // static MPI_Op _MIN() {
188 // static bool first = true;
189 // static MPI_Op min;
190 // if (first) {
191 // first = false;
192 // MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_MIN ,true ,&min);
193 // }
194 // return min;
195 // }
196 
202  /*static MPI_Op NCA() {
203  static bool first = true;
204  static MPI_Op nca;
205  if (first) {
206  first = false;
207  MPI_Op_create(Mpi_datatype<ot::TreeNode>::Node_NCA ,true ,&nca);
208  }
209  return nca;
210  }*/
211 
215  static MPI_Datatype value()
216  {
217  static bool first = true;
218  static MPI_Datatype datatype;
219 
220  if (first)
221  {
222  first = false;
223  MPI_Type_contiguous(sizeof(ot::Node), MPI_BYTE, &datatype);
224  MPI_Type_commit(&datatype);
225  }
226 
227  return datatype;
228  }
229 
230  };
231 
232 }//end namespace par
233 
234 
235 #endif //SFCSORTBENCH_NODE_H
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
A class to manage octants.
Definition: TreeNode.h:35
Definition: node.h:25
An abstract class used for communicating messages using user-defined datatypes. The user must impleme...
Definition: zoltan_hilbert.h:76
Collection of Generic Parallel Functions: Sorting, Partitioning, Searching,...
Definition: zoltan_hilbert.h:72
unsigned int getX() const
get integer values of the octree coordinates.
Definition: TreeNode.h:366
static MPI_Datatype value()
User defined MPI_Operation that sets second[i] to first[i] if first[i] is at a greater level than sec...
Definition: node.h:215