Commit 29767641 authored by Timo Koch's avatar Timo Koch
Browse files

[elemsol] Introduce separate class to simplify usage of element solution

parent f42b43fe
......@@ -50,7 +50,7 @@ class BoxLocalAssembler<TypeTag,
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using ElementResidualVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>;
using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes);
using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
......@@ -245,11 +245,8 @@ private:
ElementBoundaryTypes elemBcTypes;
elemBcTypes.update(problem, element, fvGeometry);
// get the element solution
const auto numVert = element.subEntities(dim);
ElementSolutionVector elemSol(numVert);
for (const auto& scv : scvs(fvGeometry))
elemSol[scv.indexInElement()] = curSol[scv.dofIndex()];
// create the element solution
ElementSolutionVector elemSol(element, curSol, fvGeometry);
// the actual element's current residual
ElementResidualVector residual(0.0);
......@@ -297,7 +294,7 @@ private:
// calculate derivatives w.r.t to the privars at the dof at hand
for (int pvIdx = 0; pvIdx < numEq; pvIdx++)
{
ElementSolutionVector partialDeriv(element.subEntities(dim));
ElementResidualVector partialDeriv(element.subEntities(dim));
Scalar eps = numericEpsilon(volVars.priVar(pvIdx));
Scalar delta = 0;
......@@ -452,7 +449,7 @@ class BoxLocalAssembler<TypeTag,
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using ElementResidualVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>;
using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes);
using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
......@@ -819,7 +816,7 @@ class BoxLocalAssembler<TypeTag,
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using ElementResidualVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>;
using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes);
using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
......@@ -1131,7 +1128,7 @@ class BoxLocalAssembler<TypeTag,
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using ElementResidualVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>;
using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes);
using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
......
// -*- 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 <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief The local element solution class for the box method
*/
#ifndef DUMUX_BOX_ELEMENT_SOLUTION_HH
#define DUMUX_BOX_ELEMENT_SOLUTION_HH
#include <dune/istl/bvector.hh>
#include <dumux/common/properties.hh>
namespace Dumux
{
/*!
* \ingroup BoxModel
* \brief The element solution vector
*/
template<class TypeTag>
class BoxElementSolution
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using Element = typename GridView::template Codim<0>::Entity;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
public:
//! Default constructors
BoxElementSolution() = default;
BoxElementSolution(BoxElementSolution&& other) = default;
BoxElementSolution(const BoxElementSolution& other) = default;
//! Constructor with element and solution and gridgeometry
BoxElementSolution(const Element& element, const SolutionVector& sol,
const FVGridGeometry& fvGridGeometry)
{
update(element, sol, fvGridGeometry);
}
//! Constructor with element and solution and elementgeometry (only works for box)
BoxElementSolution(const Element& element, const SolutionVector& sol,
const FVElementGeometry& fvGeometry)
{
update(element, sol, fvGeometry);
}
//! extract the element solution from the solution vector using a mapper
void update(const Element& element, const SolutionVector& sol,
const FVGridGeometry& fvGridGeometry)
{
const auto numVert = element.subEntities(GridView::dimension);
priVars_.resize(numVert);
for (int vIdx = 0; vIdx < numVert; ++vIdx)
priVars_[vIdx] = sol[fvGridGeometry.vertexMapper().subIndex(element, vIdx, GridView::dimension)];
}
//! extract the element solution from the solution vector using a local fv geometry
void update(const Element& element, const SolutionVector& sol,
const FVElementGeometry& fvGeometry)
{
const auto numVert = element.subEntities(GridView::dimension);
priVars_.resize(numVert);
for (const auto& scv : scvs(fvGeometry))
priVars_[scv.indexInElement()] = sol[scv.dofIndex()];
}
//! bracket operator const access
template<typename IndexType>
const PrimaryVariables& operator [](IndexType i) const
{ return priVars_[i]; }
//! bracket operator access
template<typename IndexType>
PrimaryVariables& operator [](IndexType i)
{ return priVars_[i]; }
private:
Dune::BlockVector<PrimaryVariables> priVars_;
};
} // end namespace Dumux
#endif
......@@ -128,10 +128,7 @@ public:
const SolutionVector& sol)
{
// get the solution at the dofs of the element
const auto numVert = element.subEntities(dim);
ElementSolutionVector elemSol(numVert);
for (const auto& scv : scvs(fvGeometry))
elemSol[scv.indexInElement()] = sol[scv.dofIndex()];
ElementSolutionVector elemSol(element, sol, fvGeometry);
// resize volume variables to the required size
volumeVariables_.resize(fvGeometry.numScv());
......
......@@ -34,6 +34,7 @@
#include <dumux/discretization/box/subcontrolvolume.hh>
#include <dumux/discretization/box/subcontrolvolumeface.hh>
#include <dumux/discretization/box/elementsolution.hh>
#include <dumux/discretization/box/globalfluxvariablescache.hh>
#include <dumux/discretization/box/elementfluxvariablescache.hh>
#include <dumux/discretization/box/globalvolumevariables.hh>
......@@ -55,10 +56,12 @@ SET_PROP(BoxModel, DiscretizationMethod)
};
//! Set the default for the FVElementGeometry vector
SET_TYPE_PROP(BoxModel, FVGridGeometry, BoxFVGridGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>);
SET_TYPE_PROP(BoxModel, FVGridGeometry, BoxFVGridGeometry<TypeTag,
GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>);
//! Set the default for the FVElementGeometry vector
SET_TYPE_PROP(BoxModel, FVElementGeometry, BoxFVElementGeometry<TypeTag, GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>);
SET_TYPE_PROP(BoxModel, FVElementGeometry, BoxFVElementGeometry<TypeTag,
GET_PROP_VALUE(TypeTag, EnableFVGridGeometryCache)>);
//! The sub control volume
SET_PROP(BoxModel, SubControlVolume)
......@@ -87,20 +90,27 @@ public:
using type = BoxSubControlVolumeFace<ScvfGeometry, IndexType>;
};
//! Set the solution vector type for an element
SET_TYPE_PROP(BoxModel, ElementSolutionVector, BoxElementSolution<TypeTag>);
//! Set the default for the ElementBoundaryTypes
SET_TYPE_PROP(BoxModel, ElementBoundaryTypes, BoxElementBoundaryTypes<TypeTag>);
//! The global volume variables vector class
SET_TYPE_PROP(BoxModel, GlobalVolumeVariables, BoxGlobalVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalVolumeVariablesCache)>);
SET_TYPE_PROP(BoxModel, GlobalVolumeVariables, BoxGlobalVolumeVariables<TypeTag,
GET_PROP_VALUE(TypeTag, EnableGlobalVolumeVariablesCache)>);
//! The element volume variables vector class
SET_TYPE_PROP(BoxModel, ElementVolumeVariables, BoxElementVolumeVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalVolumeVariablesCache)>);
SET_TYPE_PROP(BoxModel, ElementVolumeVariables, BoxElementVolumeVariables<TypeTag,
GET_PROP_VALUE(TypeTag, EnableGlobalVolumeVariablesCache)>);
//! The global flux variables cache vector class
SET_TYPE_PROP(BoxModel, GlobalFluxVariablesCache, BoxGlobalFluxVariablesCache<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalFluxVariablesCache)>);
SET_TYPE_PROP(BoxModel, GlobalFluxVariablesCache, BoxGlobalFluxVariablesCache<TypeTag,
GET_PROP_VALUE(TypeTag, EnableGlobalFluxVariablesCache)>);
//! The local flux variables cache vector class
SET_TYPE_PROP(BoxModel, ElementFluxVariablesCache, BoxElementFluxVariablesCache<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalFluxVariablesCache)>);
SET_TYPE_PROP(BoxModel, ElementFluxVariablesCache, BoxElementFluxVariablesCache<TypeTag,
GET_PROP_VALUE(TypeTag, EnableGlobalFluxVariablesCache)>);
//! Set the BaseLocalResidual to BoxLocalResidual
SET_TYPE_PROP(BoxModel, BaseLocalResidual, BoxLocalResidual<TypeTag>);
......
// -*- 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 <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief The local element solution class for cell-centered methods
*/
#ifndef DUMUX_CC_ELEMENT_SOLUTION_HH
#define DUMUX_CC_ELEMENT_SOLUTION_HH
#include <dune/istl/bvector.hh>
#include <dumux/common/properties.hh>
namespace Dumux
{
/*!
* \ingroup CCModel
* \brief The element solution vector
*/
template<class TypeTag>
class CCElementSolution
{
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using Element = typename GridView::template Codim<0>::Entity;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
public:
//! Default constructors
CCElementSolution() = default;
CCElementSolution(CCElementSolution&& other) = default;
CCElementSolution(const CCElementSolution& other) = default;
//! Constructor with element and solution
CCElementSolution(const Element& element, const SolutionVector& sol,
const FVGridGeometry& fvGridGeometry)
: CCElementSolution(sol[fvGridGeometry.elementMapper().index(element)])
{}
//! Constructor with a primary variable object
CCElementSolution(PrimaryVariables&& priVars)
: priVars_(std::move(priVars)) {}
//! Constructor with a primary variable object
CCElementSolution(const PrimaryVariables& priVars)
: priVars_(priVars) {}
//! extract the element solution from the solution vector using a mapper
void update(const Element& element, const SolutionVector& sol,
const FVGridGeometry& fvGridGeometry)
{
priVars_ = sol[fvGridGeometry.elementMapper().index(element)];
}
//! bracket operator const access
template<typename IndexType>
const PrimaryVariables& operator [](IndexType i) const
{
assert(i == 0 && "Index exceeds valid range!");
return priVars_;
}
//! bracket operator access
template<typename IndexType>
PrimaryVariables& operator [](IndexType i)
{
assert(i == 0 && "Index exceeds valid range!");
return priVars_;
}
private:
PrimaryVariables priVars_;
};
} // end namespace Dumux
#endif
......@@ -129,7 +129,7 @@ public:
// update the volume variables of the element at hand
const auto& scvI = fvGeometry.scv(globalI);
volumeVariables_[localIdx].update(ElementSolution({sol[globalI]}),
volumeVariables_[localIdx].update(ElementSolution(sol[globalI]),
problem,
element,
scvI);
......@@ -141,7 +141,7 @@ public:
{
const auto& elementJ = fvGridGeometry.element(dataJ.globalJ);
const auto& scvJ = fvGeometry.scv(dataJ.globalJ);
volumeVariables_[localIdx].update(ElementSolution({sol[dataJ.globalJ]}),
volumeVariables_[localIdx].update(ElementSolution(sol[dataJ.globalJ]),
problem,
elementJ,
scvJ);
......@@ -170,7 +170,7 @@ public:
{
// boundary volume variables
VolumeVariables dirichletVolVars;
dirichletVolVars.update(ElementSolution({problem.dirichlet(element, scvf)}),
dirichletVolVars.update(ElementSolution(problem.dirichlet(element, scvf)),
problem,
element,
scvI);
......@@ -222,7 +222,7 @@ public:
// const auto& scvJ = fvGeometry.scv(globalJ);
// VolumeVariables additionalVolVars;
// additionalVolVars.update(problem.model().elementSolution(elementJ, sol),
// additionalVolVars.update(ElementSolution(elementJ, sol, fvGridGeometry),
// problem,
// elementJ,
// scvJ);
......@@ -244,7 +244,7 @@ public:
// update the volume variables of the element
const auto& scv = fvGeometry.scv(eIdx);
volumeVariables_[0].update(ElementSolution({sol[scv.dofIndex()]}),
volumeVariables_[0].update(ElementSolution(sol[scv.dofIndex()]),
globalVolVars().problem(),
element,
scv);
......@@ -315,7 +315,7 @@ private:
// boundary volume variables
VolumeVariables dirichletVolVars;
const auto& ivScv = fvGeometry.scv(insideScvIdx);
dirichletVolVars.update(ElementSolution({problem.dirichlet(insideElement, ivScvf)}),
dirichletVolVars.update(ElementSolution(problem.dirichlet(insideElement, ivScvf)),
problem,
insideElement,
ivScv);
......
......@@ -55,7 +55,7 @@ class CCMpfaGlobalVolumeVariables<TypeTag, /*enableGlobalVolVarsCache*/true>
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using IndexType = typename GridView::IndexSet::IndexType;
......@@ -95,7 +95,7 @@ public:
const auto& insideScv = fvGeometry.scv(insideScvIdx);
const auto dirichletPriVars = problem.dirichlet(element, scvf);
volumeVariables_[scvf.outsideScvIdx()].update(ElementSolutionVector({dirichletPriVars}), problem, element, insideScv);
volumeVariables_[scvf.outsideScvIdx()].update(ElementSolutionVector(dirichletPriVars), problem, element, insideScv);
}
else
{
......
......@@ -35,6 +35,7 @@
#include <dumux/discretization/cellcentered/globalvolumevariables.hh>
#include <dumux/discretization/cellcentered/subcontrolvolume.hh>
#include <dumux/discretization/cellcentered/elementsolution.hh>
#include <dumux/discretization/cellcentered/mpfa/methods.hh>
#include <dumux/discretization/cellcentered/mpfa/connectivitymap.hh>
......@@ -158,6 +159,9 @@ public:
typedef Dumux::CCMpfaSubControlVolumeFace<method, ScvfGeometry, ScvfGeometryTraits<Scalar>, IndexType> type;
};
//! Set the solution vector type for an element
SET_TYPE_PROP(CCMpfaModel, ElementSolutionVector, CCElementSolution<TypeTag>);
//! Set the default for the ElementBoundaryTypes
SET_TYPE_PROP(CCMpfaModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>);
......
......@@ -130,7 +130,7 @@ public:
// update the volume variables of the element at hand
auto&& scvI = fvGeometry.scv(globalI);
volumeVariables_[localIdx].update(ElementSolution({sol[globalI]}),
volumeVariables_[localIdx].update(ElementSolution(sol[globalI]),
problem,
element,
scvI);
......@@ -142,7 +142,7 @@ public:
{
const auto& elementJ = fvGridGeometry.element(dataJ.globalJ);
auto&& scvJ = fvGeometry.scv(dataJ.globalJ);
volumeVariables_[localIdx].update(ElementSolution({sol[dataJ.globalJ]}),
volumeVariables_[localIdx].update(ElementSolution(sol[dataJ.globalJ]),
problem,
elementJ,
scvJ);
......@@ -186,7 +186,7 @@ public:
// const auto& elementJ = fvGridGeometry.element(globalJ);
// auto&& scvJ = fvGeometry.scv(globalJ);
// volumeVariables_[localIdx].update(ElementSolution({sol[globalJ]}),
// volumeVariables_[localIdx].update(ElementSolution(sol[globalJ]),
// problem,
// elementJ,
// scvJ);
......@@ -210,7 +210,7 @@ public:
// update the volume variables of the element
auto&& scv = fvGeometry.scv(eIdx);
volumeVariables_[0].update(ElementSolution({sol[eIdx]}),
volumeVariables_[0].update(ElementSolution(sol[eIdx]),
globalVolVars().problem(),
element,
scv);
......
......@@ -37,6 +37,7 @@
#include <dumux/implicit/cellcentered/localresidual.hh>
#include <dumux/discretization/cellcentered/connectivitymap.hh>
#include <dumux/discretization/cellcentered/elementsolution.hh>
#include <dumux/discretization/cellcentered/tpfa/fvgridgeometry.hh>
#include <dumux/discretization/cellcentered/tpfa/globalfluxvariablescache.hh>
#include <dumux/discretization/cellcentered/tpfa/fvelementgeometry.hh>
......@@ -97,6 +98,9 @@ public:
typedef Dumux::CCTpfaSubControlVolumeFace<ScvfGeometry, IndexType> type;
};
//! Set the solution vector type for an element
SET_TYPE_PROP(CCTpfaModel, ElementSolutionVector, CCElementSolution<TypeTag>);
//! Set the default for the ElementBoundaryTypes
SET_TYPE_PROP(CCTpfaModel, ElementBoundaryTypes, CCElementBoundaryTypes<TypeTag>);
......
......@@ -64,7 +64,7 @@ class BoxLocalResidual : public ImplicitLocalResidual<TypeTag>
using ElementFluxVariablesCache = typename GET_PROP_TYPE(TypeTag, ElementFluxVariablesCache);
using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache);
using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using ElementResidualVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>;
public:
using ParentType::ParentType;
......
......@@ -44,7 +44,7 @@ class CCLocalResidual : public ImplicitLocalResidual<TypeTag>
using ParentType = ImplicitLocalResidual<TypeTag>;
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity;
using ElementResidualVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
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);
......
......@@ -54,7 +54,7 @@ class ImplicitLocalResidual
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 = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementResidualVector = Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, NumEqVector)>;
using ResidualVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using ElementBoundaryTypes = typename GET_PROP_TYPE(TypeTag, ElementBoundaryTypes);
......
......@@ -492,7 +492,7 @@ public:
fvGeometry.bindElement(element);
BulkVolumeVariables volVars;
volVars.update(BulkElementSolutionVector({bulkPriVars}),
volVars.update(BulkElementSolutionVector(bulkPriVars),
bulkProblem(),
element,
fvGeometry.scv(data.bulkElementIdx()));
......
......@@ -424,7 +424,7 @@ public:
fvGeometry.bindElement(element);
BulkVolumeVariables volVars;
volVars.update(BulkElementSolutionVector({bulkPriVars}),
volVars.update(BulkElementSolutionVector(bulkPriVars),
bulkProblem(),
element,
fvGeometry.scv(data.bulkElementIdx()));
......@@ -443,7 +443,7 @@ public:
fvGeometry.bindElement(element);
LowDimVolumeVariables volVars;
volVars.update(LowDimElementSolutionVector({lowDimPriVars}),
volVars.update(LowDimElementSolutionVector(lowDimPriVars),
lowDimProblem(),
element,
fvGeometry.scv(data.lowDimElementIdx()));
......
......@@ -113,7 +113,7 @@ public:
auto elemVolVars = localView(gridVariables.curGridVolVars());
elemVolVars.bindElement(element, fvGeometry, curSol);
const auto curElemSol = elementSolution(fvGridGeometry, element, curSol);
const ElementSolution curElemSol(element, curSol, fvGridGeometry);
for (auto&& scv : scvs(fvGeometry))
{
auto dofIdxGlobal = scv.dofIndex();
......@@ -176,31 +176,6 @@ private:
static typename std::enable_if<GET_PROP_VALUE(T, EnableGlobalVolumeVariablesCache), VolumeVariables&>::type
getVolVarAccess(GridVolumeVariables& gridVolVars, ElementVolumeVariables& elemVolVars, const SubControlVolume& scv)
{ return gridVolVars.volVars(scv); }
/*!
* \brief Obtains the current solution inside a given element.
* Specialization for the box method.
*/
template<class T = TypeTag>
typename std::enable_if<GET_PROP_VALUE(T, ImplicitIsBox), ElementSolution>::type
elementSolution(const FVGridGeometry& fvGridGeometry, const Element& element, const SolutionVector& sol) const
{
auto numVert = element.subEntities(dim);
ElementSolution elemSol(numVert);
for (int v = 0; v < numVert; ++v)
elemSol[v] = sol[fvGridGeometry.vertexMapper().subIndex(element, v, dim)];
return elemSol;
}
/*!
* \brief Obtains the current solution inside a given element.
* Specialization for cell-centered methods.
*/
template<class T = TypeTag>
typename std::enable_if<!GET_PROP_VALUE(T, ImplicitIsBox), ElementSolution>::type
elementSolution(const FVGridGeometry& fvGridGeometry, const Element& element, const SolutionVector& sol) const
{ return ElementSolution({ sol[fvGridGeometry.elementMapper().index(element)] }); }
};
} // end namespace dumux
......
......@@ -45,7 +45,7 @@ class PriVarSwitchNewtonController : public NewtonController<TypeTag>
using Communicator = typename GridView::CollectiveCommunication;
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using PrimaryVariableSwitch = typename GET_PROP_TYPE(TypeTag, PrimaryVariableSwitch);
using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
using ElementSolution = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
static constexpr int numEq = GET_PROP_VALUE(TypeTag, NumEq);
......@@ -138,7 +138,7 @@ public:
if (priVarSwitch_->wasSwitched(dofIdxGlobal))
{
const auto eIdx = fvGridGeometry.elementMapper().index(element);
const auto elemSol = this->elementSolution(element, this->curSol());
const ElementSolution elemSol(element, this->curSol(), fvGridGeometry);
<