/* * vmg - a versatile multigrid solver * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn * * vmg is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * vmg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * @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 GridIteratorSet; class GridIndexTranslations { public: GridIndexTranslations() {} static bool IsGridPointOf(const Grid& grid, const Index& index_finest); static Index LocalToGlobal(const Grid& grid, const Index& index_local); static Index LocalToGlobalFinest(const Grid& grid, const Index& index_local); static Index GlobalToLocal(const Grid& grid, const Index& index_global); static Index GlobalToGlobalFinest(const Grid& grid, const Index& index_global); static Index GlobalFinestToLocal(const Grid& grid, const Index& index_finest); static Index GlobalFinestToGlobal(const Grid& grid, const Index& index_finest); static void GlobalCoarseToFine(Index& begin, Index& end); static void GlobalFineToCoarse(Index& begin, Index& end); static void GetGridAlignment(const Grid& grid_1, GridIteratorSet& bounds_1, const Grid& grid_2, GridIteratorSet& bounds_2); static Index EndOffset(const Boundary& boundary) { return Index(boundary[0] == Periodic ? 0 : 1, boundary[1] == Periodic ? 0 : 1, boundary[2] == Periodic ? 0 : 1); } }; } #endif /* GRID_INDEX_TRANSLATIONS_HPP_ */