PABLO  0.1
PArallel Balanced Linear Octree
 All Classes Functions Variables Pages
test12.cpp
1 #include "preprocessor_defines.dat"
2 #include "Class_Global.hpp"
3 #include "Class_Para_Tree.hpp"
4 
5 using namespace std;
6 
7 // =================================================================================== //
8 
9 int main(int argc, char *argv[]) {
10 
11 #if NOMPI==0
12  MPI::Init(argc, argv);
13 
14  {
15 #endif
16 
17  Class_Para_Tree<2> pablo12;
18 
20  uint32_t idx=0;
21  pablo12.setBalance(idx,false);
22 
24  pablo12.computeConnectivity();
25  pablo12.write("Pablo12_iter0");
26 
28  for (int iter=1; iter<3; iter++){
29  pablo12.adaptGlobalRefine();
30 
31  pablo12.updateConnectivity();
32  pablo12.write("Pablo12_iter"+to_string(static_cast<unsigned long long>(iter)));
33  }
34 
35 #if NOMPI==0
36 
37  pablo12.loadBalance();
38 #endif
39 
41  double xc, yc;
42  xc = yc = 0.5;
43  double radius = 0.4;
44 
46  for (int iter=3; iter<9; iter++){
47  uint32_t nocts = pablo12.getNumOctants();
48  for (int i=0; i<nocts; i++){
50  vector<vector<double> > nodes = pablo12.getNodes(i);
51  for (int j=0; j<global2D.nnodes; j++){
52  double x = nodes[j][0];
53  double y = nodes[j][1];
54  if ((pow((x-xc),2.0)+pow((y-yc),2.0) <= pow(radius,2.0))){
55  pablo12.setMarker(i, 1);
56  }
57  }
58  }
59 
61  pablo12.adapt();
62 
63 #if NOMPI==0
64 
65  pablo12.loadBalance();
66 #endif
67 
69  pablo12.updateConnectivity();
70  pablo12.write("Pablo12_iter"+to_string(static_cast<unsigned long long>(iter)));
71  }
72 #if NOMPI==0
73  }
74 
75  MPI::Finalize();
76 #endif
77 }
78 
Parallel Octree Manager Class - 2D specialization.
void setMarker(Class_Octant< 2 > *oct, int8_t marker)
void getNodes(Class_Octant< 2 > *oct, dvector2D &nodes)
uint32_t getNumOctants() const
void write(string filename)
void setBalance(Class_Octant< 2 > *oct, bool balance)