PABLO  0.1
PArallel Balanced Linear Octree
 All Classes Functions Variables Pages
test2.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> pablo2;
18 
20  pablo2.setBalanceCodimension(1);
21  uint32_t idx=0;
22  pablo2.setBalance(idx,true);
23 
25  pablo2.computeConnectivity();
26  pablo2.write("Pablo2_iter0");
27 
29  for (int iter=1; iter<3; iter++){
30  pablo2.adaptGlobalRefine();
31  pablo2.updateConnectivity();
32  pablo2.write("Pablo2_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 (int iter=3; iter<9; iter++){
42  uint32_t nocts = pablo2.getNumOctants();
43  for (int i=0; i<nocts; i++){
45  vector<vector<double> > nodes = pablo2.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  pablo2.setMarker(i, 1);
51  }
52  }
53  }
55  pablo2.adapt();
56 
58  pablo2.updateConnectivity();
59  pablo2.write("Pablo2_iter"+to_string(static_cast<unsigned long long>(iter)));
60  }
61 #if NOMPI==0
62  }
63 
64  MPI::Finalize();
65 #endif
66 }
67 
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 setBalanceCodimension(uint8_t b21codim)
void write(string filename)
void setBalance(Class_Octant< 2 > *oct, bool balance)