diff --git a/dumux/common/CMakeLists.txt b/dumux/common/CMakeLists.txt
index 9d1bee358abddcbc9176b0a4c568834745c75c70..d99fec14906b6817809f082d05f1d354ec6ba9b5 100644
--- a/dumux/common/CMakeLists.txt
+++ b/dumux/common/CMakeLists.txt
@@ -16,6 +16,7 @@ entitymap.hh
exceptions.hh
fixedlengthspline_.hh
fvproblem.hh
+indextraits.hh
intersectionmapper.hh
intrange.hh
loggingparametertree.hh
diff --git a/dumux/common/indextraits.hh b/dumux/common/indextraits.hh
new file mode 100644
index 0000000000000000000000000000000000000000..f976a277af763496e6bba717f300b9eb3311307d
--- /dev/null
+++ b/dumux/common/indextraits.hh
@@ -0,0 +1,46 @@
+// -*- 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 . *
+ *****************************************************************************/
+/*!
+ * \file
+ * \ingroup Common
+ * \brief Defines the index types used for grid and local indices.
+ */
+#ifndef DUMUX_COMMON_INDEX_TRAITS_HH
+#define DUMUX_COMMON_INDEX_TRAITS_HH
+
+#include
+
+namespace Dumux {
+
+/*!
+ * \ingroup Common
+ * \brief Struture to define the index types used for grid and local indices.
+ * \tparam GridView The grid view type
+ */
+template
+struct IndexTraits
+{
+ using GridIndex = typename GridView::IndexSet::IndexType;
+ using LocalIndex = unsigned int;
+ using SmallLocalIndex = std::uint_least8_t;
+};
+
+} // namespace Dumux
+
+#endif // DUMUX_COMMON_INDEX_TRAITS_HH
diff --git a/dumux/common/intersectionmapper.hh b/dumux/common/intersectionmapper.hh
index a2067d2cae83cadf1acdb1ee58b02a70d7aab85f..6c32d6c4e071d69625014f0ae41fe9e0bc76d27c 100644
--- a/dumux/common/intersectionmapper.hh
+++ b/dumux/common/intersectionmapper.hh
@@ -41,7 +41,7 @@ template
class ConformingGridIntersectionMapper
{
using Element = typename GridView::template Codim<0>::Entity;
- using IndexType = unsigned int;
+ using GridIndexType = typename GridView::IndexSet::IndexType;
static constexpr int codimIntersection = 1;
public:
@@ -68,7 +68,7 @@ public:
return element.subEntities(1);
}
- IndexType globalIntersectionIndex(const Element& element, const IndexType localFaceIdx) const
+ GridIndexType globalIntersectionIndex(const Element& element, const std::size_t localFaceIdx) const
{
return gridView_.indexSet().subIndex(element, localFaceIdx, codimIntersection);
}
@@ -87,7 +87,7 @@ class NonConformingGridIntersectionMapper
{
using Element = typename GridView::template Codim<0>::Entity;
using Intersection = typename GridView::Intersection;
- using IndexType = unsigned int;
+ using GridIndexType = typename GridView::IndexSet::IndexType;
public:
NonConformingGridIntersectionMapper(const GridView& gridview)
@@ -104,7 +104,7 @@ public:
return numIntersections_;
}
- IndexType globalIntersectionIndex(const Element& element, const IndexType localFaceIdx) const
+ GridIndexType globalIntersectionIndex(const Element& element, const std::size_t localFaceIdx) const
{
return (intersectionMapGlobal_[index(element)].find(localFaceIdx))->second; //use find() for const function!
}
@@ -165,7 +165,7 @@ public:
}
private:
- IndexType index(const Element& element) const
+ GridIndexType index(const Element& element) const
{
return gridView_.indexSet().index(element);
}
diff --git a/dumux/discretization/basefvgridgeometry.hh b/dumux/discretization/basefvgridgeometry.hh
index 4f208835d92354cf42306b635615d72dcfb0ee33..129dd96d0df26bd0fc69ddb3efd08614634e4a70 100644
--- a/dumux/discretization/basefvgridgeometry.hh
+++ b/dumux/discretization/basefvgridgeometry.hh
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
#include
@@ -52,7 +53,7 @@ class BaseFVGridGeometry
static constexpr int dim = GV::dimension;
static constexpr int dimWorld = GV::dimensionworld;
- using IndexType = typename GV::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using Element = typename GV::template Codim<0>::Entity;
using SubControlVolume = typename Traits::SubControlVolume;
@@ -161,7 +162,7 @@ public:
{ return elementMap()[scv.elementIndex()]; }
//! Get an element from a global element index
- Element element(IndexType eIdx) const
+ Element element(GridIndexType eIdx) const
{ return elementMap()[eIdx]; }
/*!
diff --git a/dumux/discretization/box/fvelementgeometry.hh b/dumux/discretization/box/fvelementgeometry.hh
index 3b06ab52300c9a3c9be04237a7ebe2067f52b025..ef8cd290cd65599d9d16cfb34726f9d50050c5ae 100644
--- a/dumux/discretization/box/fvelementgeometry.hh
+++ b/dumux/discretization/box/fvelementgeometry.hh
@@ -29,6 +29,7 @@
#include
#include
+#include
#include
#include
@@ -52,7 +53,8 @@ class BoxFVElementGeometry
using GridView = typename GG::GridView;
static constexpr int dim = GridView::dimension;
static constexpr int dimWorld = GridView::dimensionworld;
- using IndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using Element = typename GridView::template Codim<0>::Entity;
using CoordScalar = typename GridView::ctype;
using FeLocalBasis = typename GG::FeCache::FiniteElementType::Traits::LocalBasisType;
@@ -72,13 +74,13 @@ public:
: fvGridGeometryPtr_(&fvGridGeometry) {}
//! Get a sub control volume with a local scv index
- const SubControlVolume& scv(IndexType scvIdx) const
+ const SubControlVolume& scv(LocalIndexType scvIdx) const
{
return fvGridGeometry().scvs(eIdx_)[scvIdx];
}
//! Get a sub control volume face with a local scvf index
- const SubControlVolumeFace& scvf(IndexType scvfIdx) const
+ const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const
{
return fvGridGeometry().scvfs(eIdx_)[scvfIdx];
}
@@ -156,7 +158,7 @@ private:
const Element* elementPtr_;
const FVGridGeometry* fvGridGeometryPtr_;
- IndexType eIdx_;
+ GridIndexType eIdx_;
};
//! specialization in case the FVElementGeometries are not stored
@@ -166,10 +168,9 @@ class BoxFVElementGeometry
using GridView = typename GG::GridView;
static constexpr int dim = GridView::dimension;
static constexpr int dimWorld = GridView::dimensionworld;
-
- using IndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
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;
@@ -192,13 +193,13 @@ public:
: fvGridGeometryPtr_(&fvGridGeometry) {}
//! Get a sub control volume with a local scv index
- const SubControlVolume& scv(IndexType scvIdx) const
+ const SubControlVolume& scv(LocalIndexType scvIdx) const
{
return scvs_[scvIdx];
}
//! Get a sub control volume face with a local scvf index
- const SubControlVolumeFace& scvf(IndexType scvfIdx) const
+ const SubControlVolumeFace& scvf(LocalIndexType scvfIdx) const
{
return scvfs_[scvfIdx];
}
@@ -275,7 +276,6 @@ private:
void makeElementGeometries(const Element& element)
{
- auto eIdx = fvGridGeometry().elementMapper().index(element);
hasBoundaryScvf_ = false;
// get the element geometry
@@ -287,7 +287,6 @@ 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
@@ -296,7 +295,7 @@ private:
// add scv to the local container
scvs_[scvLocalIdx] = SubControlVolume(geometryHelper,
scvLocalIdx,
- eIdx,
+ eIdx_,
dofIdxGlobal);
}
@@ -304,7 +303,7 @@ private:
const auto numInnerScvf = (dim==1) ? 1 : element.subEntities(dim-1);
scvfs_.resize(numInnerScvf);
- unsigned int scvfLocalIdx = 0;
+ LocalIndexType scvfLocalIdx = 0;
for (; scvfLocalIdx < numInnerScvf; ++scvfLocalIdx)
{
// find the local scv indices this scvf is connected to
@@ -350,7 +349,7 @@ private:
//! The bound element
const Element* elementPtr_;
- IndexType eIdx_;
+ GridIndexType eIdx_;
//! The global geometry this is a restriction of
const FVGridGeometry* fvGridGeometryPtr_;
diff --git a/dumux/discretization/box/fvgridgeometry.hh b/dumux/discretization/box/fvgridgeometry.hh
index b6d0a3b8034b4caec8cfe74429c8110a898e78aa..85351e1e766e53e022a9ad6da051f4eaa1fa3eee 100644
--- a/dumux/discretization/box/fvgridgeometry.hh
+++ b/dumux/discretization/box/fvgridgeometry.hh
@@ -32,6 +32,7 @@
#include
#include
+#include
#include
#include
#include
@@ -83,7 +84,8 @@ class BoxFVGridGeometry
{
using ThisType = BoxFVGridGeometry;
using ParentType = BaseFVGridGeometry;
- using IndexType = typename GV::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using Element = typename GV::template Codim<0>::Entity;
using CoordScalar = typename GV::ctype;
@@ -182,7 +184,6 @@ 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);
@@ -297,31 +298,31 @@ public:
{ return feCache_; }
//! Get the local scvs for an element
- const std::vector& scvs(IndexType eIdx) const
+ const std::vector& scvs(GridIndexType eIdx) const
{ return scvs_[eIdx]; }
//! Get the local scvfs for an element
- const std::vector& scvfs(IndexType eIdx) const
+ const std::vector& scvfs(GridIndexType eIdx) const
{ return scvfs_[eIdx]; }
//! If a vertex / d.o.f. is on the boundary
- bool dofOnBoundary(unsigned int dofIdx) const
+ bool dofOnBoundary(GridIndexType dofIdx) const
{ return boundaryDofIndices_[dofIdx]; }
//! If a vertex / d.o.f. is on a periodic boundary
- bool dofOnPeriodicBoundary(std::size_t dofIdx) const
+ bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
{ return periodicVertexMap_.count(dofIdx); }
//! The index of the vertex / d.o.f. on the other side of the periodic boundary
- std::size_t periodicallyMappedDof(std::size_t dofIdx) const
+ GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
{ return periodicVertexMap_.at(dofIdx); }
//! Returns the map between dofs across periodic boundaries
- const std::unordered_map& periodicVertexMap() const
+ const std::unordered_map& periodicVertexMap() const
{ return periodicVertexMap_; }
//! Returns whether one of the geometry's scvfs lies on a boundary
- bool hasBoundaryScvf(std::size_t eIdx) const
+ bool hasBoundaryScvf(GridIndexType eIdx) const
{ return hasBoundaryScvf_[eIdx]; }
private:
@@ -340,7 +341,7 @@ private:
std::vector hasBoundaryScvf_;
// a map for periodic boundary vertices
- std::unordered_map periodicVertexMap_;
+ std::unordered_map periodicVertexMap_;
};
/*!
@@ -356,7 +357,7 @@ class BoxFVGridGeometry
{
using ThisType = BoxFVGridGeometry;
using ParentType = BaseFVGridGeometry;
- using IndexType = typename GV::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
static const int dim = GV::dimension;
static const int dimWorld = GV::dimensionworld;
@@ -501,19 +502,19 @@ public:
{ return feCache_; }
//! If a vertex / d.o.f. is on the boundary
- bool dofOnBoundary(std::size_t dofIdx) const
+ bool dofOnBoundary(GridIndexType dofIdx) const
{ return boundaryDofIndices_[dofIdx]; }
//! If a vertex / d.o.f. is on a periodic boundary
- bool dofOnPeriodicBoundary(std::size_t dofIdx) const
+ bool dofOnPeriodicBoundary(GridIndexType dofIdx) const
{ return periodicVertexMap_.count(dofIdx); }
//! The index of the vertex / d.o.f. on the other side of the periodic boundary
- std::size_t periodicallyMappedDof(std::size_t dofIdx) const
+ GridIndexType periodicallyMappedDof(GridIndexType dofIdx) const
{ return periodicVertexMap_.at(dofIdx); }
//! Returns the map between dofs across periodic boundaries
- const std::unordered_map& periodicVertexMap() const
+ const std::unordered_map& periodicVertexMap() const
{ return periodicVertexMap_; }
private:
@@ -530,7 +531,7 @@ private:
std::vector boundaryDofIndices_;
// a map for periodic boundary vertices
- std::unordered_map periodicVertexMap_;
+ std::unordered_map periodicVertexMap_;
};
} // end namespace Dumux
diff --git a/dumux/discretization/box/subcontrolvolume.hh b/dumux/discretization/box/subcontrolvolume.hh
index 88eed544da7aa68ca1870398cbb776f4d9348f51..d9fab141367604dc94721b423cf18347dc8d1381 100644
--- a/dumux/discretization/box/subcontrolvolume.hh
+++ b/dumux/discretization/box/subcontrolvolume.hh
@@ -26,9 +26,10 @@
#include
+#include
+#include
#include
#include
-#include
namespace Dumux {
@@ -66,8 +67,8 @@ struct BoxDefaultScvGeometryTraits
};
};
- using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType;
- using LocalIndexType = unsigned int;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using Scalar = typename Grid::ctype;
using Geometry = Dune::MultiLinearGeometry>;
using CornerStorage = typename ScvMLGTraits::template CornerStorage::Type;
diff --git a/dumux/discretization/box/subcontrolvolumeface.hh b/dumux/discretization/box/subcontrolvolumeface.hh
index 9eca2a0652c5053306c437733ce9f30412aae947..8652a2aefa02ab42228689532aeacdf81b8021bb 100644
--- a/dumux/discretization/box/subcontrolvolumeface.hh
+++ b/dumux/discretization/box/subcontrolvolumeface.hh
@@ -29,6 +29,7 @@
#include
#include
+#include
#include
#include
@@ -68,8 +69,8 @@ struct BoxDefaultScvfGeometryTraits
};
};
- using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType;
- using LocalIndexType = unsigned int;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using Scalar = typename Grid::ctype;
using Geometry = Dune::MultiLinearGeometry>;
using CornerStorage = typename ScvfMLGTraits::template CornerStorage::Type;
diff --git a/dumux/discretization/cellcentered/connectivitymap.hh b/dumux/discretization/cellcentered/connectivitymap.hh
index faf6ad07c2b1b53e854a3346c048c01d951a6d4c..707903afe951399481da1569b9775cd80c809dfa 100644
--- a/dumux/discretization/cellcentered/connectivitymap.hh
+++ b/dumux/discretization/cellcentered/connectivitymap.hh
@@ -32,6 +32,8 @@
#include
#include
+
+#include
#include
namespace Dumux {
@@ -51,13 +53,13 @@ class CCSimpleConnectivityMap
{
using FVElementGeometry = typename FVGridGeometry::LocalView;
using GridView = typename FVGridGeometry::GridView;
- using IndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using FluxStencil = Dumux::FluxStencil;
static constexpr int maxElemStencilSize = FVGridGeometry::maxElementStencilSize;
struct DataJ
{
- IndexType globalJ;
+ GridIndexType globalJ;
typename FluxStencil::ScvfStencilIForJ scvfsJ;
// A list of additional scvfs is needed for compatibility
// reasons with more complex connectivity maps (see mpfa)
@@ -79,7 +81,7 @@ public:
map_.resize(fvGridGeometry.gridView().size(0));
// container to store for each element J the elements I which have J in their flux stencil
- Dune::ReservedVector, maxElemStencilSize> dataJForI;
+ Dune::ReservedVector, maxElemStencilSize> dataJForI;
for (const auto& element : elements(fvGridGeometry.gridView()))
{
@@ -125,7 +127,7 @@ public:
}
}
- const std::vector& operator[] (const IndexType globalI) const
+ const std::vector& operator[] (const GridIndexType globalI) const
{ return map_[globalI]; }
private:
diff --git a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh
index fcd012caafc51d75c8085b00967ddbe15a960d75..a851d98773eefb5b20b412bf27de3ab7bcbcf7c0 100644
--- a/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh
+++ b/dumux/discretization/cellcentered/mpfa/dualgridindexset.hh
@@ -29,6 +29,7 @@
#include
#include
+#include
namespace Dumux
{
@@ -43,8 +44,8 @@ template
struct NodalIndexSetDefaultTraits
{
using GridView = GV;
- using GridIndexType = typename GV::IndexSet::IndexType;
- using LocalIndexType = std::uint8_t;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::SmallLocalIndex;
//! per default, we use dynamic data containers (iv size unknown)
template< class T > using NodalScvDataStorage = std::vector< T >;
diff --git a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
index 56f8c37e31c04d439bd0ba9b8ae4691c17cd7a4a..b0f531a779837295cabaa108798bc1de685cec24 100644
--- a/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
+++ b/dumux/discretization/cellcentered/mpfa/fvelementgeometry.hh
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
namespace Dumux
@@ -59,7 +60,7 @@ class CCMpfaFVElementGeometry
using ThisType = CCMpfaFVElementGeometry;
using GridView = typename GG::GridView;
using Element = typename GridView::template Codim<0>::Entity;
- using GridIndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
static constexpr int dim = GridView::dimension;
@@ -175,7 +176,7 @@ class CCMpfaFVElementGeometry
using ThisType = CCMpfaFVElementGeometry;
using GridView = typename GG::GridView;
using Element = typename GridView::template Codim<0>::Entity;
- using GridIndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using MpfaHelper = typename GG::MpfaHelper;
static const int dim = GridView::dimension;
diff --git a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
index 8c73955c03d2f4c2c0baccdad89980e1b1cf3880..c97e5e9f8cd5fda2b8bc3711b92f1980d0017552 100644
--- a/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
+++ b/dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
@@ -29,6 +29,7 @@
#include
#include
+#include
#include
#include
#include
@@ -78,7 +79,7 @@ class CCMpfaFVGridGeometry
using Element = typename GV::template Codim<0>::Entity;
using Vertex = typename GV::template Codim::Entity;
using Intersection = typename GV::Intersection;
- using GridIndexType = typename GV::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using CoordScalar = typename GV::ctype;
using ReferenceElements = typename Dune::ReferenceElements;
@@ -448,7 +449,7 @@ class CCMpfaFVGridGeometry
using Element = typename GV::template Codim<0>::Entity;
using Vertex = typename GV::template Codim::Entity;
using Intersection = typename GV::Intersection;
- using GridIndexType = typename GV::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using CoordScalar = typename GV::ctype;
using ReferenceElements = typename Dune::ReferenceElements;
diff --git a/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh b/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh
index 3f7020bc6a4dae2334d2497283ebf1b960b3c081..bed60502bcbc973eccefff8ef6e8bc2f1b6151fa 100644
--- a/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh
+++ b/dumux/discretization/cellcentered/mpfa/gridinteractionvolumeindexsets.hh
@@ -52,7 +52,7 @@ public:
using PrimaryInteractionVolume = PI;
using SecondaryInteractionVolume = SI;
- using GridIndexType = typename FVGridGeometry::GridView::IndexSet::IndexType;
+ using GridIndexType = typename NI::GridIndexType;
using DualGridIndexSet = CCMpfaDualGridIndexSet< NI >;
/*!
diff --git a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh
index 61e2538f14e74aee20db301789252690dcea1e9c..30a08270461cbc960c195f64c963e60c5cd322ad 100644
--- a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh
+++ b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh
@@ -26,11 +26,14 @@
#include
#include
+
#include
#include
#include
#include
+#include
+
namespace Dumux {
/*!
@@ -48,8 +51,8 @@ struct CCMpfaDefaultScvfGeometryTraits
static const int dimWorld = Grid::dimensionworld;
using Scalar = typename Grid::ctype;
- using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType;
- using LocalIndexType = unsigned int;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using OutsideGridIndexStorage = typename std::conditional_t< (dim,
Dune::ReservedVector >;
diff --git a/dumux/discretization/cellcentered/subcontrolvolume.hh b/dumux/discretization/cellcentered/subcontrolvolume.hh
index 7bb3627b2821a764a18d55f6d1f63ac506634166..08a94a881fc041412c8027cff45c0b1b327e06d8 100644
--- a/dumux/discretization/cellcentered/subcontrolvolume.hh
+++ b/dumux/discretization/cellcentered/subcontrolvolume.hh
@@ -25,8 +25,10 @@
#define DUMUX_DISCRETIZATION_CC_SUBCONTROLVOLUME_HH
#include
-#include
+
#include
+#include
+#include
namespace Dumux {
@@ -40,8 +42,8 @@ template
struct CCDefaultScvGeometryTraits
{
using Geometry = typename GridView::template Codim<0>::Geometry;
- using GridIndexType = typename GridView::IndexSet::IndexType;
- using LocalIndexType = unsigned int;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using Scalar = typename GridView::ctype;
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
diff --git a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh
index 3ccaf0ef026651cf5dd796658dd1d49838ab4bad..4fd800e17c84702d18715077158efdc1fbafbd3a 100644
--- a/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh
+++ b/dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
#include
@@ -59,7 +60,7 @@ class CCTpfaFVElementGeometry
{
using ThisType = CCTpfaFVElementGeometry;
using GridView = typename GG::GridView;
- using IndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using Element = typename GridView::template Codim<0>::Entity;
public:
@@ -80,21 +81,21 @@ public:
//! Get an elment sub control volume with a global scv index
//! We separate element and neighbor scvs to speed up mapping
- const SubControlVolume& scv(IndexType scvIdx) const
+ const SubControlVolume& scv(GridIndexType scvIdx) const
{
return fvGridGeometry().scv(scvIdx);
}
//! Get an element sub control volume face with a global scvf index
//! We separate element and neighbor scvfs to speed up mapping
- const SubControlVolumeFace& scvf(IndexType scvfIdx) const
+ const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const
{
return fvGridGeometry().scvf(scvfIdx);
}
//! Get the scvf on the same face but from the other side
//! Note that e.g. the normals might be different in the case of surface grids
- const SubControlVolumeFace& flipScvf(IndexType scvfIdx, unsigned int outsideScvIdx = 0) const
+ const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvIdx = 0) const
{
return fvGridGeometry().flipScvf(scvfIdx, outsideScvIdx);
}
@@ -104,10 +105,10 @@ public:
//! This is a free function found by means of ADL
//! To iterate over all sub control volumes of this FVElementGeometry use
//! for (auto&& scv : scvs(fvGeometry))
- friend inline Dune::IteratorRange< ScvIterator, ThisType> >
+ friend inline Dune::IteratorRange< ScvIterator, ThisType> >
scvs(const CCTpfaFVElementGeometry& fvGeometry)
{
- using ScvIterator = Dumux::ScvIterator, ThisType>;
+ using ScvIterator = Dumux::ScvIterator, ThisType>;
return Dune::IteratorRange(ScvIterator(fvGeometry.scvIndices_.begin(), fvGeometry),
ScvIterator(fvGeometry.scvIndices_.end(), fvGeometry));
}
@@ -117,12 +118,12 @@ public:
//! This is a free function found by means of ADL
//! To iterate over all sub control volume faces of this FVElementGeometry use
//! for (auto&& scvf : scvfs(fvGeometry))
- friend inline Dune::IteratorRange< ScvfIterator, ThisType> >
+ friend inline Dune::IteratorRange< ScvfIterator, ThisType> >
scvfs(const CCTpfaFVElementGeometry& fvGeometry)
{
const auto& g = fvGeometry.fvGridGeometry();
const auto scvIdx = fvGeometry.scvIndices_[0];
- using ScvfIterator = Dumux::ScvfIterator, ThisType>;
+ using ScvfIterator = Dumux::ScvfIterator, ThisType>;
return Dune::IteratorRange(ScvfIterator(g.scvfIndicesOfScv(scvIdx).begin(), fvGeometry),
ScvfIterator(g.scvfIndicesOfScv(scvIdx).end(), fvGeometry));
}
@@ -163,7 +164,7 @@ public:
private:
const Element* elementPtr_;
- std::array scvIndices_;
+ std::array scvIndices_;
const FVGridGeometry* fvGridGeometryPtr_;
};
@@ -177,7 +178,8 @@ class CCTpfaFVElementGeometry
{
using ThisType = CCTpfaFVElementGeometry;
using GridView = typename GG::GridView;
- using IndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using Element = typename GridView::template Codim<0>::Entity;
static const int dim = GridView::dimension;
@@ -201,7 +203,7 @@ public:
//! Get an elment sub control volume with a global scv index
//! We separate element and neighbor scvs to speed up mapping
- const SubControlVolume& scv(IndexType scvIdx) const
+ const SubControlVolume& scv(GridIndexType scvIdx) const
{
if (scvIdx == scvIndices_[0])
return scvs_[0];
@@ -211,7 +213,7 @@ public:
//! Get an element sub control volume face with a global scvf index
//! We separate element and neighbor scvfs to speed up mapping
- const SubControlVolumeFace& scvf(IndexType scvfIdx) const
+ const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const
{
auto it = std::find(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx);
if (it != scvfIndices_.end())
@@ -222,7 +224,7 @@ public:
//! Get the scvf on the same face but from the other side
//! Note that e.g. the normals might be different in the case of surface grids
- const SubControlVolumeFace& flipScvf(IndexType scvfIdx, unsigned int outsideScvIdx = 0) const
+ const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvIdx = 0) const
{
auto it = std::find(scvfIndices_.begin(), scvfIndices_.end(), scvfIdx);
if (it != scvfIndices_.end())
@@ -283,7 +285,7 @@ public:
neighborScvfIndices_.reserve(element.subEntities(1));
neighborScvfs_.reserve(element.subEntities(1));
- std::vector handledNeighbors;
+ std::vector handledNeighbors;
handledNeighbors.reserve(element.subEntities(1));
for (const auto& intersection : intersections(fvGridGeometry().gridView(), element))
@@ -361,7 +363,7 @@ public:
private:
- IndexType findFlippedScvfIndex_(IndexType insideScvIdx, IndexType globalOutsideScvIdx)
+ GridIndexType findFlippedScvfIndex_(GridIndexType insideScvIdx, GridIndexType globalOutsideScvIdx)
{
for (unsigned int localNeighborScvfIdx = 0; localNeighborScvfIdx < neighborScvfs_.size(); ++localNeighborScvfIdx)
{
@@ -440,7 +442,7 @@ private:
}
//! create the necessary scvs and scvfs of the neighbor elements to the bound elements
- void makeNeighborGeometries(const Element& element, const IndexType eIdx)
+ void makeNeighborGeometries(const Element& element, const GridIndexType eIdx)
{
using ScvfGridIndexStorage = typename SubControlVolumeFace::Traits::GridIndexStorage;
@@ -527,8 +529,8 @@ private:
}
}
- const IndexType findLocalIndex(const IndexType idx,
- const std::vector& indices) const
+ const LocalIndexType findLocalIndex(const GridIndexType idx,
+ const std::vector& indices) const
{
auto it = std::find(indices.begin(), indices.end(), idx);
assert(it != indices.end() && "Could not find the scv/scvf! Make sure to properly bind this class!");
@@ -556,19 +558,19 @@ private:
const FVGridGeometry* fvGridGeometryPtr_; //!< the grid fvgeometry
// local storage after binding an element
- std::array scvIndices_;
+ std::array scvIndices_;
std::array scvs_;
- std::vector scvfIndices_;
+ std::vector scvfIndices_;
std::vector scvfs_;
- std::vector> flippedScvfIndices_;
+ std::vector> flippedScvfIndices_;
- std::vector neighborScvIndices_;
+ std::vector neighborScvIndices_;
std::vector neighborScvs_;
- std::vector neighborScvfIndices_;
+ std::vector neighborScvfIndices_;
std::vector neighborScvfs_;
- std::vector> flippedNeighborScvfIndices_;
+ std::vector> flippedNeighborScvfIndices_;
bool hasBoundaryScvf_ = false;
};
diff --git a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh
index 9d59a04246533e3b67f09611aa6e304795290d69..24942d23a74f76684b9c42d11f844573bd48aa99 100644
--- a/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh
+++ b/dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh
@@ -28,7 +28,9 @@
#include
+#include
#include
+
#include
#include
#include
@@ -89,7 +91,7 @@ class CCTpfaFVGridGeometry
using ThisType = CCTpfaFVGridGeometry;
using ParentType = BaseFVGridGeometry;
using ConnectivityMap = typename Traits::template ConnectivityMap;
- using IndexType = typename GV::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using Element = typename GV::template Codim<0>::Entity;
static const int dim = GV::dimension;
@@ -163,8 +165,8 @@ public:
flipScvfIndices_.clear();
// determine size of containers
- IndexType numScvs = numDofs();
- IndexType numScvf = 0;
+ std::size_t numScvs = numDofs();
+ std::size_t numScvf = 0;
for (const auto& element : elements(this->gridView()))
numScvf += element.subEntities(1);
@@ -175,7 +177,7 @@ public:
hasBoundaryScvf_.resize(numScvs, false);
// Build the scvs and scv faces
- IndexType scvfIdx = 0;
+ GridIndexType scvfIdx = 0;
numBoundaryScvf_ = 0;
for (const auto& element : elements(this->gridView()))
{
@@ -183,7 +185,7 @@ public:
scvs_[eIdx] = SubControlVolume(element.geometry(), eIdx);
// the element-wise index sets for finite volume geometry
- std::vector scvfsIndexSet;
+ std::vector scvfsIndexSet;
scvfsIndexSet.reserve(element.subEntities(1));
// for network grids there might be multiple intersection with the same geometryInInside
@@ -252,7 +254,7 @@ public:
scvfs_.emplace_back(intersection,
intersection.geometry(),
scvfIdx,
- ScvfGridIndexStorage({eIdx, this->gridView().size(0) + numBoundaryScvf_++}),
+ ScvfGridIndexStorage({eIdx, static_cast(this->gridView().size(0) + numBoundaryScvf_++)}),
true);
scvfsIndexSet.push_back(scvfIdx++);
@@ -286,26 +288,26 @@ public:
}
//! Get a sub control volume with a global scv index
- const SubControlVolume& scv(IndexType scvIdx) const
+ const SubControlVolume& scv(GridIndexType scvIdx) const
{
return scvs_[scvIdx];
}
//! Get a sub control volume face with a global scvf index
- const SubControlVolumeFace& scvf(IndexType scvfIdx) const
+ const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const
{
return scvfs_[scvfIdx];
}
//! Get the scvf on the same face but from the other side
//! Note that e.g. the normals might be different in the case of surface grids
- const SubControlVolumeFace& flipScvf(IndexType scvfIdx, unsigned int outsideScvfIdx = 0) const
+ const SubControlVolumeFace& flipScvf(GridIndexType scvfIdx, unsigned int outsideScvfIdx = 0) const
{
return scvfs_[flipScvfIndices_[scvfIdx][outsideScvfIdx]];
}
//! Get the sub control volume face indices of an scv by global index
- const std::vector& scvfIndicesOfScv(IndexType scvIdx) const
+ const std::vector& scvfIndicesOfScv(GridIndexType scvIdx) const
{
return scvfIndicesOfScv_[scvIdx];
}
@@ -318,12 +320,12 @@ public:
{ return connectivityMap_; }
//! Returns whether one of the geometry's scvfs lies on a boundary
- bool hasBoundaryScvf(IndexType eIdx) const
+ bool hasBoundaryScvf(GridIndexType eIdx) const
{ return hasBoundaryScvf_[eIdx]; }
private:
// find the scvf that has insideScvIdx in its outsideScvIdx list and outsideScvIdx as its insideScvIdx
- IndexType findFlippedScvfIndex_(IndexType insideScvIdx, IndexType outsideScvIdx)
+ GridIndexType findFlippedScvfIndex_(GridIndexType insideScvIdx, GridIndexType outsideScvIdx)
{
// go over all potential scvfs of the outside scv
for (auto outsideScvfIndex : scvfIndicesOfScv_[outsideScvIdx])
@@ -343,12 +345,12 @@ private:
//! containers storing the global data
std::vector scvs_;
std::vector scvfs_;
- std::vector> scvfIndicesOfScv_;
- IndexType numBoundaryScvf_;
+ std::vector> scvfIndicesOfScv_;
+ std::size_t numBoundaryScvf_;
std::vector hasBoundaryScvf_;
//! needed for embedded surface and network grids (dim < dimWorld)
- std::vector> flipScvfIndices_;
+ std::vector> flipScvfIndices_;
};
/*!
@@ -366,7 +368,7 @@ class CCTpfaFVGridGeometry
using ParentType = BaseFVGridGeometry;
using ConnectivityMap = typename Traits::template ConnectivityMap;
- using IndexType = typename GV::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
using Element = typename GV::template Codim<0>::Entity;
static const int dim = GV::dimension;
@@ -375,7 +377,7 @@ class CCTpfaFVGridGeometry
using ScvfGridIndexStorage = typename Traits::SubControlVolumeFace::Traits::GridIndexStorage;
using NeighborVolVarIndices = typename std::conditional_t< (dim >;
+ Dune::ReservedVector >;
public:
//! export the type of the fv element geometry (the local view type)
@@ -456,7 +458,7 @@ public:
// the element-wise index sets for finite volume geometry
auto numLocalFaces = element.subEntities(1);
- std::vector scvfsIndexSet;
+ std::vector scvfsIndexSet;
std::vector neighborVolVarIndexSet;
scvfsIndexSet.reserve(numLocalFaces);
neighborVolVarIndexSet.reserve(numLocalFaces);
@@ -512,7 +514,7 @@ public:
else if (intersection.boundary())
{
scvfsIndexSet.push_back(numScvf_++);
- neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({numScvs_ + numBoundaryScvf_++}));
+ neighborVolVarIndexSet.emplace_back(NeighborVolVarIndices({static_cast(numScvs_ + numBoundaryScvf_++)}));
}
}
@@ -525,11 +527,11 @@ public:
connectivityMap_.update(*this);
}
- const std::vector& scvfIndicesOfScv(IndexType scvIdx) const
+ const std::vector& scvfIndicesOfScv(GridIndexType scvIdx) const
{ return scvfIndicesOfScv_[scvIdx]; }
//! Return the neighbor volVar indices for all scvfs in the scv with index scvIdx
- const std::vector& neighborVolVarIndices(IndexType scvIdx) const
+ const std::vector& neighborVolVarIndices(GridIndexType scvIdx) const
{ return neighborVolVarIndices_[scvIdx]; }
/*!
@@ -542,15 +544,15 @@ public:
private:
//! Information on the global number of geometries
- IndexType numScvs_;
- IndexType numScvf_;
- IndexType numBoundaryScvf_;
+ std::size_t numScvs_;
+ std::size_t numScvf_;
+ std::size_t numBoundaryScvf_;
//! connectivity map for efficient assembly
ConnectivityMap connectivityMap_;
//! vectors that store the global data
- std::vector> scvfIndicesOfScv_;
+ std::vector> scvfIndicesOfScv_;
std::vector> neighborVolVarIndices_;
};
diff --git a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh
index dbaca8db89d477e66e3d0fb4f22c1e3f2080345d..feee50367479484a3aa141134da4707f081bde8b 100644
--- a/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh
+++ b/dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh
@@ -32,6 +32,7 @@
#include
#include
+#include
#include
namespace Dumux {
@@ -51,8 +52,8 @@ struct CCTpfaDefaultScvfGeometryTraits
static constexpr int dimWorld = Grid::dimensionworld;
using Scalar = typename Grid::ctype;
- using GridIndexType = typename Grid::LeafGridView::IndexSet::IndexType;
- using LocalIndexType = unsigned int;
+ using GridIndexType = typename IndexTraits::GridIndex;
+ using LocalIndexType = typename IndexTraits::LocalIndex;
using GridIndexStorage = typename std::conditional_t< (dim,
Dune::ReservedVector >;
diff --git a/dumux/discretization/fluxstencil.hh b/dumux/discretization/fluxstencil.hh
index c601e6f1cc761e8d28ca9a70e2192255d8decad3..030c7fc8d8172e7c89df69a3f8421c7e922ec75e 100644
--- a/dumux/discretization/fluxstencil.hh
+++ b/dumux/discretization/fluxstencil.hh
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
namespace Dumux
@@ -56,11 +57,11 @@ class FluxStencil
using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace;
using GridView = typename FVGridGeometry::GridView;
using Element = typename GridView::template Codim<0>::Entity;
- using IndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
public:
//! Each cell I couples to a cell J always only via one face
- using ScvfStencilIForJ = Dune::ReservedVector;
+ using ScvfStencilIForJ = Dune::ReservedVector;
//! The flux stencil type
using Stencil = typename SubControlVolumeFace::Traits::GridIndexStorage;
@@ -96,14 +97,14 @@ class FluxStencil
using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace;
using GridView = typename FVGridGeometry::GridView;
using Element = typename GridView::template Codim<0>::Entity;
- using IndexType = typename GridView::IndexSet::IndexType;
+ using GridIndexType = typename IndexTraits::GridIndex;
// Use the stencil type of the primary interaction volume
using NodalIndexSet = typename FVGridGeometry::GridIVIndexSets::DualGridIndexSet::NodalIndexSet;
public:
//! We don't know yet how many faces couple to a neighboring element
- using ScvfStencilIForJ = std::vector;
+ using ScvfStencilIForJ = std::vector;
//! The flux stencil type
using Stencil = typename NodalIndexSet::NodalGridStencilType;
diff --git a/dumux/discretization/staggered/freeflow/connectivitymap.hh b/dumux/discretization/staggered/freeflow/connectivitymap.hh
index f8d9605aae234e681955dc03df94b6ec631f4058..7dd82723ad8cfdab8bb51ac2f11c87c556fbb580 100644
--- a/dumux/discretization/staggered/freeflow/connectivitymap.hh
+++ b/dumux/discretization/staggered/freeflow/connectivitymap.hh
@@ -25,6 +25,7 @@
#define DUMUX_STAGGERED_FREEFLOW_CONNECTIVITY_MAP_HH
#include
+#include
namespace Dumux {
@@ -41,17 +42,17 @@ class StaggeredFreeFlowConnectivityMap
using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace;
using Element = typename GridView::template Codim<0>::Entity;
- using IndexType = std::size_t;
+ using GridIndexType = typename IndexTraits::GridIndex;
using CellCenterIdxType = typename FVGridGeometry::DofTypeIndices::CellCenterIdx;
using FaceIdxType = typename FVGridGeometry::DofTypeIndices::FaceIdx;
- using CellCenterToCellCenterMap = std::vector>;
- using CellCenterToFaceMap = std::vector>;
- using FaceToCellCenterMap = std::vector>;
- using FaceToFaceMap = std::vector>;
+ using CellCenterToCellCenterMap = std::vector>;
+ using CellCenterToFaceMap = std::vector>;
+ using FaceToCellCenterMap = std::vector>;
+ using FaceToFaceMap = std::vector>;
- using Stencil = std::vector;
+ using Stencil = std::vector;
public:
@@ -92,25 +93,25 @@ public:
}
//! Returns the stencil of a cell center dof w.r.t. other cell center dofs
- const std::vector& operator() (CellCenterIdxType, CellCenterIdxType, const IndexType globalI) const
+ const std::vector& operator() (CellCenterIdxType, CellCenterIdxType, const GridIndexType globalI) const
{
return cellCenterToCellCenterMap_[globalI];
}
//! Returns the stencil of a cell center dof w.r.t. face dofs
- const std::vector& operator() (CellCenterIdxType, FaceIdxType, const IndexType globalI) const
+ const std::vector& operator() (CellCenterIdxType, FaceIdxType, const GridIndexType globalI) const
{
return cellCenterToFaceMap_[globalI];
}
//! Returns the stencil of a face dof w.r.t. cell center dofs
- const std::vector& operator() (FaceIdxType, CellCenterIdxType, const IndexType globalI) const
+ const std::vector& operator() (FaceIdxType, CellCenterIdxType, const GridIndexType globalI) const
{
return faceToCellCenterMap_[globalI];
}
//! Returns the stencil of a face dof w.r.t. other face dofs
- const std::vector