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

src/expde/extemp/extra.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 // extra.h
00019 //
00020 // ------------------------------------------------------------
00021 
00022 
00023 #ifndef EXTRA_H_
00024 #define EXTRA_H_
00025          
00026 
00027 class DVar_Extra_Op {
00028  private:
00029   Variable v_;
00030   double Give_at_Index(const Index3D I, const Grid* grid) const;
00031 
00032  public:
00033   DVar_Extra_Op(const Variable& v) : v_(v) {};
00034   double Give_interior(const P_interior* it_i,const Grid* gr, double h_mesh,
00035                        int l, double_stencils_in) const {
00036     return v_.Give_interior(it_i,gr,h_mesh,l, double_stencils_out);
00037   }
00038   double Give_interior_coarse(const P_interior* it_i,const Grid* gr,
00039                               double h_mesh,
00040                               int l, double_stencils_in) const {
00041     return v_.Give_interior_coarse(it_i,gr,h_mesh,l,double_stencils_out);
00042   }
00043   double Give_nearb(const P_nearb* it_n,const Grid* gr, double h_mesh, int l,
00044                     const Nearb_Ablage* nearb_ablage)
00045     const {
00046     return Give_at_Index(it_n->Ind(),gr);
00047   };
00048 
00049   /*
00050   double Give_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00051     Index3D In, Inn, Innn;
00052     dir_3D dd;
00053     double un, unn, unnn, h_mesh, h_d;
00054     Pointtype Ptypnn, Ptypnnn;
00055 
00056     In = it_b->Ind();
00057     dd = it_b->d();
00058     if(dd==Wdir) { Inn = In.next_E(l); Innn = Inn.next_E(l); }
00059     if(dd==Edir) { Inn = In.next_W(l); Innn = Inn.next_W(l); }
00060 
00061     if(dd==Ndir) { Inn = In.next_S(l); Innn = Inn.next_S(l); }
00062     if(dd==Sdir) { Inn = In.next_N(l); Innn = Inn.next_N(l); }
00063 
00064     if(dd==Tdir) { Inn = In.next_D(l); Innn = Inn.next_D(l); }
00065     if(dd==Ddir) { Inn = In.next_T(l); Innn = Inn.next_T(l); }
00066 
00067     if(gr->Point_in_domain(Inn) && gr->Point_in_domain(Innn)) {
00068       Ptypnn  = gr->Give_type(Inn);
00069       Ptypnnn = gr->Give_type(Innn);
00070       un = Give_at_Index(In,gr);
00071       if(interior == Ptypnn || uniform <= Ptypnn)
00072         unn = gr->Give_variable(Inn,l)[v_.Number_variable()];
00073       else
00074         unn = Give_at_Index(Inn,gr);
00075       if(interior == Ptypnnn || uniform <= Ptypnnn)
00076         unnn = gr->Give_variable(Innn,l)[v_.Number_variable()];
00077       else
00078         unnn = Give_at_Index(Innn,gr);
00079 
00080       h_mesh = gr->H_mesh() / Zweipotenz(gr->Max_level());
00081       h_d    = gr->Give_h(In,dd);
00082       h_d = h_d / h_mesh;
00083 
00084       return h_d*h_d * (un-2.0*unn+unnn)/2.0 
00085         + h_d * (2.0*unn - un / 2.0 - 3.0/2.0 * unnn)
00086         + unnn;
00087     }
00088 
00089     if(gr->Point_in_domain(Inn)) {
00090       Ptypnn  = gr->Give_type(Inn);
00091       if(Ptypnn >= interior) {
00092         un = Give_at_Index(In,gr);
00093         if(interior == Ptypnn || uniform <= Ptypnn)
00094           unn = gr->Give_variable(Inn,l)[v_.Number_variable()];
00095         else
00096           unn = Give_at_Index(Inn,gr);
00097         
00098         h_mesh = gr->H_mesh() / Zweipotenz(gr->Max_level());
00099         h_d    = gr->Give_h(In,dd);
00100         
00101         return ((un - unn) / h_mesh) * h_d + un;
00102       }
00103     }
00104     //    return Give_at_Index(In,gr);
00105     return v_.Give_Bo2p(it_b,gr,l);
00106   };
00107   */
00108   double Give_Bo2p(const P_Bo2p* it_b,const Grid* gr, int l) const {
00109     Index3D In, Inn;
00110     dir_3D dd;
00111     double un, unn, h_mesh, h_d;
00112     Pointtype Ptypnn;
00113 
00114     In = it_b->Ind();
00115     dd = it_b->d();
00116     if(dd==Wdir) { Inn = In.next_E(l); }
00117     if(dd==Edir) { Inn = In.next_W(l); }
00118 
00119     if(dd==Ndir) { Inn = In.next_S(l); }
00120     if(dd==Sdir) { Inn = In.next_N(l); }
00121 
00122     if(dd==Tdir) { Inn = In.next_D(l); }
00123     if(dd==Ddir) { Inn = In.next_T(l); }
00124 
00125     if(gr->Point_in_domain(Inn)) {
00126       Ptypnn  = gr->Give_type(Inn);
00127       if(Ptypnn >= interior) {
00128         un = Give_at_Index(In,gr);
00129         if(interior == Ptypnn || uniform <= Ptypnn)
00130           unn = gr->Give_variable(Inn,l)[v_.Number_variable()];
00131         else
00132           unn = Give_at_Index(Inn,gr);
00133         
00134         h_mesh = gr->H_mesh() / Zweipotenz(gr->Max_level());
00135         h_d    = gr->Give_h(In,dd);
00136         
00137         return ((un - unn) / h_mesh) * h_d + un;
00138       }
00139     }
00140     //    return Give_at_Index(In,gr);
00141     return v_.Give_Bo2p(it_b,gr,l);
00142   };
00143   double Give_cellpoi(const P_cellpoi* it_cf,const Grid* gr,
00144                       const BoCeData* bocedata) const {
00145     return v_.Give_cellpoi(it_cf,gr,bocedata);
00146   };
00147   
00148   // Size of necessary stencil
00149   int Sice_stencil() const { return 1; }
00150   
00151   // activity of points
00152   int Level() const {
00153     return v_.Give_grid()->Max_level();
00154   }
00155   Dominace_label Dominant_lev() const { return yes_dominant; }
00156   Dominace_label Dominant_poi() const { return yes_dominant; }
00157   bool run_interior() const { return v_.run_interior(); }
00158   bool run_nearb() const { return v_.run_nearb(); }
00159   int run_boundary() const { return v_.run_boundary(); }
00160 
00161   // number of operations
00162   int ops_interior() const { return 0; }
00163 
00164   // For operator ==
00165   void Active_Sim_Level( int lev) const { }
00166   void Active_Sim_interior(bool run) const { }
00167   void Active_Sim_nearb(bool run) const { }
00168   void Active_Sim_boundary( int run) const { }
00169   void Active_Sim_update(Evaluation_Parallelization_object* evpar,
00170                          int level, type_of_update typ) const {  };
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   
00175   // For abstract differential operators:
00176   // --------------------------------------
00177   // Is the expression an abstract differential operator?
00178   Differential_op_typ Abstract_differential_operator()  const { 
00179     return not_abstract;
00180   }
00181   // For abstract differential operator:
00182   int Give_number_var_of_abstract_op() const { return 0; }
00183 
00184   // for Parallelization
00185   void Add_variables_for_parallel(Evaluation_Parallelization_object *evpar)
00186     const {
00187     evpar->Variable_contained_in_expression(v_.Number_variable());
00188   }
00189   bool GS_type(int var_number_left, int dim) const {
00190     return false; 
00191   };
00192 
00193  // at the and of an iteration of an expression
00194   void clean() const { };
00195 };
00196 
00197 
00198 // Extrapolation at the boundary
00199 DExpr<DVar_Extra_Op>
00200 Extrapolate_near_boundary(Variable a);
00201 
00202 
00203 #endif
00204 
00205         

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