From 4699ad06905bd331f5c6f1050817f39c699c86f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Mon, 19 Nov 2018 11:38:42 +0100 Subject: [PATCH] [mpfa][localassembler] lambda obtains volvars to obtain cell/dirichlet values --- .../cellcentered/mpfa/fluxvariablescachefiller.hh | 10 +++------- .../cellcentered/mpfa/omethod/localassembler.hh | 6 +++--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh b/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh index b2fd78636c..82fceb984e 100644 --- a/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh +++ b/dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh @@ -443,7 +443,6 @@ private: localAssembler.assembleMatrices(handle.advectionHandle(), iv, LambdaFactory::getAdvectionLambda()); // assemble pressure vectors - const auto& evv = &elemVolVars(); for (unsigned int pIdx = 0; pIdx < ModelTraits::numPhases(); ++pIdx) { // set context in handle @@ -456,7 +455,7 @@ private: localAssembler.assembleGravity(handle.advectionHandle(), iv, getRho); // reassemble pressure vector - auto getPressure = [&evv, pIdx] (auto volVarIdx) { return (evv->operator[](volVarIdx)).pressure(pIdx); }; + auto getPressure = [pIdx] (const auto& volVars) { return volVars.pressure(pIdx); }; localAssembler.assembleU(handle.advectionHandle(), iv, getPressure); } } @@ -485,9 +484,7 @@ private: LambdaFactory::getDiffusionLambda(phaseIdx, compIdx)); // assemble vector of mole fractions - const auto& evv = &elemVolVars(); - auto getMoleFraction = [&evv, phaseIdx, compIdx] (auto volVarIdx) - { return (evv->operator[](volVarIdx)).moleFraction(phaseIdx, compIdx); }; + auto getMoleFraction = [phaseIdx, compIdx] (const auto& volVars) { return volVars.moleFraction(phaseIdx, compIdx); }; localAssembler.assembleU(handle.diffusionHandle(), iv, getMoleFraction); } @@ -513,8 +510,7 @@ private: LambdaFactory::template getHeatConductionLambda<ThermCondModel>()); // assemble vector of temperatures - const auto& evv = &elemVolVars(); - auto getMoleFraction = [&evv] (auto volVarIdx) { return (evv->operator[](volVarIdx)).temperature(); }; + auto getMoleFraction = [] (const auto& volVars) { return volVars.temperature(); }; localAssembler.assembleU(handle.heatConductionHandle(), iv, getMoleFraction); } diff --git a/dumux/discretization/cellcentered/mpfa/omethod/localassembler.hh b/dumux/discretization/cellcentered/mpfa/omethod/localassembler.hh index eaa5ac3a4d..fd25271136 100644 --- a/dumux/discretization/cellcentered/mpfa/omethod/localassembler.hh +++ b/dumux/discretization/cellcentered/mpfa/omethod/localassembler.hh @@ -147,7 +147,7 @@ public: * * \param handle The data handle in which the vector is stored * \param iv The mpfa-o interaction volume - * \param getU Lambda to obtain the desired cell/Dirichlet value from grid index + * \param getU Lambda to obtain the desired cell/Dirichlet value from vol vars */ template< class DataHandle, class IV, class GetU > void assembleU(DataHandle& handle, const IV& iv, const GetU& getU) @@ -158,9 +158,9 @@ public: // put the cell unknowns first, then Dirichlet values typename IV::Traits::IndexSet::LocalIndexType i = 0; for (; i < iv.numScvs(); i++) - u[i] = getU( iv.localScv(i).gridScvIndex() ); + u[i] = getU( this->elemVolVars()[iv.localScv(i).gridScvIndex()] ); for (const auto& data : iv.dirichletData()) - u[i++] = getU( data.volVarIndex() ); + u[i++] = getU( this->elemVolVars()[data.volVarIndex()] ); } /*! -- GitLab