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.
nuts.h
Go to the documentation of this file.
1 
10 #pragma once
11 #include "mesh.h"
12 #include <functional>
13 #include "block.h"
14 #include "point.h"
15 #include <assert.h>
16 
17 
18 namespace ts
19 {
24  class NUTS
25  {
26  private:
27 
29  ot::Mesh* m_uiOctGrid;
30 
32  ot::Mesh* m_uiBlockGrid;
33 
35  unsigned int m_uiS;
36 
38  double m_uiTB;
39 
41  double m_uiTE;
42 
44  double m_uiDTMin;
45 
47  double m_uiDTMax;
48 
50  double m_uiCFL;
51 
53  MPI_Comm m_uiCommActive;
54 
56  MPI_Comm m_uiCommGlobal;
57 
59  bool isActive;
60 
62  Point m_uiPtMin;
63 
65  Point m_uiPtMax;
66 
68  double m_uiCT;
69 
71  std::vector<unsigned int> m_uiSendSMLevelTag;
72 
74  std::vector<unsigned int> m_uiRecvSMLevelTag;
75 
77  unsigned int ** m_uiSendCountByLev;
78 
80  unsigned int ** m_uiRecvCountByLev;
81 
83  unsigned int ** m_uiSendOffsetByLev;
84 
86  unsigned int ** m_uiRecvOffsetByLev;
87 
89  std::vector< std::pair<unsigned int,unsigned int> > m_uiSendNodeRSM;
90 
92  std::vector< std::pair<unsigned int,unsigned int> > m_uiRecvNodeRSM;
93 
94 
95 
96 
97 
98  private:
100  void compBlockFlags();
101 
103  void computeBlockSM();
104 
105 
106 
107 
108  public:
109 
117  NUTS(ot::Mesh* octMesh, unsigned int s, double tb, double te, Point ptMin, Point ptMax, double cfl=0.25);
118 
120  ~NUTS();
121 
128  template<typename T>
129  void zip_to_unzip(T** in, T** out, bool isGSync=false, unsigned int dof=1);
130 
138  template<typename T>
139  void unzip_to_zip(T** in, T** out, bool isGSync=false, unsigned int dof=1);
140 
141 
149  template<typename T>
150  void unzip_sync(T** in, unsigned int blk , unsigned int dof=1);
151 
157  template<typename T>
158  void unzip_sync_all(T**in, unsigned int dof=1);
159 
163  void sync_ts();
164 
176  template<typename T>
177  void timestep(const T** in, T** out, std::function<void(T,T**,T**)>f_rhs, const double*a, const double *b, const double* c, unsigned int dof=1);
178 
179 
180 
181 
182  };
183 
184  template<typename T>
185  void NUTS::zip_to_unzip(T** in, T** out, bool isGSync, unsigned int dof)
186  {
187 
188  if(!isGSync)
189  {
190  for(unsigned int v=0;v<dof;v++)
191  m_uiOctGrid->performGhostExchange(in[v]);
192 
193  }
194 
195  for(unsigned int v=0;v<dof;v++)
196  m_uiOctGrid->unzip(in[v],out[v]);
197 
198  }
199 
200 
201  template<typename T>
202  void NUTS::unzip_to_zip(T** in, T** out, bool isGSync, unsigned int dof)
203  {
204  for(unsigned int v=0;v<dof;v++)
205  m_uiOctGrid->zip(in[v],out[v]);
206 
207  if(isGSync)
208  {
209  for(unsigned int v=0;v<dof;v++)
210  m_uiOctGrid->performGhostExchange(in[v]);
211  }
212  }
213 
214  template<typename T>
215  void NUTS::unzip_sync(T** in, unsigned int blk , unsigned int dof)
216  {
217 
218  const unsigned int blockLocalBegin = m_uiBlockGrid ->getElementLocalBegin();
219  const unsigned int blockLocalEnd = m_uiBlockGrid->getElementLocalEnd();
220 
221  if(blk< blockLocalBegin || blk>= blockLocalEnd)
222  return;
223 
224  //const unsigned int ;
225 
226 
227  }
228 
229  template<typename T>
230  void NUTS::unzip_sync_all(T**in, unsigned int dof)
231  {
232  const unsigned int blockLocalBegin = m_uiBlockGrid ->getElementLocalBegin();
233  const unsigned int blockLocalEnd = m_uiBlockGrid->getElementLocalEnd();
234 
235  for(unsigned int blk = blockLocalBegin; blk<blockLocalEnd ; blk++)
236  unzip_sync(in,blk,dof);
237 
238  }
239 
240 
241 
242 }
243 
244 
Basic: class for performing non-uniform time stepping. In order to perform non uniform time stepping ...
Definition: nuts.h:24
void unzip_sync_all(T **in, unsigned int dof=1)
: Sync operation accross all the blocks.
Definition: nuts.h:230
void performGhostExchange(std::vector< T > &vec)
Perform the ghost exchange for the vector vec.
void unzip(const T *zippedVec, T *unzippedVec)
Creates the decomposition of adaptive octree variables into blocklist variables that we computed...
Definition: mesh.h:179
A point class.
Definition: point.h:36
NUTS(ot::Mesh *octMesh, unsigned int s, double tb, double te, Point ptMin, Point ptMax, double cfl=0.25)
: constructor
Definition: nuts.cpp:15
unsigned int getElementLocalBegin() const
return the begin location of element local
Definition: mesh.h:1030
void sync_ts()
: sync to the next coarsest time step
void zip(const T *unzippedVec, T *zippedVec)
Performs the compression frrom regular block grid varable list to adaptive representation.
Definition: nuts.h:18
void unzip_sync(T **in, unsigned int blk, unsigned int dof=1)
: We need to perform block level sync operation
Definition: nuts.h:215
~NUTS()
: default destructor
Definition: nuts.cpp:94
void zip_to_unzip(T **in, T **out, bool isGSync=false, unsigned int dof=1)
: converts an zip vector to unzip format.
Definition: nuts.h:185
void timestep(const T **in, T **out, std::function< void(T, T **, T **)>f_rhs, const double *a, const double *b, const double *c, unsigned int dof=1)
: perform single time step
void unzip_to_zip(T **in, T **out, bool isGSync=false, unsigned int dof=1)
: converts the unzip vector to zip vector
Definition: nuts.h:202
unsigned int getElementLocalEnd() const
return the end location of element local
Definition: mesh.h:1032