PABLO  0.1
PArallel Balanced Linear Octree
 All Classes Functions Variables Pages
test_find_bug_LB.cpp
1 /*
2  * test_find_LB_bug.cpp
3  *
4  * Created on: 7 sept. 2015
5  * Author: marco
6  */
7 
8 
9 
10 
11 #include "preprocessor_defines.dat"
12 #include "Class_Global.hpp"
13 #include "Class_Para_Tree.hpp"
14 #include "User_Data_Comm.hpp"
15 
16 using namespace std;
17 
18 // =================================================================================== //
19 
20 int main(int argc, char *argv[]) {
21 
22 #if NOMPI==0
23  MPI::Init(argc, argv);
24 
25  {
26 #endif
27  int iter = 0;
28  int dim = 2;
29  int ga = 2;
30 
32  Class_Para_Tree<2> pablo;
33  pablo.setBalance((uint32_t)0,false);
34 
36  for (iter=0; iter<ga; iter++){
37  pablo.adaptGlobalRefine();
38  }
39 
40 #if NOMPI==0
41 
42  pablo.loadBalance();
43 #endif
44 
46  double xc, yc;
47  xc = yc = 0.75;
48  double radius = 0.25;
49 
51  uint32_t nocts = pablo.getNumOctants();
52  uint32_t nghosts = pablo.getNumGhosts();
53 
55  for (int i=0; i<nocts; i++){
56  vector<vector<double> > nodes = pablo.getNodes(i);
57  for (int j=0; j<global2D.nnodes; j++){
58  double x = nodes[j][0];
59  double y = nodes[j][1];
60  if ((pow((x-xc),2.0)+pow((y-yc),2.0) <= pow(radius,2.0))){
61  pablo.setMarker(i,1);
62  }
63  }
64  }
65  pablo.adapt();
66  if(pablo.rank==3 || pablo.rank==4)
67  pablo.setMarker((uint32_t)0,1);
68  pablo.adapt();
69  if(pablo.rank==3 || pablo.rank==4)
70  pablo.setMarker((uint32_t)0,1);
71  pablo.adapt();
72  if(pablo.rank==3)
73  pablo.setMarker((uint32_t)0,1);
74  pablo.adapt();
75  if(pablo.rank==3)
76  pablo.setMarker((uint32_t)0,1);
77  pablo.adapt();
78  pablo.loadBalance();
79 
81  iter = 0;
82  pablo.updateConnectivity();
83  pablo.write("PabloLB_iter"+to_string(static_cast<unsigned long long>(iter)));
84 
85 #if NOMPI==0
86  }
87 
88  MPI::Finalize();
89 #endif
90 }
91 
92 
93 
94 
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
uint32_t getNumGhosts() const
void write(string filename)
void setBalance(Class_Octant< 2 > *oct, bool balance)