00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GRIDBASE_H_
00025 #define GRIDBASE_H_
00026
00027 #define Point_hashtable2 BoCell
00028 #define Point_hashtable3 Bo2Point
00029 #define Point_hashtable4 Data
00030 class Point_hashtable0;
00031 class Point_hashtable1;
00032 class BoCell;
00033 class Bo2Point;
00034 class Data;
00035 class Grid;
00036 class P_boundary_tet;
00037
00038 #include <set>
00039 #include <string>
00040 #include <vector>
00041 using namespace std;
00042
00043
00044 class Grid_base : public Storage_manager, public Parallel_Info {
00045 friend class Point_hashtable3;
00046 public:
00047
00048 void Information();
00049
00050
00051 #ifdef WITH_BRICK
00052 #define DIMENSION 3
00053
00054 struct BInfoT {
00055 double localXMin[DIMENSION];
00056 double localXMax[DIMENSION];
00057 double eps;
00058 int rank;
00059 };
00060
00061 struct eqBInfoT {
00062 bool operator()(const BInfoT b1, const BInfoT b2) const
00063 {
00064 return ( ABS(b1.localXMin[0] - b2.localXMin[0]) > b1.eps ||
00065 ABS(b1.localXMin[1] - b2.localXMin[1]) > b1.eps ||
00066 ABS(b1.localXMin[2] - b2.localXMin[2]) > b1.eps ||
00067 ABS(b1.localXMax[0] - b2.localXMax[0]) > b1.eps ||
00068 ABS(b1.localXMax[1] - b2.localXMax[1]) > b1.eps ||
00069 ABS(b1.localXMax[2] - b2.localXMax[2]) > b1.eps );
00070 }
00071 };
00072
00073
00074 typedef set<BInfoT,eqBInfoT> Set_of_Processors;
00075
00076 Set_of_Processors brickInfo_m;
00077
00078 void getBrickInfo();
00079 void boundbox(double localXMin[DIMENSION], double localXMax[DIMENSION]);
00080 void localbox(double localXMin[DIMENSION], double localXMax[DIMENSION], int node);
00081
00082
00083 inline int isInBrick(double x[DIMENSION]) {
00084
00085
00086
00087
00088
00089
00090
00091 Set_of_Processors::const_iterator i;
00092 for(i=brickInfo_m.begin();i!=brickInfo_m.end();i++) {
00093 if (((*i).localXMin[0] <= x[0]) &&
00094 ((*i).localXMax[0] > x[0]) &&
00095 ((*i).localXMin[1] <= x[1]) &&
00096 ((*i).localXMax[1] > x[1]) &&
00097 ((*i).localXMin[2] <= x[2]) &&
00098 ((*i).localXMax[2] > x[2])
00099 )
00100 return (*i).rank;
00101 }
00102 return -1;
00103 }
00104 #endif // WITH_BRICK
00105
00106
00107
00108 void Print_test_AVS(ofstream *Datei, int type);
00109 void Test(int type);
00110 void Print_Test_Cell(ofstream *Datei);
00111 void Print_Test_all_Cell(ofstream *Datei, int level);
00112
00113 void Test_just_this();
00114 void Test_just_this2(int bla);
00115
00116
00117
00118
00119 void Print_Variable_AVS(ofstream *Datei, int number_var);
00120 void Print_Variable_AVS_coarse(ofstream *Datei, int number_var, int level);
00121 void Print_Cell_Variable_AVS(ofstream *Datei, int number_var);
00122 void Print_Cell_Variable_AVS_parallel(ofstream *Datei, int number_var);
00123 void Print_Variable_AVS_parallel(ofstream *Datei, int number_var);
00124 void Print_Variable_AVS_parallel(ofstream *Datei, int number_var, int level);
00125 void Print_Variable_AVS_parallel(ofstream *Datei, int number_var,
00126 int number_varb, int number_varc);
00127 void Print_surface_Variable_AVS_parallel(ofstream *Datei, int number_var);
00128
00129 void Print_Cell_Variable_AVS_moved(ofstream *Datei, int number_var,
00130 int var_a, int var_b, int var_c);
00131 void Print_Variable_AVS_moved(ofstream *Datei, int number_var,
00132 int var_a, int var_b, int var_c);
00133 void Print_Variable_AVS_moved_parallel(ofstream *Datei, int number_var,
00134 int var_a, int var_b, int var_c);
00135 void Print_Variable_AVS(ofstream *Datei, int var_a, int var_b, int var_c);
00136 void Print_Domain_AVS(ofstream *Datei);
00137 void Print_processes_UCD(ofstream *Datei);
00138 void Print_region_processes_UCD(ofstream *Datei);
00139 void Print_surface_processes_UCD(ofstream *Datei);
00140
00141
00142 void Print_Grid_Gnuplot(ofstream *Datei);
00143 void Print_Grid_Gnuplot_moved(ofstream *Datei,
00144 int var_a, int var_b, int var_c);
00145
00146
00147 void Print_Variable_OpenDx(ofstream *Datei, int number_var);
00148 void Print_Variable_OpenDx_parallel(ofstream *Datei, int number_var);
00149 void Print_Variable_OpenDx_moved(ofstream *Datei, int number_var,
00150 int var_a, int var_b, int var_c);
00151
00152 void Print_Special(ofstream *File, int number_var,
00153 int num_X_DISP, int num_Y_DISP, int num_Z_DISP);
00154 void Print_Special_streched(ofstream *File, int number_var,int num_z_correct,
00155 int num_X_DISP, int num_Y_DISP, int num_Z_DISP);
00156 void Print_Special_streched(ofstream *File, int number_var,
00157 int num_x_coor, int num_y_coor, int num_z_coor,
00158 int num_X_DISP, int num_Y_DISP, int num_Z_DISP);
00159 void Print_Special_streched_half(ofstream *File, int number_var,
00160 int num_x_coor, int num_y_coor, int num_z_coor,
00161 int num_X_DISP, int num_Y_DISP, int num_Z_DISP);
00162 void Print_Special_streched_quad(ofstream *File, int number_var,
00163 int num_x_coor, int num_y_coor, int num_z_coor,
00164 int num_X_DISP, int num_Y_DISP, int num_Z_DISP);
00165 void Print_Special_streched_quad(ofstream *File, double hlen,
00166 int number_var,
00167 int num_x_coor, int num_y_coor, int num_z_coor,
00168 int num_X_DISP, int num_Y_DISP, int num_Z_DISP,
00169 int num_heat);
00170 void Print_Special_streched_X_Y(ofstream *,
00171 int, int, int,
00172 int, int, int, int, int, int, int, int);
00173
00174
00175 void Pr_Var_AVS_mo_boundary(ofstream *Datei, int number_var,
00176 int var_a, int var_b, int var_c);
00177 void Pr_Var_AVS_mo_surface(ofstream *Datei, int number_var,
00178 int var_a, int var_b, int var_c);
00179
00180 void Pr_Var_AVS_mo_surface_half(ofstream *Datei, int number_var,
00181 int var_a, int var_b, int var_c);
00182 void Pr_Var_AVS_mo_surface_transv(ofstream *Datei, int number_var,
00183 int var_a, int var_b, int var_c, double plane);
00184 void Print_Variable_AVS_moved_half(ofstream *Datei, int number_var,
00185 int var_a, int var_b, int var_c);
00186
00187
00188
00189 int Max_level() const;
00190 int Min_level() const;
00191 double finest_mesh_size() const;
00192 double Give_finest_mesh_size() const
00193 { return finest_meshsize; }
00194
00195 inline double H_mesh() const;
00196 inline D3vector Give_A() const;
00197 double h_min_for_boundary_points;
00198
00199
00200
00201
00202
00203
00204 bool Give_label_bo(Index3D I, dir_3D d,int num) const;
00205 void Put_label_bo(bool (*Formula)(double x,double y,double z),int num);
00206 void Put_label_bo_complementary(int num_org, int num);
00207 void Put_label_bo(int num_var,int num);
00208 void Put_union_label(int num, int numa, int numb);
00209
00210 void Put_label_bo(bool lab, Index3D I, dir_3D d,int num) const;
00211
00212
00213 bool Give_label_bo_D(Index3D I, int num, int level) const;
00214
00215 void Restrict_label_bo(int num);
00216 void Set_label_bo_mg(Index3D Ind, int num, bool label, int level);
00217
00218 void Interpolation_label_bo(Index3D I, int level, int num, bool Dirichlet);
00219
00220
00221
00222
00223
00224 double* Give_variable(Index3D I, int v_e) const;
00225 double* Give_variable_slow(const Index3D I, int v_e) const;
00226
00227
00228
00229
00230 double* Give_variable(Index3D I, dir_3D d) const;
00231 double Give_h(Index3D I, dir_3D d) const;
00232
00233 double* Give_variable_cellpoi(Index3D I) const;
00234
00235
00236
00237 double* Give_bo_stencil(Index3D I, int num_stencil) const;
00238
00239 double* Give_stencil(Index3D I, int num_stencil) const;
00240
00241 double* Give_cell_variable(Index3D I) const;
00242
00243
00244 double* Give_pointer_stencil(Index3D I) const;
00245
00246
00247
00248 inline D3vector transform_coord(const D3vector V) const;
00249 inline D3vector back_transform_coord(const D3vector V) const;
00250 inline D3vector transform_coord(const Index3D I) const;
00251 inline double transform_coordX(const Index3D I) const;
00252 inline double transform_coordY(const Index3D I) const;
00253 inline double transform_coordZ(const Index3D I) const;
00254 inline D3vector transform_coord(const Index3D I, const dir_3D d) const;
00255 inline D3vector transform_coord_org_shift(const Index3D I, const dir_3D d,
00256 const double shift) const;
00257 inline D3vector transform_coord_cellpoi(const Index3D I) const;
00258 inline double transform_coordX_cellpoi(const Index3D I) const;
00259 inline double transform_coordY_cellpoi(const Index3D I) const;
00260 inline double transform_coordZ_cellpoi(const Index3D I) const;
00261
00262
00263
00264 void Print_hashtable0();
00265 void Print_hashtable1();
00266 void Print_hashtable2();
00267 void Print_hashtable3();
00268 void Print_hashtable4();
00269
00270
00271 void Print_cell_info();
00272
00273
00274
00275 bool Exists_Point(Index3D I) const;
00276 bool Point_in_domain(Index3D I) const;
00277 bool Exists_Bo_Point(IndexBo I) const;
00278 bool Exists_Bo_Point(Index3D I, dir_3D d) const;
00279 Pointtype Give_type(Index3D I) const;
00280 Pointtype Give_global_type(Index3D I) const;
00281
00282 bool Grid_point_on_finest_level(Index3D I) const;
00283 Edgetype Give_edge_typ(Index3D I);
00284 Celltype Give_cell_typ(Index3D I) const;
00285 bool Exists_Cell(Index3D I);
00286
00287
00288 bool Is_Bo_cell(Index3D I);
00289 BoCell *Give_Bo_cell(Index3D I) const;
00290
00291
00292
00293 int Give_Nummer(Index3D I);
00294 int Give_Nummer(Index3D I,dir_3D d);
00295 int Give_Nummer_cellpoi(Index3D I);
00296
00297
00298 void Label_true(Index3D I);
00299 bool Label_ask(Index3D I);
00300 void False_Label4();
00301
00302
00303 int Give_hashtable0_leng() { return hashtable0_leng; }
00304 Point_hashtable0** Give_hashtable0_start() {
00305 return hashtable0_start;
00306 }
00307 int Give_hashtable2_leng() { return hashtable2_leng; }
00308 Point_hashtable2** Give_hashtable2_start() {
00309 return hashtable2_start;
00310 }
00311
00312
00313
00314 public:
00315
00316 P_boundary_tet* auxiliary_P;
00317 int auxiliary_number;
00318
00319
00320
00321
00322 double h_offset;
00323 double finest_meshsize;
00324
00325
00326
00327 void Put_finest_level_minimal(Index3D I,
00328 int level);
00329 int Give_finest_level(Index3D I);
00330
00331 int Give_my_finest_parallel_level(Index3D I) const;
00332
00333
00334 void Construct_cell_points_hash0();
00335 void Calc_type_of_edges_uniform();
00336
00337
00338 bool Correct_faces_uniform();
00339 bool Correct_edge(Index3D I);
00340 bool Correct_face(IndexSurface I);
00341 void Set_edge_typ(Index3D I, Edgetype typ);
00342 void Set_cell_typ(Index3D I, Celltype typ);
00343 void Set_point_typ(Index3D I,
00344 Pointtype typ);
00345
00346 void Add_cell(Index3D I);
00347 void Add_edge(Index3D I);
00348 void Add_edge_parallel(Index3D I);
00349 void Add_point(Index3D I);
00350 void Set_point_typ(Index3D I,
00351 int finest_level,
00352 Pointtype type);
00353 void Add_point(Index3D I, Pointtype type);
00354 void Add_point_interior(Index3D I);
00355 void Add_bocell(Index3D I);
00356 void Add_bo2point(Index3D I, dir_3D d,
00357 int l, int number_var);
00358 void Add_Uniform_Grid(int Max_tiefe);
00359
00360
00361
00362 void Add_double(Index3D I, int varebene,
00363 int number_var);
00364 void Add_MG_double(int varebene,
00365 int number_var);
00366
00367
00368 void Calc_multigrid_points_part1();
00369 void Calc_multigrid_points_part2();
00370 void Add_multigrid_point(Index3D I,int l);
00371 void Add_interpolation_point(Index3D I,
00372 int l);
00373
00374
00375 bool Is_Slave(Index3D I);
00376
00377 void Depth_hashtable0(int* max_depth,
00378 double* ave_depth);
00379 void Depth_hashtable1(int* max_depth,
00380 double* ave_depth);
00381 void Depth_hashtable2(int* max_depth,
00382 double* ave_depth);
00383 void Depth_hashtable3(int* max_depth,
00384 double* ave_depth);
00385 void Depth_hashtable4(int* max_depth,
00386 double* ave_depth);
00387
00388
00389 D3vector local_coord_cellpoi(const Index3D I) const;
00390
00391 Grid_base(int n_max, All_Domains* dom,
00392 Grid_gen_parameters& gpara, MPI_Comm comm);
00393 Grid_base(double h_finest_level, All_Domains* dom,
00394 Grid_gen_parameters& gpara, MPI_Comm comm);
00395 Grid_base(int n_max, All_Domains* dom, MPI_Comm comm);
00396 Grid_base(double h_finest_level, All_Domains* dom, MPI_Comm comm);
00397 void Grid_generation(int n_max);
00398 void Dummy_grid_generation();
00399 void Add_27Stencil(Index3D I);
00400 void Add_small_27Stencil(Index3D I, int level);
00401 void Fullfill_27Stencil();
00402 void Fullfill_B1B2();
00403 void Add_B1B2(Index3D I);
00404 void Add_points_of_cell(Index3D I);
00405 void Remove_edges();
00406 void Construct_points_hash1();
00407 void Remove_exterior_points();
00408 void Calc_interior_points();
00409
00410
00411 void Calc_interior_cells_Part1();
00412 void Calc_interior_cells_Part2();
00413 void Calc_interior_cells_Part3(int level);
00414 void Calc_boundary_cells();
00415 void Calc_boundary_2points(int number_var);
00416 void Info_hashtable0();
00417 void Info_hashtable1();
00418 void Info_hashtable2();
00419 void Info_hashtable3();
00420 void Info_hashtable4();
00421 void Calc_Neumann_pro_type();
00422 void Remove_all_hashtables();
00423
00424
00425
00426 void Send_boundary_cells_parallel();
00427 void Send_cells_parallel(int level);
00428 bool Send_boundary_cell_in_direction(Point_hashtable0* poi,
00429 Index3D next_index);
00430 bool Send_bo_with_cell_point_in_direction(dir_3D i, Point_hashtable0* poi);
00431 bool Send_cell_in_direction(Point_hashtable0* poi,
00432 int t,
00433 Index3D my_lev_index, Index3D next_index);
00434
00435
00436
00437 void Send_grid_points_direct_parallel(Pointtype typ);
00438 bool Send_point_direct_in_direction(int i, Point_hashtable1* poi,
00439 Index3D next_index);
00440
00441
00442
00443
00444 void Send_coarse_grid_points_parallel();
00445 void Send_coarse_grid_points_parallel(int level);
00446 bool Send_coarse_point_direct_in_direction(int i, Point_hashtable1* poi,
00447 int t, Index3D my_lev_index,
00448 Index3D next_index);
00449
00450
00451 bool Send_label_in_direction_A(int i, Point_hashtable1* poi,
00452 int t, Index3D my_lev_index,
00453 Index3D next_index);
00454 bool Send_label_in_direction_B(int i, Point_hashtable1* poi,
00455 int t, Index3D my_lev_index,
00456 Index3D next_index);
00457 void Send_label_parallel(int level, int num);
00458
00459
00460 void Send_multi_grid_points_parallel(int level);
00461 bool Send_multi_grid_point_in_direction(int d, Point_hashtable1* poi,
00462 int t, Index3D my_lev_index,
00463 Index3D next_index);
00464
00465 bool Send_prol_point_in_direction(int d, Point_hashtable1* poi, int t,
00466 Index3D my_lev_index, Index3D next_index);
00467
00468 bool Send_I_point_in_direction(int d, Point_hashtable1* poi, int t,
00469 bool also_f_p, Index3D my_lev_index,
00470 Index3D next_index);
00471 bool Send_B_point_in_direction(int d, Bo2Point* poi, Index3D next_index);
00472 bool Send_Z_point_in_direction(int d, BoCell* poi, Index3D next_index);
00473 bool Send_boundary_stencils_in_direction(Point_hashtable0* poi,
00474 int t, Index3D my_lev_index,
00475 Index3D next_index);
00476
00477 bool Send_interior_stencils_in_direction(Point_hashtable0* poi,
00478 int t, Index3D my_lev_index,
00479 Index3D next_index);
00480
00481 void Prepare_communication();
00482 void Prepare_communication_coarser_grids();
00483 void Prepare_communication_all_grids();
00484 void Prepare_communication_boundary_stencils();
00485 void Prepare_communication_boundary_stencils(int level);
00486 void Prepare_communication_interior_stencils();
00487 void Prepare_communication_interior_stencils(int level);
00488
00489
00491 void Start_for_face_correction_parallel();
00492 void End_for_face_correction_parallel();
00493
00494 int* edges_to_be_sent[18];
00495 int lenght_edges_to_be_sent[18];
00496 int number_edges_to_be_sent[18];
00497 void Test_array(int i);
00498
00499 int direction_and_number[2];
00500 int *direction_and_number_process;
00501 int *receive_buffer;
00502 int length_receive_buffer;
00503
00504 int* Give_receive_buffer(int length);
00505
00506 void put_for_send_edge(Index3D I);
00507 bool must_edges_be_send();
00508 bool send_edges();
00509
00510
00511
00512
00513
00514
00516
00517 double distanceD(D3vector V, dir_3D d);
00518 double offset_square;
00519
00521 void Initialize_variable();
00522
00523
00524 int i_iter;
00525
00526
00527
00528
00529 Point_hashtable0* hashtable0_point(Index3D I) const;
00530 void Initialize_hash0(int lenght);
00531
00532
00533 Point_hashtable0* point0;
00534 int hashtable0_leng;
00535 int hashtable0_occ;
00536 Point_hashtable0** hashtable0_start;
00537
00538
00539
00540
00541 Point_hashtable1* hashtable1_point(Index3D I) const;
00542 void Initialize_hash1(int lenght);
00543 void Resize_hash0(int lenght);
00544 void Resize_hash1(int lenght);
00545
00546
00547 Point_hashtable1* point1;
00548 int hashtable1_leng;
00549 int hashtable1_occ;
00550 Point_hashtable1** hashtable1_start;
00551
00552
00553
00554
00555 Point_hashtable2* hashtable2_point(Index3D I) const;
00556 void Initialize_hash2(int lenght);
00557 int Calc_number_boundary_cells_for_hash2();
00558
00559
00560 Point_hashtable2* bocell;
00561 int hashtable2_leng;
00562 int hashtable2_occ;
00563 Point_hashtable2** hashtable2_start;
00564
00565
00566
00567
00568 Point_hashtable3* hashtable3_point(IndexBo IB) const;
00569 Point_hashtable3* hashtable3_point(Index3D Ind, dir_3D dir) const;
00570 void Initialize_hash3(int lenght);
00571
00572
00573 Point_hashtable3* bo2point;
00574 int hashtable3_leng;
00575 int hashtable3_occ;
00576 Point_hashtable3** hashtable3_start;
00577
00578
00579
00580
00581 Point_hashtable4* hashtable4_point(Index3D, int level);
00582 Point_hashtable4* hashtable4_point(Index3D);
00583 void Initialize_hash4(int lenght);
00584
00585
00586 Point_hashtable4* varpoint;
00587 int hashtable4_leng;
00588 int hashtable4_occ;
00589 Point_hashtable4** hashtable4_start;
00590
00591
00592
00593 bool Calc_Is_Slave(Index3D I);
00594 bool Decide_poi_interpolates(Index3D I);
00595 void Recursion_Add_27Stencil(Index3D I, int l);
00596 int Recursion_Count_Cells(Index3D I);
00597 int Recursion_Cells_parallel(Index3D I, int number,
00598 int number_cell_var,
00599 double* buffer_send_double);
00600 int Recursion_Cells_AVS(Index3D I, ofstream *Datei, int nummer);
00601 int Recursion_Cells_AVS(Index3D I, ofstream *Datei, int nummer,
00602 int number_cell_variable);
00603 int Recursion_Cells_AVS_parallel(Index3D I, int nummer, int* buffer);
00604 int Write_Cells_AVS_parallel(Index3D I, int nummer, int* buffer);
00605 int Recursion_Edges_AVS(Index3D I, ofstream *Datei, int nummer);
00606 int Recursion_Cells_OPENDX(Index3D I, ofstream *Datei, int nummer);
00607 void Recursion_Print_cell_info(Index3D I);
00608 void Recursion_Construct_cell_points_hash0(Index3D I);
00609 void Recursion_Calc_type_of_edges_uniform(Index3D I);
00610
00611 D3vector A_domain_sp;
00612 D3vector B_domain_sp;
00613
00614 Celltype Recursion_calc_interior_cells_Part1(Index3D I);
00615 Celltype Recursion_calc_interior_cells_Part2(Index3D I);
00616 void Recursion_calc_interior_cells_Part3(Index3D I, int level);
00617 Celltype Calc_cell_type(Index3D I);
00618 void Recursion_add_Uniform_Grid(Index3D I,int Max_tiefe);
00619
00620
00621 void Print_Cell_avs(Index3D I, ofstream *Datei);
00622 void Print_ec_avs(IndexBo indexbo_A, IndexBo indexbo_B,
00623 ofstream *Datei, int number);
00624 int avs_bo_cell(BoCell* bo,ofstream *Datei,bool print_or_calc,int number);
00625 int avs_bo_cell(BoCell* bo,ofstream *Datei,int number,
00626 int number_cell_var);
00627 int avs_bo_cell_parallel_surface(BoCell* bo,int number,
00628 int* buffer, bool print_or_calc);
00629 int avs_bo_cell_parallel(BoCell* bo,int number, int* buffer);
00630 int avs_bo_cell_parallel(BoCell* bo,int number, int number_cell_var,
00631 double* buffer_send_double);
00632
00633
00634 int avs_bo_cell_typ(BoCell* bo,ofstream *datei, int number,double value);
00635 int Recursion_Cell_typ_AVS(Index3D I, ofstream *Datei, int nummer);
00636 int Recursion_Count_all_Cells(Index3D I);
00637
00638
00639 bool is_negative(BoCell* bo, Tetraeder_storage* tets);
00640 bool is_negative_surf(BoCell* bo, Tetraeder_storage* tets);
00641 int avs_bo_cell_half(BoCell* bo,ofstream *Datei,bool print_or_calc,int number);
00642 int count_edgepoint(Tetraeder_storage* tet, BoCell* bo);
00643 int count_nearb_surf_half(BoCell* bo, bool posi);
00644 int count_nearb_surf_transv(BoCell* bo, bool posi);
00645 int avs_bo_cell_surf(BoCell* bo,ofstream *datei,bool print_or_calc,
00646 int number);
00647 int avs_bo_cell_surf_half(BoCell* bo,ofstream *datei,bool print_or_calc,
00648 int number);
00649 int avs_bo_cell_surf_transv(BoCell* bo,ofstream *datei,bool print_or_calc,
00650 int number);
00651
00652 int Recursion_Count_Cells_half(Index3D I);
00653 int Recursion_Count_Cells_surf_half(Index3D I);
00654 int Recursion_Count_Cells_surf_transv(Index3D I);
00655
00656 int Recursion_Cells_AVS_half(Index3D I, ofstream *Datei, int nummer);
00657 int Recursion_Cells_AVS_surf_half(Index3D I, ofstream *Datei, int nummer);
00658 int Recursion_Cells_AVS_surf_transv(Index3D I, ofstream *Datei, int nummer);
00659
00660
00661
00662 void Print_Cell_opendx(Index3D I, ofstream *Datei);
00663 void Print_ec_opendx(IndexBo indexbo_A, IndexBo indexbo_B,
00664 ofstream *Datei, int number);
00665 int opendx_bo_cell(BoCell* bo,ofstream *Datei,bool print_or_calc,int number);
00666 };
00667
00668
00670
00672 #include "hash.h"
00673
00675
00677
00678 inline bool Grid_base::Point_in_domain(Index3D I) const {
00679 Point_hashtable1* point;
00680 point = hashtable1_point(I);
00681 if(point==NULL) return false;
00682
00683
00684
00685 if(point->typ < interior && point->typ!=parallel_p) return false;
00686 return true;
00687 }
00688
00689 inline bool Grid_base:: Exists_Cell(Index3D I) {
00690 if(developer_version) {
00691 if(!I.Cell_index()) cout << "\n Error in Exists_Cell!" << endl;
00692 }
00693 return hashtable0_point(I)!=NULL;
00694 }
00695
00696 inline bool Grid_base::Exists_Point(Index3D I) const {
00697 return hashtable1_point(I)!=NULL;
00698 }
00699
00700 inline bool Grid_base::Exists_Bo_Point(IndexBo I) const {
00701 return hashtable3_point(I)!=NULL;
00702 }
00703
00704 inline bool Grid_base::Exists_Bo_Point(Index3D I, dir_3D d) const {
00705 return hashtable3_point(I,d)!=NULL;
00706 }
00707
00708
00709 inline int Grid_base::Max_level() const { return max_level; };
00710 inline int Grid_base::Min_level() const { return min_level; };
00711
00712 inline double* Grid_base::Give_cell_variable(Index3D I) const {
00713 return hashtable0_point(I)->var;
00714 }
00715
00716 inline double* Grid_base::Give_pointer_stencil(Index3D I) const {
00717 return hashtable0_point(I)->var;
00718 }
00719
00720 inline double* Grid_base::Give_bo_stencil(Index3D I,int num_stencil) const {
00721 return &(hashtable0_point(I)->var[cell_number_of_bo_stencil(num_stencil)]);
00722 }
00723
00724 inline double* Grid_base::Give_stencil(Index3D I,int num_stencil) const {
00725 return &(hashtable0_point(I)->var[cell_number_of_stencil(num_stencil)]);
00726 }
00727
00728 inline double* Grid_base::Give_variable(Index3D Ind, dir_3D dir) const {
00729 static Point_hashtable3* point;
00730 point = hashtable3_start
00731 [hashtable3_function(Ind.ind_x.index,Ind.ind_y.index,
00732 Ind.ind_z.index, dir, hashtable3_leng)];
00733 while(point!=NULL) {
00734 if(point->ind==Ind && point->direction==dir) return point->var;
00735 point = point->next;
00736 }
00737
00738
00739
00740 return NULL;
00741 }
00742
00743
00744 inline double* Grid_base::Give_variable_cellpoi(Index3D Ind) const {
00745 static Point_hashtable2* point;
00746 point = hashtable2_start
00747 [hashtable2_function(Ind.ind_x.index,Ind.ind_y.index,
00748 Ind.ind_z.index, hashtable2_leng)];
00749 while(point!=NULL) {
00750 if(point->ind==Ind) return point->var;
00751 point = point->next;
00752 }
00753 if(developer_version) {
00754 if(point==NULL) {
00755 cout << " Error 1 in Give_variable_cellpoi! my rank"
00756 << my_rank
00757 << " x: " << Ind.I_x().get()
00758 << " y: " << Ind.I_y().get()
00759 << " z: " << Ind.I_z().get()
00760 << endl;
00761 return NULL;
00762 }
00763 else
00764 if(point->var==NULL)
00765 cout << " Error 2 in Give_variable_cellpoi! " << endl;
00766 }
00767 return point->var;
00768 }
00769
00770
00771 inline double Grid_base::Give_h(Index3D Ind, dir_3D dir) const {
00772 static Point_hashtable3* point;
00773 point = hashtable3_start
00774 [hashtable3_function(Ind.ind_x.index,Ind.ind_y.index,
00775 Ind.ind_z.index, dir, hashtable3_leng)];
00776 while(point!=NULL) {
00777 if(point->ind==Ind && point->direction==dir) return point->h;
00778 point = point->next;
00779 }
00780 return point->h;
00781 }
00782
00783
00784 inline double Grid_base::H_mesh() const {
00785 return H_bounding;
00786 };
00787
00788 inline D3vector Grid_base::Give_A() const {
00789 return A_bounding;
00790 }
00791
00792
00793 inline D3vector Grid_base::transform_coord(const D3vector V) const {
00794 return D3vector(Give_A().x + V.x*H_mesh(),
00795 Give_A().y + V.y*H_mesh(),
00796 Give_A().z + V.z*H_mesh());
00797 };
00798
00799
00800 inline D3vector Grid_base::back_transform_coord(const D3vector V) const {
00801 return D3vector((-Give_A().x + V.x)/H_mesh(),
00802 (-Give_A().y + V.y)/H_mesh(),
00803 (-Give_A().z + V.z)/H_mesh());
00804 };
00805
00806
00807 inline D3vector Grid_base::transform_coord(const Index3D I) const {
00808 return transform_coord(I.coordinate());
00809 };
00810 inline double Grid_base::transform_coordX(const Index3D I) const {
00811 return Give_A().x + H_mesh() * I.coordinate_x();
00812 };
00813 inline double Grid_base::transform_coordY(const Index3D I) const {
00814 return Give_A().y + H_mesh() * I.coordinate_y();
00815 };
00816 inline double Grid_base::transform_coordZ(const Index3D I) const {
00817 return Give_A().z + H_mesh() * I.coordinate_z();
00818 };
00819
00820
00821 inline D3vector Grid_base::transform_coord(const Index3D I, const dir_3D d)
00822 const {
00823 return hashtable3_point(I,d)->transform_coord(Give_A(),H_mesh());
00824 };
00825
00826 inline D3vector Grid_base::transform_coord_org_shift(const Index3D I,
00827 const dir_3D d,
00828 const double shift)
00829 const {
00830 return hashtable3_point(I,d)->transform_coord_org_shift(Give_A(),
00831 H_mesh()/Zweipotenz(Max_level()),
00832 H_mesh(),shift);
00833 };
00834
00835
00836
00837 inline D3vector Grid_base::local_coord_cellpoi(const Index3D Ind) const {
00838 static Point_hashtable2* point;
00839 point = hashtable2_start
00840 [hashtable2_function(Ind.ind_x.index,Ind.ind_y.index,
00841 Ind.ind_z.index, hashtable2_leng)];
00842 while(point!=NULL) {
00843 if(point->ind==Ind) return point->Local_coord_bocellpoint();
00844 point = point->next;
00845 }
00846 return point->Local_coord_bocellpoint();
00847 };
00848
00849 inline D3vector Grid_base::transform_coord_cellpoi(const Index3D I) const {
00850 return transform_coord(I.coordinate()) + local_coord_cellpoi(I);
00851 };
00852
00853 inline double Grid_base::transform_coordX_cellpoi(const Index3D I) const {
00854 return Give_A().x + H_mesh() * I.coordinate_x()
00855 + local_coord_cellpoi(I).x;
00856 };
00857
00858 inline double Grid_base::transform_coordY_cellpoi(const Index3D I) const {
00859 return Give_A().y + H_mesh() * I.coordinate_y()
00860 + local_coord_cellpoi(I).y;
00861 };
00862
00863 inline double Grid_base::transform_coordZ_cellpoi(const Index3D I) const {
00864 return Give_A().z + H_mesh() * I.coordinate_z()
00865 + local_coord_cellpoi(I).z;
00866 };
00867
00868
00869 inline Celltype Grid_base::Give_cell_typ(Index3D I) const {
00870 static Point_hashtable0* point;
00871 if(developer_version) {
00872 if(!I.Cell_index()) {
00873 cout << "\n Error 1 in Give_cell_typ!" << endl;
00874 cout << " Point: "; I.coordinate().Print(); cout << endl;
00875 }
00876 }
00877 point = hashtable0_point(I);
00878 if(point==NULL) {
00879 return no_cell_exists;
00880 }
00881 return (Celltype)point->typ;
00882 }
00883
00884
00885 #endif
00886
00887