src/expde/grid/listnb/listnb4.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 // listnb4.h
00019 //
00020 // ------------------------------------------------------------
00021 
00022 #define initialize_nearb true
00023 
00024 // near boundary points
00025 class P_nearb {
00026  public:
00027   P_nearb(Index3D I, P_nearb* Next) : ind(I), next(Next) {};
00028 
00029   // initialize
00030   void initialize(const Grid* gitter, int level);
00031 
00032   // idem
00033   double *varM(const Grid* gitter,int level) const;
00034   double *varP_slow(const Grid* gitter,int var_ebene, Ort1D i,Ort1D j,Ort1D k,
00035                     int level) const;
00036 
00037   // next:
00038   double *varN(const Grid* gitter, int level) const;
00039   double *varS(const Grid* gitter, int level) const;
00040   double *varW(const Grid* gitter, int level) const;
00041   double *varE(const Grid* gitter, int level) const;
00042   double *varT(const Grid* gitter, int level) const;
00043   double *varD(const Grid* gitter, int level) const;
00044   // double next:
00045   double *varND(const Grid* gitter, int level) const;
00046   double *varWN(const Grid* gitter, int level) const;
00047   double *varWT(const Grid* gitter, int level) const;
00048   double *varED(const Grid* gitter, int level) const;
00049   double *varST(const Grid* gitter, int level) const;
00050   double *varES(const Grid* gitter, int level) const;
00051   // third next:
00052   double *varEST(const Grid* gitter, int level) const;
00053   double *varWND(const Grid* gitter, int level) const;
00054 
00055   // double next special
00056   double *varWD(const Grid* gitter, int level) const;
00057   double *varET(const Grid* gitter, int level) const;
00058 
00059   // informations about the neighbour cells:
00060   Celltype  Give_cell_typ(const Grid* grid, dir_sons i, int l) const;
00061   BoCeData* Give_Bo_cell( const Grid* grid, dir_sons i, int l) const;
00062 
00063   // physical coordinates
00064   D3vector coordinate(const Grid* gitter) const;
00065   double coordinateX(const Grid* gitter) const;
00066   double coordinateY(const Grid* gitter) const;
00067   double coordinateZ(const Grid* gitter) const;
00068 
00069   // for iteration:
00070   P_nearb* Next() const { return next; };
00071 
00072   // index of point
00073   Index3D Ind() const { return ind; };
00074 
00075   // for MG
00076   void Set_first_mg_coeff_nearb(Point_mg_coeff_nearb* first) {
00077     first_mg_coeff_nearb = first;
00078   }
00079   void Set_first_mg_coeff_bo(   Point_mg_coeff_bo*    first) {
00080     first_mg_coeff_bo    = first;
00081   }
00082   Point_mg_coeff_nearb* Give_first_mg_coeff_nearb() const {
00083     return first_mg_coeff_nearb;
00084   }
00085   Point_mg_coeff_bo* Give_first_mg_coeff_bo() const {
00086     return first_mg_coeff_bo;
00087   }
00088 
00089   // label for boundary points
00090   bool Give_Label(int num, int level, const Grid* gitter) const;
00091  private:
00092   Index3D ind;
00093   P_nearb *next;
00094 
00095   double* pointer_varM;
00096   
00097   double* pointer_varN;
00098   double* pointer_varS;
00099   double* pointer_varE;
00100   double* pointer_varW;
00101   double* pointer_varT;
00102   double* pointer_varD;
00103   
00104   double* pointer_varND;
00105   double* pointer_varWN;
00106   double* pointer_varWT;
00107   double* pointer_varED;
00108   double* pointer_varST;
00109   double* pointer_varES;
00110   
00111   double* pointer_varEST;
00112   double* pointer_varWND;
00113 
00114   BoCeData* bocedatas[8]; 
00115   Celltype  celltyps[8];
00116 
00117   // for MG
00118   Point_mg_coeff_nearb* first_mg_coeff_nearb;
00119   Point_mg_coeff_bo*    first_mg_coeff_bo;
00120 };
00121 
00122 inline void P_nearb::initialize(const Grid* gitter, int level) {
00123   int i;
00124   Index3D next; 
00125   Index3D ori(2,2,2);
00126 
00127   pointer_varM = gitter->Give_variable(ind,level);
00128   pointer_varN = gitter->Give_variable_slow(ind.next_NS(Rd,level),level);
00129   pointer_varS = gitter->Give_variable_slow(ind.next_NS(Ld,level),level);
00130   pointer_varE = gitter->Give_variable_slow(ind.next_EW(Rd,level),level);
00131   pointer_varW = gitter->Give_variable_slow(ind.next_EW(Ld,level),level);
00132   pointer_varT = gitter->Give_variable_slow(ind.next_TD(Rd,level),level);
00133   pointer_varD = gitter->Give_variable_slow(ind.next_TD(Ld,level),level);
00134   pointer_varND = 
00135     gitter->Give_variable_slow(ind.next_NS(Rd,level).next_TD(Ld,level),level);
00136   pointer_varWN = 
00137     gitter->Give_variable_slow(ind.next_NS(Rd,level).next_EW(Ld,level),level);
00138   pointer_varWT = 
00139     gitter->Give_variable_slow(ind.next_TD(Rd,level).next_EW(Ld,level),level);
00140   pointer_varED =
00141     gitter->Give_variable_slow(ind.next_TD(Ld,level).next_EW(Rd,level),level);
00142   pointer_varST =
00143     gitter->Give_variable_slow(ind.next_TD(Rd,level).next_NS(Ld,level),level);
00144   pointer_varES =
00145     gitter->Give_variable_slow(ind.next_EW(Rd,level).next_NS(Ld,level),level);
00146   pointer_varEST =
00147     gitter->Give_variable_slow(
00148           ind.next_EW(Rd,level).next_NS(Ld,level).next_TD(Rd,level),level);
00149   pointer_varWND =
00150     gitter->Give_variable_slow(
00151           ind.next_EW(Ld,level).next_NS(Rd,level).next_TD(Ld,level),level);
00152 
00153   // Zelltyp
00154   for(i=0;i<8;++i) {
00155    next = ind.next((dir_sons)i,level+1);
00156    if(ori <= next)
00157      celltyps[i] = gitter->Give_cell_typ(next);
00158    else
00159      celltyps[i] = ex_cell;
00160   }
00161   for(i=0;i<8;++i) {
00162     if(celltyps[i] >= bo_cell) {
00163       bocedatas[i] = gitter->Give_Bo_cell(ind.next((dir_sons)i,level+1));
00164     }
00165     else bocedatas[i]=NULL;
00166   }
00167 }
00168 
00169 
00170 
00171 // coordinate
00172 inline D3vector P_nearb::coordinate(const Grid* gitter) const {
00173   return gitter->transform_coord(ind);
00174 };
00175 inline double P_nearb::coordinateX(const Grid* gitter) const {
00176   return gitter->transform_coordX(ind);
00177 };
00178 inline double P_nearb::coordinateY(const Grid* gitter) const {
00179   return gitter->transform_coordY(ind);
00180 };
00181 inline double P_nearb::coordinateZ(const Grid* gitter) const {
00182   return gitter->transform_coordZ(ind);
00183 };
00184 
00185 
00186 // next:
00187 inline double *P_nearb::varN(const Grid* gitter, int level)
00188      const {
00189   return pointer_varN;
00190 };
00191 inline double *P_nearb::varS(const Grid* gitter, int level)
00192      const {
00193   return pointer_varS;
00194 };
00195 inline double *P_nearb::varE(const Grid* gitter, int level)
00196      const {
00197   return pointer_varE;
00198 };
00199 inline double *P_nearb::varW(const Grid* gitter, int level)
00200      const {
00201   return pointer_varW;
00202 };
00203 inline double *P_nearb::varT(const Grid* gitter, int level)
00204      const {
00205   return pointer_varT;
00206 };
00207 inline double *P_nearb::varD(const Grid* gitter, int level)
00208      const {
00209   return pointer_varD;
00210 };
00211 // double next:
00212 inline double *P_nearb::varND(const Grid* gitter, int level)
00213      const {
00214   return pointer_varND;
00215 };
00216 inline double *P_nearb::varWN(const Grid* gitter, int level)
00217      const {
00218   return pointer_varWN;
00219 };
00220 inline double *P_nearb::varWT(const Grid* gitter, int level)
00221      const {
00222   return pointer_varWT;
00223 };
00224 inline double *P_nearb::varED(const Grid* gitter, int level)
00225      const {
00226   return pointer_varED;
00227 };
00228 inline double *P_nearb::varST(const Grid* gitter, int level)
00229      const {
00230   return pointer_varST;
00231 };
00232 inline double *P_nearb::varES(const Grid* gitter, int level)
00233      const {
00234   return pointer_varES;
00235 };
00236 // third next:
00237 inline double *P_nearb::varEST(const Grid* gitter, int level)
00238      const {
00239   return pointer_varEST;
00240 };
00241 inline double *P_nearb::varWND(const Grid* gitter, int level)
00242      const {
00243   return pointer_varWND;
00244 };
00245 
00246 
00247 // double next special:
00248 inline double *P_nearb::varWD(const Grid* gitter, int level)
00249      const {
00250   return gitter->Give_variable(ind.next_WD(level),level);
00251 };
00252 inline double *P_nearb::varET(const Grid* gitter, int level)
00253      const {
00254   return gitter->Give_variable(ind.next_ET(level),level);
00255 };
00256 
00258 
00259 // idem
00260 inline double *P_nearb::varM(const Grid* gitter, int level) const {
00261   return pointer_varM;
00262 };
00263 
00264 inline double *P_nearb::varP_slow(const Grid* gitter,int var_ebene,
00265                              Ort1D i, Ort1D j, Ort1D k, int level) const {
00266   return gitter->Give_variable_slow(ind.next(i,j,k,level),var_ebene);
00267 };
00268 
00269 
00270 // informations about the neighbour cells:
00271 inline Celltype  P_nearb::Give_cell_typ(const Grid* grid, dir_sons i, int l)
00272      const {
00273   return celltyps[i];
00274 };
00275 inline BoCeData* P_nearb::Give_Bo_cell(const Grid* grid, dir_sons i, int l)
00276      const {
00277   return bocedatas[i];
00278 };
00279 
00280 inline bool P_nearb::Give_Label(int num, int level, const Grid* gitter) const {
00281   // since no Dirichlet boundary condition, we can run that point. 
00282   return gitter->Give_label_bo_D(ind,num,level)==false;
00283 };

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