00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00026
00027
00028
00029 #ifdef COMP_GNUOLD
00030 #include <iostream.h>
00031 #include <fstream.h>
00032 #include <time.h>
00033 #include <math.h>
00034 #else
00035 #include <iostream>
00036 #include <fstream>
00037 #include <ctime>
00038 #include <cmath>
00039 #endif
00040
00041
00042
00043 #include "../parser.h"
00044
00045
00046 #include "../paramete.h"
00047 #include "../abbrevi.h"
00048 #include "../math_lib/math_lib.h"
00049
00050
00051 #include "../basic/basic.h"
00052
00053
00054 #include "../domain/domain.h"
00055
00056
00057 #include "../formulas/boundy.h"
00058 #include "../formulas/loc_sten.h"
00059
00060
00061 #include "gpar.h"
00062 #include "parallel.h"
00063 #include "mgcoeff.h"
00064 #include "sto_man.h"
00065 #include "gridbase.h"
00066 #include "grid.h"
00067
00069
00071
00072 void Grid_base::Print_ec_opendx(IndexBo indexbo_A, IndexBo indexbo_B,
00073 ofstream *Datei, int number) {
00074 *Datei << number << " 1 line ";
00075 *Datei << hashtable3_point(indexbo_A)->nummer << " ";
00076 *Datei << hashtable3_point(indexbo_B)->nummer << " ";
00077 *Datei << endl;
00078 }
00079
00080
00081 int Grid_base::opendx_bo_cell(BoCell* bo,ofstream *datei,bool print_or_calc,
00082 int number) {
00083 Tetraeder_storage* tets;
00084 int num;
00085 Index3D I;
00086 Cell_type_points typ;
00087
00088 #ifdef PERIODIC
00089 if(bo->Give_Index().neighbour_non_periodic(WSDd).Is_non_periodic()) {
00090 return number;
00091 }
00092 #endif
00093
00094
00095 if(print_or_calc==false) {
00096 for(tets = bo->Give_tets();tets!=NULL;tets = tets->Next()) {
00097 number++;
00098 }
00099 }
00100 else {
00101 I = bo->Give_Index();
00102
00103 for(tets = bo->Give_tets();tets!=NULL;tets = tets->Next()) {
00104 ++number;
00105
00106 num = tets->N0();
00107 typ = bo->edge_point(num);
00108 if(typ==edge_poi_typ) {
00109 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00110 bo->edge_dir(num)) << " ";
00111 }
00112 if(typ==corner_poi_typ) {
00113 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00114 << " ";
00115 }
00116 if(typ==cell_poi_typ) {
00117 *datei << Give_Nummer_cellpoi(I) << " ";
00118 }
00119
00120 num = tets->N1();
00121 typ = bo->edge_point(num);
00122 if(typ==edge_poi_typ) {
00123 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00124 bo->edge_dir(num)) << " ";
00125 }
00126 if(typ==corner_poi_typ) {
00127 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00128 << " ";
00129 }
00130 if(typ==cell_poi_typ) {
00131 *datei << Give_Nummer_cellpoi(I) << " ";
00132 }
00133
00134 num = tets->N2();
00135 typ = bo->edge_point(num);
00136 if(typ==edge_poi_typ) {
00137 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00138 bo->edge_dir(num)) << " ";
00139 }
00140 if(typ==corner_poi_typ) {
00141 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00142 << " ";
00143 }
00144 if(typ==cell_poi_typ) {
00145 *datei << Give_Nummer_cellpoi(I) << " ";
00146 }
00147
00148 num = tets->N3();
00149 typ = bo->edge_point(num);
00150 if(typ==edge_poi_typ) {
00151 *datei << Give_Nummer(I.neighbour(bo->corner(num)),
00152 bo->edge_dir(num)) << " ";
00153 }
00154 if(typ==corner_poi_typ) {
00155 *datei << Give_Nummer(I.neighbour(bo->corner(num)))
00156 << " ";
00157 }
00158 if(typ==cell_poi_typ) {
00159 *datei << Give_Nummer_cellpoi(I) << " ";
00160 }
00161 *datei << endl;
00162 }
00163 }
00164 return number;
00165 }
00166
00167
00168
00169 int Grid_base::Recursion_Cells_OPENDX(Index3D I, ofstream *Datei, int nummer) {
00170 int i;
00171 Index3D Ison;
00172 for(i=0;i<8;++i) {
00173 if(Exists_Point(I.son((dir_sons)i)))
00174 nummer = Recursion_Cells_OPENDX(I.son((dir_sons)i),Datei,nummer);
00175 else {
00176 Ison = I.son((dir_sons)i);
00177
00178
00179 #ifdef PERIODIC
00180 if(Ison.neighbour_non_periodic(WSDd).Is_non_periodic()
00181 && Give_cell_typ(Ison) == int_cell) {
00182 #else
00183 if(Give_cell_typ(Ison) == int_cell) {
00184 #endif
00185 nummer++;
00186
00187
00188 *Datei << Give_Nummer(Ison.neighbour(WNTd)) << " ";
00189 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00190 *Datei << Give_Nummer(Ison.neighbour(WSTd)) << " ";
00191 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00192 *Datei << "\n";
00193
00194 nummer++;
00195
00196 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00197 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00198 *Datei << Give_Nummer(Ison.neighbour(WSTd)) << " ";
00199 *Datei << Give_Nummer(Ison.neighbour(ESDd)) << " ";
00200 *Datei << "\n";
00201
00202 nummer++;
00203
00204 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00205 *Datei << Give_Nummer(Ison.neighbour(WSDd)) << " ";
00206 *Datei << Give_Nummer(Ison.neighbour(WSTd)) << " ";
00207 *Datei << Give_Nummer(Ison.neighbour(ESDd)) << " ";
00208 *Datei << "\n";
00209
00210 nummer++;
00211
00212 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00213 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00214 *Datei << Give_Nummer(Ison.neighbour(ESDd)) << " ";
00215 *Datei << Give_Nummer(Ison.neighbour(ENDd)) << " ";
00216 *Datei << "\n";
00217
00218 nummer++;
00219
00220 *Datei << Give_Nummer(Ison.neighbour(ENTd)) << " ";
00221 *Datei << Give_Nummer(Ison.neighbour(WNTd)) << " ";
00222 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00223 *Datei << Give_Nummer(Ison.neighbour(ENDd)) << " ";
00224 *Datei << "\n";
00225
00226 nummer++;
00227
00228 *Datei << Give_Nummer(Ison.neighbour(WNTd)) << " ";
00229 *Datei << Give_Nummer(Ison.neighbour(WNDd)) << " ";
00230 *Datei << Give_Nummer(Ison.neighbour(ESTd)) << " ";
00231 *Datei << Give_Nummer(Ison.neighbour(ENDd)) << " ";
00232 *Datei << "\n";
00233 }
00234 }
00235 }
00236 return nummer;
00237 }
00238
00239
00241
00243 void Grid_base::Print_Variable_OpenDx(ofstream *Datei, int number_var) {
00244 int number_cells, number, ebene;
00245 int number_points;
00246 Index3D ind;
00247 Pointtype typ_point;
00248
00249 if(Is_storage_initialized()==false) {
00250 cout << " \n Fehler in Print_Variable_OpenDx! Initialisierung fehlt! "
00251 << endl;
00252 return;
00253 }
00254 if(Give_max_num_var() <= number_var) {
00255 cout << " \n Fehler in Print_Variable_OPENDX! number_var zu gross! " << endl;
00256 }
00257 else {
00258
00259 *Datei << "# File created by ExPDE " << endl;
00260 *Datei << "# dx file format for OpenDx " << endl;
00261 *Datei << "# scalar value " << endl;
00262
00263
00264
00265 ind = Index3D(2,2,2);
00266 number_cells = Recursion_Count_Cells(ind);
00267
00268 iterate_hash2 {
00269 number_cells = opendx_bo_cell(bocell,Datei,false,number_cells);
00270 }
00271
00272
00273 number_points=0;
00274 iterate_hash1 {
00275 if(point1->typ >= interior) {
00276 point1->nummer = number_points;
00277 number_points++;
00278 }
00279 else point1->nummer = -1;
00280 }
00281
00282 iterate_hash3 {
00283 bo2point->Set_number_avs(number_points);
00284 ++number_points;
00285 }
00286
00287 iterate_hash2 {
00288 if(bocell->Exists_bocellpoint()) {
00289 bocell->Set_number_avs(number_points);
00290 number_points++;
00291 }
00292 }
00293
00294
00295
00296 *Datei << "object 1 class array type float rank 1 shape 3 items "
00297 << number_points << " data follows" << endl;
00298
00299
00300 iterate_hash1 {
00301 if(point1->nummer != -1) {
00302 *Datei << " " ;
00303 transform_coord(point1->ind.coordinate()).Print(Datei);
00304 *Datei << "\n";
00305 }
00306 }
00307
00308 iterate_hash3 {
00309 *Datei << " " ;
00310 (bo2point->transform_coord(Give_A(),
00311 H_mesh())).Print(Datei);
00312 *Datei << "\n";
00313 }
00314
00315 iterate_hash2 {
00316 if(bocell->Exists_bocellpoint()) {
00317 *Datei << " " ;
00318 (transform_coord(bocell->ind.coordinate()) +
00319 bocell->Local_coord_bocellpoint()).Print(Datei);
00320 *Datei << "\n";
00321 }
00322 }
00323
00324
00325 *Datei << "object 2 class array type int rank 1 shape 4 items "
00326 << number_cells << " data follows" << endl;
00327
00328 ind = Index3D(2,2,2);
00329 number=Recursion_Cells_OPENDX(ind,Datei,0);
00330
00331 iterate_hash2 {
00332 number = opendx_bo_cell(bocell,Datei,true,number);
00333 }
00334
00335 *Datei << "attribute " << '"' << "element type"
00336 << '"' << " string " << '"' << "tetrahedra" << '"' << "" << endl;
00337 *Datei << "attribute " << '"' << "ref" << '"'
00338 << " string " << '"' << "positions" << '"' << "" << endl;
00339
00340
00341 *Datei << "object 3 class array type float rank 0 items "
00342 << number_points << " data follows" << endl;
00343
00344
00345
00346 iterate_hash1 {
00347 if(point1->nummer != -1) {
00348
00349 typ_point = point1->typ;
00350 if(typ_point==exterior)
00351 cout << " Fehler in Print_Variable_OPENDX! " << endl;
00352 if(typ_point!=multigrid) {
00353 ebene = Give_finest_level(point1->ind);
00354 *Datei << Give_variable(point1->ind,ebene)[number_var];
00355 *Datei << "\n";
00356 }
00357 else *Datei << " 1.0 \n";
00358 }
00359 }
00360
00361 iterate_hash3 {
00362
00363 *Datei << Give_variable(bo2point->ind,bo2point->direction)[number_var];
00364 *Datei << " \n";
00365 }
00366
00367 iterate_hash2 {
00368 if(bocell->Exists_bocellpoint()) {
00369
00370 *Datei << bocell->Give_var()[number_var];
00371 *Datei << "\n";
00372 }
00373 }
00374
00375 *Datei << "attribute "
00376 << '"' << "dep"
00377 << '"' << " string " << '"' << "positions" << '"' << "" << endl;
00378
00379
00380 *Datei << "object " << '"'
00381 << "irregular positions irregular connections"
00382 << '"' << " class field" <<
00383 endl;
00384 *Datei << "component " << '"' << "positions" << '"' << " value 1" << endl;
00385 *Datei << "component "
00386 << '"' << "connections" << '"' << " value 2" << endl;
00387 *Datei << "component " << '"' << "data" << '"' << " value 3" << endl;
00388 *Datei << "end" << endl;
00389
00390
00391
00392 }
00393 }
00394
00395
00396
00397
00398 void Grid_base::Print_Variable_OpenDx_moved(ofstream *Datei, int number_var,
00399 int number_var_a,
00400 int number_var_b,
00401 int number_var_c) {
00402 int number_cells, number, ebene;
00403 int number_points;
00404 Index3D ind;
00405 Pointtype typ_point;
00406
00407 if(Is_storage_initialized()==false) {
00408 cout <<
00409 " \n Fehler in Print_Variable_OpenDx_moved! Initialisierung fehlt! "
00410 << endl;
00411 return;
00412 }
00413 if(Give_max_num_var() <= number_var) {
00414 cout << " \n Fehler in Print_Variable_OPENDX! number_var zu gross! " << endl;
00415 }
00416 else {
00417
00418 *Datei << "# File created by ExPDE " << endl;
00419 *Datei << "# dx file format for OpenDx " << endl;
00420 *Datei << "# scalar value moved by a vector" << endl;
00421
00422
00423
00424 ind = Index3D(2,2,2);
00425 number_cells = Recursion_Count_Cells(ind);
00426
00427 iterate_hash2 {
00428 number_cells = opendx_bo_cell(bocell,Datei,false,number_cells);
00429 }
00430
00431
00432 number_points=0;
00433 iterate_hash1 {
00434 if(point1->typ >= interior) {
00435 point1->nummer = number_points;
00436 number_points++;
00437 }
00438 else point1->nummer = -1;
00439 }
00440
00441 iterate_hash3 {
00442 bo2point->Set_number_avs(number_points);
00443 ++number_points;
00444 }
00445
00446 iterate_hash2 {
00447 if(bocell->Exists_bocellpoint()) {
00448 bocell->Set_number_avs(number_points);
00449 number_points++;
00450 }
00451 }
00452
00453
00454 *Datei << "object 1 class array type float rank 1 shape 3 items "
00455 << number_points << " data follows" << endl;
00456
00457
00458 iterate_hash1 {
00459 if(point1->nummer != -1) {
00460 *Datei << " " ;
00461 (transform_coord(point1->ind.coordinate()) +
00462 D3vector(Give_variable(point1->ind,Max_level())[number_var_a],
00463 Give_variable(point1->ind,Max_level())[number_var_b],
00464 Give_variable(point1->ind,Max_level())[number_var_c])
00465 ).Print(Datei);
00466 *Datei << "\n";
00467 }
00468 }
00469
00470 iterate_hash3 {
00471 *Datei << " " ;
00472 ((bo2point->transform_coord(Give_A(),
00473 H_mesh())) +
00474 D3vector(Give_variable(bo2point->ind,bo2point->direction)[number_var_a],
00475 Give_variable(bo2point->ind,bo2point->direction)[number_var_b],
00476 Give_variable(bo2point->ind,bo2point->direction)[number_var_c])
00477 ).Print(Datei);
00478 *Datei << "\n";
00479 }
00480
00481 iterate_hash2 {
00482 if(bocell->Exists_bocellpoint()) {
00483 *Datei << " " ;
00484 (transform_coord(bocell->ind.coordinate()) +
00485 bocell->Local_coord_bocellpoint() +
00486 D3vector(bocell->Give_var()[number_var_a],
00487 bocell->Give_var()[number_var_b],
00488 bocell->Give_var()[number_var_c])
00489 ).Print(Datei);
00490 *Datei << "\n";
00491 }
00492 }
00493
00494
00495 *Datei << "object 2 class array type int rank 1 shape 4 items "
00496 << number_cells << " data follows" << endl;
00497
00498 ind = Index3D(2,2,2);
00499 number=Recursion_Cells_OPENDX(ind,Datei,0);
00500
00501 iterate_hash2 {
00502 number = opendx_bo_cell(bocell,Datei,true,number);
00503 }
00504
00505 *Datei << "attribute " << '"' << "element type"
00506 << '"' << " string " << '"' << "tetrahedra" << '"' << "" << endl;
00507 *Datei << "attribute " << '"' << "ref" << '"'
00508 << " string " << '"' << "positions" << '"' << "" << endl;
00509
00510
00511 *Datei << "object 3 class array type float rank 0 items "
00512 << number_points << " data follows" << endl;
00513
00514
00515
00516 iterate_hash1 {
00517 if(point1->nummer != -1) {
00518
00519 typ_point = point1->typ;
00520 if(typ_point==exterior)
00521 cout << " Fehler in Print_Variable_OPENDX! " << endl;
00522 if(typ_point!=multigrid) {
00523 ebene = Give_finest_level(point1->ind);
00524 *Datei << Give_variable(point1->ind,ebene)[number_var];
00525
00526 *Datei << "\n";
00527 }
00528 else *Datei << " 1.0 \n";
00529 }
00530 }
00531
00532 iterate_hash3 {
00533
00534 *Datei << Give_variable(bo2point->ind,bo2point->direction)[number_var];
00535 *Datei << " \n";
00536 }
00537
00538 iterate_hash2 {
00539 if(bocell->Exists_bocellpoint()) {
00540
00541 *Datei << bocell->Give_var()[number_var];
00542 *Datei << "\n";
00543 }
00544 }
00545
00546 *Datei << "attribute "
00547 << '"' << "dep"
00548 << '"' << " string " << '"' << "positions" << '"' << "" << endl;
00549
00550
00551 *Datei << "object " << '"'
00552 << "irregular positions irregular connections"
00553 << '"' << " class field" <<
00554 endl;
00555 *Datei << "component " << '"' << "positions" << '"' << " value 1" << endl;
00556 *Datei << "component "
00557 << '"' << "connections" << '"' << " value 2" << endl;
00558 *Datei << "component " << '"' << "data" << '"' << " value 3" << endl;
00559 *Datei << "end" << endl;
00560 }
00561 }
00562