/* * 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 tuple.hpp * @author Julian Iseringhausen * @date Wed May 18 16:48:46 2011 * * @brief Templated class for storing tuples. * */ #ifndef TUPLE_HPP_ #define TUPLE_HPP_ namespace VMG { template class Tuple { public: T& Left() {return left;} T& Right() {return right;} const T& Left() const {return left;} const T& Right() const {return right;} private: T left, right; }; template class Tuple3 { public: Tuple& operator[](const int& index) {return tuples[index];} Tuple& X() {return tuples[0];} Tuple& Y() {return tuples[1];} Tuple& Z() {return tuples[2];} const Tuple& operator[](const int& index) const {return tuples[index];} const Tuple& X() const {return tuples[0];} const Tuple& Y() const {return tuples[1];} const Tuple& Z() const {return tuples[2];} private: Tuple tuples[3]; }; } #endif /* TUPLE_HPP_ */