From 2f233d78069fdbd4ba3294c5cf670e57a76572b4 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Wed, 3 Nov 2021 22:04:33 +0100 Subject: [PATCH] [staggered] Add traits to check whether a grid is twist-free --- .../staggered/consistentlyorientedgrid.hh | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 dumux/discretization/facecentered/staggered/consistentlyorientedgrid.hh diff --git a/dumux/discretization/facecentered/staggered/consistentlyorientedgrid.hh b/dumux/discretization/facecentered/staggered/consistentlyorientedgrid.hh new file mode 100644 index 0000000000..295ef7d8d0 --- /dev/null +++ b/dumux/discretization/facecentered/staggered/consistentlyorientedgrid.hh @@ -0,0 +1,58 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program 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. * + * * + * This program 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 <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup Typetraits + * \copydoc Type trait to determine if a grid is oriented consistently + */ +#ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_CONSISTENTLY_ORIENTED_GRID_HH +#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_CONSISTENTLY_ORIENTED_GRID_HH + +#include <type_traits> + +// forward declare +namespace Dune { +template<int dim, class Coordinates> +class YaspGrid; + +template <int dim, class HostGrid, bool mapIndexStorage> +class SubGrid; + +} + +namespace Dumux { + +/*! + * \brief Helper type to determine whether a grid is guaranteed to be oriented consistently. + * This means that the intersection indices always correspond to the ones of a reference element + * or, in other words, the elements are never rotated. + */ +template<class T> +struct ConsistentlyOrientedGrid : public std::false_type {}; + +template<int dim, class Coords> +struct ConsistentlyOrientedGrid<Dune::YaspGrid<dim, Coords>> : public std::true_type {}; + +template<int dim, class Coords, bool mapIndexStorage> +struct ConsistentlyOrientedGrid<Dune::SubGrid<dim, Dune::YaspGrid<dim, Coords>, mapIndexStorage>> : public std::true_type {}; + + +} // end namespace Dumux + +#endif -- GitLab