Commit 7fd1d079 authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Timo Koch
Browse files

[discretization] Make local view calls with bind const

parent dda73f24
......@@ -94,7 +94,7 @@ public:
{
unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
const auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
const int dofIdx = scv.dofIndex();
......
......@@ -90,7 +90,7 @@ public:
{
unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
const auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
const int dofIdx = scv.dofIndex();
......
......@@ -246,7 +246,7 @@ private:
static const Scalar sandGrainRoughness = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.SandGrainRoughness");
unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
const auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
using std::sqrt;
......
......@@ -188,8 +188,8 @@ public:
// prepare the fvGeometry and the element volume variables
// these quantities will be used later to obtain the effective pressure
auto fvGeometry = localView( this->problem(pmFlowId).gridGeometry() ).bindElement(element);
auto elemVolVars = localView(assembler.gridVariables(Dune::index_constant<PMFlowId>()).curGridVolVars()).bindElement(element,
const auto fvGeometry = localView( this->problem(pmFlowId).gridGeometry() ).bindElement(element);
const auto elemVolVars = localView(assembler.gridVariables(Dune::index_constant<PMFlowId>()).curGridVolVars()).bindElement(element,
fvGeometry,
this->curSol()[Dune::index_constant<PMFlowId>()]);
......
......@@ -198,7 +198,7 @@ private:
if (!faceVarScalarDataInfo_.empty() || !faceVarVectorDataInfo_.empty())
{
auto fvGeometry = localView(this->gridGeometry()).bind(element);
const auto fvGeometry = localView(this->gridGeometry()).bind(element);
elemFaceVars.bindElement(element, fvGeometry, this->sol());
for (auto&& scvf : scvfs(fvGeometry))
......
......@@ -486,7 +486,7 @@ private:
// velocity output
if (velocityOutput_->enableOutput())
{
auto elemFluxVarsCache = localView(gridVariables_.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
const auto elemFluxVarsCache = localView(gridVariables_.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
velocityOutput_->calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
......@@ -677,7 +677,7 @@ private:
// velocity output
if (velocityOutput_->enableOutput())
{
auto elemFluxVarsCache = localView(gridVariables_.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
const auto elemFluxVarsCache = localView(gridVariables_.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
for (int phaseIdx = 0; phaseIdx < velocityOutput_->numFluidPhases(); ++phaseIdx)
velocityOutput_->calculateVelocity(velocity[phaseIdx], element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
......
......@@ -207,7 +207,7 @@ public:
for(auto&& indices : darcyIndices)
{
const auto& darcyElement = this->problem(darcyIdx).gridGeometry().boundingBoxTree().entitySet().entity(indices.eIdx);
auto darcyFvGeometry = localView(this->problem(darcyIdx).gridGeometry()).bindElement(darcyElement);
const auto darcyFvGeometry = localView(this->problem(darcyIdx).gridGeometry()).bindElement(darcyElement);
const auto& scv = (*scvs(darcyFvGeometry).begin());
const auto darcyElemSol = elementSolution(darcyElement, this->curSol()[darcyIdx], this->problem(darcyIdx).gridGeometry());
......@@ -246,7 +246,7 @@ public:
for(auto&& indices : stokesElementIndices)
{
const auto& stokesElement = this->problem(stokesIdx).gridGeometry().boundingBoxTree().entitySet().entity(indices.eIdx);
auto stokesFvGeometry = localView(this->problem(stokesIdx).gridGeometry()).bindElement(stokesElement);
const auto stokesFvGeometry = localView(this->problem(stokesIdx).gridGeometry()).bindElement(stokesElement);
VelocityVector faceVelocity(0.0);
......
......@@ -107,7 +107,7 @@ public:
darcyToStokesCellCenterStencils[darcyElementIdx[0]].push_back(stokesElementIdx);
const auto& darcyElement = darcyFvGridGeometry.element(darcyElementIdx[0]);
auto darcyFvGeometry = localView(darcyFvGridGeometry).bindElement(darcyElement);
const auto darcyFvGeometry = localView(darcyFvGridGeometry).bindElement(darcyElement);
// find the corresponding Darcy sub control volume face
for (const auto& darcyScvf : scvfs(darcyFvGeometry))
......
......@@ -154,7 +154,7 @@ Dune::MatrixIndexSet getCouplingJacobianPattern(const CouplingManager& couplingM
for (const auto& elementI : elements(gridGeometryI.gridView()))
{
auto fvGeometry = localView(gridGeometryI).bindElement(elementI);
const auto fvGeometry = localView(gridGeometryI).bindElement(elementI);
// loop over sub control faces
for (auto&& scvf : scvfs(fvGeometry))
......
......@@ -127,7 +127,7 @@ public:
{
// check in which subcontrolvolume(s) we are
const auto element = gridGeometry.boundingBoxTree().entitySet().entity(eIdx);
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto globalPos = source.position();
static const bool boxPointSourceLumping = getParamFromGroup<bool>(paramGroup, "PointSource.EnableBoxLumping", true);
......
......@@ -473,7 +473,7 @@ public:
bulkContext_.lowDimElemVolVars.reserve(elementStencil.size());
// local view on the bulk fv geometry
auto bulkFvGeometry = localView(this->problem(bulkId).gridGeometry()).bindElement(element);
const auto bulkFvGeometry = localView(this->problem(bulkId).gridGeometry()).bindElement(element);
for (const auto lowDimElemIdx : elementStencil)
{
......@@ -537,9 +537,9 @@ public:
const auto& bulkSol = Assembler::isImplicit() ? this->curSol()[bulkId] : assembler.prevSol()[bulkId];
const auto curBulkElem = bulkGridGeom.element(embedments[i].first);
auto bulkFvGeom = localView(bulkGridGeom).bind(curBulkElem);
auto bulkElemVolVars = localView(assembler.gridVariables(bulkId).curGridVolVars()).bind(curBulkElem, bulkFvGeom, bulkSol);
auto bulkElemFluxVarsCache = localView(assembler.gridVariables(bulkId).gridFluxVarsCache()).bind(curBulkElem, bulkFvGeom, bulkElemVolVars);
const auto bulkFvGeom = localView(bulkGridGeom).bind(curBulkElem);
const auto bulkElemVolVars = localView(assembler.gridVariables(bulkId).curGridVolVars()).bind(curBulkElem, bulkFvGeom, bulkSol);
const auto bulkElemFluxVarsCache = localView(assembler.gridVariables(bulkId).gridFluxVarsCache()).bind(curBulkElem, bulkFvGeom, bulkElemVolVars);
lowDimContext_.isSet = true;
lowDimContext_.bulkElemBcTypes[i].update(this->problem(bulkId), curBulkElem, bulkFvGeom);
......
......@@ -159,7 +159,7 @@ public:
}();
// we should always find numElementCorners coupling scvfs
auto fvGeometry = localView(bulkFvGridGeometry).bindElement(bulkElement);
const auto fvGeometry = localView(bulkFvGridGeometry).bindElement(bulkElement);
unsigned int foundCounter = 0;
std::vector<BulkIndexType> embeddedScvfIndices(numElementCorners);
......
......@@ -120,7 +120,7 @@ public:
{
const auto bulkElement = bulkFvGridGeometry.element(bulkElemIdx);
auto fvGeometry = localView(bulkFvGridGeometry).bind(bulkElement);
const auto fvGeometry = localView(bulkFvGridGeometry).bind(bulkElement);
std::vector<BulkIndexType> embeddedScvfIndices;
for (const auto& scvf : scvfs(fvGeometry))
......
......@@ -439,7 +439,7 @@ public:
const auto& ldGridGeometry = this->problem(lowDimId).gridGeometry();
const auto elemJ = ldGridGeometry.element(lowDimElemIdx);
auto fvGeom = localView(ldGridGeometry).bindElement(elemJ);
const auto fvGeom = localView(ldGridGeometry).bindElement(elemJ);
VolumeVariables<lowDimId> volVars;
......@@ -748,7 +748,7 @@ public:
// update transmissibilities after low dim context has changed (implicit only)
if (BulkLocalAssembler::isImplicit())
{
auto elemVolVars = localView(gridVolVars).bind(bulkLocalAssembler.element(), bulkLocalAssembler.fvGeometry(), this->curSol()[bulkId]);
const auto elemVolVars = localView(gridVolVars).bind(bulkLocalAssembler.element(), bulkLocalAssembler.fvGeometry(), this->curSol()[bulkId]);
fluxVarsCache.update(bulkLocalAssembler.element(), bulkLocalAssembler.fvGeometry(), elemVolVars);
}
}
......
......@@ -89,7 +89,7 @@ public:
{
const auto bulkElement = bulkFvGridGeometry.element(bulkElemIdx);
auto fvGeometry = localView(bulkFvGridGeometry).bindElement(bulkElement);
const auto fvGeometry = localView(bulkFvGridGeometry).bindElement(bulkElement);
bool found = false;
BulkIndexType embeddedScvfIdx;
......
......@@ -96,8 +96,8 @@ public:
auto eIdx = gridGeometry.elementMapper().index(element);
// bind the geometries and volume variables to the element (all the elements in stencil)
auto fvGeometry = localView(gridGeometry).bind(element);
auto elemVolVars = localView(gridVolVars).bind(element, fvGeometry, sol);
const auto fvGeometry = localView(gridGeometry).bind(element);
const auto elemVolVars = localView(gridVolVars).bind(element, fvGeometry, sol);
for (auto&& scvf : scvfs(fvGeometry))
cache(eIdx, scvf.index()).update(problem(), element, fvGeometry, elemVolVars, scvf, invasionState().invaded(element));
......
......@@ -98,9 +98,9 @@ public:
hasChangedInCurrentIteration_ = false;
for (auto&& element : elements(problem_.gridGeometry().gridView()))
{
auto fvGeometry = localView(problem_.gridGeometry()).bindElement(element);
auto elemVolVars = localView(gridVolVars).bind(element, fvGeometry, sol);
auto elemFluxVarsCache = localView(gridFluxVarsCache).bind(element, fvGeometry, elemVolVars);
const auto fvGeometry = localView(problem_.gridGeometry()).bindElement(element);
const auto elemVolVars = localView(gridVolVars).bind(element, fvGeometry, sol);
const auto elemFluxVarsCache = localView(gridFluxVarsCache).bind(element, fvGeometry, elemVolVars);
for (auto&& scvf : scvfs(fvGeometry))
{
......@@ -160,9 +160,9 @@ public:
if (!invadedCurrentIteration_[eIdx] || invadedPreviousTimeStep_[eIdx] == invadedCurrentIteration_[eIdx])
continue;
auto fvGeometry = localView(problem_.gridGeometry()).bindElement(element);
auto elemVolVars = localView(gridVolVars).bind(element, fvGeometry, sol);
auto elemFluxVarsCache = localView(gridFluxVarsCache).bind(element, fvGeometry, elemVolVars);
const auto fvGeometry = localView(problem_.gridGeometry()).bindElement(element);
const auto elemVolVars = localView(gridVolVars).bind(element, fvGeometry, sol);
const auto elemFluxVarsCache = localView(gridFluxVarsCache).bind(element, fvGeometry, elemVolVars);
for (auto&& scvf : scvfs(fvGeometry))
{
......
......@@ -208,8 +208,8 @@ public:
// by default, all coordinate directions are considered for the definition of a boundary
// make sure FVElementGeometry and volume variables are bound to the element
auto fvGeometry = localView(localResidual_.problem().gridGeometry()).bind(element);
auto curElemVolVars = localView(gridVariables_.curGridVolVars()).bind(element, fvGeometry, sol_);
const auto fvGeometry = localView(localResidual_.problem().gridGeometry()).bind(element);
const auto curElemVolVars = localView(gridVariables_.curGridVolVars()).bind(element, fvGeometry, sol_);
auto prevElemVolVars = localView(gridVariables_.prevGridVolVars());
if (!isStationary_)
......
......@@ -89,9 +89,9 @@ public:
const auto eIdx = problem().gridGeometry().elementMapper().index(element);
// make sure FVElementGeometry & vol vars are bound to the element
auto fvElementGeometry = localView(problem().gridGeometry()).bindElement(element);
auto elemVolVars = localView(this->gridVariables().curGridVolVars()).bind(element, fvElementGeometry, this->sol());
auto elemFluxVarsCache = localView(this->gridVariables().gridFluxVarsCache()).bind(element, fvElementGeometry, elemVolVars);
const auto fvElementGeometry = localView(problem().gridGeometry()).bindElement(element);
const auto elemVolVars = localView(this->gridVariables().curGridVolVars()).bind(element, fvElementGeometry, this->sol());
const auto elemFluxVarsCache = localView(this->gridVariables().gridFluxVarsCache()).bind(element, fvElementGeometry, elemVolVars);
// treat the throat flux related data
std::size_t dataIdx = 0;
......
......@@ -79,7 +79,7 @@ public:
{
const auto elemSol = elementSolution(element, x, gridGeometry);
auto fvGeometry = localView(gridGeometry).bind(element);
const auto fvGeometry = localView(gridGeometry).bind(element);
for (const auto& scv : scvs(fvGeometry))
{
const auto fluidMatrixInteraction = spatialParams.fluidMatrixInteraction(element, scv, elemSol);
......
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