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