/** * @file grid_index_translations.hpp * @author Julian Iseringhausen * @date Tue May 17 11:46:37 2011 * * @brief Class to convert different representations of grid * indices. * */ #ifndef GRID_INDEX_TRANSLATIONS_HPP_ #define GRID_INDEX_TRANSLATIONS_HPP_ #include "base/defs.hpp" #include "base/index.hpp" namespace VMG { class Comm; class Grid; class GridIndexTranslations { public: GridIndexTranslations(const Grid* father_) : father(father_) {} Index GlobalToLocal(const Index& index_global) const; static Index GlobalToFiner(const Index& index_global); static Index GlobalToCoarser(const Index& index_global); static Index GlobalToFiner(const Index& index_global, const int& num_levels); static Index GlobalToCoarser(const Index& index_global, const int& num_levels); Index LocalToGlobal(const Index& index_local) const; Index LocalToFiner(const Index& index_local) const; Index LocalToCoarser(const Index& index_local) const; Index FinestGlobalToLocal(const Index& index_finest) const; Index FinestGlobalToGlobal(const Index& index_finest) const; static void FineToCoarse(Index& begin, Index& end); static void CoarseToFine(Index& begin, Index& end, const Index& size_global); static Index EndOffset(const Boundary& boundary) { Index offset; for (int i=0; i<3; ++i) offset[i] = (boundary[i] == Open || boundary[i] == Dirichlet ? 1 : 0); return offset; } protected: const Grid* Father() const {return father;} private: const Grid* father; }; } #endif /* GRID_INDEX_TRANSLATIONS_HPP_ */