00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00030
00031
00033
00034
00035
00036 #ifdef COMP_GNUOLD
00037 #include <iostream.h>
00038 #include <fstream.h>
00039 #include <time.h>
00040 #include <math.h>
00041 #else
00042 #include <iostream>
00043 #include <fstream>
00044 #include <ctime>
00045 #include <cmath>
00046 #endif
00047
00048
00049
00050 #include "../parser.h"
00051
00052
00053 #include "../paramete.h"
00054 #include "../abbrevi.h"
00055 #include "../math_lib/math_lib.h"
00056
00057
00058 #include "../basic/basic.h"
00059
00060
00061 #include "../domain/domain.h"
00062
00063
00064 #include "../formulas/boundy.h"
00065 #include "../formulas/loc_sten.h"
00066
00067
00068 #include "gpar.h"
00069 #include "parallel.h"
00070 #include "mgcoeff.h"
00071 #include "sto_man.h"
00072 #include "gridbase.h"
00073 #include "grid.h"
00074
00076
00078
00079 void Grid_base::Print_ec_avs(IndexBo indexbo_A, IndexBo indexbo_B,
00080 ofstream *Datei, int number) {
00081 *Datei << number << " 1 line ";
00082 *Datei << hashtable3_point(indexbo_A)->nummer << " ";
00083 *Datei << hashtable3_point(indexbo_B)->nummer << " ";
00084 *Datei << "\n";
00085 }
00086
00087
00088 int Grid_base::avs_bo_cell(BoCell* bo,ofstream *datei,bool print_or_calc,
00089 int number) {
00090 Tetraeder_storage* tets;
00091 int num;
00092 Index3D I;
00093 Cell_type_points typ;
00094
00095 #ifdef PERIODIC
00096 if(bo->Give_Index().neighbour_non_periodic(WSDd).Is_non_periodic()) {
00097 return number;
00098 }
00099 #endif
00100
00101 if(print_or_calc==false) {
00102 for(tets = bo->Give_tets();tets!=NULL;tets = tets->Next()) {
00103 number++;
00104 }
00105 }
00106 else {
00107 I = bo->Give_Index();
00108 for(tets = bo->Give_tets();tets!=NULL;tets = tets->Next()) {
00109 ++number;
00110 *datei << number << " 1 tet ";
00111
00112 num = tets->N0();
00113 typ = bo->edge_point(num);
00114 if(typ==edge_poi_typ) {
00115 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00116 bo->edge_dir(num)) << " ";
00117 }
00118 if(typ==corner_poi_typ) {
00119 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00120 << " ";
00121 }
00122 if(typ==cell_poi_typ) {
00123 *datei << Give_Nummer_cellpoi(I) << " ";
00124 }
00125
00126 num = tets->N1();
00127 typ = bo->edge_point(num);
00128 if(typ==edge_poi_typ) {
00129 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00130 bo->edge_dir(num)) << " ";
00131 }
00132 if(typ==corner_poi_typ) {
00133 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00134 << " ";
00135 }
00136 if(typ==cell_poi_typ) {
00137 *datei << Give_Nummer_cellpoi(I) << " ";
00138 }
00139
00140 num = tets->N2();
00141 typ = bo->edge_point(num);
00142 if(typ==edge_poi_typ) {
00143 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00144 bo->edge_dir(num)) << " ";
00145 }
00146 if(typ==corner_poi_typ) {
00147 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00148 << " ";
00149 }
00150 if(typ==cell_poi_typ) {
00151 *datei << Give_Nummer_cellpoi(I) << " ";
00152 }
00153
00154 num = tets->N3();
00155 typ = bo->edge_point(num);
00156 if(typ==edge_poi_typ) {
00157 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00158 bo->edge_dir(num)) << " ";
00159 }
00160 if(typ==corner_poi_typ) {
00161 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00162 << " ";
00163 }
00164 if(typ==cell_poi_typ) {
00165 *datei << Give_Nummer_cellpoi(I) << " ";
00166 }
00167 *datei << endl;
00168 }
00169 }
00170 return number;
00171 }
00172
00173 int Grid_base::avs_bo_cell(BoCell* bo,ofstream *datei,
00174 int number,int number_cell_var) {
00175 Tetraeder_storage* tets;
00176
00177 for(tets = bo->Give_tets();tets!=NULL;tets = tets->Next()) {
00178 ++number;
00179 *datei << number << " " << tets->Give_variable()[number_cell_var] << "\n";
00180 }
00181 return number;
00182 }
00183
00184
00185 int Grid_base::Recursion_Count_Cells(Index3D I) {
00186 Index3D Ison;
00187
00188 int summe, i;
00189 summe = 0;
00190 for(i=0;i<8;++i) {
00191 if(Exists_Point(I.son((dir_sons)i)))
00192 summe = summe + Recursion_Count_Cells(I.son((dir_sons)i));
00193 else {
00194 Ison = I.son((dir_sons)i);
00195
00196 #ifdef PERIODIC
00197 if(Ison.neighbour_non_periodic(WSDd).Is_non_periodic()
00198 && Give_cell_typ(Ison) == int_cell) {
00199 #else
00200 if(Give_cell_typ(Ison) == int_cell) {
00201 #endif
00202 summe = summe + 6;
00203 }
00204 }
00205 }
00206 return summe;
00207 }
00208
00209
00210 void Grid_base::Print_Cell_avs(Index3D I, ofstream *Datei) {
00211 *Datei << Give_Nummer(I.neighbour_EW(Ld).neighbour_NS(Ld).neighbour_TD(Rd)) << " ";
00212 *Datei << Give_Nummer(I.neighbour_EW(Rd).neighbour_NS(Ld).neighbour_TD(Rd)) << " ";
00213 *Datei << Give_Nummer(I.neighbour_EW(Rd).neighbour_NS(Rd).neighbour_TD(Rd)) << " ";
00214 *Datei << Give_Nummer(I.neighbour_EW(Ld).neighbour_NS(Rd).neighbour_TD(Rd)) << " ";
00215
00216 *Datei << Give_Nummer(I.neighbour_EW(Ld).neighbour_NS(Ld).neighbour_TD(Ld)) << " ";
00217 *Datei << Give_Nummer(I.neighbour_EW(Rd).neighbour_NS(Ld).neighbour_TD(Ld)) << " ";
00218 *Datei << Give_Nummer(I.neighbour_EW(Rd).neighbour_NS(Rd).neighbour_TD(Ld)) << " ";
00219 *Datei << Give_Nummer(I.neighbour_EW(Ld).neighbour_NS(Rd).neighbour_TD(Ld)) << " ";
00220 }
00221
00222
00223 int Grid_base::Recursion_Cells_AVS(Index3D I, ofstream *Datei, int nummer) {
00224 int i;
00225 Index3D Ison;
00226
00227 for(i=0;i<8;++i) {
00228 if(Exists_Point(I.son((dir_sons)i)))
00229 nummer = Recursion_Cells_AVS(I.son((dir_sons)i),Datei,nummer);
00230 else {
00231 Ison = I.son((dir_sons)i);
00232
00233 #ifdef PERIODIC
00234 if(Ison.neighbour_non_periodic(WSDd).Is_non_periodic()
00235 && Give_cell_typ(Ison) == int_cell) {
00236 #else
00237 if(Give_cell_typ(Ison) == int_cell) {
00238 #endif
00239 nummer++;
00240
00241 *Datei << nummer << " 1 tet ";
00242
00243 *Datei << Give_Nummer(Ison.neighbour(WNTd)) << " ";
00244 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00245 *Datei << Give_Nummer(Ison.neighbour(WSTd)) << " ";
00246 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00247 *Datei << "\n";
00248
00249 nummer++;
00250 *Datei << nummer << " 1 tet ";
00251
00252 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00253 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00254 *Datei << Give_Nummer(Ison.neighbour(WSTd)) << " ";
00255 *Datei << Give_Nummer(Ison.neighbour(ESDd)) << " ";
00256 *Datei << "\n";
00257
00258 nummer++;
00259 *Datei << nummer << " 1 tet ";
00260
00261 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00262 *Datei << Give_Nummer(Ison.neighbour(WSDd)) << " ";
00263 *Datei << Give_Nummer(Ison.neighbour(WSTd)) << " ";
00264 *Datei << Give_Nummer(Ison.neighbour(ESDd)) << " ";
00265 *Datei << "\n";
00266
00267 nummer++;
00268 *Datei << nummer << " 1 tet ";
00269
00270 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00271 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00272 *Datei << Give_Nummer(Ison.neighbour(ESDd)) << " ";
00273 *Datei << Give_Nummer(Ison.neighbour(ENDd)) << " ";
00274 *Datei << "\n";
00275
00276 nummer++;
00277 *Datei << nummer << " 1 tet ";
00278
00279 *Datei << Give_Nummer(Ison.neighbour(ENTd)) << " ";
00280 *Datei << Give_Nummer(Ison.neighbour(WNTd)) << " ";
00281 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00282 *Datei << Give_Nummer(Ison.neighbour(ENDd)) << " ";
00283 *Datei << "\n";
00284
00285 nummer++;
00286 *Datei << nummer << " 1 tet ";
00287
00288 *Datei << Give_Nummer(Ison.neighbour(WNTd)) << " ";
00289 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00290 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00291 *Datei << Give_Nummer(Ison.neighbour(ENDd)) << " ";
00292 *Datei << "\n";
00293 }
00294 }
00295 }
00296 return nummer;
00297 }
00298
00299
00300 int Grid_base::Recursion_Cells_AVS(Index3D I, ofstream *Datei, int nummer,
00301 int number_cell_var) {
00302 int i;
00303 Index3D Ison;
00304 double value;
00305
00306 for(i=0;i<8;++i) {
00307 if(Exists_Point(I.son((dir_sons)i)))
00308 nummer = Recursion_Cells_AVS(I.son((dir_sons)i),Datei,nummer,
00309 number_cell_var);
00310 else {
00311 if(Give_cell_typ(I.son((dir_sons)i)) == int_cell) {
00312 Ison = I.son((dir_sons)i);
00313 value = Give_cell_variable(Ison)[number_cell_var];
00314
00315 nummer++;
00316 *Datei << nummer << " " << value << "\n";
00317
00318 nummer++;
00319 *Datei << nummer << " " << value << "\n";
00320
00321 nummer++;
00322 *Datei << nummer << " " << value << "\n";
00323
00324 nummer++;
00325 *Datei << nummer << " " << value << "\n";
00326
00327 nummer++;
00328 *Datei << nummer << " " << value << "\n";
00329
00330 nummer++;
00331 *Datei << nummer << " " << value << "\n";
00332
00333 }
00334 }
00335 }
00336 return nummer;
00337 }
00338
00339 void Grid_base::Print_Domain_AVS(ofstream *Datei) {
00340 static int number_cells;
00341 static Index3D ind;
00342
00343 if(Is_storage_initialized()==false) {
00344 cout << " \n Fehler in Print_Domain_AVS! Initialisierung fehlt! "
00345 << endl;
00346 return;
00347 }
00348
00349 ind = ind.son(ENTd);
00350 ind = ind.son(WSDd);
00351 number_cells = Recursion_Count_Cells(ind);
00352 *Datei << hashtable1_occ << " " << number_cells << " 1 0 0" << endl;
00353
00354
00355 iterate_hash1 {
00356 *Datei << point1->nummer << " " ;
00357 transform_coord(point1->ind.coordinate()).Print(Datei);
00358 *Datei << "\n";
00359 }
00360
00361
00362 ind = Index3D(2,2,2);
00363 Recursion_Cells_AVS(ind,Datei,0);
00364
00365
00366 *Datei << "1 1" << "\n";
00367
00368
00369 *Datei << "Konstante " << "\n";
00370
00371
00372 iterate_hash1 {
00373 *Datei << point1->nummer << " 1.0 \n";
00374 }
00375 }
00376
00378
00380 void Grid_base::Print_Variable_AVS(ofstream *Datei, int number_var) {
00381 int number_cells, number, ebene;
00382 int number_points;
00383 Pointtype typ_point;
00384 Index3D ind(2,2,2);
00385
00386 if(Is_storage_initialized()==false) {
00387 cout << " \n Fehler in Print_Variable_AVS! Initialisierung fehlt! "
00388 << endl;
00389 return;
00390 }
00391 if(Give_max_num_var() <= number_var) {
00392 cout << " \n Fehler in Print_Variable_AVS! number_var zu gross! " << endl;
00393 }
00394 else {
00395
00396 *Datei << "# File created by ExPDE " << endl;
00397 *Datei << "# UCD file format for AVS " << endl;
00398 *Datei << "# scalar value " << endl;
00399
00400
00401
00402 ind = Index3D(2,2,2);
00403
00404 number_cells = Recursion_Count_Cells(ind);
00405
00406 iterate_hash2 {
00407 number_cells = avs_bo_cell(bocell,Datei,false,number_cells);
00408 }
00409
00410
00411 number_points=0;
00412 iterate_hash1 {
00413 if(point1->typ >= interior || point1->typ==parallel_p) {
00414 point1->nummer = number_points;
00415 number_points++;
00416 }
00417 else point1->nummer = -1;
00418 }
00419
00420 iterate_hash3 {
00421 bo2point->Set_number_avs(number_points);
00422 ++number_points;
00423 }
00424
00425 iterate_hash2 {
00426 if(bocell->Exists_bocellpoint()) {
00427 bocell->Set_number_avs(number_points);
00428 number_points++;
00429 }
00430 }
00431
00432 *Datei << number_points << " "
00433 << number_cells << " 1 0 0" << endl;
00434
00435
00436
00437 iterate_hash1 {
00438 if(point1->nummer != -1) {
00439 *Datei << point1->nummer << " " ;
00440 transform_coord(point1->ind.coordinate()).Print(Datei);
00441 *Datei << "\n";
00442 }
00443 }
00444
00445 iterate_hash3 {
00446 *Datei << bo2point->nummer << " " ;
00447 (bo2point->transform_coord(Give_A(),
00448 H_mesh())).Print(Datei);
00449 *Datei << "\n";
00450 }
00451
00452 iterate_hash2 {
00453 if(bocell->Exists_bocellpoint()) {
00454 *Datei << bocell->Number_avs() << " " ;
00455 (transform_coord(bocell->ind.coordinate()) +
00456 bocell->Local_coord_bocellpoint()).Print(Datei);
00457 *Datei << "\n";
00458 }
00459 }
00460
00461
00462 ind = Index3D(2,2,2);
00463 number=Recursion_Cells_AVS(ind,Datei,0);
00464
00465 iterate_hash2 {
00466 number = avs_bo_cell(bocell,Datei,true,number);
00467 }
00468
00469
00470 *Datei << "1 1" << "\n";
00471
00472
00473 *Datei << "variable, unit " << "\n";
00474
00475
00476
00477 iterate_hash1 {
00478 if(point1->nummer != -1) {
00479 *Datei << point1->nummer << " ";
00480 typ_point = point1->typ;
00481 if(typ_point==exterior)
00482 cout << " Fehler in Print_Variable_AVS! " << endl;
00483 if(typ_point!=multigrid) {
00484 ebene = Give_finest_level(point1->ind);
00485 *Datei << Give_variable(point1->ind,ebene)[number_var];
00486
00487 *Datei << "\n";
00488 }
00489 else *Datei << " 1.0 \n";
00490 }
00491 }
00492
00493 iterate_hash3 {
00494 *Datei << bo2point->nummer << " ";
00495 *Datei << Give_variable(bo2point->ind,bo2point->direction)[number_var];
00496 *Datei << " \n";
00497 }
00498
00499 iterate_hash2 {
00500 if(bocell->Exists_bocellpoint()) {
00501 *Datei << bocell->Number_avs() << " " ;
00502 *Datei << bocell->Give_var()[number_var];
00503 *Datei << "\n";
00504 }
00505 }
00506 }
00507 }
00508
00509 void Grid_base::Print_Variable_AVS_coarse(ofstream *Datei, int number_var,
00510 int level) {
00511 int number_cells, number;
00512 int number_points;
00513 Index3D ind;
00514 Pointtype typ_point;
00515
00516 if(Is_storage_initialized()==false) {
00517 cout << " \n Fehler in Print_Variable_AVS_coarse! Initialisierung fehlt! "
00518 << endl;
00519 return;
00520 }
00521 if(Give_max_num_var() <= number_var) {
00522 cout << " \n Fehler in Print_Variable_AVS_coarse! number_var zu gross! "
00523 << endl;
00524 }
00525 else {
00526
00527 *Datei << "# File created by ExPDE " << endl;
00528 *Datei << "# UCD file format for AVS " << endl;
00529 *Datei << "# scalar value " << endl;
00530
00531
00532
00533 number_cells = 0;
00534 iterate_hash0 {
00535 ind = point0->Give_Index();
00536 if(ind.Cell_index()) {
00537 if(ind.Tiefe()==level+1 &&
00538 (point0->typ == int_cell || point0->typ == bo_cell)) {
00539 number_cells = number_cells + 6;
00540 }
00541 }
00542 }
00543
00544
00545 number_points=0;
00546 iterate_hash1 {
00547 if(point1->typ != exterior
00548 && point1->ind.Tiefe()<=level
00549 && point1->finest_level >= level)
00550
00551 {
00552 point1->nummer = number_points;
00553 number_points++;
00554 }
00555 else point1->nummer = -1;
00556 }
00557
00558 *Datei << number_points << " "
00559 << number_cells << " 1 0 0" << endl;
00560
00561
00562
00563 iterate_hash1 {
00564 if(point1->nummer != -1) {
00565 *Datei << point1->nummer << " " ;
00566 transform_coord(point1->ind.coordinate()).Print(Datei);
00567 *Datei << "\n";
00568 }
00569 }
00570
00571
00572 number = 0;
00573 iterate_hash0 {
00574 ind = point0->Give_Index();
00575 if(ind.Cell_index()) {
00576 if(ind.Tiefe()==level+1 &&
00577 (point0->typ == int_cell || point0->typ == bo_cell)) {
00578 number++;
00579
00580 *Datei << number << " 1 tet ";
00581
00582 *Datei << Give_Nummer(ind.neighbour(WNTd)) << " ";
00583 *Datei << Give_Nummer(ind.neighbour(WNDd)) << " ";
00584 *Datei << Give_Nummer(ind.neighbour(WSTd)) << " ";
00585 *Datei << Give_Nummer(ind.neighbour(ESTd)) << " ";
00586 *Datei << "\n";
00587
00588 number++;
00589 *Datei << number << " 1 tet ";
00590
00591 *Datei << Give_Nummer(ind.neighbour(ESTd)) << " ";
00592 *Datei << Give_Nummer(ind.neighbour(WNDd)) << " ";
00593 *Datei << Give_Nummer(ind.neighbour(WSTd)) << " ";
00594 *Datei << Give_Nummer(ind.neighbour(ESDd)) << " ";
00595 *Datei << "\n";
00596
00597 number++;
00598 *Datei << number << " 1 tet ";
00599
00600 *Datei << Give_Nummer(ind.neighbour(WNDd)) << " ";
00601 *Datei << Give_Nummer(ind.neighbour(WSDd)) << " ";
00602 *Datei << Give_Nummer(ind.neighbour(WSTd)) << " ";
00603 *Datei << Give_Nummer(ind.neighbour(ESDd)) << " ";
00604 *Datei << "\n";
00605
00606 number++;
00607 *Datei << number << " 1 tet ";
00608
00609 *Datei << Give_Nummer(ind.neighbour(ESTd)) << " ";
00610 *Datei << Give_Nummer(ind.neighbour(WNDd)) << " ";
00611 *Datei << Give_Nummer(ind.neighbour(ESDd)) << " ";
00612 *Datei << Give_Nummer(ind.neighbour(ENDd)) << " ";
00613 *Datei << "\n";
00614
00615 number++;
00616 *Datei << number << " 1 tet ";
00617
00618 *Datei << Give_Nummer(ind.neighbour(ENTd)) << " ";
00619 *Datei << Give_Nummer(ind.neighbour(WNTd)) << " ";
00620 *Datei << Give_Nummer(ind.neighbour(ESTd)) << " ";
00621 *Datei << Give_Nummer(ind.neighbour(ENDd)) << " ";
00622 *Datei << "\n";
00623
00624 number++;
00625 *Datei << number << " 1 tet ";
00626
00627 *Datei << Give_Nummer(ind.neighbour(WNTd)) << " ";
00628 *Datei << Give_Nummer(ind.neighbour(WNDd)) << " ";
00629 *Datei << Give_Nummer(ind.neighbour(ESTd)) << " ";
00630 *Datei << Give_Nummer(ind.neighbour(ENDd)) << " ";
00631 *Datei << "\n";
00632 }
00633 }
00634 }
00635
00636
00637 *Datei << "1 1" << "\n";
00638
00639
00640 *Datei << "variable, unit " << "\n";
00641
00642
00643
00644 double* vars;
00645 iterate_hash1 {
00646 if(point1->nummer != -1) {
00647 *Datei << point1->nummer << " ";
00648 typ_point = point1->typ;
00649 if(typ_point==exterior)
00650 cout << " Fehler in Print_Variable_AVS_coarse! " << endl;
00651 vars = Give_variable_slow(point1->ind,level);
00652 if(vars!=NULL)
00653 *Datei << vars[number_var];
00654 else
00655 *Datei << 0.0;
00656 *Datei << "\n";
00657 }
00658 }
00659 }
00660 }
00661
00662
00663
00664 void Grid_base::Print_Variable_AVS(ofstream *Datei,
00665 int number_var_a,
00666 int number_var_b,
00667 int number_var_c) {
00668 int number_cells, number, ebene;
00669 int number_points;
00670 Index3D ind;
00671 Pointtype typ_point;
00672
00673 if(Is_storage_initialized()==false) {
00674 cout << " \n Fehler in Print_Variable_AVS! Initialisierung fehlt! "
00675 << endl;
00676 return;
00677 }
00678 if(Give_max_num_var() <= number_var_a ||
00679 Give_max_num_var() <= number_var_b ||
00680 Give_max_num_var() <= number_var_c ) {
00681 cout << " \n Fehler in Print_Variable_AVS! number_var zu gross! " << endl;
00682 }
00683 else {
00684
00685 *Datei << "# File created by ExPDE " << endl;
00686 *Datei << "# UCD file format for AVS " << endl;
00687 *Datei << "# vector field " << endl;
00688
00689
00690
00691 ind = Index3D(2,2,2);
00692 number_cells = Recursion_Count_Cells(ind);
00693
00694 iterate_hash2 {
00695 number_cells = avs_bo_cell(bocell,Datei,false,number_cells);
00696 }
00697
00698
00699 number_points=0;
00700 iterate_hash1 {
00701 if(point1->typ >= interior || point1->typ==parallel_p) {
00702 point1->nummer = number_points;
00703 number_points++;
00704 }
00705 else point1->nummer = -1;
00706 }
00707
00708 iterate_hash3 {
00709 bo2point->Set_number_avs(number_points);
00710 ++number_points;
00711 }
00712
00713 iterate_hash2 {
00714 if(bocell->Exists_bocellpoint()) {
00715 bocell->Set_number_avs(number_points);
00716 number_points++;
00717 }
00718 }
00719
00720 *Datei << number_points << " "
00721 << number_cells << " 3 0 0" << endl;
00722
00723
00724
00725 iterate_hash1 {
00726 if(point1->nummer != -1) {
00727 *Datei << point1->nummer << " " ;
00728 transform_coord(point1->ind.coordinate()).Print(Datei);
00729 *Datei << "\n";
00730 }
00731 }
00732
00733 iterate_hash3 {
00734 *Datei << bo2point->nummer << " " ;
00735 (bo2point->transform_coord(Give_A(),
00736 H_mesh())).Print(Datei);
00737 *Datei << "\n";
00738 }
00739
00740 iterate_hash2 {
00741 if(bocell->Exists_bocellpoint()) {
00742 *Datei << bocell->Number_avs() << " " ;
00743
00744
00745
00746
00747 (transform_coord(bocell->ind.coordinate()) +
00748 bocell->Local_coord_bocellpoint()).Print(Datei);
00749 *Datei << "\n";
00750 }
00751 }
00752
00753
00754 ind = Index3D(2,2,2);
00755 number=Recursion_Cells_AVS(ind,Datei,0);
00756
00757 iterate_hash2 {
00758 number = avs_bo_cell(bocell,Datei,true,number);
00759 }
00760
00761
00762 *Datei << "3 1 1 1" << "\n";
00763
00764
00765 *Datei << "x-coord " << "\n";
00766 *Datei << "y-coord " << "\n";
00767 *Datei << "z-coord " << "\n";
00768
00769
00770
00771 iterate_hash1 {
00772 if(point1->nummer != -1) {
00773 *Datei << point1->nummer << " ";
00774 typ_point = point1->typ;
00775 if(typ_point==exterior)
00776 cout << " Fehler in Print_Variable_AVS! " << endl;
00777 if(typ_point!=multigrid) {
00778
00779 ebene = Give_finest_level(point1->ind);
00780 *Datei << Give_variable(point1->ind,ebene)[number_var_a] << " ";
00781 *Datei << Give_variable(point1->ind,ebene)[number_var_b] << " ";
00782 *Datei << Give_variable(point1->ind,ebene)[number_var_c];
00783
00784 *Datei << "\n";
00785 }
00786 else *Datei << " 1.0 1.0 1.0 \n";
00787 }
00788 }
00789
00790 iterate_hash3 {
00791 *Datei << bo2point->nummer << " ";
00792 *Datei << Give_variable(bo2point->ind,bo2point->direction)[number_var_a]
00793 << " ";
00794 *Datei << Give_variable(bo2point->ind,bo2point->direction)[number_var_b]
00795 << " ";
00796 *Datei << Give_variable(bo2point->ind,bo2point->direction)[number_var_c];
00797 *Datei << " \n";
00798 }
00799
00800 iterate_hash2 {
00801 if(bocell->Exists_bocellpoint()) {
00802 *Datei << bocell->Number_avs() << " " ;
00803 *Datei << bocell->Give_var()[number_var_a] << " ";
00804 *Datei << bocell->Give_var()[number_var_b] << " ";
00805 *Datei << bocell->Give_var()[number_var_c];
00806 *Datei << "\n";
00807 }
00808 }
00809 }
00810 }
00811
00812 void Grid_base::Print_Variable_AVS_moved(ofstream *Datei, int number_var,
00813 int number_var_a,
00814 int number_var_b,
00815 int number_var_c) {
00816 int number_cells, number, ebene;
00817 int number_points;
00818 Index3D ind;
00819 Pointtype typ_point;
00820
00821 if(Is_storage_initialized()==false) {
00822 cout << " \n Fehler in Print_Variable_AVS! Initialisierung fehlt! "
00823 << endl;
00824 return;
00825 }
00826 if(Give_max_num_var() <= number_var) {
00827 cout << " \n Fehler in Print_Variable_AVS! number_var zu gross! " << endl;
00828 }
00829 else {
00830
00831 *Datei << "# File created by ExPDE " << endl;
00832 *Datei << "# UCD file format for AVS " << endl;
00833 *Datei << "# scalar value moved by a vector" << endl;
00834
00835
00836
00837 ind = Index3D(2,2,2);
00838 number_cells = Recursion_Count_Cells(ind);
00839
00840 iterate_hash2 {
00841 number_cells = avs_bo_cell(bocell,Datei,false,number_cells);
00842 }
00843
00844
00845 number_points=0;
00846 iterate_hash1 {
00847 if(point1->typ >= interior || point1->typ==parallel_p) {
00848 point1->nummer = number_points;
00849 number_points++;
00850 }
00851 else point1->nummer = -1;
00852 }
00853
00854 iterate_hash3 {
00855 bo2point->Set_number_avs(number_points);
00856 ++number_points;
00857 }
00858
00859 iterate_hash2 {
00860 if(bocell->Exists_bocellpoint()) {
00861 bocell->Set_number_avs(number_points);
00862 number_points++;
00863 }
00864 }
00865
00866 *Datei << number_points << " "
00867 << number_cells << " 1 0 0" << endl;
00868
00869
00870
00871 iterate_hash1 {
00872 if(point1->nummer != -1) {
00873 *Datei << point1->nummer << " " ;
00874 (transform_coord(point1->ind.coordinate()) +
00875 D3vector(Give_variable(point1->ind,Max_level())[number_var_a],
00876 Give_variable(point1->ind,Max_level())[number_var_b],
00877 Give_variable(point1->ind,Max_level())[number_var_c])
00878 ).Print(Datei);
00879 *Datei << "\n";
00880 }
00881 }
00882
00883 iterate_hash3 {
00884 *Datei << bo2point->nummer << " " ;
00885 ((bo2point->transform_coord(Give_A(),
00886 H_mesh())) +
00887 D3vector(Give_variable(bo2point->ind,bo2point->direction)[number_var_a],
00888 Give_variable(bo2point->ind,bo2point->direction)[number_var_b],
00889 Give_variable(bo2point->ind,bo2point->direction)[number_var_c])
00890 ).Print(Datei);
00891 *Datei << "\n";
00892 }
00893
00894 iterate_hash2 {
00895 if(bocell->Exists_bocellpoint()) {
00896 *Datei << bocell->Number_avs() << " " ;
00897 (transform_coord(bocell->ind.coordinate()) +
00898 bocell->Local_coord_bocellpoint() +
00899 D3vector(bocell->Give_var()[number_var_a],
00900 bocell->Give_var()[number_var_b],
00901 bocell->Give_var()[number_var_c])
00902 ).Print(Datei);
00903 *Datei << "\n";
00904 }
00905 }
00906
00907
00908 ind = Index3D(2,2,2);
00909 number=Recursion_Cells_AVS(ind,Datei,0);
00910
00911 iterate_hash2 {
00912 number = avs_bo_cell(bocell,Datei,true,number);
00913 }
00914
00915
00916 *Datei << "1 1" << "\n";
00917
00918
00919 *Datei << "variable, unit " << "\n";
00920
00921
00922
00923 iterate_hash1 {
00924 if(point1->nummer != -1) {
00925 *Datei << point1->nummer << " ";
00926 typ_point = point1->typ;
00927 if(typ_point==exterior)
00928 cout << " Fehler in Print_Variable_AVS! " << endl;
00929 if(typ_point!=multigrid) {
00930 ebene = Give_finest_level(point1->ind);
00931 *Datei << Give_variable(point1->ind,ebene)[number_var];
00932
00933 *Datei << "\n";
00934 }
00935 else *Datei << " 1.0 \n";
00936 }
00937 }
00938
00939 iterate_hash3 {
00940 *Datei << bo2point->nummer << " ";
00941 *Datei << Give_variable(bo2point->ind,bo2point->direction)[number_var];
00942 *Datei << " \n";
00943 }
00944
00945 iterate_hash2 {
00946 if(bocell->Exists_bocellpoint()) {
00947 *Datei << bocell->Number_avs() << " " ;
00948 *Datei << bocell->Give_var()[number_var];
00949 *Datei << "\n";
00950 }
00951 }
00952 }
00953 }
00955
00957
00958 void Grid_base::Print_Cell_Variable_AVS(ofstream *Datei, int number_cell_var) {
00959 int number_cells, number;
00960 int number_points;
00961 Index3D ind;
00962
00963 if(Is_storage_initialized()==false) {
00964 cout << " \n Fehler in Print_Cell_Variable_AVS! Initialisierung fehlt! "
00965 << endl;
00966 return;
00967 }
00968 if(Give_max_num_cell_var() <= number_cell_var) {
00969 cout << " \n Fehler in Print_Cell_Variable_AVS! " << endl;
00970 }
00971 else {
00972
00973 *Datei << "# File created by ExPDE " << endl;
00974 *Datei << "# UCD file format for AVS " << endl;
00975 *Datei << "# scalar value on cells" << endl;
00976
00977
00978
00979 ind = Index3D(2,2,2);
00980 number_cells = Recursion_Count_Cells(ind);
00981
00982 iterate_hash2 {
00983 number_cells = avs_bo_cell(bocell,Datei,false,number_cells);
00984 }
00985
00986
00987 number_points=0;
00988 iterate_hash1 {
00989 if(point1->typ >= interior || point1->typ==parallel_p) {
00990 point1->nummer = number_points;
00991 number_points++;
00992 }
00993 else point1->nummer = -1;
00994 }
00995
00996 iterate_hash3 {
00997 bo2point->Set_number_avs(number_points);
00998 ++number_points;
00999 }
01000
01001 iterate_hash2 {
01002 if(bocell->Exists_bocellpoint()) {
01003 bocell->Set_number_avs(number_points);
01004 number_points++;
01005 }
01006 }
01007
01008 *Datei << number_points << " "
01009 << number_cells << " 0 1 0" << endl;
01010
01011
01012
01013 iterate_hash1 {
01014 if(point1->nummer != -1) {
01015 *Datei << point1->nummer << " " ;
01016 transform_coord(point1->ind.coordinate()).Print(Datei);
01017 *Datei << "\n";
01018 }
01019 }
01020
01021 iterate_hash3 {
01022 *Datei << bo2point->nummer << " " ;
01023 (bo2point->transform_coord(Give_A(),
01024 H_mesh())).Print(Datei);
01025 *Datei << "\n";
01026 }
01027
01028 iterate_hash2 {
01029 if(bocell->Exists_bocellpoint()) {
01030 *Datei << bocell->Number_avs() << " " ;
01031 (transform_coord(bocell->ind.coordinate()) +
01032 bocell->Local_coord_bocellpoint()).Print(Datei);
01033 *Datei << "\n";
01034 }
01035 }
01036
01037
01038 ind = Index3D(2,2,2);
01039 number=Recursion_Cells_AVS(ind,Datei,0);
01040
01041 iterate_hash2 {
01042 number = avs_bo_cell(bocell,Datei,true,number);
01043 }
01044
01045
01046 *Datei << "1 1" << "\n";
01047
01048
01049 *Datei << "variable, unit " << "\n";
01050
01051
01052
01053 ind = Index3D(2,2,2);
01054 number=Recursion_Cells_AVS(ind,Datei,0,number_cell_var);
01055
01056 iterate_hash2 {
01057 number = avs_bo_cell(bocell,Datei,number,number_cell_var);
01058 }
01059 }
01060 }
01061
01062 void Grid_base::Print_Cell_Variable_AVS_moved(ofstream *Datei,
01063 int number_cell_var,
01064 int number_var_a,
01065 int number_var_b,
01066 int number_var_c) {
01067 int number_cells, number;
01068 int number_points;
01069 Index3D ind;
01070
01071 if(Is_storage_initialized()==false) {
01072 cout << " \n Fehler in Print_Cell_Variable_AVS! Initialisierung fehlt! "
01073 << endl;
01074 return;
01075 }
01076 if(Give_max_num_cell_var() <= number_cell_var) {
01077 cout << " \n Fehler in Print_Cell_Variable_AVS! " << endl;
01078 }
01079 else {
01080
01081 *Datei << "# File created by ExPDE " << endl;
01082 *Datei << "# UCD file format for AVS " << endl;
01083 *Datei << "# scalar value on cells" << endl;
01084
01085
01086
01087 ind = Index3D(2,2,2);
01088 number_cells = Recursion_Count_Cells(ind);
01089
01090 iterate_hash2 {
01091 number_cells = avs_bo_cell(bocell,Datei,false,number_cells);
01092 }
01093
01094
01095 number_points=0;
01096 iterate_hash1 {
01097 if(point1->typ >= interior || point1->typ==parallel_p) {
01098 point1->nummer = number_points;
01099 number_points++;
01100 }
01101 else point1->nummer = -1;
01102 }
01103
01104 iterate_hash3 {
01105 bo2point->Set_number_avs(number_points);
01106 ++number_points;
01107 }
01108
01109 iterate_hash2 {
01110 if(bocell->Exists_bocellpoint()) {
01111 bocell->Set_number_avs(number_points);
01112 number_points++;
01113 }
01114 }
01115
01116 *Datei << number_points << " "
01117 << number_cells << " 0 1 0" << endl;
01118
01119
01120
01121 iterate_hash1 {
01122 if(point1->nummer != -1) {
01123 *Datei << point1->nummer << " " ;
01124 (transform_coord(point1->ind.coordinate()) +
01125 D3vector(Give_variable(point1->ind,Max_level())[number_var_a],
01126 Give_variable(point1->ind,Max_level())[number_var_b],
01127 Give_variable(point1->ind,Max_level())[number_var_c])
01128 ).Print(Datei);
01129 *Datei << "\n";
01130 }
01131 }
01132
01133 iterate_hash3 {
01134 *Datei << bo2point->nummer << " " ;
01135 ((bo2point->transform_coord(Give_A(),
01136 H_mesh())) +
01137 D3vector(Give_variable(bo2point->ind,bo2point->direction)[number_var_a],
01138 Give_variable(bo2point->ind,bo2point->direction)[number_var_b],
01139 Give_variable(bo2point->ind,bo2point->direction)[number_var_c])
01140 ).Print(Datei);
01141 *Datei << "\n";
01142 }
01143
01144 iterate_hash2 {
01145 if(bocell->Exists_bocellpoint()) {
01146 *Datei << bocell->Number_avs() << " " ;
01147 (transform_coord(bocell->ind.coordinate()) +
01148 bocell->Local_coord_bocellpoint() +
01149 D3vector(bocell->Give_var()[number_var_a],
01150 bocell->Give_var()[number_var_b],
01151 bocell->Give_var()[number_var_c])
01152 ).Print(Datei);
01153 *Datei << "\n";
01154 }
01155 }
01156
01157
01158 ind = Index3D(2,2,2);
01159 number=Recursion_Cells_AVS(ind,Datei,0);
01160
01161 iterate_hash2 {
01162 number = avs_bo_cell(bocell,Datei,true,number);
01163 }
01164
01165
01166 *Datei << "1 1" << "\n";
01167
01168
01169 *Datei << "variable, unit " << "\n";
01170
01171
01172
01173 ind = Index3D(2,2,2);
01174 number=Recursion_Cells_AVS(ind,Datei,0,number_cell_var);
01175
01176 iterate_hash2 {
01177 number = avs_bo_cell(bocell,Datei,number,number_cell_var);
01178 }
01179 }
01180 }
01181
01182
01183
01184
01185
01186
01188
01190
01191
01192 void Grid_base::Print_Grid_Gnuplot(ofstream *Datei) {
01193 *Datei << "# File created by ExPDE " << endl;
01194 *Datei << "# file format for Gnuplot " << endl;
01195 *Datei << "# visualization of the surface ";
01196
01197 Index3D I;
01198
01199
01200 *Datei << "\n";
01201 Give_A().Print(Datei);
01202 *Datei << "\n \n" ;
01203 (Give_A()+D3vector(H_mesh(),H_mesh(),H_mesh())).Print(Datei);
01204 *Datei << "\n" ;
01205
01206
01207 Tetraeder_storage* tet;
01208 iterate_hash2 {
01209 for(tet=bocell->Give_boundary_tets();tet!=NULL;tet=tet->Next()) {
01210 I = bocell->Give_Index();
01211 *Datei << "\n" ;
01212 *Datei << "\n" ;
01213 transform_coord(I.neighbour(bocell->corner(tet->N0())),
01214 bocell->edge_dir(tet->N0())).Print(Datei);
01215 *Datei << endl;
01216 transform_coord(I.neighbour(bocell->corner(tet->N1())),
01217 bocell->edge_dir(tet->N1())).Print(Datei);
01218 *Datei << endl;
01219 transform_coord(I.neighbour(bocell->corner(tet->N2())),
01220 bocell->edge_dir(tet->N2())).Print(Datei);
01221 }
01222 }
01223 }
01224
01225
01226 inline D3vector MAX_of_vectors(D3vector& A, D3vector& B) {
01227 return D3vector(MAX(A.x,B.x),MAX(A.y,B.y),MAX(A.z,B.z));
01228 }
01229 inline D3vector MIN_of_vectors(D3vector& A, D3vector& B) {
01230 return D3vector(MIN(A.x,B.x),MIN(A.y,B.y),MIN(A.z,B.z));
01231 }
01232
01233 void Grid_base::Print_Grid_Gnuplot_moved(ofstream *Datei,
01234 int number_var_a,
01235 int number_var_b,
01236 int number_var_c) {
01237 *Datei << "# File created by ExPDE " << endl;
01238 *Datei << "# file format for Gnuplot " << endl;
01239 *Datei << "# visualization of the surface ";
01240
01241 Index3D I;
01242 D3vector loc0, loc1, loc2;
01243 D3vector locmax, locmin;
01244
01245 Tetraeder_storage* tet;
01246
01247 locmax = D3vector(0.0,0.0,0.0);
01248 locmin = D3vector(0.0,0.0,0.0);
01249
01250
01251 iterate_hash2 {
01252 for(tet=bocell->Give_boundary_tets();tet!=NULL;tet=tet->Next()) {
01253 I = bocell->Give_Index();
01254 loc0 = transform_coord(I.neighbour(bocell->corner(tet->N0())),
01255 bocell->edge_dir(tet->N0())) +
01256 D3vector(bocell->vars[tet->N0()][number_var_a],
01257 bocell->vars[tet->N0()][number_var_b],
01258 bocell->vars[tet->N0()][number_var_c]);
01259 loc1 = transform_coord(I.neighbour(bocell->corner(tet->N1())),
01260 bocell->edge_dir(tet->N1())) +
01261 D3vector(bocell->vars[tet->N1()][number_var_a],
01262 bocell->vars[tet->N1()][number_var_b],
01263 bocell->vars[tet->N1()][number_var_c]);
01264 loc2 = transform_coord(I.neighbour(bocell->corner(tet->N2())),
01265 bocell->edge_dir(tet->N2())) +
01266 D3vector(bocell->vars[tet->N2()][number_var_a],
01267 bocell->vars[tet->N2()][number_var_b],
01268 bocell->vars[tet->N2()][number_var_c]);
01269
01270 locmax=MAX_of_vectors(locmax,loc0);
01271 locmax=MAX_of_vectors(locmax,loc1);
01272 locmax=MAX_of_vectors(locmax,loc2);
01273
01274 locmin=MIN_of_vectors(locmin,loc0);
01275 locmin=MIN_of_vectors(locmin,loc1);
01276 locmin=MIN_of_vectors(locmin,loc2);
01277 }
01278 }
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288 double h_maxx;
01289 h_maxx = MAX(locmax.x-locmin.x,locmax.y-locmin.y,locmax.z-locmin.z);
01290 *Datei << "\n";
01291 locmin.Print(Datei);
01292 *Datei << "\n \n" ;
01293 (locmin+D3vector(h_maxx,h_maxx,h_maxx)).Print(Datei);
01294 *Datei << "\n";
01295
01296
01297 iterate_hash2 {
01298 for(tet=bocell->Give_boundary_tets();tet!=NULL;tet=tet->Next()) {
01299 I = bocell->Give_Index();
01300 *Datei << "\n" ;
01301 *Datei << "\n" ;
01302
01303 loc0 = transform_coord(I.neighbour(bocell->corner(tet->N0())),
01304 bocell->edge_dir(tet->N0())) +
01305 D3vector(bocell->vars[tet->N0()][number_var_a],
01306 bocell->vars[tet->N0()][number_var_b],
01307 bocell->vars[tet->N0()][number_var_c]);
01308 loc1 = transform_coord(I.neighbour(bocell->corner(tet->N1())),
01309 bocell->edge_dir(tet->N1())) +
01310 D3vector(bocell->vars[tet->N1()][number_var_a],
01311 bocell->vars[tet->N1()][number_var_b],
01312 bocell->vars[tet->N1()][number_var_c]);
01313 loc2 = transform_coord(I.neighbour(bocell->corner(tet->N2())),
01314 bocell->edge_dir(tet->N2())) +
01315 D3vector(bocell->vars[tet->N2()][number_var_a],
01316 bocell->vars[tet->N2()][number_var_b],
01317 bocell->vars[tet->N2()][number_var_c]);
01318
01319 loc0.Print(Datei); *Datei << endl;
01320 loc1.Print(Datei); *Datei << endl;
01321 loc2.Print(Datei);
01322 }
01323 }
01324 }
01325
01327
01329
01330 void Grid_base::Print_test_AVS(ofstream *Datei, int type) {
01331 int number_cells, number;
01332 int number_points;
01333 Index3D ind;
01334 Pointtype typ_point;
01335
01336
01337 *Datei << "# File created by ExPDE " << endl;
01338 *Datei << "# UCD file format for AVS " << endl;
01339 *Datei << "# scalar value " << endl;
01340
01341
01342
01343 ind = Index3D(2,2,2);
01344 number_cells = Recursion_Count_Cells(ind);
01345
01346 iterate_hash2 {
01347 number_cells = avs_bo_cell(bocell,Datei,false,number_cells);
01348 }
01349
01350
01351 number_points=0;
01352 iterate_hash1 {
01353
01354 if(point1->typ != exterior) {
01355 point1->nummer = number_points;
01356 number_points++;
01357 }
01358 else point1->nummer = -1;
01359 }
01360
01361 iterate_hash3 {
01362 bo2point->Set_number_avs(number_points);
01363 ++number_points;
01364 }
01365
01366 iterate_hash2 {
01367 if(bocell->Exists_bocellpoint()) {
01368 bocell->Set_number_avs(number_points);
01369 number_points++;
01370 }
01371 }
01372
01373 *Datei << number_points << " "
01374 << number_cells << " 1 0 0" << endl;
01375
01376
01377
01378 iterate_hash1 {
01379 if(point1->nummer != -1) {
01380 *Datei << point1->nummer << " " ;
01381 transform_coord(point1->ind.coordinate()).Print(Datei);
01382 *Datei << "\n";
01383 }
01384 }
01385
01386 iterate_hash3 {
01387 *Datei << bo2point->nummer << " " ;
01388 (bo2point->transform_coord(Give_A(),
01389 H_mesh())).Print(Datei);
01390 *Datei << "\n";
01391 }
01392
01393 iterate_hash2 {
01394 if(bocell->Exists_bocellpoint()) {
01395 *Datei << bocell->Number_avs() << " " ;
01396 (transform_coord(bocell->ind.coordinate()) +
01397 bocell->Local_coord_bocellpoint()).Print(Datei);
01398 *Datei << "\n";
01399 }
01400 }
01401
01402
01403 ind = Index3D(2,2,2);
01404 number=Recursion_Cells_AVS(ind,Datei,0);
01405
01406 iterate_hash2 {
01407 number = avs_bo_cell(bocell,Datei,true,number);
01408 }
01409
01410
01411 *Datei << "1 1" << "\n";
01412
01413
01414 *Datei << "variable, unit " << "\n";
01415
01416
01417
01418 iterate_hash1 {
01419 if(point1->nummer != -1) {
01420 *Datei << point1->nummer << " ";
01421 typ_point = point1->typ;
01422 if(typ_point==exterior)
01423 cout << " Fehler in Print_Variable_AVS! " << endl;
01424
01425 if(type==0) *Datei << 2.0;
01426 if(type==1) *Datei << point1->typ;
01427 *Datei << "\n";
01428
01429
01430 }
01431 }
01432
01433 iterate_hash3 {
01434 *Datei << bo2point->nummer << " ";
01435 if(type==0) *Datei << 2.0;
01436 if(type==1) *Datei << -2.0;
01437 *Datei << " \n";
01438 }
01439
01440 iterate_hash2 {
01441 if(bocell->Exists_bocellpoint()) {
01442 *Datei << bocell->Number_avs() << " " ;
01443 if(type==0) *Datei << 2.0;
01444 if(type==1) *Datei << -1.0;
01445 *Datei << "\n";
01446 }
01447 }
01448 }
01449
01450
01451 void Grid_base::Test(int type) {
01452 if(type==0) {
01453 cout << " \n Print boundary cells: " << endl;
01454 iterate_hash2 {
01455 cout << " center point: "; bocell->ind.coordinate().Print();
01456 cout << endl;
01457 }
01458 }
01459 if(type==1) {
01460 cout << " \n Print cells: " << endl;
01461 iterate_hash0 {
01462 if(point0->Give_Index().Cell_index()
01463 && point0->typ==int_cell
01464 && point0->Give_Index().Tiefe()==4) {
01465 cout << " cell point: " << point0->typ << " where: ";
01466 transform_coord(point0->Give_Index().coordinate()).Print();
01467 cout << endl;
01468 }
01469 }
01470 }
01471 if(type==7) {
01472 cout << " \n Print cells boundary 0: " << endl;
01473 int Anzahl;
01474 Anzahl=0;
01475 iterate_hash0 {
01476 if(point0->Give_Index().Cell_index())
01477 if(point0->typ==fine_bo_cell) {
01478 Anzahl++;
01479 cout << " cell point: " << point0->typ << " where: ";
01480 point0->Give_Index().coordinate().Print();
01481 cout << endl;
01482 }
01483 }
01484 cout << " Anzahl: " << Anzahl << endl;
01485 }
01486 if(type==2) {
01487 cout << " \n Test Corners of boundary cells: " << endl;
01488 bool error;
01489 int k;
01490 iterate_hash2 {
01491 error=false;
01492 for(k=0;k<8;++k) {
01493 if(Exists_Point(bocell->ind.neighbour((dir_sons)k))==false)
01494 error=true;
01495 }
01496 if(error) {
01497 cout << " error at center point: "; bocell->ind.coordinate().Print();
01498 cout << endl;
01499 }
01500 }
01501 }
01502 if(type==3) {
01503 cout << " \n Test Corners of cells of type fine_bo_cell: " << endl;
01504 bool error;
01505 int k;
01506 iterate_hash0 {
01507 if(point0->Give_Index().Cell_index()) {
01508 if(point0->typ==fine_bo_cell) {
01509 error=false;
01510 for(k=0;k<8;++k) {
01511 if(Exists_Point(point0->ind.neighbour((dir_sons)k))==false)
01512 error=true;
01513 }
01514 if(error) {
01515 cout << " error at center point: "; point0->ind.coordinate().Print();
01516 point0->ind.Print();
01517 cout << endl;
01518 }
01519 }
01520 }
01521 }
01522 }
01523 if(type==4) {
01524 if(my_rank==0) cout << " \n boundary points: " << endl;
01525 for(int p=0;p<give_number_of_processes();++p) {
01526 if(my_rank==p) {
01527 cout << " process: " << my_rank << endl;
01528 iterate_hash3 {
01529 if(I_am_responsible_for(bo2point->Give_boindex())) {
01530 cout << " point: ";
01531 transform_coord(bo2point->ind.coordinate()).Print();
01532 cout << ", " << bo2point->direction << endl;
01533 }
01534 }
01535 }
01536 MPI_Barrier(comm);
01537 }
01538 }
01539 if(type==5) {
01540 if(my_rank==0) cout << " \n interior points: " << endl;
01541 for(int p=0;p<give_number_of_processes();++p) {
01542 if(my_rank==p) {
01543 cout << " process: " << my_rank << endl;
01544 iterate_hash1 {
01545 if(I_am_responsible_for(point1->Give_Index()) &&
01546 point1->typ>=interior) {
01547 cout << " point: ";
01548 transform_coord(point1->ind.coordinate()).Print();
01549 cout << " typ: " << point1->typ << endl;
01550 }
01551 }
01552 }
01553 MPI_Barrier(comm);
01554 }
01555 }
01556 if(type==6) {
01557 if(my_rank==0) cout << " \n interior points: " << endl;
01558 for(int p=0;p<give_number_of_processes();++p) {
01559 if(my_rank==p) {
01560 cout << " process: " << my_rank << endl;
01561 iterate_hash1 {
01562
01563
01564
01565 if(true) {
01566 cout << " point: ";
01567 transform_coord(point1->ind.coordinate()).Print();
01568 cout << " typ: " << point1->typ << endl;
01569 }
01570 }
01571 }
01572 MPI_Barrier(comm);
01573 }
01574 }
01575 }
01576
01577
01579
01581
01582 void Grid_base::Print_Test_Cell(ofstream *Datei) {
01583 int number_cells, number;
01584 int number_points;
01585 Index3D ind;
01586
01587
01588 *Datei << "# File created by ExPDE " << endl;
01589 *Datei << "# UCD file format for AVS " << endl;
01590 *Datei << "# test cell" << endl;
01591
01592
01593
01594 ind = Index3D(2,2,2);
01595 number_cells = Recursion_Count_Cells(ind);
01596
01597 iterate_hash2 {
01598 number_cells = avs_bo_cell(bocell,Datei,false,number_cells);
01599 }
01600
01601
01602 number_points=0;
01603 iterate_hash1 {
01604 if(point1->typ >= interior || point1->typ==parallel_p) {
01605 point1->nummer = number_points;
01606 number_points++;
01607 }
01608 else point1->nummer = -1;
01609 }
01610
01611 iterate_hash3 {
01612 bo2point->Set_number_avs(number_points);
01613 ++number_points;
01614 }
01615
01616 iterate_hash2 {
01617 if(bocell->Exists_bocellpoint()) {
01618 bocell->Set_number_avs(number_points);
01619 number_points++;
01620 }
01621 }
01622
01623 *Datei << number_points << " "
01624 << number_cells << " 0 1 0" << endl;
01625
01626
01627
01628 iterate_hash1 {
01629 if(point1->nummer != -1) {
01630 *Datei << point1->nummer << " " ;
01631 transform_coord(point1->ind.coordinate()).Print(Datei);
01632 *Datei << "\n";
01633 }
01634 }
01635
01636 iterate_hash3 {
01637 *Datei << bo2point->nummer << " " ;
01638 (bo2point->transform_coord(Give_A(),
01639 H_mesh())).Print(Datei);
01640 *Datei << "\n";
01641 }
01642
01643 iterate_hash2 {
01644 if(bocell->Exists_bocellpoint()) {
01645 *Datei << bocell->Number_avs() << " " ;
01646 (transform_coord(bocell->ind.coordinate()) +
01647 bocell->Local_coord_bocellpoint()).Print(Datei);
01648 *Datei << "\n";
01649 }
01650 }
01651
01652
01653 ind = Index3D(2,2,2);
01654 number=Recursion_Cells_AVS(ind,Datei,0);
01655
01656 iterate_hash2 {
01657 number = avs_bo_cell(bocell,Datei,true,number);
01658 }
01659
01660
01661 *Datei << "1 1" << "\n";
01662
01663
01664 *Datei << "variable, unit " << "\n";
01665
01666
01667
01668 ind = Index3D(2,2,2);
01669 number=Recursion_Cell_typ_AVS(ind,Datei,0);
01670
01671 iterate_hash2 {
01672 number = avs_bo_cell_typ(bocell,Datei,number,-1.0);
01673 }
01674 }
01675
01676 int Grid_base::avs_bo_cell_typ(BoCell* bo,ofstream *datei,
01677 int number,double value) {
01678 Tetraeder_storage* tets;
01679
01680 for(tets = bo->Give_tets();tets!=NULL;tets = tets->Next()) {
01681 ++number;
01682 *datei << number << " " << value << "\n";
01683 }
01684 return number;
01685 }
01686
01687
01688 int Grid_base::Recursion_Cell_typ_AVS(Index3D I, ofstream *Datei, int nummer) {
01689 int i;
01690 Index3D Ison;
01691 double value;
01692
01693 for(i=0;i<8;++i) {
01694 if(Exists_Point(I.son((dir_sons)i)))
01695 nummer = Recursion_Cell_typ_AVS(I.son((dir_sons)i),Datei,nummer);
01696 else {
01697 if(Give_cell_typ(I.son((dir_sons)i)) == int_cell) {
01698 Ison = I.son((dir_sons)i);
01699 value = Give_cell_typ(Ison);
01700
01701 nummer++;
01702 *Datei << nummer << " " << value << "\n";
01703
01704 nummer++;
01705 *Datei << nummer << " " << value << "\n";
01706
01707 nummer++;
01708 *Datei << nummer << " " << value << "\n";
01709
01710 nummer++;
01711 *Datei << nummer << " " << value << "\n";
01712
01713 nummer++;
01714 *Datei << nummer << " " << value << "\n";
01715
01716 nummer++;
01717 *Datei << nummer << " " << value << "\n";
01718
01719 }
01720 }
01721 }
01722 return nummer;
01723 }
01724
01725 void Grid_base::Print_Test_all_Cell(ofstream *Datei, int level) {
01726 int number_cells, i;
01727 int number_points;
01728 Index3D I;
01729 D3vector v;
01730
01731
01732 *Datei << "# File created by ExPDE " << endl;
01733 *Datei << "# UCD file format for AVS " << endl;
01734 *Datei << "# test cell" << endl;
01735
01736
01737
01738 number_cells = 0;
01739 iterate_hash0 {
01740 I = point0->Give_Index();
01741 if(I.Cell_index() && I.Tiefe() == level) {
01742 number_cells = number_cells + 1;
01743 }
01744 }
01745
01746 number_points = number_cells * 8;
01747
01748
01749 *Datei << number_points << " "
01750 << number_cells << " 0 1 0" << endl;
01751
01752
01753
01754 number_cells = 0;
01755 iterate_hash0 {
01756 I = point0->Give_Index();
01757 if(I.Cell_index() && I.Tiefe() == level) {
01758 for(i=0;i<8;++i) {
01759 v = transform_coord(I.neighbour((dir_sons)i).coordinate());
01760 *Datei << number_cells*8+i
01761 << " " << v.x
01762 << " " << v.y
01763 << " " << v.z
01764 << "\n";
01765 }
01766 number_cells = number_cells + 1;
01767 }
01768 }
01769
01770
01771
01772 number_cells = 0;
01773 iterate_hash0 {
01774 I = point0->Give_Index();
01775 if(I.Cell_index() && I.Tiefe() == level) {
01776 *Datei << number_cells << " 1 hex "
01777 << number_cells*8+WNTd << " "
01778 << number_cells*8+WSTd << " "
01779 << number_cells*8+ESTd << " "
01780 << number_cells*8+ENTd << " "
01781 << number_cells*8+WNDd << " "
01782 << number_cells*8+WSDd << " "
01783 << number_cells*8+ESDd << " "
01784 << number_cells*8+ENDd << " "
01785 << "\n";
01786 number_cells = number_cells + 1;
01787 }
01788 }
01789
01790
01791 *Datei << "1 1" << "\n";
01792
01793
01794 *Datei << "variable, unit " << "\n";
01795
01796
01797
01798 number_cells = 0;
01799 iterate_hash0 {
01800 I = point0->Give_Index();
01801 if(I.Cell_index() && I.Tiefe() == level) {
01802
01803 *Datei << number_cells << " " << Give_cell_typ(I) << "\n";
01804 number_cells = number_cells + 1;
01805 }
01806 }
01807 }