diff --git a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh index 59680aded654242d794f817ba0afad5c9138db51..e1e537e93bf0a9b2a8d68c4a68bd3f21055b407e 100644 --- a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh +++ b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh @@ -32,6 +32,30 @@ namespace Dumux { +/*! + * \ingroup CCMpfaDiscretization + * \brief Default traits to be used in conjuntion + * with the dual grid nodal index set. + * + * \tparam GV The grid view type + */ +template<class GV> +struct NodalIndexSetDefaultTraits +{ + using GridView = GV; + using GridIndexType = typename GV::IndexSet::IndexType; + using LocalIndexType = std::uint8_t; + + //! per default, we use dynamic data containers (iv size unknown) + template< class T > using NodalScvDataStorage = std::vector< T >; + template< class T > using NodalScvfDataStorage = std::vector< T >; + + //! store data on neighbors of scvfs in static containers if possible + template< class T > + using ScvfNeighborDataStorage = typename std::conditional_t< (int(GV::dimension)<int(GV::dimensionworld)), + std::vector< T >, + Dune::ReservedVector< T, 2 > >; +}; /*! * \ingroup CCMpfaDiscretization diff --git a/dumux/discretization/cellcentered/mpfa/fvgridgeometrytraits.hh b/dumux/discretization/cellcentered/mpfa/fvgridgeometrytraits.hh new file mode 100644 index 0000000000000000000000000000000000000000..4ab6ae7ad70ea75e71a881fcf41fbd8271b977dd --- /dev/null +++ b/dumux/discretization/cellcentered/mpfa/fvgridgeometrytraits.hh @@ -0,0 +1,72 @@ +// -*- 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 CCMpfaDiscretization + * \brief Traits class to be used in conjunction with the CCMpfaFVGridGeometry. + */ +#ifndef DUMUX_DISCRETIZATION_CC_MPFA_FV_GRID_GEOMETRY_TRAITS_HH +#define DUMUX_DISCRETIZATION_CC_MPFA_FV_GRID_GEOMETRY_TRAITS_HH + +#include <dumux/common/defaultmappertraits.hh> + +#include <dumux/discretization/cellcentered/subcontrolvolume.hh> + +#include <dumux/discretization/cellcentered/mpfa/connectivitymap.hh> +#include <dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh> +#include <dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh> +#include <dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh> +#include <dumux/discretization/cellcentered/mpfa/helper.hh> + +namespace Dumux { + +/*! + * \ingroup CCMpfaDiscretization + * \brief Traits class to be used for the CCMpfaFVGridGeometry. + * + * \tparam GV the grid view type + * \tparam NI the type used for node-local indexing + * \tparam PIV the primary interaction volume type + * \tparam SIV the secondary interaction volume type + */ +template<class GV, class NI, class PIV, class SIV> +struct CCMpfaFVGridGeometryTraits : public DefaultMapperTraits<GV> +{ + using SubControlVolume = CCSubControlVolume<GV>; + using SubControlVolumeFace = CCMpfaSubControlVolumeFace<GV>; + using NodalIndexSet = NI; + //! State the maximum admissible element stencil size + //! Per default, we use high values that are hopefully enough for all cases + //! We assume simplex grids where stencils can get quite large but the size is unknown + static constexpr int maxElementStencilSize = int(GV::dimension) == 3 ? 150 : + (int(GV::dimension)<int(GV::dimensionworld) ? 45 : 15); + //! type definitions depending on the FVGridGeometry itself + template< class FVGridGeom > + using MpfaHelper = CCMpfaHelper< FVGridGeom >; + template< class FVGridGeom > + using ConnectivityMap = CCMpfaConnectivityMap<FVGridGeom, PIV::MpfaMethod>; + template< class FVGridGeom > + using GridIvIndexSets = CCMpfaGridInteractionVolumeIndexSets< FVGridGeom, NodalIndexSet, PIV, SIV >; + template< class FVGridGeom, bool enableCache > + using LocalView = CCMpfaFVElementGeometry<FVGridGeom, enableCache>; +}; + +} // end namespace Dumux + +#endif diff --git a/dumux/discretization/cellcentered/mpfa/properties.hh b/dumux/discretization/cellcentered/mpfa/properties.hh index b6ceed332a3664bce8533127dd69e5ea1ecdd83a..44e093eea611a8850f36373fca6438db4d294097 100644 --- a/dumux/discretization/cellcentered/mpfa/properties.hh +++ b/dumux/discretization/cellcentered/mpfa/properties.hh @@ -37,19 +37,14 @@ #include <dumux/discretization/cellcentered/gridvolumevariables.hh> #include <dumux/discretization/cellcentered/elementsolution.hh> #include <dumux/discretization/cellcentered/elementboundarytypes.hh> -#include <dumux/discretization/cellcentered/subcontrolvolume.hh> #include <dumux/discretization/cellcentered/mpfa/methods.hh> +#include <dumux/discretization/cellcentered/mpfa/fvgridgeometrytraits.hh> #include <dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh> #include <dumux/discretization/cellcentered/mpfa/gridfluxvariablescache.hh> -#include <dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh> -#include <dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh> #include <dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh> #include <dumux/discretization/cellcentered/mpfa/elementfluxvariablescache.hh> #include <dumux/discretization/cellcentered/mpfa/dualgridindexset.hh> -#include <dumux/discretization/cellcentered/mpfa/connectivitymap.hh> -#include <dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh> -#include <dumux/discretization/cellcentered/mpfa/helper.hh> #include <dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh> @@ -63,26 +58,10 @@ NEW_TYPE_TAG(CCMpfaModel, INHERITS_FROM(FiniteVolumeModel)); //! Set the index set type used on the dual grid nodes SET_PROP(CCMpfaModel, DualGridNodalIndexSet) { - using GV = typename GET_PROP_TYPE(TypeTag, GridView); - static constexpr int dim = GV::dimension; - static constexpr int dimWorld = GV::dimensionworld; private: - struct Traits - { - using GridView = GV; - using GridIndexType = typename GV::IndexSet::IndexType; - using LocalIndexType = std::uint8_t; - - //! per default, we use dynamic data containers (iv size unknown) - template< class T > using NodalScvDataStorage = std::vector< T >; - template< class T > using NodalScvfDataStorage = std::vector< T >; - - //! store data on neighbors of scvfs in static containers if possible - template< class T > - using ScvfNeighborDataStorage = typename std::conditional_t< (dim<dimWorld), - std::vector< T >, - Dune::ReservedVector< T, 2 > >; - }; + using GV = typename GET_PROP_TYPE(TypeTag, GridView); + using Traits = NodalIndexSetDefaultTraits< GV >; + public: using type = CCMpfaDualGridNodalIndexSet< Traits >; }; @@ -114,32 +93,8 @@ private: using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using PrimaryIV = typename GET_PROP_TYPE(TypeTag, PrimaryInteractionVolume); using SecondaryIV = typename GET_PROP_TYPE(TypeTag, SecondaryInteractionVolume); - - struct Traits : public DefaultMapperTraits<GridView> - { - using SubControlVolume = CCSubControlVolume<GridView>; - using SubControlVolumeFace = CCMpfaSubControlVolumeFace<GridView>; - using NodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet); - - //! State the maximum admissible element stencil size - //! Per default, we use high values that are hopefully enough for all cases - //! We assume simplex grids where stencils can get quite large but the size is unknown - static constexpr int maxElementStencilSize = int(GridView::dimension) == 3 ? 150 : - (int(GridView::dimension)<int(GridView::dimensionworld) ? 45 : 15); - - //! type definitions depending on the FVGridGeometry itself - template< class FVGridGeom > - using MpfaHelper = CCMpfaHelper< FVGridGeom >; - - template< class FVGridGeom > - using ConnectivityMap = CCMpfaConnectivityMap<FVGridGeom, FVGridGeom::GridIVIndexSets::PrimaryInteractionVolume::MpfaMethod>; - - template< class FVGridGeom > - using GridIvIndexSets = CCMpfaGridInteractionVolumeIndexSets< FVGridGeom, NodalIndexSet, PrimaryIV, SecondaryIV >; - - template< class FVGridGeom, bool enableCache > - using LocalView = CCMpfaFVElementGeometry<FVGridGeom, enableCache>; - }; + using NodalIndexSet = typename GET_PROP_TYPE(TypeTag, DualGridNodalIndexSet); + using Traits = CCMpfaFVGridGeometryTraits<GridView, NodalIndexSet, PrimaryIV, SecondaryIV>; public: using type = CCMpfaFVGridGeometry<GridView, Traits, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>; };