diff --git a/dumux/discretization/staggered/elementvolumevariables.hh b/dumux/discretization/staggered/elementvolumevariables.hh index cba46de3b7908942baeaa63edf096ced822ec4cb..ff84ccca7b9095b6ac8a3272827889e91338207f 100644 --- a/dumux/discretization/staggered/elementvolumevariables.hh +++ b/dumux/discretization/staggered/elementvolumevariables.hh @@ -30,6 +30,7 @@ #include <vector> #include <dune/common/exceptions.hh> +#include <dumux/discretization/staggered/elementsolution.hh> namespace Dumux { diff --git a/dumux/discretization/staggered/gridvolumevariables.hh b/dumux/discretization/staggered/freeflow/gridvolumevariables.hh similarity index 94% rename from dumux/discretization/staggered/gridvolumevariables.hh rename to dumux/discretization/staggered/freeflow/gridvolumevariables.hh index 0f2fbd7b26181ad308bf2f93a84cd81740ccd302..9cc924905c9edfcdb7baafd660f914f6da8c2502 100644 --- a/dumux/discretization/staggered/gridvolumevariables.hh +++ b/dumux/discretization/staggered/freeflow/gridvolumevariables.hh @@ -29,9 +29,20 @@ //! make the local view function available whenever we use this class #include <dumux/discretization/localview.hh> #include <dumux/discretization/staggered/elementsolution.hh> +#include <dumux/discretization/staggered/elementvolumevariables.hh> namespace Dumux { +template<class P, class VV> +struct StaggeredGridDefaultGridVolumeVariablesTraits +{ + using Problem = P; + using VolumeVariables = VV; + + template<class GridVolumeVariables, bool cachingEnabled> + using LocalView = StaggeredElementVolumeVariables<GridVolumeVariables, cachingEnabled>; +}; + /*! * \ingroup StaggeredDiscretization * \brief Grid volume variables class for staggered models @@ -52,8 +63,8 @@ class StaggeredGridVolumeVariables<Traits, /*cachingEnabled*/true> using PrimaryVariables = typename Traits::VolumeVariables::PrimaryVariables; public: - //! export the type of the indices TODO: get them out of the volvars - using Indices = typename Traits::Indices; + //! export the type of the indices + using Indices = typename Traits::VolumeVariables::Indices; //! export the type of the VolumeVariables using VolumeVariables = typename Traits::VolumeVariables; diff --git a/dumux/discretization/staggered/freeflow/properties.hh b/dumux/discretization/staggered/freeflow/properties.hh index 7d8d20f15c38a6815b73da380aecd5bf705a7073..74815ff2b28d0356886597fef356bf27746f8b6f 100644 --- a/dumux/discretization/staggered/freeflow/properties.hh +++ b/dumux/discretization/staggered/freeflow/properties.hh @@ -40,6 +40,7 @@ #include "boundarytypes.hh" #include "velocityoutput.hh" #include "fvgridgeometrytraits.hh" +#include "gridvolumevariables.hh" namespace Dumux { @@ -94,6 +95,19 @@ public: using type = StaggeredFaceVariables<FacePrimaryVariables, GridView::dimension>; }; +//! Set the default global volume variables cache vector class +SET_PROP(StaggeredFreeFlowModel, GridVolumeVariables) +{ +private: + using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); + static constexpr auto enableCache = GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache); + using Traits = StaggeredGridDefaultGridVolumeVariablesTraits<Problem, VolumeVariables>; +public: + using type = StaggeredGridVolumeVariables<Traits, enableCache>; +}; + + //! Boundary types at a single degree of freedom SET_PROP(StaggeredFreeFlowModel, BoundaryTypes) { diff --git a/dumux/discretization/staggered/gridvariablestraits.hh b/dumux/discretization/staggered/gridvariablestraits.hh deleted file mode 100644 index 4120bd3db4f781bef19b40d53be7283e5248d209..0000000000000000000000000000000000000000 --- a/dumux/discretization/staggered/gridvariablestraits.hh +++ /dev/null @@ -1,53 +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 - * \ingroup StaggeredDiscretization - * \brief Traits class to be used in conjunction with the StaggeredGridFaceVariables. - */ -#ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_VARIABLES_TRAITS_HH -#define DUMUX_DISCRETIZATION_STAGGERED_GRID_VARIABLES_TRAITS_HH - -#include <dumux/discretization/staggered/elementvolumevariables.hh> - -namespace Dumux { - -/*! - * \ingroup StaggeredDiscretization - * \brief Traits class to be used for the StaggeredGridVolumeVariables. - * - * \tparam P The problem type - * \tparam VV The volume variables type - * \tparam I The indices type - * TODO: Remove the indices (get out of volvar) and do a default class like in tpfa - */ -template<class P, class VV, class I> -struct StaggeredGridVolumeVariablesTraits -{ - template<class GridVolumeVariables, bool enableCache> - using LocalView = StaggeredElementVolumeVariables<GridVolumeVariables, enableCache>; - - using Problem = P; - using VolumeVariables = VV; - using Indices = I; -}; - -} // end namespace Dumux - -#endif diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index ce97d02c01b650c500440cb5445e0a9010519c04..51f0661255111c5c7e01cb16da5d05d826db7a18 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -39,7 +39,6 @@ #include <dumux/discretization/cellcentered/subcontrolvolume.hh> #include <dumux/discretization/staggered/gridvariables.hh> #include <dumux/discretization/staggered/gridfluxvariablescache.hh> -#include <dumux/discretization/staggered/gridvolumevariables.hh> #include <dumux/discretization/staggered/fvgridgeometry.hh> #include <dumux/discretization/staggered/gridfacevariables.hh> #include <dumux/discretization/staggered/facesolution.hh> @@ -48,8 +47,6 @@ #include <dune/istl/multitypeblockvector.hh> #include <dune/istl/multitypeblockmatrix.hh> -#include <dumux/discretization/staggered/gridvariablestraits.hh> - namespace Dumux { // forward declarations @@ -74,24 +71,6 @@ public: //! Cache the face variables per default SET_BOOL_PROP(StaggeredModel, EnableGridFaceVariablesCache, true); -//! Set the default global volume variables cache vector class -SET_PROP(StaggeredModel, GridVolumeVariables) -{ -private: - using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices; // TODO extract indices from volumevariables - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - - static constexpr auto enableCache = GET_PROP_VALUE(TypeTag, EnableGridVolumeVariablesCache); - - using Traits = StaggeredGridVolumeVariablesTraits<Problem, VolumeVariables, Indices>; // TODO extract indices from volumevariables - -public: - using type = StaggeredGridVolumeVariables<Traits, enableCache>; -}; - //! Set the global flux variables cache vector class SET_PROP(StaggeredModel, GridFluxVariablesCache) {