src/expde/grid/listnb/listnb3.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 // listnb3.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   double* pointer_varN;
00097   double* pointer_varS;
00098   double* pointer_varE;
00099   double* pointer_varW;
00100   double* pointer_varT;
00101   double* pointer_varD;
00102   
00103   double* pointer_varND;
00104   double* pointer_varWN;
00105   double* pointer_varWT;
00106   double* pointer_varED;
00107   double* pointer_varST;
00108   double* pointer_varES;
00109   
00110   double* pointer_varEST;
00111   double* pointer_varWND;
00112 };
00113 
00114 inline void P_nearb::initialize(const Grid* gitter, int level) {
00115   pointer_varM = gitter->Give_variable(ind,level);
00116   pointer_varN = gitter->Give_variable_slow(ind.next_NS(Rd,level),level);
00117   pointer_varS = gitter->Give_variable_slow(ind.next_NS(Ld,level),level);
00118   pointer_varE = gitter->Give_variable_slow(ind.next_EW(Rd,level),level);
00119   pointer_varW = gitter->Give_variable_slow(ind.next_EW(Ld,level),level);
00120   pointer_varT = gitter->Give_variable_slow(ind.next_TD(Rd,level),level);
00121   pointer_varD = gitter->Give_variable_slow(ind.next_TD(Ld,level),level);
00122   pointer_varND = 
00123     gitter->Give_variable_slow(ind.next_NS(Rd,level).next_TD(Ld,level),level);
00124   pointer_varWN = 
00125     gitter->Give_variable_slow(ind.next_NS(Rd,level).next_EW(Ld,level),level);
00126   pointer_varWT = 
00127     gitter->Give_variable_slow(ind.next_TD(Rd,level).next_EW(Ld,level),level);
00128   pointer_varED =
00129     gitter->Give_variable_slow(ind.next_TD(Ld,level).next_EW(Rd,level),level);
00130   pointer_varST =
00131     gitter->Give_variable_slow(ind.next_TD(Rd,level).next_NS(Ld,level),level);
00132   pointer_varES =
00133     gitter->Give_variable_slow(ind.next_EW(Rd,level).next_NS(Ld,level),level);
00134   pointer_varEST =
00135     gitter->Give_variable_slow(
00136           ind.next_EW(Rd,level).next_NS(Ld,level).next_TD(Rd,level),level);
00137   pointer_varWND =
00138     gitter->Give_variable_slow(
00139           ind.next_EW(Ld,level).next_NS(Rd,level).next_TD(Ld,level),level);
00140 }
00141 
00142 
00143 
00144 // coordinate
00145 inline D3vector P_nearb::coordinate(const Grid* gitter) const {
00146   return gitter->transform_coord(ind);
00147 };
00148 inline double P_nearb::coordinateX(const Grid* gitter) const {
00149   return gitter->transform_coordX(ind);
00150 };
00151 inline double P_nearb::coordinateY(const Grid* gitter) const {
00152   return gitter->transform_coordY(ind);
00153 };
00154 inline double P_nearb::coordinateZ(const Grid* gitter) const {
00155   return gitter->transform_coordZ(ind);
00156 };
00157 
00158 
00159 // next:
00160 inline double *P_nearb::varN(const Grid* gitter, int level)
00161      const {
00162   return pointer_varN;
00163 };
00164 inline double *P_nearb::varS(const Grid* gitter, int level)
00165      const {
00166   return pointer_varS;
00167 };
00168 inline double *P_nearb::varE(const Grid* gitter, int level)
00169      const {
00170   return pointer_varE;
00171 };
00172 inline double *P_nearb::varW(const Grid* gitter, int level)
00173      const {
00174   return pointer_varW;
00175 };
00176 inline double *P_nearb::varT(const Grid* gitter, int level)
00177      const {
00178   return pointer_varT;
00179 };
00180 inline double *P_nearb::varD(const Grid* gitter, int level)
00181      const {
00182   return pointer_varD;
00183 };
00184 // double next:
00185 inline double *P_nearb::varND(const Grid* gitter, int level)
00186      const {
00187   return pointer_varND;
00188 };
00189 inline double *P_nearb::varWN(const Grid* gitter, int level)
00190      const {
00191   return pointer_varWN;
00192 };
00193 inline double *P_nearb::varWT(const Grid* gitter, int level)
00194      const {
00195   return pointer_varWT;
00196 };
00197 inline double *P_nearb::varED(const Grid* gitter, int level)
00198      const {
00199   return pointer_varED;
00200 };
00201 inline double *P_nearb::varST(const Grid* gitter, int level)
00202      const {
00203   return pointer_varST;
00204 };
00205 inline double *P_nearb::varES(const Grid* gitter, int level)
00206      const {
00207   return pointer_varES;
00208 };
00209 // third next:
00210 inline double *P_nearb::varEST(const Grid* gitter, int level)
00211      const {
00212   return pointer_varEST;
00213 };
00214 inline double *P_nearb::varWND(const Grid* gitter, int level)
00215      const {
00216   return pointer_varWND;
00217 };
00218 
00219 
00220 // double next special:
00221 inline double *P_nearb::varWD(const Grid* gitter, int level)
00222      const {
00223   return gitter->Give_variable(ind.next_WD(level),level);
00224 };
00225 inline double *P_nearb::varET(const Grid* gitter, int level)
00226      const {
00227   return gitter->Give_variable(ind.next_ET(level),level);
00228 };
00229 
00231 
00232 // idem
00233 inline double *P_nearb::varM(const Grid* gitter, int level) const {
00234   return pointer_varM;
00235 };
00236 
00237 inline double *P_nearb::varP_slow(const Grid* gitter,int var_ebene,
00238                              Ort1D i, Ort1D j, Ort1D k, int level) const {
00239   return gitter->Give_variable_slow(ind.next(i,j,k,level),var_ebene);
00240 };
00241 
00242 
00243 // informations about the neighbour cells:
00244 inline Celltype  P_nearb::Give_cell_typ(const Grid* grid, dir_sons i, int l)
00245      const {
00246   return grid->Give_cell_typ(ind.next((dir_sons)i,l+1));
00247 };
00248 inline BoCeData* P_nearb::Give_Bo_cell(const Grid* grid, dir_sons i, int l)
00249      const {
00250   return grid->Give_Bo_cell(ind.next((dir_sons)i,l+1));
00251 };
00252 

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