Commit e01f3648 authored by Timo Koch's avatar Timo Koch
Browse files

[disc] Make FVGridGeometry independent of TypeTag (box,tpfa,mpfa,staggered)

Mpfa contributed by DennisGlaeser
parent ade5a1c2
// -*- 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 Common
* \brief Defines the default element and vertex mapper types
*/
#ifndef DUMUX_DEFAULT_MAPPER_TRAITS_HH
#define DUMUX_DEFAULT_MAPPER_TRAITS_HH
#include <dune/common/version.hh>
#include <dune/grid/common/mcmgmapper.hh>
namespace Dumux {
template <class GridView>
struct DefaultMapperTraits
{
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
using VertexMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
#else
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout>;
using VertexMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGVertexLayout>;
#endif
};
} // namespace Dumux
#endif
......@@ -30,28 +30,25 @@
#include <dune/grid/common/rangegenerators.hh>
#include <dune/common/version.hh>
#include <dumux/common/properties.hh>
namespace Dumux
{
namespace Dumux {
/*!
* \ingroup Common
* \brief defines a standard intersection mapper for mapping of global DOFs assigned
* to faces. It only works for conforming grids, without hanging nodes.
* \todo This shouldn't depend on type tag but gridview only
*/
template<class TypeTag>
template<class GridView>
class ConformingGridIntersectionMapper
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Element = typename GridView::template Codim<0>::Entity;
using IndexType = unsigned int;
static constexpr int codimIntersection = 1;
public:
ConformingGridIntersectionMapper(const GridView& gridView) : gridView_(gridView) { }
ConformingGridIntersectionMapper(const GridView& gridView)
: gridView_(gridView) { }
void update()
{}
......@@ -85,12 +82,10 @@ private:
* \ingroup Common
* \brief defines an intersection mapper for mapping of global DOFs assigned
* to faces which also works for non-conforming grids and corner-point grids.
* \todo This shouldn't depend on type tag but gridview only
*/
template<class TypeTag>
template<class GridView>
class NonConformingGridIntersectionMapper
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Element = typename GridView::template Codim<0>::Entity;
using Intersection = typename GridView::Intersection;
using IndexType = unsigned int;
......
......@@ -102,7 +102,6 @@ NEW_PROP_TAG(MaxNumNeighborsPerScvf); //!< The maximum number of ne
/////////////////////////////////////////////////////////////////
// Additional properties used by the cell-centered mpfa schemes:
/////////////////////////////////////////////////////////////////
NEW_PROP_TAG(MpfaMethod); //!< Specifies the mpfa method to be used
NEW_PROP_TAG(MpfaHelper); //!< A Helper class depending on the mpfa method and grid dimension
NEW_PROP_TAG(PrimaryInteractionVolume); //!< The primary interaction volume type
NEW_PROP_TAG(SecondaryInteractionVolume); //!< The secondary interaction volume type used e.g. on the boundaries
......@@ -189,7 +188,6 @@ NEW_PROP_TAG(CellCenterPrimaryVariables); //!< The primary variables co
NEW_PROP_TAG(FacePrimaryVariables); //!< The primary variables container type for face dofs
NEW_PROP_TAG(IntersectionMapper); //!< Specifies the intersection mapper
NEW_PROP_TAG(DofTypeIndices); //!< Specifies index types for accessing the multi type block vectors/matrices
NEW_PROP_TAG(StaggeredGeometryHelper); //!< Specifies a helper class for the staggered grid geometry
NEW_PROP_TAG(StaggeredPrimaryVariables); //!< The hybrid primary variables container type
NEW_PROP_TAG(BaseEpsilon); //!< A base epsilon for numerical differentiation, can contain multiple values
NEW_PROP_TAG(FaceVariables); //!< Class containing local face-related data
......
......@@ -32,31 +32,35 @@
#include <dumux/common/geometry/boundingboxtree.hh>
#include <dumux/common/geometry/geometricentityset.hh>
namespace Dumux
{
namespace Dumux {
/*!
* \ingroup Discretization
* \brief Base class for all finite volume grid geometries
* \tparam Impl the type of the actual implementation
* \tparam GV the grid view type
* \tparam Traits the fv geometry traits
*/
template<class TypeTag>
template<class Impl, class GV, class Traits>
class BaseFVGridGeometry
{
using Implementation = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper);
using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper);
using ElementMap = EntityMap<GridView, 0>;
using ElementSet = GridViewGeometricEntitySet<GridView, 0>;
using ElementMap = EntityMap<GV, 0>;
using ElementSet = GridViewGeometricEntitySet<GV, 0>;
using BoundingBoxTree = Dumux::BoundingBoxTree<ElementSet>;
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
using CoordScalar = typename GridView::ctype;
static const int dim = GV::dimension;
static const int dimWorld = GV::dimensionworld;
using CoordScalar = typename GV::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
public:
//! export the grid view type
using GridView = GV;
//! export the element mapper type
using ElementMapper = typename Traits::ElementMapper;
//! export the vertex mapper type
using VertexMapper = typename Traits::VertexMapper;
//! Constructor computes the bouding box of the entire domain, for e.g. setting boundary conditions
BaseFVGridGeometry(const GridView& gridView)
: gridView_(gridView)
......@@ -78,8 +82,9 @@ public:
* The local object is only functional after calling its bind/bindElement method.
* This is a free function that will be found by means of ADL
*/
friend inline FVElementGeometry localView(const Implementation& fvGridGeometry)
{ return FVElementGeometry(fvGridGeometry); }
template<class GridGeometry>
friend inline typename GridGeometry::LocalView localView(const GridGeometry& fvGridGeometry)
{ return typename GridGeometry::LocalView(fvGridGeometry); }
/*!
* \brief Update all fvElementGeometries (do this again after grid adaption)
......
......@@ -18,6 +18,7 @@
*****************************************************************************/
/*!
* \file
* \ingroup BoxDiscretization
* \brief Base class for the local finite volume geometry for box models
* This builds up the sub control volumes and sub control volume faces
* for an element.
......@@ -29,58 +30,44 @@
#include <dune/geometry/referenceelements.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dumux/common/properties.hh>
#include <dumux/discretization/scvandscvfiterators.hh>
#include <dumux/discretization/box/boxgeometryhelper.hh>
namespace Dumux
{
//! forward declaration of the global finite volume geometry
template<class TypeTag, bool EnableFVGridGeometryCache>
class BoxFVGridGeometry;
namespace Dumux {
/*!
* \ingroup ImplicitModel
* \ingroup BoxDiscretization
* \brief Base class for the finite volume geometry vector for box models
* This builds up the sub control volumes and sub control volume faces
* for each element.
* \tparam GG the finite volume grid geometry type
* \tparam enableFVGridGeometryCache if the grid geometry is cached or not
*/
template<class TypeTag, bool EnableFVGridGeometryCache>
class BoxFVElementGeometry
{};
template<class GG, bool enableFVGridGeometryCache>
class BoxFVElementGeometry;
//! specialization in case the FVElementGeometries are stored
template<class TypeTag>
class BoxFVElementGeometry<TypeTag, true>
template<class GG>
class BoxFVElementGeometry<GG, true>
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using GridView = typename GG::GridView;
static constexpr int dim = GridView::dimension;
static constexpr int dimWorld = GridView::dimensionworld;
using IndexType = typename GridView::IndexSet::IndexType;
using Element = typename GridView::template Codim<0>::Entity;
using CoordScalar = typename GridView::ctype;
using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
public:
//! export type of subcontrol volume
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using SubControlVolume = typename GG::SubControlVolume;
//! export type of subcontrol volume face
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using SubControlVolumeFace = typename GG::SubControlVolumeFace;
//! export type of finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVGridGeometry = GG;
//! the maximum number of scvs per element (2^dim for cubes)
static constexpr std::size_t maxNumElementScvs = (1<<dim);
private:
using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using IndexType = typename GridView::IndexSet::IndexType;
using Element = typename GridView::template Codim<0>::Entity;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using CoordScalar = typename GridView::ctype;
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeLocalBasis = typename FeCache::FiniteElementType::Traits::LocalBasisType;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
public:
//! Constructor
BoxFVElementGeometry(const FVGridGeometry& fvGridGeometry)
: fvGridGeometryPtr_(&fvGridGeometry) {}
......@@ -170,38 +157,33 @@ private:
};
//! specialization in case the FVElementGeometries are not stored
template<class TypeTag>
class BoxFVElementGeometry<TypeTag, false>
template<class GG>
class BoxFVElementGeometry<GG, false>
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using GridView = typename GG::GridView;
static constexpr int dim = GridView::dimension;
static constexpr int dimWorld = GridView::dimensionworld;
public:
//! export type of subcontrol volume
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
//! export type of subcontrol volume face
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
//! export type of finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
//! the maximum number of scvs per element (2^dim for cubes)
static constexpr std::size_t maxNumElementScvs = (1<<dim);
private:
using IndexType = typename GridView::IndexSet::IndexType;
using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType;
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using Element = typename GridView::template Codim<0>::Entity;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using CoordScalar = typename GridView::ctype;
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeLocalBasis = typename FeCache::FiniteElementType::Traits::LocalBasisType;
using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
using GeometryHelper = BoxGeometryHelper<GridView, dim, SubControlVolume, SubControlVolumeFace>;
using GeometryHelper = BoxGeometryHelper<GridView, dim,
typename GG::SubControlVolume,
typename GG::SubControlVolumeFace>;
public:
//! export type of subcontrol volume
using SubControlVolume = typename GG::SubControlVolume;
//! export type of subcontrol volume face
using SubControlVolumeFace = typename GG::SubControlVolumeFace;
//! export type of finite volume grid geometry
using FVGridGeometry = GG;
//! the maximum number of scvs per element (2^dim for cubes)
static constexpr std::size_t maxNumElementScvs = (1<<dim);
//! Constructor
BoxFVElementGeometry(const FVGridGeometry& fvGridGeometry)
: fvGridGeometryPtr_(&fvGridGeometry) {}
......@@ -301,6 +283,7 @@ private:
// construct the sub control volumes
scvs_.resize(elementGeometry.corners());
using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType;
for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx)
{
// get asssociated dof index
......@@ -372,6 +355,6 @@ private:
std::vector<SubControlVolumeFace> scvfs_;
};
} // end namespace
} // end namespace Dumux
#endif
......@@ -18,6 +18,7 @@
*****************************************************************************/
/*!
* \file
* \ingroup BoxDiscretization
* \brief Base class for the finite volume geometry vector for box models
* This builds up the sub control volumes and sub control volume faces
* for each element of the grid partition.
......@@ -29,59 +30,93 @@
#include <dune/localfunctions/lagrange/pqkfactory.hh>
#include <dumux/discretization/methods.hh>
#include <dumux/common/defaultmappertraits.hh>
#include <dumux/discretization/basefvgridgeometry.hh>
#include <dumux/discretization/box/boxgeometryhelper.hh>
#include <dumux/discretization/box/fvelementgeometry.hh>
#include <dumux/discretization/box/subcontrolvolume.hh>
#include <dumux/discretization/box/subcontrolvolumeface.hh>
namespace Dumux
namespace Dumux {
/*!
* \ingroup BoxDiscretization
* \brief The default traits for the box finite volume grid geometry
* Defines the scv and scvf types and the mapper types
* \tparam the grid view type
*/
template<class GridView>
struct BoxDefaultGridGeometryTraits
: public DefaultMapperTraits<GridView>
{
using SubControlVolume = BoxSubControlVolume<GridView>;
using SubControlVolumeFace = BoxSubControlVolumeFace<GridView>;
template<class FVGridGeometry, bool enableCache>
using LocalView = BoxFVElementGeometry<FVGridGeometry, enableCache>;
};
/*!
* \ingroup ImplicitModel
* \brief Base class for the finite volume geometry vector for box models
* \ingroup BoxDiscretization
* \brief Base class for the finite volume geometry vector for box schemes
* This builds up the sub control volumes and sub control volume faces
* for each element.
* \note This class is specialized for versions with and without caching the fv geometries on the grid view
*/
template<class TypeTag, bool EnableFVGridGeometryCache>
class BoxFVGridGeometry
{};
template<class Scalar,
class GridView,
bool enableFVGridGeometryCache = false,
class Traits = BoxDefaultGridGeometryTraits<GridView> >
class BoxFVGridGeometry;
// specialization in case the FVElementGeometries are stored
template<class TypeTag>
class BoxFVGridGeometry<TypeTag, true> : public BaseFVGridGeometry<TypeTag>
/*!
* \ingroup BoxDiscretization
* \brief Base class for the finite volume geometry vector for box schemes
* This builds up the sub control volumes and sub control volume faces
* \note For caching enabled we store the fv geometries for the whole grid view which is memory intensive but faster
*/
template<class Scalar, class GV, class Traits>
class BoxFVGridGeometry<Scalar, GV, true, Traits>
: public BaseFVGridGeometry<BoxFVGridGeometry<Scalar, GV, true, Traits>, GV, Traits>
{
using ParentType = BaseFVGridGeometry<TypeTag>;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using IndexType = typename GridView::IndexSet::IndexType;
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType;
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper);
using Element = typename GridView::template Codim<0>::Entity;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using CoordScalar = typename GridView::ctype;
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
using ThisType = BoxFVGridGeometry<Scalar, GV, true, Traits>;
using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>;
using IndexType = typename GV::IndexSet::IndexType;
using Element = typename GV::template Codim<0>::Entity;
using CoordScalar = typename GV::ctype;
static const int dim = GV::dimension;
static const int dimWorld = GV::dimensionworld;
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
using GeometryHelper = BoxGeometryHelper<GridView, dim, SubControlVolume, SubControlVolumeFace>;
using GeometryHelper = BoxGeometryHelper<GV, dim,
typename Traits::SubControlVolume,
typename Traits::SubControlVolumeFace>;
public:
//! export discretization method
static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::Box;
//! export the type of the fv element geometry (the local view type)
using LocalView = typename Traits::template LocalView<ThisType, true>;
//! export the type of sub control volume
using SubControlVolume = typename Traits::SubControlVolume;
//! export the type of sub control volume
using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
//! Constructor
BoxFVGridGeometry(const GridView gridView)
: ParentType(gridView) {}
//! the vertex mapper is the dofMapper
//! this is convenience to have better chance to have the same main files for box/tpfa/mpfa...
const VertexMapper& dofMapper() const
const DofMapper& dofMapper() const
{ return this->vertexMapper(); }
//! The total number of sub control volumes
......@@ -141,6 +176,7 @@ public:
// construct the sub control volumes
scvs_[eIdx].resize(elementGeometry.corners());
using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType;
for (LocalIndexType scvLocalIdx = 0; scvLocalIdx < elementGeometry.corners(); ++scvLocalIdx)
{
const auto dofIdxGlobal = this->vertexMapper().subIndex(element, scvLocalIdx, dim);
......@@ -242,41 +278,53 @@ private:
std::vector<bool> boundaryDofIndices_;
};
// specialization in case the FVElementGeometries are not stored
template<class TypeTag>
class BoxFVGridGeometry<TypeTag, false> : public BaseFVGridGeometry<TypeTag>
/*!
* \ingroup BoxDiscretization
* \brief Base class for the finite volume geometry vector for box schemes
* This builds up the sub control volumes and sub control volume faces
* \note For caching disabled we store only some essential index maps to build up local systems on-demand in
* the corresponding FVElementGeometry
*/
template<class Scalar, class GV, class Traits>
class BoxFVGridGeometry<Scalar, GV, false, Traits>
: public BaseFVGridGeometry<BoxFVGridGeometry<Scalar, GV, false, Traits>, GV, Traits>
{
using ParentType = BaseFVGridGeometry<TypeTag>;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using IndexType = typename GridView::IndexSet::IndexType;
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper);
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
using ThisType = BoxFVGridGeometry<Scalar, GV, false, Traits>;
using ParentType = BaseFVGridGeometry<ThisType, GV, Traits>;
using IndexType = typename GV::IndexSet::IndexType;
using Element = typename GridView::template Codim<0>::Entity;
using Vertex = typename GridView::template Codim<dim>::Entity;
static const int dim = GV::dimension;
static const int dimWorld = GV::dimensionworld;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using CoordScalar = typename GridView::ctype;
using Element = typename GV::template Codim<0>::Entity;
using CoordScalar = typename GV::ctype;
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
public:
//! export discretization method
static constexpr DiscretizationMethods discretizationMethod = DiscretizationMethods::Box;
//! export the type of the fv element geometry (the local view type)
using LocalView = typename Traits::template LocalView<ThisType, false>;
//! export the type of sub control volume
using SubControlVolume = typename Traits::SubControlVolume;
//! export the type of sub control volume
using SubControlVolumeFace = typename Traits::SubControlVolumeFace;
//! export dof mapper type
using DofMapper = typename Traits::VertexMapper;
//! export the finite element cache type
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
//! export the grid view type
using GridView = GV;
//! Constructor
BoxFVGridGeometry(const GridView gridView)
: ParentType(gridView) {}
//! the vertex mapper is the dofMapper
//! this is convenience to have better chance to have the same main files for box/tpfa/mpfa...
const VertexMapper& dofMapper() const
const DofMapper& dofMapper() const
{ return this->vertexMapper(); }
//! The total number of sub control volumes
......
......@@ -37,8 +37,6 @@
#include <dumux/discretization/methods.hh>
#include <dumux/discretization/fvproperties.hh>
#include <dumux/discretization/box/subcontrolvolume.hh>
#include <dumux/discretization/box/subcontrolvolumeface.hh>
#include <dumux/discretization/box/elementsolution.hh>
#include <dumux/discretization/box/elementboundarytypes.hh>
#include <dumux/discretization/box/gridfluxvariablescache.hh>
......@@ -61,97 +59,20 @@ SET_PROP(BoxModel, DiscretizationMethod)
static const DiscretizationMethods value = DiscretizationMethods::Box;
};
//! Set the default for the FVElementGeometry vector
SET_TYPE_PROP(BoxModel, FVGridGeometry, BoxFVGridGeometry<TypeTag,
GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>);
//! Set the default for the FVElementGeometry vector
SET_TYPE_PROP(BoxModel, FVElementGeometry, BoxFVElementGeometry<TypeTag,
GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>);
//! The sub control volume
SET_PROP(BoxModel, SubControlVolume)
{
private:
using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
static const int dim = Grid::dimension;
static const int dimWorld = Grid::dimensionworld;
// we use geometry traits that use static corner vectors to and a fixed geometry type
template <class ct>
struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct>
{
// we use static vectors to store the corners as we know
// the number of corners in advance (2^(dim) corners (1<<(dim))
template< int mydim, int cdim >
struct CornerStorage
{
using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(dim)) >;
};
// we know all scvfs will have the same geometry type
template< int mydim >
struct hasSingleGeometryType
{
static const bool v = true;
static const unsigned int topologyId = Dune::Impl::CubeTopology< mydim >::type::id;
};
};
struct ScvGeometryTraits
{
using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType;
using LocalIndexType = unsigned int;
using Scalar = typename Grid::ctype;
using Geometry = Dune::MultiLinearGeometry<Scalar, dim, dimWorld, ScvfMLGTraits<Scalar>>;
using CornerStorage = typename ScvfMLGTraits<Scalar>::template CornerStorage<dim, dimWorld>::Type;