Changeset dfed1c for src/grid/grid.hpp


Ignore:
Timestamp:
Nov 22, 2011, 9:22:10 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
facba0
Parents:
66f24d
Message:

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/grid/grid.hpp

    r66f24d rdfed1c  
    1212
    1313#include "base/object.hpp"
    14 #include "grid/grid_indexing.hpp"
     14#include "grid/grid_index_translations.hpp"
     15#include "grid/grid_iterator.hpp"
     16#include "grid/grid_iterator_suite.hpp"
     17#include "grid/grid_properties.hpp"
    1518
    1619namespace VMG
     
    1821
    1922class Comm;
     23class Multigrid;
     24class Stencil;
    2025
    2126class Grid : public Object
    2227{
    2328public:
    24   Grid()
     29  typedef GridIterator iterator;
     30
     31  Grid(int level_ = 0, Multigrid* father_ = NULL) :
     32    index_translations(this),
     33    level(level_),
     34    father(father_)
    2535  {
    2636    grid = NULL;
    2737  }
    2838
    29   Grid(const GlobalIndices& global_, const LocalIndices& local_, const SpatialExtent& extent_) :
     39  Grid(const GlobalIndices& global_, const LocalIndices& local_, const SpatialExtent& extent_,
     40       int level_ = 0, Multigrid* father_ = NULL) :
     41    index_translations(this),
     42    level(level_),
    3043    global(global_),
    3144    local(local_),
    32     extent(extent_)
    33   {InitGrid();}
     45    extent(extent_),
     46    iterators(local_),
     47    father(father_)
     48  {
     49    InitGrid();
     50  }
     51
     52  Grid(const Grid& rhs) :
     53    index_translations(rhs.Indexing()),
     54    level(rhs.Level()),
     55    global(rhs.Global()),
     56    local(rhs.Local()),
     57    extent(rhs.Extent()),
     58    iterators(rhs.Iterators()),
     59    father(rhs.Father())
     60  {
     61    InitGrid();
     62    SetGrid(rhs);
     63  }
    3464
    3565  virtual ~Grid();
    3666
    37   Grid(const Comm* comm, const Index& size, const vmg_float& width);
     67  Grid& operator=(const Grid& rhs);
    3868
    3969  const GlobalIndices& Global() const {return global;}
     
    4474  LocalIndices& Local() {return local;}
    4575  SpatialExtent& Extent() {return extent;}
     76
     77  GridIteratorSuite& Iterators() {return iterators;}
     78  const GridIteratorSuite& Iterators() const {return iterators;}
    4679
    4780  const vmg_float& MeshWidth() const {return Extent().MeshWidth().X();} ///< Mesh width of current level
     
    77110  int GlobalLinearIndex(const Index& index) const;
    78111
    79   Index GlobalToLocalIndex(const Index& index) const;
    80 
    81112  bool IsCompatible(const Grid& rhs) const; ///< Check if two grids share compatible settings
    82113  bool IsConsistent() const;                  ///< Check grid for nan and inf
     114
     115  Multigrid* Father() const {return father;}
    83116
    84117  virtual vmg_float DebugKnownSolution(Vector x) const {return 0.0;}
    85118  vmg_float DebugKnownSolution(Index i) const {return DebugKnownSolution(extent.Begin() + i * extent.MeshWidth());}
    86119
     120  const GridIndexTranslations& Indexing() const {return index_translations;}
     121
     122  const int& Level() const {return level;}
     123
     124  bool IsActive() const {return Local().Size().Product() > 0;}
     125
    87126private:
    88127  void InitGrid();
    89128
     129  GridIndexTranslations index_translations;
     130
    90131protected:
     132  int level;
     133
    91134  GlobalIndices global;
    92135  LocalIndices local;
    93136  SpatialExtent extent;
    94137
     138  GridIteratorSuite iterators;
     139
    95140  vmg_float *grid;
     141
     142  Multigrid* father;
    96143
    97144  static vmg_float correction;
     
    120167inline int Grid::GlobalLinearIndex(int x, int y, int z) const
    121168{
    122   return z + global.Size().Z() * (y + global.Size().Y() * x);
     169  return z + global.SizeGlobal().Z() * (y + global.SizeGlobal().Y() * x);
    123170}
    124171
     
    128175}
    129176
    130 inline Index Grid::GlobalToLocalIndex(const Index& index) const
    131 {
    132   return index - Global().Begin() + Local().Begin();
    133 }
    134 
    135177}
    136178
Note: See TracChangeset for help on using the changeset viewer.