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

src/expde/extemp/sim2.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 // sim2.h
00019 //
00020 // ------------------------------------------------------------
00021 
00022 
00023 template<class A>
00024 class DWrapSim {
00025   A a_;
00026  public:
00027   DWrapSim(const A& a)
00028     : a_(a)
00029     {}
00030   void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00031                        int l, double_stencils_in) const {
00032     a_.Run_interior(it_i,gr,h_mesh,l, double_stencils_out);
00033   };
00034   void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00035                            double h_mesh,
00036                            int l, double_stencils_in) const {
00037     a_.Run_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00038   };
00039   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00040                     const Nearb_Ablage* nearb_ablage)
00041     const {
00042     a_.Run_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00043   };
00044   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00045     a_.Run_Bo2p(it_b,gr,l);
00046   };
00047   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00048                       const BoCeData* bocedata) const {
00049     a_.Run_cellpoi(it_cf,gr,bocedata);
00050   };
00051 
00052   // Size of necessary stencil
00053   int Sice_stencil() const { return a_.Sice_stencil(); }
00054 
00055   // activity of points
00056   int Level() const { return a_.Level(); }
00057   Dominace_label Dominant_lev() const { return a_.Dominant_lev(); }
00058   Dominace_label Dominant_poi() const { return a_.Dominant_poi(); }
00059   bool run_interior() const { return a_.run_interior(); }
00060   bool run_nearb()    const { return a_.run_nearb(); }
00061   int run_boundary() const { return a_.run_boundary(); }
00062 
00063   // number of operations
00064   int ops_interior() const { return a_.ops_interior(); }   
00065 
00066   // For operator ==
00067   void Active_Sim_Level( int lev) const { a_.Active_Sim_Level(lev); }
00068   void Active_Sim_interior( bool run) const { a_.Active_Sim_interior(run); }
00069   void Active_Sim_nearb( bool run) const { a_.Active_Sim_nearb(run); }
00070   void Active_Sim_boundary(int run) const { a_.Active_Sim_boundary(run); }
00071   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00072                          int level, type_of_update typ) const 
00073     {  a_.Active_Sim_update(evpar,level,typ); };
00074 
00075   // Put pointer to grid and activity of boundary points of test space  
00076   void Put_grid_rbo(Grid* gr, int r_bo) const {
00077     a_.Put_grid_rbo(gr,r_bo); }
00078   // Is the expression an abstract differential operator?
00079    Differential_op_typ Abstract_differential_operator() const
00080     { return not_abstract; }
00081   // for Parallelization
00082   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00083     const {
00084     a_.Add_variables_for_parallel(evpar);
00085   };
00086   bool GS_type(int var_number_left, int dim_left) const {
00087     return a_.GS_type(var_number_left, dim_left);
00088   }
00089   // at the and of an iteration of an expression
00090   void clean() const { a_.clean(); };
00091 };
00092 
00093 
00094 
00095 template<class B>
00096 class DExprVecSim {
00097  private:
00098   // Nummer der Variablen
00099   int number_variable;
00100   int *value_;
00101   int dim;
00102 
00103   // variable
00104   Variable* a;  // not used
00105 
00106   // expression
00107   B b_;
00108  public:
00109   DExprVecSim(int num_var, int* val, int dime, const B& b) : b_(b) {
00110     number_variable = num_var;
00111     value_          = val;
00112     dim = dime;
00113   }
00114   void Run_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00115                        int l, double_stencils_in) const {
00116     it_i->varM(gr,l)[number_variable+*value_] = 
00117       b_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00118   };
00119   void Run_interior_coarse(const P_interior* it_i,const Grid* gr,
00120                            double h_mesh,
00121                        int l, double_stencils_in) const {
00122     it_i->varM(gr,l)[number_variable+*value_] =
00123       b_.Give_interior_coarse(it_i,gr,h_mesh,l, double_stencils_out);
00124   };
00125   void Run_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00126                     const Nearb_Ablage* nearb_ablage) const {
00127     it_n->varM(gr,l)[number_variable+*value_] = 
00128       b_.Give_nearb(it_n,gr,h_mesh,l,nearb_ablage);
00129   };
00130   void Run_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00131     it_b->varM(gr)[number_variable+*value_] = 
00132       b_.Give_Bo2p(it_b,gr,l);
00133   };
00134   void Run_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00135                       const BoCeData* bocedata) const {
00136     it_cf->varM(gr)[number_variable+*value_] =
00137       b_.Give_cellpoi(it_cf,gr,bocedata);
00138   };
00139 
00140   // Size of necessary stencil
00141   int Sice_stencil() const { return b_.Sice_stencil(); }
00142 
00143   // activity of points
00144   int Level() const { return b_.Level();  }
00145   Dominace_label Dominant_lev() const { return b_.Dominant_lev(); }
00146   Dominace_label Dominant_poi() const { return b_.Dominant_poi(); }
00147   bool run_interior() const { return b_.run_interior(); }
00148   bool run_nearb() const { return b_.run_nearb(); }
00149   int run_boundary() const { return b_.run_boundary(); }
00150 
00151   // number of operations
00152   int ops_interior() const { return b_.ops_interior(); }   
00153 
00154   // For operator ==
00155   void Active_Sim_Level( int lev) const {
00156     //    a->Active_Level(lev); 
00157     b_.Active_Sim_Level(lev); }
00158   void Active_Sim_interior(bool run) const {
00159     //    a->Active_interior(run); 
00160     b_.Active_Sim_interior(run); }
00161   void Active_Sim_nearb(bool run) const {
00162     //    a->Active_nearb(run); 
00163     b_.Active_Sim_nearb(run); }
00164   void Active_Sim_boundary( int run) const {
00165     //    a->Active_boundary(run);
00166     b_.Active_Sim_boundary(run); }
00167   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00168                          int level, type_of_update typ) const { 
00169     //    a->Active_Sim_update(level,typ); 
00170     b_.Active_Sim_update(evpar,level,typ); };
00171 
00172   // Put pointer to grid and activity of boundary points of test space  
00173   void Put_grid_rbo(Grid* gr, int r_bo) const {
00174     b_.Put_grid_rbo(gr,r_bo); }
00175   // Is the expression an abstract differential operator?
00176    Differential_op_typ Abstract_differential_operator() const
00177     { return not_abstract; }
00178   // for Parallelization
00179   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar) 
00180     const {
00181     b_.Add_variables_for_parallel(evpar);
00182   };
00183   bool GS_type(int var_number_left, int dim_left) const {
00184     return b_.GS_type(number_variable,dim);
00185   };
00186 
00187   // at the and of an iteration of an expression
00188   void clean() const { b_.clean(); };
00189 };

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