PABLO  0.1
PArallel Balanced Linear Octree
 All Classes Functions Variables Pages
test13.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  int iter = 0;
17 
19  Class_Para_Tree<2> pablo13;
20 
22  uint32_t idx=0;
23  pablo13.setBalance(idx,false);
24 
26  pablo13.computeConnectivity();
27  pablo13.write("Pablo13_iter"+to_string(static_cast<unsigned long long>(iter)));
28 
30  for (iter=1; iter<3; iter++){
31  pablo13.adaptGlobalRefine();
32  pablo13.updateConnectivity();
33  pablo13.write("Pablo13_iter"+to_string(static_cast<unsigned long long>(iter)));
34  }
35 
36 #if NOMPI==0
37 
38  pablo13.loadBalance();
39 #endif
40 
42  double xc, yc;
43  xc = yc = 0.5;
44  double radius = 0.4;
45 
47  for (iter=3; iter<9; iter++){
48  uint32_t nocts = pablo13.getNumOctants();
49  for (int i=0; i<nocts; i++){
51  vector<vector<double> > nodes = pablo13.getNodes(i);
52  for (int j=0; j<global2D.nnodes; j++){
53  double x = nodes[j][0];
54  double y = nodes[j][1];
55  if ((pow((x-xc),2.0)+pow((y-yc),2.0) <= pow(radius,2.0))){
56  pablo13.setMarker(i, 1);
57  }
58  }
59  }
60 
62  pablo13.adapt();
63 
64 #if NOMPI==0
65 
66  pablo13.loadBalance();
67 #endif
68 
70  pablo13.updateConnectivity();
71  pablo13.write("Pablo13_iter"+to_string(static_cast<unsigned long long>(iter)));
72  }
73 
75  pablo13.adaptGlobalCoarse();
76  pablo13.updateConnectivity();
77  pablo13.write("Pablo13_iter"+to_string(static_cast<unsigned long long>(iter)));
78 
79 
81  xc = yc = 0.35;
82  radius = 0.15;
83 
85  for (iter=10; iter<15; iter++){
86  uint32_t nocts = pablo13.getNumOctants();
87  for (int i=0; i<nocts; i++){
89  vector<vector<double> > nodes = pablo13.getNodes(i);
90  for (int j=0; j<global2D.nnodes; j++){
91  double x = nodes[j][0];
92  double y = nodes[j][1];
94  if ((pow((x-xc),2.0)+pow((y-yc),2.0) <= pow(radius,2.0))){
95  pablo13.setMarker(i, -1);
96  }
97  }
98  }
100  pablo13.adapt();
101 
102 #if NOMPI==0
103 
104  pablo13.loadBalance();
105 #endif
106 
108  pablo13.updateConnectivity();
109  pablo13.write("Pablo13_iter"+to_string(static_cast<unsigned long long>(iter)));
110  }
111 #if NOMPI==0
112  }
113  MPI::Finalize();
114 #endif
115 }
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)