00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef ARRAY_H_
00024 #define ARRAY_H_
00025
00026
00028
00029
00030
00031
00032
00034
00035
00036
00038
00039 class DExprVAR_ARR {
00040 private:
00041
00042 int number_variable;
00043 int *value_;
00044 Grid* grid;
00045 Variable* start;
00046 int dim;
00047 public:
00048 DExprVAR_ARR(Variable* vec, int number_var, int* v, int dimension) {
00049 dim = dimension;
00050 start = vec;
00051 number_variable = number_var;
00052 value_ = v;
00053 grid = vec[0].Give_grid();
00054 }
00055
00056 Grid* Give_grid() const {
00057 return grid;
00058 }
00059 int Number_variable_start() const {
00060 return number_variable;
00061 }
00062 int* Give_value() const {
00063 return value_;
00064 }
00065 int Give_dim() const {
00066 return dim;
00067 }
00068
00069 int Number_variable() const {
00070 return number_variable + (*value_);
00071 }
00072 double Give_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00073 int l, double_stencils_in) const {
00074 return it_i->varM(gr,l)[number_variable+*value_];
00075 };
00076 double Give_interior_coarse(const P_interior* it_i,const Grid* gr,
00077 double h_mesh, int l, double_stencils_in) const {
00078 return it_i->varM(gr,l)[number_variable+*value_];
00079 };
00080 double Give_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00081 const Nearb_Ablage* nearb_ablage)
00082 const {
00083 return it_n->varM(gr,l)[number_variable+*value_];
00084 };
00085 double Give_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00086 return it_b->varM(gr)[number_variable+*value_];
00087 };
00088 double Give_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00089 const BoCeData* bocedata) const {
00090 return it_cf->varM(gr)[number_variable+*value_];
00091 };
00092
00093
00094 int Sice_stencil() const { return 1; }
00095
00096
00097 int Level() const {
00098 if(*value_>=dim) *value_=0;
00099 return start[*value_].Level();
00100 }
00101 Dominace_label Dominant_lev() const { return not_dominant; }
00102 Dominace_label Dominant_poi() const { return not_dominant; }
00103 bool run_interior() const {
00104 if(*value_>=dim) *value_=0;
00105 return start[*value_].run_interior();
00106 }
00107 bool run_nearb() const {
00108 if(*value_>=dim) *value_=0;
00109 return start[*value_].run_nearb();
00110 }
00111 int run_boundary() const {
00112 if(*value_>=dim) *value_=0;
00113 return start[*value_].run_boundary();
00114 }
00115
00116
00117 int ops_interior() const { return 0; }
00118
00119
00120 void Active_Sim_Level( int lev) const { };
00121 void Active_Sim_interior(bool run) const { };
00122 void Active_Sim_nearb(bool run) const { };
00123 void Active_Sim_boundary( int run) const { };
00124 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00125 int level, type_of_update typ) const { };
00126
00127
00128 void Put_grid_rbo(Grid* gr, int r_bo) const { };
00129
00130
00131
00132 Differential_op_typ Abstract_differential_operator()
00133 const { return abstract_both; }
00134 int Give_number_var_of_abstract_op()
00135 const { return number_variable; }
00136 bool Give_array_variable_inserted() const {
00137 return true;
00138 }
00139 int Give_length_of_array_variable_inserted() const {
00140 return dim;
00141 }
00142
00143
00144 double Give_interior_sten_element(Index3D I, double meshsize,
00145 int stelle,
00146 const Grid* grid, int l) const {
00147 cout << " Error in DExprVAR_ARR! " << endl;
00148 return (grid->Give_variable(I.neighbour(ESTd),l)[number_variable+*value_] +
00149 grid->Give_variable(I.neighbour(WNDd),l)[number_variable+*value_])
00150 * 0.5;
00151 }
00152 double Give_boundary_sten_element(const Grid* grid, BoCeData* b_cell,
00153 double* u_ablage, int num_v) const {
00154 cout << " Error in DExprVAR_ARR! " << endl;
00155 return b_cell->vars[num_v][number_variable+*value_];
00156
00157 }
00158
00159 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00160 const {
00161 for(int i=0;i<dim;++i)
00162 start[i].Add_variables_for_parallel(evpar);
00163 };
00164 bool GS_type(int var_number_left, int dim) const {
00165 return false; };
00166
00167
00168 void clean() const { };
00169 };
00170
00171
00172 class Array_Variable {
00173 public:
00174 Array_Variable(int dimension, Grid* gridp) {
00175 dim = dimension;
00176 start = new Variable[dim];
00177 for(int i=0;i<dim;++i) {
00178 start[i].Initialize(gridp);
00179 }
00180 number_variable = start->Number_variable();
00181 }
00182 Variable& operator[](int i) {
00183 return start[i];
00184 }
00185 DExpr<DExprVAR_ARR>
00186 operator[](Local_int& I) const {
00187 return DExpr<DExprVAR_ARR>(DExprVAR_ARR(start,
00188 start[0].Number_variable(),
00189 I.Give_pointer(),
00190 dim));
00191 }
00192 int Give_dim() {
00193 return dim;
00194 }
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 private:
00215 Variable *start;
00216 int dim;
00217 int number_variable;
00218 };
00219
00220 Macro_operator_definition(DExpr<DExprVAR_ARR>);
00221 Macro_operator_var_definition(DExpr<DExprVAR_ARR>,DExpr<DExprVAR_ARR>);
00222
00223
00224
00225
00227
00228 class DExprLoc_VAR_ARR {
00229 private:
00230 double* value_;
00231 int *Index_value_;
00232
00233 int dim;
00234 public:
00235 DExprLoc_VAR_ARR(double* var_value_, int* v, int dimension) {
00236 value_ = var_value_;
00237 Index_value_ = v;
00238 dim = dimension;
00239 }
00240 double Give_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00241 int l, double_stencils_in) const {
00242 return value_[*Index_value_];
00243 }
00244 double Give_interior_coarse(const P_interior* it_i,const Grid* gr,
00245 double h_mesh,
00246 int l, double_stencils_in) const {
00247 return value_[*Index_value_];
00248 }
00249 double Give_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00250 const Nearb_Ablage* nearb_ablage)
00251 const {
00252 return value_[*Index_value_];
00253 };
00254 double Give_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00255 return value_[*Index_value_];
00256 };
00257 double Give_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00258 const BoCeData* bocedata) const {
00259 return value_[*Index_value_];
00260 };
00261
00262 int Sice_stencil() const { return 1; }
00263
00264
00265 int Level() const { return 0; }
00266 Dominace_label Dominant_lev() const { return anti_dominant; }
00267 Dominace_label Dominant_poi() const { return anti_dominant; }
00268 bool run_interior() const { return true; }
00269 bool run_nearb() const { return true; }
00270 int run_boundary() const { return 1; }
00271
00272
00273 int ops_interior() const { return 0; }
00274
00275 void Active_Sim_Level( int lev) const { };
00276 void Active_Sim_interior(bool run) const { };
00277 void Active_Sim_nearb(bool run) const { };
00278 void Active_Sim_boundary( int run) const { };
00279 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00280 int level, type_of_update typ) const { };
00281
00282
00283 void Put_grid_rbo(Grid* gr, int r_bo) const { };
00284
00285 Differential_op_typ Abstract_differential_operator() const
00286 { return abstract_both; }
00287 int Give_number_var_of_abstract_op() const { return -1; }
00288 bool Give_array_variable_inserted() const {
00289 return false;
00290 }
00291 int Give_length_of_array_variable_inserted() const {
00292 return 0;
00293 }
00294
00295
00296 double Give_interior_sten_element(Index3D I, double meshsize,
00297 int stelle,
00298 const Grid* grid, int l) const {
00299 if(*value_>=dim) *value_=0;
00300 return value_[*Index_value_];
00301 }
00302 double Give_boundary_sten_element(const Grid* grid, BoCeData* b_cell,
00303 double* u_ablage, int num_v) const {
00304 if(*value_>=dim) *value_=0;
00305 return value_[*Index_value_];
00306 }
00307
00308
00309 void Put_interior(const P_interior* it_i, int lev, double x) { Put(x); };
00310 void Put_nearb(const P_nearb* it_n, int lev, double x) { Put(x); };
00311 void Put_Bo2p(const P_Bo2p* it_b, double x) { Put(x); };
00312 void Put_cellpoi(const P_cellpoi* it_cf, double x) { Put(x); };
00313
00314 void Put(double x) {
00315 value_[*Index_value_]=x;
00316 };
00317 double Get() const {
00318 return value_[*Index_value_];
00319 };
00320 double* Give_pointer() const {
00321 return value_;
00322 };
00323
00324 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00325 const {};
00326 bool GS_type(int var_number_left, int dim) const {
00327 return false; };
00328
00329
00330 void clean() const {};
00331 };
00332
00333 class Array_Local_var {
00334 public:
00335 Array_Local_var(int dimension, double *startD) {
00336 dim = dimension;
00337 start_double = startD;
00338 start = new Local_var[dim];
00339 for(int i=0;i<dim;++i) {
00340 start[i].Initialize(&(startD[i]));
00341 }
00342 }
00343 Local_var& operator[](int i) const {
00344 return start[i];
00345 }
00346 DExpr<DExprLoc_VAR_ARR>
00347 operator[](Local_int& I) const {
00348 return DExpr<DExprLoc_VAR_ARR>(DExprLoc_VAR_ARR(start[0].Give_pointer(),
00349 I.Give_pointer(),dim));
00350 }
00351 int Give_dim() {
00352 return dim;
00353 }
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373 private:
00374 Local_var *start;
00375 int dim;
00376 double* start_double;
00377 };
00378
00379
00380
00381
00383
00384
00385 template<class A>
00386 class DResDiff_Bo_ARR {
00387 A a_;
00388
00389
00390 int num_stencils;
00391 int *Index_value_;
00392 bool array_variable_inserted;
00393
00394 int dim;
00395
00396
00397 int number_variable;
00398 bool* label_on_cell;
00399
00400
00401 Grid *grid;
00402
00403
00404 double** Stencils_fine;
00405 double* u_ablage;
00406
00407 bool *corner_in_domain;
00408
00409 public:
00410
00411 DResDiff_Bo_ARR(const A& a, int num_s, Grid* gr, int *Ivalue_)
00412 : a_(a), num_stencils(num_s), grid(gr), Index_value_(Ivalue_) {
00413 number_variable = a_.Give_number_var_of_abstract_op();
00414 array_variable_inserted = a_.Give_array_variable_inserted();
00415 dim = a_.Give_length_of_array_variable_inserted();
00416 };
00417 double Give_interior(const P_interior* it_i, const Grid* gr, double h_mesh,
00418 int l, double_stencils_in) const {
00419 return a_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00420 };
00421 double Give_interior_coarse(const P_interior* it_i, const Grid* gr,
00422 double h_mesh,
00423 int l, double_stencils_in) const {
00424 return a_.Give_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00425 };
00426 double Give_nearb(const P_nearb* it_n, const Grid* gr, double h_mesh, int l,
00427 const Nearb_Ablage* nearb_ablage) const {
00428 static int i;
00429 static Celltype cetyp;
00430 static double sum;
00431 dir_sons dir_v;
00432 static int actual_number;
00433
00434
00435 sum = a_.Give_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00436
00437 if(array_variable_inserted)
00438 actual_number = number_variable+(*Index_value_);
00439 else
00440 actual_number = number_variable;
00441
00442 for(i=0;i<8;++i) {
00443 dir_v = opposite3D((dir_sons)i);
00444
00445 cetyp = nearb_ablage->Give_Celltyp((dir_sons)i);
00446
00447 if(cetyp==bo_cell) {
00448 sum = sum +
00449 Evaluate_lsm(nearb_ablage->Give_u_Recell((dir_sons)i),
00450 actual_number, dir_v,
00451 gr->Give_bo_stencil(it_n->Ind().next((dir_sons)i,l+1),
00452 num_stencils+(*Index_value_)));
00453 }
00454 }
00455 return sum;
00456 };
00457 double Give_cellpoi(const P_cellpoi* it_cf, const Grid* gr,
00458 const BoCeData* bocedata) const {
00459 return a_.Give_cellpoi(it_cf,gr,bocedata);
00460 };
00461 double Give_Bo2p(const P_Bo2p* it_b, const Grid* gr,int l) const {
00462 return a_.Give_Bo2p(it_b,gr,l);
00463 };
00464
00465 int Sice_stencil() const { return a_.Sice_stencil(); }
00466
00467
00468 int Level() const { return (a_).Level(); }
00469 Dominace_label Dominant_lev() const { return not_dominant; }
00470 Dominace_label Dominant_poi() const { return not_dominant; }
00471 bool run_interior() const { return (a_).run_interior(); }
00472 bool run_nearb() const { return (a_).run_nearb(); }
00473 int run_boundary() const { return (a_).run_boundary(); }
00474
00475
00476 int ops_interior() const { return a_.ops_interior(); }
00477
00478
00479 void Active_Sim_Level( int lev) const { };
00480 void Active_Sim_interior(bool run) const { };
00481 void Active_Sim_nearb(bool run) const { };
00482 void Active_Sim_boundary( int run) const { };
00483 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00484 int level, type_of_update typ) const { };
00485
00486
00487 void Put_grid_rbo(Grid* gr, int r_bo) const {
00488 a_.Put_grid_rbo(gr,r_bo);
00489 };
00490
00491
00492
00493 Differential_op_typ Abstract_differential_operator() const
00494 { return not_abstract; }
00495
00496
00497
00498
00499
00500 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00501 const {
00502 if(array_variable_inserted == false)
00503 evpar->Variable_contained_in_expression(number_variable);
00504 else
00505 for(int i=0;i<dim;++i)
00506 evpar->Variable_contained_in_expression(number_variable+i);
00507 };
00508 bool GS_type(int var_number_left, int dim_left) const {
00509 if(array_variable_inserted == false) {
00510 if(number_variable>=var_number_left &&
00511 number_variable<=(var_number_left+dim_left)) return true;
00512 else return false;
00513 }
00514 else {
00515 if((number_variable+dim)>=var_number_left &&
00516 number_variable<=(var_number_left+dim_left)) return true;
00517 else return false;
00518 }
00519 };
00520
00521
00522 void clean() const { a_.clean(); };
00523 };
00524
00525 class Index_Res_stencil_boundary_ARR {
00526 private:
00527
00528 Grid *grid;
00529
00530
00531 int num_stencils;
00532 int* Index_value_;
00533 public:
00534 Index_Res_stencil_boundary_ARR(int num_s, Grid* gr, int *Ivalue_)
00535 : grid(gr), num_stencils(num_s), Index_value_(Ivalue_) {
00536 };
00537
00538 template<class A>
00539 DExpr<DResDiff_Bo_ARR<DExpr<A> > >
00540 operator() (const DExpr<A>& a_) {
00541 Differential_op_typ a_abstract;
00542 a_abstract = a_.Abstract_differential_operator();
00543 if(a_abstract==not_abstract) {
00544 cout << " This is not an abstract differential operator! Error!" << endl;
00545 }
00546 if(a_abstract==abstract_diag)
00547 cout<<"\n Please use operator [] instead of operator ()! Error!" << endl;
00548
00549 typedef DResDiff_Bo_ARR<DExpr<A> > ExprT;
00550 return DExpr<ExprT>(ExprT(a_,num_stencils,grid,Index_value_));
00551 }
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567 };
00568
00569
00570 class Array_Res_stencil_boundary {
00571 public:
00572 Array_Res_stencil_boundary(int dimension, Grid* gr) {
00573 dim = dimension;
00574 start = new Res_stencil_boundary[dim];
00575 for(int i=0;i<dim;++i) {
00576 start[i].Initialize(gr);
00577 }
00578 }
00579 Res_stencil_boundary& operator[](int i) const {
00580 return start[i];
00581 }
00582 Index_Res_stencil_boundary_ARR
00583 operator[](Local_int& I) const {
00584 for(int i=0;i<dim;++i) {
00585 if(start[i].Give_used()==false) {
00586 cout << " Error: Use Array_Res_stencil_boundary first time "
00587 << " with operator operator[](int i) !! " << endl;
00588 }
00589 }
00590 return Index_Res_stencil_boundary_ARR(start[0].num_stencils,
00591 start[0].grid,
00592 I.Give_pointer());
00593 }
00594 int Give_dim() {
00595 return dim;
00596 }
00597 private:
00598 Res_stencil_boundary *start;
00599 int dim;
00600 };
00601
00602
00603
00604
00605
00606
00607
00609
00610
00611
00612 template<class A>
00613 class Expr_for_iterator {
00614 private:
00615 A a_;
00616 int* value_;
00617 int begin;
00618 int end;
00619
00620 double dummy;
00621 public:
00622 Expr_for_iterator(const A& x, int b, int e, int* v)
00623 : a_(x), value_(v), begin(b), end(e)
00624 {}
00625
00626 void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00627 int l, double_stencils_in) const {
00628 for((*value_)=begin;(*value_)<=end;(*value_)++)
00629 a_.Run_interior(it_i,gr,h_mesh,l, double_stencils_out);
00630 };
00631 void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00632 double h_mesh,
00633 int l, double_stencils_in) const {
00634 for((*value_)=begin;(*value_)<=end;(*value_)++)
00635 a_.Run_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00636 };
00637 void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00638 const Nearb_Ablage* nearb_ablage)
00639 const {
00640 for((*value_)=begin;(*value_)<=end;(*value_)++)
00641 a_.Run_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00642 };
00643 void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00644 for((*value_)=begin;(*value_)<=end;(*value_)++)
00645 a_.Run_Bo2p(it_b,gr,l);
00646 };
00647 void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00648 const BoCeData* bocedata) const {
00649 for((*value_)=begin;(*value_)<=end;(*value_)++)
00650 a_.Run_cellpoi(it_cf,gr,bocedata);
00651 };
00652
00653
00654 int Sice_stencil() const { return a_.Sice_stencil(); }
00655
00656
00657 int Level() const { return a_.Level(); }
00658 Dominace_label Dominant_lev() const { return a_.Dominant_lev(); }
00659 Dominace_label Dominant_poi() const { return a_.Dominant_poi(); }
00660 bool run_interior() const { return a_.run_interior(); }
00661 bool run_nearb() const { return a_.run_nearb(); }
00662 int run_boundary() const { return a_.run_boundary(); }
00663
00664
00665 int ops_interior() const { return a_.ops_interior()*(end-begin+1); }
00666
00667
00668 void Active_Sim_Level( int lev) const { a_.Active_Sim_Level(lev); }
00669 void Active_Sim_interior( bool run) const { a_.Active_Sim_interior(run); }
00670 void Active_Sim_nearb( bool run) const { a_.Active_Sim_nearb(run); }
00671 void Active_Sim_boundary(int run) const { a_.Active_Sim_boundary(run); }
00672 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00673 int level, type_of_update typ) const
00674 { a_.Active_Sim_update(evpar,level,typ); };
00675
00676
00677 void Put_grid_rbo(Grid* gr, int r_bo) const {
00678 a_.Put_grid_rbo(gr,r_bo); }
00679
00680 Differential_op_typ Abstract_differential_operator() const
00681 { return not_abstract; }
00682
00683 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00684 const {
00685 a_.Add_variables_for_parallel(evpar);
00686 };
00687 bool GS_type(int var_number_left, int dim_left) const {
00688 return a_.GS_type(var_number_left, dim_left);
00689 };
00690
00691
00692 void clean() const { a_.clean(); };
00693 };
00694
00695 template<class A>
00696 class Expr_for_sum {
00697 private:
00698 A a_;
00699 int* value_;
00700 int begin;
00701 int end;
00702
00703 double* sum;
00704 public:
00705 Expr_for_sum(const A& x, int b, int e, int* v)
00706 : a_(x), value_(v), begin(b), end(e) {
00707 if(e<b) cout << "\n Empty Sum! Error! " << endl;
00708 sum = new double;
00709 };
00710
00711
00712 double Give_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00713 int l, double_stencils_in) const {
00714 (*value_)=begin;
00715 (*sum)=a_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00716 for((*value_)=begin+1;(*value_)<=end;(*value_)++)
00717 (*sum) = (*sum)+a_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00718 return (*sum);
00719 };
00720 double Give_interior_coarse(const P_interior* it_i,const Grid* gr,
00721 double h_mesh, int l, double_stencils_in) const {
00722 (*value_)=begin;
00723 (*sum) = a_.Give_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00724 for((*value_)=begin+1;(*value_)<=end;(*value_)++)
00725 (*sum)=(*sum)+
00726 a_.Give_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00727 return (*sum);
00728 };
00729 double Give_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00730 const Nearb_Ablage* nearb_ablage)
00731 const {
00732 (*value_)=begin;
00733 (*sum) = a_.Give_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00734 for((*value_)=begin+1;(*value_)<=end;(*value_)++)
00735 (*sum) = (*sum) + a_.Give_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00736 return (*sum);
00737 };
00738 double Give_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00739 (*value_)=begin;
00740 (*sum) = a_.Give_Bo2p(it_b,gr,l);
00741 for((*value_)=begin+1;(*value_)<=end;(*value_)++)
00742 (*sum) = (*sum) + a_.Give_Bo2p(it_b,gr,l);
00743 return (*sum);
00744 };
00745 double Give_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00746 const BoCeData* bocedata) const {
00747 (*value_)=begin;
00748 (*sum) = a_.Give_cellpoi(it_cf,gr,bocedata);
00749 for((*value_)=begin+1;(*value_)<=end;(*value_)++)
00750 (*sum) = (*sum) + a_.Give_cellpoi(it_cf,gr,bocedata);
00751 return (*sum);
00752 };
00753
00754
00755 int Sice_stencil() const { return a_.Sice_stencil(); }
00756
00757
00758 int Level() const { return a_.Level(); }
00759 Dominace_label Dominant_lev() const { return a_.Dominant_lev(); }
00760 Dominace_label Dominant_poi() const { return a_.Dominant_poi(); }
00761 bool run_interior() const { return a_.run_interior(); }
00762 bool run_nearb() const { return a_.run_nearb(); }
00763 int run_boundary() const { return a_.run_boundary(); }
00764
00765
00766 int ops_interior() const { return a_.ops_interior()*(end-begin+1)
00767 +(end-begin); }
00768
00769
00770 void Active_Sim_Level( int lev) const { a_.Active_Sim_Level(lev); }
00771 void Active_Sim_interior( bool run) const { a_.Active_Sim_interior(run); }
00772 void Active_Sim_nearb( bool run) const { a_.Active_Sim_nearb(run); }
00773 void Active_Sim_boundary(int run) const { a_.Active_Sim_boundary(run); }
00774 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00775 int level, type_of_update typ) const
00776 { a_.Active_Sim_update(evpar,level,typ); };
00777
00778
00779 void Put_grid_rbo(Grid* gr, int r_bo) const { a_.Put_grid_rbo(gr,r_bo); }
00780
00781
00782
00783 Differential_op_typ Abstract_differential_operator() const {
00784 return not_abstract; }
00785
00786 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00787 const {
00788 a_.Add_variables_for_parallel(evpar);
00789 };
00790 bool GS_type(int var_number_left, int dim_left) const {
00791 return a_.GS_type(var_number_left, dim_left);
00792 };
00793
00794
00795 void clean() const { delete(sum); a_.clean(); };
00796 };
00797
00798
00799
00800 class Schleife {
00801 public:
00802 int* value_;
00803 int begin;
00804 int end;
00805 Schleife(int* v, int b, int e) : value_(v), begin(b), end(e)
00806 {};
00807 template<class A>
00808 DWrapSim<Expr_for_iterator<DWrapSim<A> > >
00809 operator()(const DWrapSim<A> & a)
00810 {
00811 typedef Expr_for_iterator<DWrapSim<A> > ExprT;
00812 return DWrapSim<ExprT>(ExprT(a,begin,end,value_));
00813 }
00814 };
00815
00816
00817
00818
00819 class SchleifeSum {
00820 public:
00821 int* value_;
00822 int begin;
00823 int end;
00824 SchleifeSum(int* v, int b, int e) : value_(v), begin(b), end(e)
00825 {};
00826 template<class A>
00827 DExpr<Expr_for_sum<DExpr<A> > >
00828 operator()(const DExpr<A> & a)
00829 {
00830 typedef Expr_for_sum<DExpr<A> > ExprT;
00831 return DExpr<ExprT>(ExprT(a,begin,end,value_));
00832 }
00833 };
00834
00835
00836
00837
00838
00840
00842
00843
00844 Schleife For(Local_int& I, int begin, int end);
00845
00846
00847 SchleifeSum Sum(Local_int& I, int begin, int end);
00848
00850
00851
00852
00853 template<class A, class B, class C>
00854 class DExprProcedure3 {
00855 private:
00856 void (*Procedure)(double* x, double* y, double* z);
00857 int opsf;
00858 A a_;
00859 B b_;
00860 C c_;
00861 public:
00862 DExprProcedure3(void (*procedure)(double* x, double* y, double* z),
00863 const A& a, const B& b, const C& c) : a_(a), b_(b), c_(c)
00864 {
00865 Procedure = procedure;
00866 opsf = 0;
00867 }
00868
00869 void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00870 int l, double_stencils_in) const {
00871 Procedure(a_.Give_regular_pointer(it_i,gr,l),
00872 b_.Give_regular_pointer(it_i,gr,l),
00873 c_.Give_regular_pointer(it_i,gr,l));
00874 };
00875 void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00876 double h_mesh,
00877 int l, double_stencils_in) const {
00878 Procedure(a_.Give_regular_pointer(it_i,gr,l),
00879 b_.Give_regular_pointer(it_i,gr,l),
00880 c_.Give_regular_pointer(it_i,gr,l));
00881 };
00882 void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00883 const Nearb_Ablage* nearb_ablage)
00884 const {
00885 Procedure(a_.Give_regular_pointer(it_n,gr,l),
00886 b_.Give_regular_pointer(it_n,gr,l),
00887 c_.Give_regular_pointer(it_n,gr,l));
00888 };
00889 void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00890 Procedure(a_.Give_Bo2p_pointer(it_b,gr,l),
00891 b_.Give_Bo2p_pointer(it_b,gr,l),
00892 c_.Give_Bo2p_pointer(it_b,gr,l));
00893 };
00894 void Run_cellpoi(const P_cellpoi* it_cf, const Grid* gr,
00895 const BoCeData* bocedata) const {
00896 Procedure(a_.Give_cellpoi_pointer(it_cf,gr),
00897 b_.Give_cellpoi_pointer(it_cf,gr),
00898 c_.Give_cellpoi_pointer(it_cf,gr));
00899 };
00900
00901
00902 int Sice_stencil() const { return 1; }
00903
00904
00905 int Level() const {
00906 if(c_.Dominant_lev() == yes_dominant ||
00907 (b_.Dominant_lev() == anti_dominant &&
00908 a_.Dominant_lev() == anti_dominant))
00909 return c_.Level();
00910 if(b_.Dominant_lev() == yes_dominant ||
00911 (c_.Dominant_lev() == anti_dominant &&
00912 a_.Dominant_lev() == anti_dominant))
00913 return b_.Level();
00914 if(a_.Dominant_lev() == yes_dominant ||
00915 (b_.Dominant_lev() == anti_dominant &&
00916 c_.Dominant_lev() == anti_dominant))
00917 return a_.Level();
00918 if(c_.Dominant_lev() == anti_dominant)
00919 return MAX(a_.Level(),b_.Level());
00920 if(b_.Dominant_lev() == anti_dominant)
00921 return MAX(a_.Level(),c_.Level());
00922 if(a_.Dominant_lev() == anti_dominant)
00923 return MAX(c_.Level(),b_.Level());
00924 return MAX(a_.Level(),b_.Level(),c_.Level());
00925 }
00926 Dominace_label Dominant_lev() const {
00927 return (Dominace_label)(MAX(a_.Dominant_lev(),
00928 b_.Dominant_lev(),
00929 c_.Dominant_lev()));
00930 }
00931 Dominace_label Dominant_poi() const {
00932 return (Dominace_label)(MAX(a_.Dominant_poi(),
00933 b_.Dominant_poi(),
00934 c_.Dominant_poi()));
00935 }
00936 bool run_interior() const {
00937 if(c_.Dominant_poi() == yes_dominant ||
00938 (b_.Dominant_poi() == anti_dominant &&
00939 a_.Dominant_poi() == anti_dominant))
00940 return c_.run_interior();
00941 if(b_.Dominant_poi() == yes_dominant ||
00942 (c_.Dominant_poi() == anti_dominant &&
00943 a_.Dominant_poi() == anti_dominant))
00944 return b_.run_interior();
00945 if(a_.Dominant_poi() == yes_dominant ||
00946 (b_.Dominant_poi() == anti_dominant &&
00947 c_.Dominant_poi() == anti_dominant))
00948 return a_.run_interior();
00949 if(c_.Dominant_poi() == anti_dominant)
00950 return b_.run_interior();
00951 return c_.run_interior();
00952 }
00953 bool run_nearb() const {
00954 if(c_.Dominant_poi() == yes_dominant ||
00955 (b_.Dominant_poi() == anti_dominant &&
00956 a_.Dominant_poi() == anti_dominant))
00957 return c_.run_nearb();
00958 if(b_.Dominant_poi() == yes_dominant ||
00959 (c_.Dominant_poi() == anti_dominant &&
00960 a_.Dominant_poi() == anti_dominant))
00961 return b_.run_nearb();
00962 if(a_.Dominant_poi() == yes_dominant ||
00963 (b_.Dominant_poi() == anti_dominant &&
00964 c_.Dominant_poi() == anti_dominant))
00965 return a_.run_nearb();
00966 if(c_.Dominant_poi() == anti_dominant)
00967 return b_.run_nearb();
00968 return c_.run_nearb();
00969 }
00970 bool run_boundary() const {
00971 if(c_.Dominant_poi() == yes_dominant ||
00972 (b_.Dominant_poi() == anti_dominant &&
00973 a_.Dominant_poi() == anti_dominant))
00974 return c_.run_boundary();
00975 if(b_.Dominant_poi() == yes_dominant ||
00976 (c_.Dominant_poi() == anti_dominant &&
00977 a_.Dominant_poi() == anti_dominant))
00978 return b_.run_boundary();
00979 if(a_.Dominant_poi() == yes_dominant ||
00980 (b_.Dominant_poi() == anti_dominant &&
00981 c_.Dominant_poi() == anti_dominant))
00982 return a_.run_boundary();
00983 if(c_.Dominant_poi() == anti_dominant)
00984 return b_.run_boundary();
00985 return c_.run_boundary();
00986 }
00987
00988
00989 int ops_interior() const {
00990 return opsf;
00991 }
00992
00993 void Active_Sim_Level( int lev) const {
00994 a_.Active_Sim_Level(lev);
00995 b_.Active_Sim_Level(lev);
00996 c_.Active_Sim_Level(lev);
00997 };
00998 void Active_Sim_interior(bool run) const {
00999 a_.Active_Sim_interior(run);
01000 b_.Active_Sim_interior(run);
01001 c_.Active_Sim_interior(run);
01002 };
01003 void Active_Sim_nearb(bool run) const {
01004 a_.Active_Sim_nearb(run);
01005 b_.Active_Sim_nearb(run);
01006 c_.Active_Sim_nearb(run);
01007 };
01008 void Active_Sim_boundary( int run) const {
01009 a_.Active_Sim_boundary(run);
01010 b_.Active_Sim_boundary(run);
01011 c_.Active_Sim_boundary(run);
01012 };
01013 void Active_Sim_update(Evaluation_Parallelization_object* evpar,
01014 int level, type_of_update typ) const {
01015 a_.Active_Sim_update(evpar,level,typ);
01016 b_.Active_Sim_update(evpar,level,typ);
01017 b_.Active_Sim_update(evpar,level,typ);
01018 };
01019
01020
01021 void Put_grid_rbo(Grid* gr, int r_bo) const {
01022 a_.Put_grid_rbo(gr,r_bo);
01023 b_.Put_grid_rbo(gr,r_bo);
01024 c_.Put_grid_rbo(gr,r_bo);
01025 }
01026
01027
01028
01029 Differential_op_typ Abstract_differential_operator() const {
01030 return not_abstract;
01031 };
01032
01033 void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
01034 const {
01035 a_.Add_variables_for_parallel(evpar);
01036 b_.Add_variables_for_parallel(evpar);
01037 c_.Add_variables_for_parallel(evpar);
01038 };
01039 bool GS_type(int var_number_left, int dim_left) const {
01040 if(c_.GS_type(var_number_left, dim_left)==true) return true;
01041 if(b_.GS_type(var_number_left, dim_left)==true) return true;
01042 return a_.GS_type(var_number_left, dim_left);
01043 };
01044
01045
01046 void clean() const {
01047 a_.clean();
01048 b_.clean();
01049 c_.clean();
01050 };
01051 };
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260 class Procedure {
01261 private:
01262 void (*Procedure3)(double* x, double* y,double* z);
01263 void (*Procedure4)(double* x, double* y,double* z, double* u);
01264
01265 int type;
01266
01267 int length_x, length_y, length_z;
01268 public:
01269
01270 Procedure(void (*procedure)(double* x, double* y,double* z),
01271 int len_x, int len_y, int len_z)
01272 {
01273 Procedure3 = procedure;
01274 type = 3;
01275 length_x = len_x;
01276 length_y = len_y;
01277 length_z = len_z;
01278 }
01279 Procedure(void (*procedure)(double* x, double* y,double* z))
01280 {
01281 Procedure3 = procedure;
01282 type = 3;
01283 length_x = 0;
01284 length_y = 0;
01285 length_z = 0;
01286 }
01287
01288
01289 DWrapSim<DExprProcedure3<DExprVAR, DExprVAR, DExprVAR> > operator()
01290 (Array_Variable& a, Array_Variable& b, Array_Variable& c) {
01291 if(a.Give_dim()<length_x &&
01292 b.Give_dim()<length_y &&
01293 c.Give_dim()<length_z) {
01294 cout << "\n Wrong length of vectors! " << endl;
01295 }
01296 if(type != 3) cout << "\n Wrong usage of procedure 3! " << endl;
01297 typedef DExprProcedure3<DExprVAR, DExprVAR, DExprVAR> ExprT;
01298 return DWrapSim<ExprT>(ExprT(Procedure3,
01299 DExprVAR(a[0]),DExprVAR(b[0]),DExprVAR(c[0])));
01300 }
01301
01302 DWrapSim<DExprProcedure3<Local_var, DExprVAR, DExprVAR> > operator()
01303 (Array_Local_var& a, Array_Variable& b, Array_Variable& c) {
01304 if(a.Give_dim()<length_x &&
01305 b.Give_dim()<length_y &&
01306 c.Give_dim()<length_z) {
01307 cout << "\n Wrong length of vectors! " << endl;
01308 }
01309 if(type != 3) cout << "\n Wrong usage of procedure 3! " << endl;
01310 typedef DExprProcedure3<Local_var, DExprVAR, DExprVAR> ExprT;
01311 return DWrapSim<ExprT>(ExprT(Procedure3,
01312 a[0],DExprVAR(b[0]),DExprVAR(c[0])));
01313 }
01314
01315 DWrapSim<DExprProcedure3<DExprVAR, Local_var, DExprVAR> > operator()
01316 (Array_Variable& a, Array_Local_var& b, Array_Variable& c) {
01317 if(a.Give_dim()<length_x &&
01318 b.Give_dim()<length_y &&
01319 c.Give_dim()<length_z) {
01320 cout << "\n Wrong length of vectors! " << endl;
01321 }
01322 if(type != 3) cout << "\n Wrong usage of procedure 3! " << endl;
01323 typedef DExprProcedure3<DExprVAR, Local_var, DExprVAR> ExprT;
01324 return DWrapSim<ExprT>(ExprT(Procedure3,
01325 DExprVAR(a[0]),b[0],DExprVAR(c[0])));
01326 }
01327
01328 DWrapSim<DExprProcedure3<DExprVAR, DExprVAR, Local_var> > operator()
01329 (Array_Variable& a, Array_Variable& b, Array_Local_var& c) {
01330 if(a.Give_dim()<length_x &&
01331 b.Give_dim()<length_y &&
01332 c.Give_dim()<length_z) {
01333 cout << "\n Wrong length of vectors! " << endl;
01334 }
01335 if(type != 3) cout << "\n Wrong usage of procedure 3! " << endl;
01336 typedef DExprProcedure3<DExprVAR, DExprVAR, Local_var> ExprT;
01337 return DWrapSim<ExprT>(ExprT(Procedure3,
01338 DExprVAR(a[0]),DExprVAR(b[0]),c[0]));
01339 }
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349 };
01350
01351
01352 #endif
01353