From 14acffd843b932423a456a38ebd5ca6ba473691a Mon Sep 17 00:00:00 2001 From: Simon Scholz <simon.scholz@iws.uni-stuttgart.de> Date: Tue, 28 Nov 2017 11:17:48 +0100 Subject: [PATCH] [tpfa][cc] add static assert and cast for PermeabilityType+TODO for later --- dumux/discretization/cellcentered/tpfa/darcyslaw.hh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dumux/discretization/cellcentered/tpfa/darcyslaw.hh b/dumux/discretization/cellcentered/tpfa/darcyslaw.hh index cd03da9a87..13c6601111 100644 --- a/dumux/discretization/cellcentered/tpfa/darcyslaw.hh +++ b/dumux/discretization/cellcentered/tpfa/darcyslaw.hh @@ -119,7 +119,7 @@ class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ false> using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); using ElementFluxVarsCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache); using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache); - + using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); using Element = typename GridView::template Codim<0>::Entity; using IndexType = typename GridView::IndexSet::IndexType; @@ -210,10 +210,18 @@ class CCTpfaDarcysLaw<TypeTag, /*isNetwork*/ false> // check if we evaluate the permeability in the volume (for discontinuous fields, default) // or at the scvf center for analytical permeability fields (e.g. convergence studies) auto getPermeability = [&problem](const VolumeVariables& volVars, - const GlobalPosition& scvfIpGlobal) + const GlobalPosition& scvfIpGlobal) -> typename SpatialParams::PermeabilityType { if (GET_PROP_VALUE(TypeTag, EvaluatePermeabilityAtScvfIP)) + { + // TODO: Make PermeabilityType a property!! + // We do an implicit cast to permeability type in case EvaluatePermeabilityAtScvfIP is not true so that it compiles + // If it is true make sure that no cast is necessary and the correct return type is specified in the spatial params + static_assert(!GET_PROP_VALUE(TypeTag, EvaluatePermeabilityAtScvfIP) + || std::is_same<std::decay_t<typename SpatialParams::PermeabilityType>, std::decay_t<decltype(problem.spatialParams().permeabilityAtPos(scvfIpGlobal))>>::value, + "permeabilityAtPos doesn't return PermeabilityType stated in the spatial params!"); return problem.spatialParams().permeabilityAtPos(scvfIpGlobal); + } else return volVars.permeability(); }; -- GitLab