src/expde/grid/listnb/listnb2.h

Go to the documentation of this file.
00001 //    expde: expression templates for partial differential equations.
00002 //    Copyright (C) 2000  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 // ------------------------------------------------------------
00014 // listnb2.h
00015 //
00016 // ------------------------------------------------------------
00017 
00018 #define initialize_nearb true
00019 
00020 // near boundary points
00021 class P_nearb {
00022  public:
00023   P_nearb(Index3D I, P_nearb* Next) : ind(I), next(Next) {};
00024 
00025   // initialize
00026   void initialize(const Grid* gitter, int level);
00027 
00028   // idem
00029   double *varM(const Grid* gitter,int level) const;
00030   double *varP_slow(const Grid* gitter,int var_ebene, Ort1D i,Ort1D j,Ort1D k,
00031                     int level) const;
00032 
00033   // next:
00034   double *varN(const Grid* gitter, int level) const;
00035   double *varS(const Grid* gitter, int level) const;
00036   double *varW(const Grid* gitter, int level) const;
00037   double *varE(const Grid* gitter, int level) const;
00038   double *varT(const Grid* gitter, int level) const;
00039   double *varD(const Grid* gitter, int level) const;
00040   // double next:
00041   double *varND(const Grid* gitter, int level) const;
00042   double *varWN(const Grid* gitter, int level) const;
00043   double *varWT(const Grid* gitter, int level) const;
00044   double *varED(const Grid* gitter, int level) const;
00045   double *varST(const Grid* gitter, int level) const;
00046   double *varES(const Grid* gitter, int level) const;
00047   // third next:
00048   double *varEST(const Grid* gitter, int level) const;
00049   double *varWND(const Grid* gitter, int level) const;
00050 
00051   // double next special
00052   double *varWD(const Grid* gitter, int level) const;
00053   double *varET(const Grid* gitter, int level) const;
00054 
00055   // informations about the neighbour cells:
00056   Celltype  Give_cell_typ(const Grid* grid, dir_sons i, int l) const;
00057   BoCeData* Give_Bo_cell( const Grid* grid, dir_sons i, int l) const;
00058 
00059   // physical coordinates
00060   D3vector coordinate(const Grid* gitter) const;
00061   double coordinateX(const Grid* gitter) const;
00062   double coordinateY(const Grid* gitter) const;
00063   double coordinateZ(const Grid* gitter) const;
00064 
00065   // for iteration:
00066   P_nearb* Next() const { return next; };
00067 
00068   // index of point
00069   Index3D Ind() const { return ind; };
00070 
00071   // for MG
00072   void Set_first_mg_coeff_nearb(Point_mg_coeff_nearb* first) {
00073     cout << "Error: mg coefficients are not allowed in listnbi with i<4" 
00074          << endl;
00075   }
00076   void Set_first_mg_coeff_bo(   Point_mg_coeff_bo*    first) {
00077     cout << "Error: mg coefficients are not allowed in listnbi with i<4" 
00078          << endl;
00079   }
00080   Point_mg_coeff_nearb* Give_first_mg_coeff_nearb() const {
00081     cout << "Error: mg coefficients are not allowed in listnbi with i<4" 
00082          << endl;
00083     return NULL;
00084   }
00085   Point_mg_coeff_bo* Give_first_mg_coeff_bo() const {
00086     cout << "Error: mg coefficients are not allowed in listnbi with i<4" 
00087          << endl;
00088     return NULL;
00089   }
00090  private:
00091   Index3D ind;
00092   P_nearb *next;
00093 
00094   double* pointer_varM;
00095 };
00096 
00097 inline void P_nearb::initialize(const Grid* gitter, int level) {
00098   pointer_varM = gitter->Give_variable(ind,level);
00099 }
00100 
00101 
00102 
00103 // coordinate
00104 inline D3vector P_nearb::coordinate(const Grid* gitter) const {
00105   return gitter->transform_coord(ind);
00106 };
00107 inline double P_nearb::coordinateX(const Grid* gitter) const {
00108   return gitter->transform_coordX(ind);
00109 };
00110 inline double P_nearb::coordinateY(const Grid* gitter) const {
00111   return gitter->transform_coordY(ind);
00112 };
00113 inline double P_nearb::coordinateZ(const Grid* gitter) const {
00114   return gitter->transform_coordZ(ind);
00115 };
00116 
00117 
00118 
00119 
00120 // next:
00121 inline double *P_nearb::varN(const Grid* gitter, int level)
00122      const {
00123   return gitter->Give_variable(ind.next_NS(Rd,level),level);
00124 };
00125 inline double *P_nearb::varS(const Grid* gitter, int level)
00126      const {
00127   return gitter->Give_variable(ind.next_NS(Ld,level),level);
00128 };
00129 inline double *P_nearb::varE(const Grid* gitter, int level)
00130      const {
00131   return gitter->Give_variable(ind.next_EW(Rd,level),level);
00132 };
00133 inline double *P_nearb::varW(const Grid* gitter, int level)
00134      const {
00135   return gitter->Give_variable(ind.next_EW(Ld,level),level);
00136 };
00137 inline double *P_nearb::varT(const Grid* gitter, int level)
00138      const {
00139   return gitter->Give_variable(ind.next_TD(Rd,level),level);
00140 };
00141 inline double *P_nearb::varD(const Grid* gitter, int level)
00142      const {
00143   return gitter->Give_variable(ind.next_TD(Ld,level),level);
00144 };
00145 // double next:
00146 inline double *P_nearb::varND(const Grid* gitter, int level)
00147      const {
00148   return gitter->Give_variable(ind.next_NS(Rd,level).next_TD(Ld,level),level);
00149 };
00150 inline double *P_nearb::varWN(const Grid* gitter, int level)
00151      const {
00152   return gitter->Give_variable(ind.next_NS(Rd,level).next_EW(Ld,level),
00153                                level);
00154 };
00155 inline double *P_nearb::varWT(const Grid* gitter, int level)
00156      const {
00157   return gitter->Give_variable(ind.next_TD(Rd,level).next_EW(Ld,level),
00158                                level);
00159 };
00160 inline double *P_nearb::varED(const Grid* gitter, int level)
00161      const {
00162   return gitter->Give_variable(ind.next_TD(Ld,level).next_EW(Rd,level),
00163                                level);
00164 };
00165 inline double *P_nearb::varST(const Grid* gitter, int level)
00166      const {
00167   return gitter->Give_variable(ind.next_TD(Rd,level).next_NS(Ld,level),
00168                                level);
00169 };
00170 inline double *P_nearb::varES(const Grid* gitter, int level)
00171      const {
00172   return gitter->Give_variable(ind.next_EW(Rd,level).next_NS(Ld,level),
00173                                level);
00174 };
00175 // third next
00176 inline double *P_nearb::varEST(const Grid* gitter, int level)
00177      const {
00178   return gitter->Give_variable(
00179     ind.next_EW(Rd,level).next_NS(Ld,level).next_TD(Rd,level),level);
00180 };
00181 inline double *P_nearb::varWND(const Grid* gitter, int level)
00182      const {
00183   return gitter->Give_variable(
00184     ind.next_EW(Ld,level).next_NS(Rd,level).next_TD(Ld,level),level);
00185 };
00186 
00187 // double next special:
00188 inline double *P_nearb::varWD(const Grid* gitter, int level)
00189      const {
00190   return gitter->Give_variable(ind.next_WD(level),level);
00191 };
00192 inline double *P_nearb::varET(const Grid* gitter, int level)
00193      const {
00194   return gitter->Give_variable(ind.next_ET(level),level);
00195 };
00196 
00198 
00199 // idem
00200 inline double *P_nearb::varM(const Grid* gitter, int level) const {
00201   return pointer_varM;
00202 };
00203 
00204 inline double *P_nearb::varP_slow(const Grid* gitter,int var_ebene,
00205                              Ort1D i, Ort1D j, Ort1D k, int level) const {
00206   return gitter->Give_variable_slow(ind.next(i,j,k,level),var_ebene);
00207 };
00208 
00209 // informations about the neighbour cells:
00210 inline Celltype  P_nearb::Give_cell_typ(const Grid* grid, dir_sons i, int l)
00211      const {
00212   return grid->Give_cell_typ(ind.next((dir_sons)i,l+1));
00213 };
00214 inline BoCeData* P_nearb::Give_Bo_cell(const Grid* grid, dir_sons i, int l)
00215      const {
00216   return grid->Give_Bo_cell(ind.next((dir_sons)i,l+1));
00217 };
00218 

Generated on Mon Jan 16 13:23:41 2006 for IPPL by  doxygen 1.4.6