From 87dfc530a45d5ee074a86cbf8c0d12ba38f6f048 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Sun, 7 Jan 2018 22:07:31 +0100 Subject: [PATCH] [assembly] Use ReservedBlockVector in local residual --- dumux/assembly/cclocalresidual.hh | 5 ++--- dumux/assembly/fvlocalresidual.hh | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dumux/assembly/cclocalresidual.hh b/dumux/assembly/cclocalresidual.hh index bc13dd2a89..c90d2d4776 100644 --- a/dumux/assembly/cclocalresidual.hh +++ b/dumux/assembly/cclocalresidual.hh @@ -25,8 +25,7 @@ #ifndef DUMUX_CC_LOCAL_RESIDUAL_HH #define DUMUX_CC_LOCAL_RESIDUAL_HH -#include <dune/istl/matrix.hh> - +#include <dumux/common/reservedblockvector.hh> #include <dumux/common/properties.hh> #include <dumux/assembly/fvlocalresidual.hh> @@ -43,7 +42,6 @@ class CCLocalResidual : public FVLocalResidual<TypeTag> using ParentType = FVLocalResidual<TypeTag>; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; - using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); @@ -52,6 +50,7 @@ class CCLocalResidual : public FVLocalResidual<TypeTag> using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); public: + using ElementResidualVector = typename ParentType::ElementResidualVector; using ParentType::ParentType; //! evaluate the flux residual for a sub control volume face and add to residual diff --git a/dumux/assembly/fvlocalresidual.hh b/dumux/assembly/fvlocalresidual.hh index 575671d3f4..c0ecb2f074 100644 --- a/dumux/assembly/fvlocalresidual.hh +++ b/dumux/assembly/fvlocalresidual.hh @@ -30,6 +30,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/timeloop.hh> +#include <dumux/common/reservedblockvector.hh> #include <dumux/discretization/methods.hh> namespace Dumux { @@ -46,13 +47,13 @@ class FVLocalResidual using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using Element = typename GridView::template Codim<0>::Entity; using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); - using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>; using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes); using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); @@ -62,6 +63,10 @@ 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 constructor FVLocalResidual(const Problem* problem, const TimeLoop* timeLoop = nullptr) -- GitLab