From d51e66f68a5274f0eef7e6775a11274ad6fec012 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Sun, 17 Dec 2017 20:17:39 +0100 Subject: [PATCH] [staggered] Remove primary variables class --- dumux/discretization/staggered/properties.hh | 2 +- dumux/implicit/staggered/primaryvariables.hh | 135 ------------------- 2 files changed, 1 insertion(+), 136 deletions(-) delete mode 100644 dumux/implicit/staggered/primaryvariables.hh diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index 9c684077a1..ca82217268 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -33,7 +33,7 @@ #include <dumux/discretization/cellcentered/elementboundarytypes.hh> #include <dumux/assembly/staggeredlocalresidual.hh> -#include <dumux/implicit/staggered/primaryvariables.hh> +#include <dumux/implicit/staggered/gridvariables.hh> #include <dumux/discretization/cellcentered/subcontrolvolume.hh> #include <dumux/discretization/staggered/gridvariables.hh> diff --git a/dumux/implicit/staggered/primaryvariables.hh b/dumux/implicit/staggered/primaryvariables.hh deleted file mode 100644 index 64114a8387..0000000000 --- a/dumux/implicit/staggered/primaryvariables.hh +++ /dev/null @@ -1,135 +0,0 @@ -// -*- 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 2 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 - * \brief Primary Variables for the Staggered Grid models - */ -#ifndef DUMUX_STAGGERED_PRIMARYVARIABLES_HH -#define DUMUX_STAGGERED_PRIMARYVARIABLES_HH - -#include <dune/istl/multitypeblockvector.hh> -#include <dumux/common/intrange.hh> - -namespace Dumux -{ - -/*! - * \ingroup NavierStokesModel - * \brief This class inherits from DUNE's MultiTypeBlockVector and provides a specific [] operator for convenience - */ -template<class TypeTag, - class CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables), - class FacePrimaryVariables = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables)> -class StaggeredPrimaryVariables : public Dune::MultiTypeBlockVector<CellCenterPrimaryVariables, FacePrimaryVariables> -{ - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Indices = typename GET_PROP_TYPE(TypeTag, Indices); - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - typename DofTypeIndices::CellCenterIdx cellCenterIdx; - typename DofTypeIndices::FaceIdx faceIdx; - - using ParentType = Dune::MultiTypeBlockVector<CellCenterPrimaryVariables, FacePrimaryVariables>; - - static constexpr auto faceOffset = GET_PROP_VALUE(TypeTag, NumEqCellCenter); - - -public: - StaggeredPrimaryVariables() = default; - - // introduce a blocklevel variable so that this class can be used in a Dune::BlockVector - static constexpr int blocklevel = 1; - - - /*! - * \brief Constructor to initialize all entries with the same value - * - * \param value The value - */ - StaggeredPrimaryVariables(const Scalar value) noexcept - { - (*this)[cellCenterIdx] = value; - (*this)[faceIdx] = value; - } - - /*! - * \brief Constructor to initialize the cellcenter and face primary values with given values - * - * \param ccPriVars The cellcenter primary variables used for initialization - * \param facePriVars The face primary variables used for initialization - */ - StaggeredPrimaryVariables(CellCenterPrimaryVariables&& ccPriVars, FacePrimaryVariables&& facePriVars) noexcept - { - (*this)[cellCenterIdx] = std::forward<decltype(ccPriVars)>(ccPriVars); - (*this)[faceIdx] = std::forward<decltype(facePriVars)>(facePriVars); - } - - /*! - * \brief Operator overload which allows to automatically access the "right" priVars vector via pvIdx. - * const version - * \note: the ParentType (DUNE multitypeblockvector) [] operator has to be visible (using ...) - * - * \param pvIdx The global index of the primary variable - */ - using ParentType::operator []; - const Scalar& operator [](const unsigned int pvIdx) const - { - if(pvIdx < faceOffset) - return ParentType::operator[](cellCenterIdx)[pvIdx]; - else - return ParentType::operator[](faceIdx)[pvIdx - faceOffset]; - } - - /*! - * \brief Operator overload which allows to automatically access the "right" priVars vector via pvIdx - * non-const version - * - * \param pvIdx The global index of the primary variable - */ - Scalar& operator [](const unsigned int pvIdx) - { - if(pvIdx < faceOffset) - return ParentType::operator[](cellCenterIdx)[pvIdx]; - else - return ParentType::operator[](faceIdx)[pvIdx - faceOffset]; - } -}; - -/*! -* \brief Class which provides two ranges of indices (cc and face) -* cc: for(auto i : PriVarIndices(cellCenterIdx)) { ... } -* face: for(auto i : PriVarIndices(faceIdx)) { ... } -*/ -template<class TypeTag> -class PriVarIndices : public IntRange -{ - using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); - using cellCenterIdx = typename DofTypeIndices::CellCenterIdx; - using faceIdx = typename DofTypeIndices::FaceIdx; - - static constexpr auto numEqCellCenter = GET_PROP_VALUE(TypeTag, NumEqCellCenter); - static constexpr auto numEqFace = GET_PROP_VALUE(TypeTag, NumEqFace); - -public: - PriVarIndices(cellCenterIdx) : IntRange(0, numEqCellCenter) {} - PriVarIndices(faceIdx) : IntRange(numEqCellCenter, numEqCellCenter + numEqFace) {} -}; - -} // namespace Dumux - -#endif -- GitLab