source: src/grid/grid_index_translations.hpp@ 64ba929

Last change on this file since 64ba929 was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

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

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file grid_index_translations.hpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Tue May 17 11:46:37 2011
5 *
6 * @brief Class to convert different representations of grid
7 * indices.
8 *
9 */
10
11#ifndef GRID_INDEX_TRANSLATIONS_HPP_
12#define GRID_INDEX_TRANSLATIONS_HPP_
13
14#include "base/defs.hpp"
15#include "base/index.hpp"
16
17namespace VMG
18{
19
20class Comm;
21class Grid;
22
23class GridIndexTranslations
24{
25public:
26 GridIndexTranslations(const Grid* father_) :
27 father(father_)
28 {}
29
30 Index GlobalToLocal(const Index& index_global) const;
31 static Index GlobalToFiner(const Index& index_global);
32 static Index GlobalToCoarser(const Index& index_global);
33
34 static Index GlobalToFiner(const Index& index_global, const int& num_levels);
35 static Index GlobalToCoarser(const Index& index_global, const int& num_levels);
36
37 Index LocalToGlobal(const Index& index_local) const;
38 Index LocalToFiner(const Index& index_local) const;
39 Index LocalToCoarser(const Index& index_local) const;
40
41 Index FinestGlobalToLocal(const Index& index_finest) const;
42 Index FinestGlobalToGlobal(const Index& index_finest) const;
43
44 static void FineToCoarse(Index& begin, Index& end);
45 static void CoarseToFine(Index& begin, Index& end, const Index& size_global);
46
47 static Index EndOffset(const Boundary& boundary)
48 {
49 Index offset;
50
51 for (int i=0; i<3; ++i)
52 offset[i] = (boundary[i] == Open || boundary[i] == Dirichlet ? 1 : 0);
53
54 return offset;
55 }
56
57protected:
58 const Grid* Father() const {return father;}
59
60private:
61 const Grid* father;
62};
63
64}
65
66#endif /* GRID_INDEX_TRANSLATIONS_HPP_ */
Note: See TracBrowser for help on using the repository browser.