Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

src/expde/extemp/sim.h

Go to the documentation of this file.
00001 //    expde: expression templates for partial differential equations.
00002 //    Copyright (C) 2001  Christoph Pflaum
00003 //    This program is free software; you can redistribute it and/or modify
00004 //    it under the terms of the GNU General Public License as published by
00005 //    the Free Software Foundation; either version 2 of the License, or
00006 //    (at your option) any later version.
00007 //
00008 //    This program is distributed in the hope that it will be useful,
00009 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //    GNU General Public License for more details.
00012 //
00013 //                 SEE  Notice1.doc made by 
00014 //                 LAWRENCE LIVERMORE NATIONAL LABORATORY
00015 //
00016 
00017 // ------------------------------------------------------------
00018 // sim.h
00019 //
00020 // ------------------------------------------------------------
00021 
00022 
00023 #ifndef SIM_H_
00024 #define SIM_H_
00025             
00027 //  1. Expresions for several equations
00028 //  2. while cnstruction (not finished now)
00030 
00032 //  1. Expresions for several equations
00033 
00034 
00035 
00036 /* DExprAnd */
00037 template<class A, class B>
00038 class DExprAnd {
00039   A a_;
00040   B b_;
00041  public:
00042   DExprAnd(const A& a, const B& b)
00043     : a_(a), b_(b)
00044     {}
00045   double Give_interior(const P_interior* it_i, const Grid* gr, double h_mesh,
00046                        int l, double_stencils_in) const {
00047     b_.Run_interior(it_i,gr,h_mesh,l, double_stencils_out);
00048     return a_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00049   }
00050   double Give_interior_coarse(const P_interior* it_i, const Grid* gr,
00051                               double h_mesh,
00052                               int l, double_stencils_in) const {
00053     b_.Run_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00054     return a_.Give_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00055   }
00056   double Give_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00057                     const Nearb_Ablage* nearb_ablage)
00058     const {
00059     b_.Run_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00060     return a_.Give_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00061   };
00062   double Give_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00063     b_.Run_Bo2p(it_b,gr,l);
00064     return a_.Give_Bo2p(it_b,gr,l);
00065   };
00066   double Give_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00067                       const BoCeData* bocedata) const {
00068     b_.Run_cellpoi(it_cf,gr,bocedata);
00069     return a_.Give_cellpoi(it_cf,gr,bocedata);
00070   };
00071 
00072   // Size of necessary stencil
00073   int Sice_stencil() const { return MAX(a_.Sice_stencil(),b_.Sice_stencil()); }
00074 
00075   // activity of points
00076   int Level() const { 
00077     if(b_.Dominant_lev()==yes_dominant || a_.Dominant_lev() == anti_dominant)
00078       return b_.Level();
00079     else
00080       if(a_.Dominant_lev()==yes_dominant|| b_.Dominant_lev() == anti_dominant)
00081         return a_.Level();
00082     else return MAX(a_.Level(),b_.Level()); 
00083   }
00084   Dominace_label Dominant_lev() const {
00085     return (Dominace_label)(MAX(a_.Dominant_lev(),b_.Dominant_lev()));
00086   }
00087   Dominace_label Dominant_poi() const {
00088     return (Dominace_label)(MAX(a_.Dominant_poi(),b_.Dominant_poi()));
00089   }
00090   bool run_interior() const { 
00091     if(a_.Dominant_poi()==yes_dominant || b_.Dominant_poi() == anti_dominant)
00092       return a_.run_interior();
00093     else return b_.run_interior(); 
00094   }
00095   bool run_nearb() const { 
00096     if(a_.Dominant_poi()==yes_dominant || b_.Dominant_poi() == anti_dominant)
00097       return a_.run_nearb();
00098     else return b_.run_nearb(); 
00099   }
00100   int run_boundary() const { 
00101     if(a_.Dominant_poi()==yes_dominant || b_.Dominant_poi() == anti_dominant)
00102       return a_.run_boundary();
00103     else return b_.run_boundary(); 
00104   }
00105   // calculation of computational time and MFlops
00106   int ops_interior() const { return a_.ops_interior() + b_.ops_interior(); }
00107   // For operator ==
00108   void Active_Sim_Level( int lev) const { 
00109     a_.Active_Sim_Level(lev); b_.Active_Sim_Level(lev); };
00110   void Active_Sim_interior(bool run) const { 
00111     a_.Active_Sim_interior(run); b_.Active_Sim_interior(run); };
00112   void Active_Sim_nearb(bool run) const { 
00113     a_.Active_Sim_nearb(run); b_.Active_Sim_nearb(run); };
00114   void Active_Sim_boundary( int run) const { 
00115     a_.Active_Sim_boundary(run); b_.Active_Sim_boundary(run); };
00116   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00117                          int level, type_of_update typ) const {  
00118     a_.Active_Sim_update(evpar,level,typ); 
00119     b_.Active_Sim_update(evpar,level,typ); };
00120 
00121   // Put pointer to grid and activity of boundary points of test space  
00122   void Put_grid_rbo(Grid* gr, int r_bo) const {
00123     a_.Put_grid_rbo(gr,r_bo);
00124     b_.Put_grid_rbo(gr,r_bo); }
00125   // Is the expression an abstract differential operator?
00126   bool Abstract_differential_operator() {
00127     return false; }
00128   // for Parallelization
00129   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00130     const {
00131     a_.Add_variables_for_parallel(evpar);
00132     b_.Add_variables_for_parallel(evpar);
00133   };
00134   bool GS_type(int var_number_left, int dim_left) const {
00135     if(b_.GS_type(var_number_left, dim_left)==true) return true;
00136     return a_.GS_type(var_number_left, dim_left);
00137   };
00138 
00139   // at the and of an iteration of an expression
00140   void clean() const { a_.clean(); b_.clean(); };
00141 };
00142 
00143 /* DExprAnd */
00144 template<class A, class B>
00145 class DExprAndSim {
00146   A a_;
00147   B b_;
00148  public:
00149   DExprAndSim(const A& a, const B& b)
00150     : a_(a), b_(b)
00151     {}
00152   void Run_interior(const P_interior* it_i, const Grid* gr, double h_mesh,
00153                        int l, double_stencils_in) const {
00154     b_.Run_interior(it_i,gr,h_mesh,l, double_stencils_out);
00155     a_.Run_interior(it_i,gr,h_mesh,l, double_stencils_out);
00156   }
00157   void Run_interior_coarse(const P_interior* it_i, const Grid* gr,
00158                            double h_mesh,
00159                            int l, double_stencils_in) const {
00160     b_.Run_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00161     a_.Run_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00162   }
00163   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00164                     const Nearb_Ablage* nearb_ablage)
00165     const {
00166     b_.Run_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00167     a_.Run_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00168   };
00169   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00170     b_.Run_Bo2p(it_b,gr,l);
00171     a_.Run_Bo2p(it_b,gr,l);
00172   };
00173   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00174                       const BoCeData* bocedata) const {
00175     b_.Run_cellpoi(it_cf,gr,bocedata);
00176     a_.Run_cellpoi(it_cf,gr,bocedata);
00177   };
00178 
00179   // Size of necessary stencil
00180   int Sice_stencil() const { return MAX(a_.Sice_stencil(),b_.Sice_stencil()); }
00181 
00182   // activity of points
00183   int Level() const { 
00184     if(b_.Dominant_lev()==yes_dominant || a_.Dominant_lev() == anti_dominant)
00185       return b_.Level();
00186     else
00187       if(a_.Dominant_lev()==yes_dominant|| b_.Dominant_lev() == anti_dominant)
00188         return a_.Level();
00189     else return MAX(a_.Level(),b_.Level()); 
00190   }
00191   Dominace_label Dominant_lev() const {
00192     return (Dominace_label)(MAX(a_.Dominant_lev(),b_.Dominant_lev()));
00193   }
00194   Dominace_label Dominant_poi() const {
00195     return (Dominace_label)(MAX(a_.Dominant_poi(),b_.Dominant_poi()));
00196   }
00197   bool run_interior() const { 
00198     if(a_.Dominant_poi()==yes_dominant || b_.Dominant_poi() == anti_dominant)
00199       return a_.run_interior();
00200     else return b_.run_interior(); 
00201   }
00202   bool run_nearb() const { 
00203     if(a_.Dominant_poi()==yes_dominant || b_.Dominant_poi() == anti_dominant)
00204       return a_.run_nearb();
00205     else return b_.run_nearb(); 
00206   }
00207   int run_boundary() const { 
00208     if(a_.Dominant_poi()==yes_dominant || b_.Dominant_poi() == anti_dominant)
00209       return a_.run_boundary();
00210     else return b_.run_boundary(); 
00211   }
00212 
00213   // calculation of computational time and MFlops
00214   int ops_interior() const { return a_.ops_interior() + b_.ops_interior(); }
00215   // For operator ==
00216   void Active_Sim_Level( int lev) const { 
00217     a_.Active_Sim_Level(lev); b_.Active_Sim_Level(lev); };
00218   void Active_Sim_interior(bool run) const { 
00219     a_.Active_Sim_interior(run); b_.Active_Sim_interior(run); };
00220   void Active_Sim_nearb(bool run) const { 
00221     a_.Active_Sim_nearb(run); b_.Active_Sim_nearb(run); };
00222   void Active_Sim_boundary( int run)  const {
00223     a_.Active_Sim_boundary(run); b_.Active_Sim_boundary(run); };
00224   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00225                          int level, type_of_update typ) const {
00226     a_.Active_Sim_update(evpar,level,typ); 
00227     b_.Active_Sim_update(evpar,level,typ); };
00228 
00229   // Put pointer to grid and activity of boundary points of test space  
00230   void Put_grid_rbo(Grid* gr, int r_bo) const {
00231     a_.Put_grid_rbo(gr,r_bo);
00232     b_.Put_grid_rbo(gr,r_bo); }
00233   // Is the expression an abstract differential operator?
00234    Differential_op_typ Abstract_differential_operator() const
00235     { return not_abstract; }
00236   // for Parallelization
00237   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00238     const {
00239     a_.Add_variables_for_parallel(evpar);
00240     b_.Add_variables_for_parallel(evpar);
00241   };
00242   bool GS_type(int var_number_left, int dim_left) const {
00243     if(b_.GS_type(var_number_left, dim_left)==true) return true;
00244     return a_.GS_type(var_number_left, dim_left);
00245   };
00246 
00247   // at the and of an iteration of an expression
00248   void clean() const { a_.clean(); b_.clean(); };
00249 };
00250 
00252 // Sim
00253 
00254 /* Wrapper Sim */
00255 /* DExprSim */
00256 /*
00257 template<class A>
00258 class DWrapSim {
00259   A a_;
00260  public:
00261   DWrapSim(const A& a)
00262     : a_(a)
00263     {}
00264   void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00265                        int l, double_stencils_in) const {
00266     a_.Run_interior(it_i,gr,h_mesh,l, double_stencils_out);
00267   };
00268   void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00269                            double h_mesh,
00270                            int l, double_stencils_in) const {
00271     a_.Run_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00272   };
00273   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00274                     const Nearb_Ablage* nearb_ablage)
00275     const {
00276     a_.Run_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00277   };
00278   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00279     a_.Run_Bo2p(it_b,gr,l);
00280   };
00281   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00282                       const BoCeData* bocedata) const {
00283     a_.Run_cellpoi(it_cf,gr,bocedata);
00284   };
00285 
00286   // Size of necessary stencil
00287   int Sice_stencil() const { return a_.Sice_stencil(); }
00288 
00289   // activity of points
00290   int Level() const { return a_.Level(); }
00291   Dominace_label Dominant_lev() const { return a_.Dominant_lev(); }
00292   Dominace_label Dominant_poi() const { return a_.Dominant_poi(); }
00293   bool run_interior() const { return a_.run_interior(); }
00294   bool run_nearb()    const { return a_.run_nearb(); }
00295   int run_boundary() const { return a_.run_boundary(); }
00296 
00297   // number of operations
00298   int ops_interior() const { return a_.ops_interior(); }   
00299 
00300   // For operator ==
00301   void Active_Sim_Level( int lev) const { a_.Active_Sim_Level(lev); }
00302   void Active_Sim_interior( bool run) const { a_.Active_Sim_interior(run); }
00303   void Active_Sim_nearb( bool run) const { a_.Active_Sim_nearb(run); }
00304   void Active_Sim_boundary(int run) const { a_.Active_Sim_boundary(run); }
00305   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00306   int level, type_of_update typ) const 
00307     {  a_.Active_Sim_update(evpar,level,typ); };
00308 
00309   // Put pointer to grid and activity of boundary points of test space  
00310   void Put_grid_rbo(Grid* gr, int r_bo) const {
00311     a_.Put_grid_rbo(gr,r_bo); }
00312   // Is the expression an abstract differential operator?
00313    Differential_op_typ Abstract_differential_operator() const
00314     { return not_abstract; }
00315   // for Parallelization
00316   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00317     const {
00318     a_.Add_variables_for_parallel(evpar);
00319   };
00320 
00321   // at the and of an iteration of an expression
00322   void clean() const { a_.clean(); };
00323 };
00324 */
00325 
00326 
00327 /* DExprSim */
00328 template<class B>
00329 class DExprSim {
00330  private:
00331   // Nummer der Variablen
00332   int number_variable;
00333   // variable
00334   Variable* a;
00335 
00336   // expression
00337   B b_;
00338  public:
00339   DExprSim(Variable& vec, const B& b) : b_(b) {
00340     number_variable =  vec.Number_variable();
00341     a = vec.Give_my_pointer();
00342   }
00343   void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00344                        int l, double_stencils_in) const {
00345     it_i->varM(gr,l)[number_variable] = 
00346       b_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00347   };
00348   void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00349                            double h_mesh,
00350                        int l, double_stencils_in) const {
00351     it_i->varM(gr,l)[number_variable] =
00352       b_.Give_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00353   };
00354   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00355                     const Nearb_Ablage* nearb_ablage) const {
00356     it_n->varM(gr,l)[number_variable] = 
00357       b_.Give_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00358   };
00359   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00360     it_b->varM(gr)[number_variable] = 
00361       b_.Give_Bo2p(it_b,gr,l);
00362   };
00363   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00364                       const BoCeData* bocedata) const {
00365     it_cf->varM(gr)[number_variable] =
00366       b_.Give_cellpoi(it_cf,gr,bocedata);
00367   };
00368 
00369   // Size of necessary stencil
00370   int Sice_stencil() const { return b_.Sice_stencil(); }
00371 
00372   // activity of points
00373   int Level() const { return b_.Level();  }
00374   Dominace_label Dominant_lev() const { return b_.Dominant_lev(); }
00375   Dominace_label Dominant_poi() const { return b_.Dominant_poi(); }
00376   bool run_interior() const { return b_.run_interior(); }
00377   bool run_nearb() const { return b_.run_nearb(); }
00378   int run_boundary() const { return b_.run_boundary(); }
00379 
00380   // number of operations
00381   int ops_interior() const { return b_.ops_interior(); }   
00382 
00383   // For operator ==
00384   void Active_Sim_Level( int lev) const {
00385     a->Active_Level(lev); 
00386     b_.Active_Sim_Level(lev); }
00387   void Active_Sim_interior(bool run) const {
00388     a->Active_interior(run); 
00389     b_.Active_Sim_interior(run); }
00390   void Active_Sim_nearb(bool run) const {
00391     a->Active_nearb(run); 
00392     b_.Active_Sim_nearb(run); }
00393   void Active_Sim_boundary( int run) const {
00394     a->Active_boundary(run);
00395     b_.Active_Sim_boundary(run); }
00396   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00397                          int level, type_of_update typ) const { 
00398     a->Active_update(evpar,level,typ); 
00399     b_.Active_Sim_update(evpar,level,typ); };
00400 
00401   // Put pointer to grid and activity of boundary points of test space  
00402   void Put_grid_rbo(Grid* gr, int r_bo) const {
00403     b_.Put_grid_rbo(gr,r_bo); }
00404   // Is the expression an abstract differential operator?
00405    Differential_op_typ Abstract_differential_operator() const
00406     { return not_abstract; }
00407   // for Parallelization
00408   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00409     const {
00410     b_.Add_variables_for_parallel(evpar);
00411   };
00412   bool GS_type(int var_number_left, int dim_left) const {
00413     return b_.GS_type(number_variable,0);
00414   };
00415 
00416   // at the and of an iteration of an expression
00417   void clean() const { b_.clean(); };
00418 };
00419 
00420 
00421 /* DExprSimLit */
00422 class DExprSimLit {
00423  private:
00424   // Aktive Punkte:
00425   int  r_boundary;   // type boundary point:
00426   bool r_interior;   // type interior point:
00427   bool r_nearb;      // type nearb point:
00428   int  level;        // level:
00429   // variable
00430   Variable* a;
00431 
00432   // Nummer der Variablen
00433   int number_variable;
00434 
00435   // value
00436   double value_;
00437  public:
00438   DExprSimLit(Variable& vec, double value) {
00439     r_boundary = vec.run_boundary();
00440     r_interior = vec.run_interior();
00441     r_nearb    = vec.run_nearb();
00442     level      = vec.Level();
00443     number_variable =  vec.Number_variable();
00444     value_ = value;
00445 
00446     a = vec.Give_my_pointer();
00447   }
00448   void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00449                        int l, double_stencils_in) const {
00450     it_i->varM(gr,l)[number_variable] = value_;
00451   };
00452   void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00453                            double h_mesh,
00454                            int l, double_stencils_in) const {
00455     it_i->varM(gr,l)[number_variable] = value_;
00456   };
00457   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00458                     const Nearb_Ablage* nearb_ablage) const {
00459     it_n->varM(gr,l)[number_variable] = value_;
00460   };
00461   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00462     it_b->varM(gr)[number_variable] = value_;
00463   };
00464   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00465                       const BoCeData* bocedata) const {
00466     it_cf->varM(gr)[number_variable] = value_;
00467   };
00468 
00469   // Size of necessary stencil
00470   int Sice_stencil() const { return 1; }
00471 
00472   // activity of points
00473   int Level() const { return level;  }
00474   Dominace_label Dominant_lev() const { return yes_dominant; }
00475   Dominace_label Dominant_poi() const { return yes_dominant; }
00476   bool run_interior() const { return r_interior; }
00477   bool run_nearb() const { return r_nearb; }
00478   int run_boundary() const { return r_boundary; }
00479 
00480   // number of operations
00481   int ops_interior() const { return 0; }
00482 
00483   // For operator ==
00484   void Active_Sim_Level( int lev) const {
00485     a->Active_Level(lev); }
00486   void Active_Sim_interior(bool run) const {
00487     a->Active_interior(run); }
00488   void Active_Sim_nearb(bool run) const {
00489     a->Active_nearb(run); }
00490   void Active_Sim_boundary( int run) const {
00491     a->Active_boundary(run); }
00492   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00493                          int level, type_of_update typ) const { 
00494     a->Active_update(evpar,level,typ); };
00495 
00496   // Put pointer to grid and activity of boundary points of test space  
00497   void Put_grid_rbo(Grid* gr, int r_bo) const { };
00498   // Is the expression an abstract differential operator?
00499    Differential_op_typ Abstract_differential_operator() const
00500     { return not_abstract; }
00501   // for Parallelization
00502   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00503     const { 
00504   };
00505   bool GS_type(int var_number_left, int dim_left) const {
00506   return false; }; 
00507 
00508   void clean() const { };
00509 };
00510 
00511 // new:
00512 template<class B>
00513 class DExprSimloc {
00514   double *a;
00515   B b_;
00516  public:
00517   DExprSimloc(const Local_var& av, const B& b)
00518     : a(av.Give_pointer()), b_(b)
00519     {}
00520   void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00521                        int l, double_stencils_in) const {
00522     *a = b_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00523   };
00524   void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00525                            double h_mesh,
00526                            int l, double_stencils_in) const {
00527     *a = b_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00528   };
00529   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00530                     const Nearb_Ablage* nearb_ablage) const {
00531     *a = b_.Give_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00532   };
00533   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00534     *a = b_.Give_Bo2p(it_b,gr,l);
00535   };
00536   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00537                       const BoCeData* bocedata) const {
00538     *a = b_.Give_cellpoi(it_cf,gr,bocedata);
00539   };
00540 
00541   // Size of necessary stencil
00542   int Sice_stencil() const { return b_.Sice_stencil(); }
00543 
00544   // activity of points
00545   int Level() const { return b_.Level();  }
00546   Dominace_label Dominant_lev() const { return b_.Dominant_lev(); }
00547   Dominace_label Dominant_poi() const { return b_.Dominant_poi(); }
00548   bool run_interior() const { return b_.run_interior(); }
00549   bool run_nearb()    const { return b_.run_nearb(); }
00550   int run_boundary() const { return b_.run_boundary(); }
00551 
00552   // number of operations
00553   int ops_interior() const { return b_.ops_interior(); }   
00554 
00555   // For operator ==
00556   void Active_Sim_Level( int lev) const {
00557     b_.Active_Sim_Level(lev); }
00558   void Active_Sim_interior(bool run) const {
00559     b_.Active_Sim_interior(run); }
00560   void Active_Sim_nearb(bool run) const {
00561     b_.Active_Sim_nearb(run); }
00562   void Active_Sim_boundary( int run) const {
00563     b_.Active_Sim_boundary(run); }
00564   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00565                          int level, type_of_update typ) const { 
00566     b_.Active_Sim_update(evpar,level,typ); };
00567 
00568   // Put pointer to grid and activity of boundary points of test space  
00569   void Put_grid_rbo(Grid* gr, int r_bo) const {
00570     b_.Put_grid_rbo(gr,r_bo); }
00571   // Is the expression an abstract differential operator?
00572    Differential_op_typ Abstract_differential_operator() const
00573     { return not_abstract; }
00574   // for Parallelization
00575   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00576     const {
00577     b_.Add_variables_for_parallel(evpar);
00578   };
00579   bool GS_type(int var_number_left, int dim_left) const {
00580     return b_.GS_type(var_number_left, dim_left);
00581   }; 
00582 
00583   // at the and of an iteration of an expression
00584   void clean() const { b_.clean(); };
00585 };
00586 
00587 class DExprSimlocLit {
00588   double *a;
00589   double x;
00590  public:
00591   DExprSimlocLit(const Local_var& av, double x_)
00592     : a(av.Give_pointer()), x(x_)
00593     {}
00594   void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00595                        int l, double_stencils_in) const {
00596     *a = x;
00597   };
00598   void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00599                            double h_mesh,
00600                            int l, double_stencils_in) const {
00601     *a = x;
00602   };
00603   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00604                     const Nearb_Ablage* nearb_ablage) const {
00605     *a = x;
00606   };
00607   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00608     *a = x;
00609   };
00610   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00611                       const BoCeData* bocedata) const {
00612     *a = x;
00613   };
00614 
00615   // Size of necessary stencil
00616   int Sice_stencil() const { return 1; }
00617 
00618   // activity of points
00619   int Level() const { return 0;  }
00620   Dominace_label Dominant_lev() const { return anti_dominant; }
00621   Dominace_label Dominant_poi() const { return anti_dominant; }
00622   bool run_interior() const { return 1; }
00623   bool run_boundary() const { return 1; }
00624   int run_nearb() const { return 1; }
00625 
00626   // number of operations
00627   int ops_interior() const { return 0; }
00628 
00629   // For operator ==
00630   void Active_Sim_Level( int lev) const { };
00631   void Active_Sim_interior(bool run) const { };
00632   void Active_Sim_nearb(bool run) const { };
00633   void Active_Sim_boundary( int run) const { };
00634   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00635                          int level, type_of_update typ) const {  };
00636 
00637   // Put pointer to grid and activity of boundary points of test space  
00638   void Put_grid_rbo(Grid* gr, int r_bo) const {};
00639   // Is the expression an abstract differential operator?
00640    Differential_op_typ Abstract_differential_operator() const
00641     { return not_abstract; }
00642   // for Parallelization
00643   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00644     const { };
00645   bool GS_type(int var_number_left, int dim_left) const {
00646   return false; }; 
00647 
00648   void clean() const { };
00649 };
00650 
00651 
00653 // several & operators for systems of equations
00655 
00656 template<class A, class B>
00657 DExpr<DExprAnd<DExpr<A>,  DWrapSim<B> > >
00658 operator&(const  DExpr<A>& a, const DWrapSim<B>& b)
00659 {
00660   typedef DExprAnd<DExpr<A>,  DWrapSim<B> >  ExprT;
00661   return DExpr<ExprT>(ExprT(a,b));
00662 }
00663 
00664 
00665 template<class A, class B>
00666 DWrapSim<DExprAndSim<DWrapSim<A>,  DWrapSim<B> > >
00667 operator&(const  DWrapSim<A>& a, const DWrapSim<B>& b)
00668 {
00669   typedef DExprAndSim<DWrapSim<A>,  DWrapSim<B> >  ExprT;
00670   return DWrapSim<ExprT>(ExprT(a,b));
00671 }
00672 
00673 
00674 template<class B>
00675 DExpr<DExprAnd<DExprVAR,  DWrapSim<B> > >
00676 operator&(Variable& a, const DWrapSim<B>& b)
00677 {
00678   typedef DExprAnd<DExprVAR,  DWrapSim<B> >  ExprT;
00679   return DExpr<ExprT>(ExprT(DExprVAR(a),b));
00680 }
00681 
00682 template<class B>
00683 DExpr<DExprAnd<DExprLIT,  DWrapSim<B> > >
00684 operator&(double value, const DWrapSim<B>& b)
00685 {
00686   typedef DExprAnd<DExprLIT,  DWrapSim<B> >  ExprT;
00687   return DExpr<ExprT>(ExprT(DExprLIT(value),b));
00688 }
00689 
00690 
00691 template<class B>
00692 DExpr<DExprAnd<Local_var,  DWrapSim<B> > >
00693 operator&(Local_var &a, const DWrapSim<B>& b)
00694 {
00695   typedef DExprAnd<Local_var,  DWrapSim<B> >  ExprT;
00696   return DExpr<ExprT>(ExprT(a,b));
00697 }
00698 
00699 /*
00700 template<class B>
00701 DWrapSim<DExprVecSim<B> >
00702 operator== (DExpr<DExprVAR_ARR>& a, const  B& b_)
00703 {
00704   typedef DWrapSim<DExprVecSim<B> > ExprT;
00705   return ExprT(DExprVecSim<B>(a.Number_variable(),a.Give_value(),b_)); 
00706 }
00707 */
00708 template<class B> 
00709 DWrapSim<DExprSim<B> >
00710 operator== (Variable& a, const  B& b_)
00711 {
00712   typedef DWrapSim<DExprSim<B> > ExprT;
00713   return ExprT(DExprSim<B>(a,b_)); 
00714 }
00715 
00716 DWrapSim<DExprSimLit>
00717 operator== (Variable& a, double value);
00718 
00719 
00720 template<class B> 
00721 DWrapSim<DExprSimloc<B> > 
00722 operator== (const Local_var& a, const  B& b_)
00723 {
00724   typedef DWrapSim<DExprSimloc<B> > ExprT;
00725   return ExprT(DExprSimloc<B>(a,b_)); 
00726 }
00727 
00728 DWrapSim<DExprSimlocLit>
00729 operator== (const Local_var& a, double x);
00730 
00731 DWrapSim<DExprSimloc<DExprVAR> >
00732 operator== (const Local_var& a, Variable& b);
00733 
00734 
00736 //  2. while cnstruction
00737 
00738 /* DExprWhile */
00739 /*
00740 template<class B>
00741 class DExprWhile {
00742   Local_var *a;
00743   B b_;
00744  public:
00745   DExprWhile(Local_var *av, const B& b)
00746     : a(av), b_(b)
00747     {}
00748   void run_interior(const I_point *i_point, const double h_mesh) const {
00749    while(a->Get()>0) b_.run_interior(i_point,h_mesh);
00750   }
00751   void run_black(const I_point *i_point, const double h_mesh) const {
00752    while(a->Get()>0) b_.run_black(i_point,h_mesh);
00753   }
00754   void run_red(const I_point *i_point, const double h_mesh) const {
00755    while(a->Get()>0) b_.run_red(i_point,h_mesh);
00756   }
00757   void run_boundary(const I_point *i_point, const double h_mesh) const {
00758    while(a->Get()>0) b_.run_boundary(i_point,h_mesh);
00759   }
00760   void run_R(const I_point *i_point, const double h_mesh) const {
00761     cout << " \n fehlt noch in DExprWhile! \n";
00762   }
00763 
00764   // activity of points
00765   int Level() const { 
00766     return b_.Level();
00767   }
00768   //  int Dominant() const { return b_.Dominant(); }
00769   int Dominant() const { return -1; }
00770   int run_red() const { return b_.run_red(); }
00771   int run_boundary() const { return b_.run_boundary(); }
00772   int run_interior() const { return b_.run_interior(); }
00773   int run_black() const { return b_.run_black(); }
00774   int run_boundary() const { return b_.run_boundary(); }
00775 
00776   // calculation of computational time and MFlops
00777   int ops_black() const { return b_.ops_black(); }
00778   int ops_red()   const { return b_.ops_red(); }
00779   int ops_interior() const { return b_.ops_interior(); }
00780   int ops_boundary()  const { return b_.ops_boundary(); }
00781   int ops()       const { return b_.ops(); }
00782   // For operator ==
00783   void Active_Sim_Level( int lev) const {
00784     b_.Active_Sim_Level(lev); }
00785   void Active_Sim_interior( int run) const {
00786     b_.Active_Sim_interior(run); }
00787   void Active_Sim_black( int run) const {
00788     b_.Active_Sim_black(run); }
00789   void Active_Sim_boundary( int run) const {
00790     b_.Active_Sim_boundary(run); }
00791   void Active_Sim_red( int run) const {
00792     b_.Active_Sim_red(run);}
00793   void Active_Sim_boundary( int run) const {
00794     b_.Active_Sim_boundary(run);}
00795   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00796   int level, type_of_update typ) const { 
00797     b_.Active_Sim_update(evpar,level,typ); };
00798 
00799 };
00800 
00801 template<class B>
00802 DExprWhile<B>
00803 While(Local_var& a, const B& b)
00804 {
00805  return DExprWhile<B>(&a,b);
00806 }
00807 
00808 
00809 template<class A, class B>
00810 DExpr<DExprAnd<DExpr<A> ,  DExprWhile<B> > >
00811 operator&(const DExpr<A>& a, const DExprWhile<B>& b)
00812 {
00813   typedef DExprAnd<DExpr<A>,  DExprWhile<B> >  ExprT;
00814   return DExpr<ExprT>(ExprT(a,b));
00815 }
00816 
00817 
00818 template<class B>
00819 DExpr<DExprAnd<DExprLIT,  DExprWhile<B> > >
00820 operator&(double value, const DExprWhile<B>& b)
00821 {
00822   typedef DExprAnd<DExprLIT,  DExprWhile<B> >  ExprT;
00823   return DExpr<ExprT>(ExprT(DExprLIT(value),b));
00824 }
00825 
00826 
00827 template<class B>
00828 DExpr<DExprAnd<Local_var,  DExprWhile<B> > >
00829 operator&(Local_var& a, const DExprWhile<B>& b)
00830 {
00831   typedef DExprAnd<Local_var,  DExprWhile<B> >  ExprT;
00832   return DExpr<ExprT>(ExprT(a,b));
00833 }
00834 
00835 */
00836 
00837 #endif
00838              

Generated on Fri Nov 2 01:25:57 2007 for IPPL by doxygen 1.3.5