1 #include "preprocessor_defines.dat"
2 #include "Class_Global.hpp"
3 #include "Class_Para_Tree.hpp"
4 #include "User_Data_Comm.hpp"
5 #include "User_Data_LB.hpp"
21 int main(
int argc,
char *argv[]) {
24 MPI::Init(argc, argv);
39 for (iter=1; iter<5; iter++){
65 for (
int i=0; i<nb; i++){
67 randc[0] = 0.8 * (double) (rand()) / RAND_MAX + 0.1;
68 randc[1] = 0.8 * (double) (rand()) / RAND_MAX + 0.1;
69 randc[2] = (double) (rand()) / RAND_MAX - 0.5;
70 double randr = (0.05 * (double) (rand()) / RAND_MAX + 0.04);
72 double dz = 0.005 + 0.05 * (double) (rand()) / RAND_MAX;
73 double omega = 0.5 * (double) (rand()) / RAND_MAX;
74 double aa = 0.15 * (double) (rand()) / RAND_MAX;
92 vector<double> oct_data(nocts, 0.0),oct_data_ghost;
93 vector<double> oct_data_new(nocts, 0.0);
103 for (iter=itstart; iter<itend; iter++){
104 if(pabloBB.
rank==0) cout <<
"iter " << iter << endl;
108 for (
int i=0; i<nb; i++){
109 BB[i].c[0] = BB0[i].c[0];
110 BB[i].c[1] = BB0[i].c[1];
111 BB[i].c[2] = BB[i].c[2]+ Dt*DZ[i];
115 for (
int iref=0; iref<nrefperiter; iref++){
117 for (
int i=0; i<nocts; i++){
120 vector<vector<double> > nodes = pabloBB.
getNodes(i);
122 vector<double> center = pabloBB.
getCenter(i);
124 while (!inside && ib<nb){
125 double xc = BB[ib].c[0];
126 double yc = BB[ib].c[1];
127 double zc = BB[ib].c[2];
128 double radius = BB[ib].r;
131 for (
int j=0; j<global3D.
nnodes; j++){
132 double x = nodes[j][0];
133 double y = nodes[j][1];
134 double z = nodes[j][2];
135 if (((!inside) && (pow((x-xc),2.0)+pow((y-yc),2.0)+pow((z-zc),2.0) <= 1.15*pow(radius,2.0) &&
136 pow((x-xc),2.0)+pow((y-yc),2.0)+pow((z-zc),2.0) >= 0.85*pow(radius,2.0))) ||
137 ((!inside) && (pow((center[0]-xc),2.0)+pow((center[1]-yc),2.0)+pow((center[2]-zc),2.0) <= 1.15*pow(radius,2.0) &&
138 pow((center[0]-xc),2.0)+pow((center[1]-yc),2.0)+pow((center[2]-zc),2.0) >= 0.85*pow(radius,2.0)))){
153 if (pabloBB.
getLevel(i) > 4 && !inside){
161 vector<uint32_t> mapidx;
162 vector<bool> isghost;
163 bool adapt = pabloBB.
adapt(
true);
169 oct_data_new.resize(nocts, 0);
170 for (uint32_t i=0; i<nocts; i++){
172 oct_data_new[i] = oct_data[mapidx[i]];
174 oct_data = oct_data_new;
175 vector<double>().swap(oct_data_new);
190 pabloBB.
writeTest(
"PabloBubble3D_iter"+to_string(static_cast<unsigned long long>(iter)), oct_data);
Parallel Octree Manager Class - 3D specialization.
uint8_t getLevel(Class_Octant< 3 > *oct)
void setBalanceCodimension(uint8_t b21codim)
void getCenter(Class_Octant< 3 > *oct, dvector ¢er)
void getNodes(Class_Octant< 3 > *oct, dvector2D &nodes)
uint32_t getNumOctants() const
void setMarker(Class_Octant< 3 > *oct, int8_t marker)
void getMapping(uint32_t &idx, u32vector &mapper, vector< bool > &isghost)
void writeTest(string filename, vector< double > data)
void updateConnectivity()
void setBalance(Class_Octant< 3 > *oct, bool balance)