| 1 | /**
|
|---|
| 2 | * @file multigrid.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Apr 18 12:54:51 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief VMG::Multigrid
|
|---|
| 7 | *
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | #ifndef MULTIGRID_HPP_
|
|---|
| 11 | #define MULTIGRID_HPP_
|
|---|
| 12 |
|
|---|
| 13 | #include <vector>
|
|---|
| 14 |
|
|---|
| 15 | #include "base/object.hpp"
|
|---|
| 16 | #include "grid/grid_properties.hpp"
|
|---|
| 17 |
|
|---|
| 18 | namespace VMG
|
|---|
| 19 | {
|
|---|
| 20 |
|
|---|
| 21 | class Comm;
|
|---|
| 22 | class Grid;
|
|---|
| 23 | class Index;
|
|---|
| 24 | class Interface;
|
|---|
| 25 |
|
|---|
| 26 | class Multigrid : public Object
|
|---|
| 27 | {
|
|---|
| 28 | public:
|
|---|
| 29 | Multigrid(Comm* comm, const Interface* interface);
|
|---|
| 30 |
|
|---|
| 31 | virtual ~Multigrid();
|
|---|
| 32 |
|
|---|
| 33 | Grid& operator()() {return *grids[levelIndex];}
|
|---|
| 34 | Grid& operator()(const int& level) {return *grids[levelMax-level];}
|
|---|
| 35 |
|
|---|
| 36 | const Grid& operator()() const {return *grids[levelIndex];}
|
|---|
| 37 | const Grid& operator()(const int& level) const {return *grids[levelMax-level];}
|
|---|
| 38 |
|
|---|
| 39 | const int& Level() const {return levelCurrent;} ///< Current level
|
|---|
| 40 | int LevelIndex() const {return levelMax-levelCurrent;} ///< Index of current level
|
|---|
| 41 |
|
|---|
| 42 | const int& GlobalMaxLevel() const {return levelGlobalMax;}
|
|---|
| 43 | const int& MaxLevel() const {return levelMax;} ///< Maximum level
|
|---|
| 44 | const int& MinLevel() const {return levelMin;} ///< Minimum level
|
|---|
| 45 | const int& NumLevels() const {return numLevels;} ///< Number of levels
|
|---|
| 46 |
|
|---|
| 47 | void SetLevel(int level);
|
|---|
| 48 |
|
|---|
| 49 | void ToCoarserLevel(); ///< Switch to next coarser level if possible
|
|---|
| 50 | void ToFinerLevel(); ///< Switch to next finer level if possible
|
|---|
| 51 |
|
|---|
| 52 | void ClearAll(); ///< Overwrites all grid points with zeros
|
|---|
| 53 | void ClearAllCoarseLevels(); ///< Overwrites all grid points on all levels except the finest one with zeros
|
|---|
| 54 |
|
|---|
| 55 | void SetCoarserDirichletValues();
|
|---|
| 56 |
|
|---|
| 57 | protected:
|
|---|
| 58 |
|
|---|
| 59 | std::vector<Grid*> grids;
|
|---|
| 60 |
|
|---|
| 61 | int levelGlobalMax, levelMin, levelMax;
|
|---|
| 62 | int levelIndex, levelCurrent;
|
|---|
| 63 | int numLevels;
|
|---|
| 64 | };
|
|---|
| 65 |
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | #endif /* MULTIGRID_HPP_ */
|
|---|