src/expde/grid/listce/listce1.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 // listce1.h
00019 //
00020 // ------------------------------------------------------------
00021 
00022 
00024 // interior cells
00026 
00027 class P_interior_cell {
00028  public:
00029   P_interior_cell(Index3D I, P_interior_cell* Next, double* var) : 
00030     pointer_varM(var), ind(I), next(Next) {};
00031 
00032   // idem
00033   double *varM(const Grid* gitter) const;
00034 
00035   // corner point variable:
00036   double *varWSD(const Grid* gitter,int lev) const;
00037   double *varWST(const Grid* gitter,int lev) const;
00038   double *varWND(const Grid* gitter,int lev) const;
00039   double *varWNT(const Grid* gitter,int lev) const;
00040   double *varESD(const Grid* gitter,int lev) const;
00041   double *varEST(const Grid* gitter,int lev) const;
00042   double *varEND(const Grid* gitter,int lev) const;
00043   double *varENT(const Grid* gitter,int lev) const;
00044 
00045   // physical coordinates
00046   D3vector coordinate(const Grid* gitter) const;
00047   double coordinateX(const Grid* gitter) const;
00048   double coordinateY(const Grid* gitter) const;
00049   double coordinateZ(const Grid* gitter) const;
00050 
00051   // index of cell
00052   Index3D Ind() const { return ind; };
00053 
00054   // for iteration:
00055   P_interior_cell* Next() { return next; };
00056 
00057   ~P_interior_cell() {
00058     if(next!=NULL)         delete next;
00059     if(pointer_varM!=NULL) delete pointer_varM;
00060   }
00061 
00062  private:
00063   double* pointer_varM;
00064 
00065   Index3D ind;
00066   P_interior_cell *next;  
00067 };
00068 
00069 
00070 // coordinates
00071 inline D3vector P_interior_cell::coordinate(const Grid* gitter) const {
00072   return gitter->transform_coord(ind);
00073 };
00074 inline double P_interior_cell::coordinateX(const Grid* gitter) const {
00075   return gitter->transform_coordX(ind);
00076 };
00077 inline double P_interior_cell::coordinateY(const Grid* gitter) const {
00078   return gitter->transform_coordY(ind);
00079 };
00080 inline double P_interior_cell::coordinateZ(const Grid* gitter) const {
00081   return gitter->transform_coordZ(ind);
00082 };
00083 
00084 inline double *P_interior_cell::varM(const Grid* gitter) const {
00085   return pointer_varM;
00086 };
00087 
00088 inline double *P_interior_cell::varENT(const Grid* gitter,int lev) const {
00089   return gitter->Give_variable(ind.neighbour(ENTd),lev);
00090 };
00091 inline double *P_interior_cell::varEND(const Grid* gitter,int lev) const {
00092   return gitter->Give_variable(ind.neighbour(ENDd),lev);
00093 };
00094 inline double *P_interior_cell::varEST(const Grid* gitter,int lev) const {
00095   return gitter->Give_variable(ind.neighbour(ESTd),lev);
00096 };
00097 inline double *P_interior_cell::varESD(const Grid* gitter,int lev) const {
00098   return gitter->Give_variable(ind.neighbour(ESDd),lev);
00099 };
00100 inline double *P_interior_cell::varWNT(const Grid* gitter,int lev) const {
00101   return gitter->Give_variable(ind.neighbour(WNTd),lev);
00102 };
00103 inline double *P_interior_cell::varWND(const Grid* gitter,int lev) const {
00104   return gitter->Give_variable(ind.neighbour(WNDd),lev);
00105 };
00106 inline double *P_interior_cell::varWST(const Grid* gitter,int lev) const {
00107   return gitter->Give_variable(ind.neighbour(WSTd),lev);
00108 };
00109 inline double *P_interior_cell::varWSD(const Grid* gitter,int lev) const {
00110   return gitter->Give_variable(ind.neighbour(WSDd),lev);
00111 };
00112 
00114 // boundary tets
00116 
00117 class P_boundary_tet {
00118  public:
00119   P_boundary_tet(D3vector coord, P_boundary_tet* Next, double* var,
00120                  Tetraeder_storage* ts, BoCell *bc) : 
00121     pointer_varM(var), tet(ts), in_boundary_cell(bc),
00122     middle_points_coord(coord), next(Next) {};
00123 
00124   // idem
00125   double *varM(const Grid* gitter) const; // middle of tet
00126 
00127   double *var0(const Grid* gitter) const; // corner of tet
00128   double *var1(const Grid* gitter) const; // corner of tet
00129   double *var2(const Grid* gitter) const; // corner of tet
00130   double *var3(const Grid* gitter) const; // corner of tet
00131 
00132   // physical coordinates
00133   D3vector coordinate(const Grid* gitter) const;
00134   double coordinateX(const Grid* gitter) const;
00135   double coordinateY(const Grid* gitter) const;
00136   double coordinateZ(const Grid* gitter) const;
00137 
00138   // index of cell
00139   //  Index3D Ind() const { return ind; };
00140 
00141   // for iteration:
00142   P_boundary_tet* Next() { return next; };
00143 
00144   ~P_boundary_tet() {
00145     if(next!=NULL)         delete next;
00146     if(pointer_varM!=NULL) delete pointer_varM;
00147   }
00148  private:
00149   double* pointer_varM;      // middle of tet
00150 
00151   Tetraeder_storage* tet;    // pointer to tet
00152   BoCell *in_boundary_cell;  // boundary cell in which tet is contained
00153 
00154   D3vector middle_points_coord;
00155   //  Index3D ind;
00156   P_boundary_tet *next;  
00157 };
00158 
00159 
00160 // coordinates
00161 inline D3vector P_boundary_tet::coordinate(const Grid* gitter) const {
00162   return middle_points_coord;
00163 };
00164 inline double P_boundary_tet::coordinateX(const Grid* gitter) const {
00165   return middle_points_coord.x;
00166 };
00167 inline double P_boundary_tet::coordinateY(const Grid* gitter) const {
00168   return middle_points_coord.y;
00169 };
00170 inline double P_boundary_tet::coordinateZ(const Grid* gitter) const {
00171   return middle_points_coord.z;
00172 };
00173 
00174 inline double *P_boundary_tet::varM(const Grid* gitter) const {
00175   return pointer_varM;
00176 };
00177 
00178 inline double *P_boundary_tet::var0(const Grid* gitter) const {
00179   return in_boundary_cell->vars[tet->N0()];
00180 };
00181 inline double *P_boundary_tet::var1(const Grid* gitter) const {
00182   return in_boundary_cell->vars[tet->N1()];
00183 };
00184 inline double *P_boundary_tet::var2(const Grid* gitter) const {
00185   return in_boundary_cell->vars[tet->N2()];
00186 };
00187 inline double *P_boundary_tet::var3(const Grid* gitter) const {
00188   return in_boundary_cell->vars[tet->N3()];
00189 };
00190 

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