source: src/grid/multigrid.hpp@ 66f24d

Last change on this file since 66f24d was 48b662, checked in by Olaf Lenz <olenz@…>, 14 years ago

Moved files in scafacos_fcs one level up.

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

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[48b662]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 "grid/grid_indexing.hpp"
16
17namespace VMG
18{
19
20class Comm;
21class Grid;
22class Index;
23class Interface;
24
25class Multigrid : public Object
26{
27public:
28 Multigrid(Comm* comm, const Interface* interface);
29
30 virtual ~Multigrid();
31
32 Grid& operator()() {return *grids[levelIndex];}
33 Grid& operator()(const int& level) {return *grids[levelMax-level];}
34
35 const Grid& operator()() const {return *grids[levelIndex];}
36 const Grid& operator()(const int& level) const {return *grids[levelMax-level];}
37
38 const int& Level() const {return levelCurrent;} ///< Current level
39 int LevelIndex() const {return levelMax-levelCurrent;} ///< Index of current level
40
41 const int& GlobalMaxLevel() const {return levelGlobalMax;}
42 const int& MaxLevel() const {return levelMax;} ///< Maximum level
43 const int& MinLevel() const {return levelMin;} ///< Minimum level
44 const int& NumLevels() const {return numLevels;} ///< Number of levels
45
46 void SetLevel(int level);
47
48 void ToCoarserLevel(); ///< Switch to next coarser level if possible
49 void ToFinerLevel(); ///< Switch to next finer level if possible
50
51 void ClearAll(); ///< Overwrites all grid points with zeros
52 void ClearAllCoarseLevels(); ///< Overwrites all grid points on all levels except the finest one with zeros
53
54 void SetCoarserDirichletValues();
55
56protected:
57
58 std::vector<Grid*> grids;
59
60 int levelGlobalMax, levelMin, levelMax;
61 int levelIndex, levelCurrent;
62 int numLevels;
63
64private:
65 LocalIndices InitDirichlet(const GlobalIndices& global,
66 const SpatialExtent& extent,
67 const Index& pos,
68 const Index& procs);
69
70 LocalIndices InitPeriodic(const GlobalIndices& global,
71 const SpatialExtent& extent,
72 const Index& pos,
73 const Index& procs);
74};
75
76}
77
78#endif /* MULTIGRID_HPP_ */
Note: See TracBrowser for help on using the repository browser.