PABLO  0.1
PArallel Balanced Linear Octree
 All Classes Functions Variables Pages
test3.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;
18  Class_Para_Tree<2> pablo3;
19 
21  uint32_t idx=0;
22  pablo3.setBalance(idx,false);
23 
25  pablo3.computeConnectivity();
26  pablo3.write("Pablo3_iter"+to_string(static_cast<unsigned long long>(iter)));
27 
29  for (iter=1; iter<3; iter++){
30  pablo3.adaptGlobalRefine();
31  pablo3.updateConnectivity();
32  pablo3.write("Pablo3_iter"+to_string(static_cast<unsigned long long>(iter)));
33  }
34 
36  double xc, yc;
37  xc = yc = 0.5;
38  double radius = 0.4;
39 
41  for (iter=3; iter<9; iter++){
42  uint32_t nocts = pablo3.getNumOctants();
43  for (int i=0; i<nocts; i++){
45  vector<vector<double> > nodes = pablo3.getNodes(i);
46  for (int j=0; j<global2D.nnodes; j++){
47  double x = nodes[j][0];
48  double y = nodes[j][1];
49  if ((pow((x-xc),2.0)+pow((y-yc),2.0) <= pow(radius,2.0))){
50  pablo3.setMarker(i, 1);
51  }
52  }
53  }
55  pablo3.adapt();
56 
58  pablo3.updateConnectivity();
59  pablo3.write("Pablo3_iter"+to_string(static_cast<unsigned long long>(iter)));
60  }
61 
63  pablo3.adaptGlobalCoarse();
64  pablo3.updateConnectivity();
65  pablo3.write("Pablo3_iter"+to_string(static_cast<unsigned long long>(iter)));
66 
68  xc = yc = 0.35;
69  radius = 0.15;
70 
72  for (iter=10; iter<15; iter++){
73  uint32_t nocts = pablo3.getNumOctants();
74  for (int i=0; i<nocts; i++){
76  vector<vector<double> > nodes = pablo3.getNodes(i);
77  for (int j=0; j<global2D.nnodes; j++){
78  double x = nodes[j][0];
79  double y = nodes[j][1];
81  if ((pow((x-xc),2.0)+pow((y-yc),2.0) <= pow(radius,2.0))){
82  pablo3.setMarker(i, -1);
83  }
84  }
85  }
87  pablo3.adapt();
88  pablo3.updateConnectivity();
89  pablo3.write("Pablo3_iter"+to_string(static_cast<unsigned long long>(iter)));
90  }
91 #if NOMPI==0
92  }
93  MPI::Finalize();
94 #endif
95 }
96 
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)