Commit 7ebd297d authored by Timo Koch's avatar Timo Koch Committed by Dennis Gläser
Browse files

[tpfa][box] Export max number of scvs and use in residual

parent b54577d8
......@@ -63,9 +63,8 @@ class FVLocalResidual
using TimeLoop = TimeLoopBase<Scalar>;
public:
//! the container storing all element residuals (for cc size is 1 for box 2^dim)
static constexpr size_t maxNumScv = (1 << GridView::dimension); // 2^dim
using ElementResidualVector = ReservedBlockVector<ResidualVector, maxNumScv>;
//! the container storing all element residuals
using ElementResidualVector = ReservedBlockVector<ResidualVector, FVElementGeometry::maxNumElementScvs>;
//! the constructor
FVLocalResidual(const Problem* problem,
......
......@@ -54,28 +54,33 @@ class BoxFVElementGeometry
template<class TypeTag>
class BoxFVElementGeometry<TypeTag, true>
{
using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using IndexType = typename GridView::IndexSet::IndexType;
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);
using Element = typename GridView::template Codim<0>::Entity;
//! 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 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;
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
using FeCache = Dune::PQkLocalFiniteElementCache<CoordScalar, Scalar, dim, 1>;
using FeLocalBasis = typename FeCache::FiniteElementType::Traits::LocalBasisType;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
using ScvIterator = Dumux::ScvIterator<SubControlVolume, std::vector<IndexType>, ThisType>;
using ScvfIterator = Dumux::ScvfIterator<SubControlVolumeFace, std::vector<IndexType>, ThisType>;
public:
//! Constructor
BoxFVElementGeometry(const FVGridGeometry& fvGridGeometry)
: fvGridGeometryPtr_(&fvGridGeometry) {}
......@@ -169,16 +174,22 @@ template<class TypeTag>
class BoxFVElementGeometry<TypeTag, false>
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using IndexType = typename GridView::IndexSet::IndexType;
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);
using LocalIndexType = typename SubControlVolumeFace::Traits::LocalIndexType;
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
//! 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);
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
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);
......
......@@ -61,15 +61,18 @@ class CCTpfaFVElementGeometry<TypeTag, true>
using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using IndexType = typename GridView::IndexSet::IndexType;
using Element = typename GridView::template Codim<0>::Entity;
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);
using Element = typename GridView::template Codim<0>::Entity;
//! export type of finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
//! the maximum number of scvs per element
static constexpr std::size_t maxNumElementScvs = 1;
using ScvIterator = Dumux::ScvIterator<SubControlVolume, std::array<IndexType, 1>, ThisType>;
using ScvfIterator = Dumux::ScvfIterator<SubControlVolumeFace, std::vector<IndexType>, ThisType>;
public:
//! Constructor
CCTpfaFVElementGeometry(const FVGridGeometry& fvGridGeometry)
: fvGridGeometryPtr_(&fvGridGeometry) {}
......@@ -100,9 +103,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>
friend inline Dune::IteratorRange< ScvIterator<SubControlVolume, std::array<IndexType, 1>, ThisType> >
scvs(const CCTpfaFVElementGeometry& fvGeometry)
{
using ScvIterator = Dumux::ScvIterator<SubControlVolume, std::array<IndexType, 1>, ThisType>;
return Dune::IteratorRange<ScvIterator>(ScvIterator(fvGeometry.scvIndices_.begin(), fvGeometry),
ScvIterator(fvGeometry.scvIndices_.end(), fvGeometry));
}
......@@ -112,11 +116,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>
friend inline Dune::IteratorRange< ScvfIterator<SubControlVolumeFace, std::vector<IndexType>, ThisType> >
scvfs(const CCTpfaFVElementGeometry& fvGeometry)
{
const auto& g = fvGeometry.fvGridGeometry();
const auto scvIdx = fvGeometry.scvIndices_[0];
using ScvfIterator = Dumux::ScvfIterator<SubControlVolumeFace, std::vector<IndexType>, ThisType>;
return Dune::IteratorRange<ScvfIterator>(ScvfIterator(g.scvfIndicesOfScv(scvIdx).begin(), fvGeometry),
ScvfIterator(g.scvfIndicesOfScv(scvIdx).end(), fvGeometry));
}
......@@ -168,15 +173,21 @@ class CCTpfaFVElementGeometry<TypeTag, false>
using ThisType = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
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 Element = typename GridView::template Codim<0>::Entity;
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
static const int dim = GridView::dimension;
static const 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
static constexpr std::size_t maxNumElementScvs = 1;
//! Constructor
CCTpfaFVElementGeometry(const FVGridGeometry& fvGridGeometry)
: fvGridGeometryPtr_(&fvGridGeometry) {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment