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
......@@ -163,11 +163,11 @@ public:
continue;
// get the fvGeometry and elementVolVars needed for the bc and source interfaces
auto fvGeometry = localView(*gridGeometry_).bind(element);
auto elemVolVars = localView(gridVariables_->curGridVolVars()).bind(element, fvGeometry, sol);
const auto fvGeometry = localView(*gridGeometry_).bind(element);
const auto elemVolVars = localView(gridVariables_->curGridVolVars()).bind(element, fvGeometry, sol);
// elemFluxVarsCache for neumann interface
auto elemFluxVarsCache = localView(gridVariables_->gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
const auto elemFluxVarsCache = localView(gridVariables_->gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
//! Check if we have to refine around a source term
if (refineAtSource_)
......
......@@ -102,8 +102,8 @@ public:
const SolutionVector& sol) const
{
// make sure FVElementGeometry and volume variables are bound to the element
auto fvGeometry = localView(gridGeometry).bind(element);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bind(element, fvGeometry, sol);
const auto fvGeometry = localView(gridGeometry).bind(element);
const auto elemVolVars = localView(gridVariables.curGridVolVars()).bind(element, fvGeometry, sol);
ElementResidualVector storage(fvGeometry.numScv());
......
......@@ -142,7 +142,7 @@ auto getJacobianPattern(const GridGeometry& gridGeometry)
else
{
static constexpr auto faceIdx = GridGeometry::faceIdx();
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
// loop over sub control faces
for (auto&& scvf : scvfs(fvGeometry))
......
......@@ -307,7 +307,7 @@ public:
{
// check in which subcontrolvolume(s) we are
const auto element = boundingBoxTree.entitySet().entity(eIdx);
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto globalPos = source.position();
// loop over all sub control volumes and check if the point source is inside
......
......@@ -175,7 +175,7 @@ public:
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
const auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
// loop over sub control volumes
for (auto&& scv : scvs(fvGeometry))
......
......@@ -93,8 +93,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);
fluxVarsCache_[eIdx].resize(fvGeometry.numScvf());
for (auto&& scvf : scvfs(fvGeometry))
......
......@@ -81,7 +81,7 @@ public:
for (const auto& element : elements(gridGeometry.gridView()))
{
auto eIdx = gridGeometry.elementMapper().index(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
// get the element solution
auto elemSol = elementSolution(element, sol, gridGeometry);
......
......@@ -55,7 +55,7 @@ public:
for (const auto& element : elements(gridGeometry.gridView()))
{
// iterate over the scvfs
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
for (const auto& scvf : scvfs(fvGeometry))
{
......
......@@ -88,7 +88,7 @@ public:
// We are looking for the elements I, for which this element J is in the flux stencil
const auto globalJ = gridGeometry.elementMapper().index(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
// obtain the data of J in elements I
dataJForI.clear();
......
......@@ -72,7 +72,7 @@ public:
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
const auto elemSol = elementSolution(element, sol, gridGeometry);
......
......@@ -160,8 +160,8 @@ public:
for (const auto& element : elements(gridGeometry.gridView()))
{
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);
// Prepare all caches of the scvfs inside the corresponding interaction volume. Skip
// those ivs that are touching a boundary, we only store the data on interior ivs here.
......
......@@ -179,9 +179,9 @@ private:
continue;
// compute gradients in all scvs of all interaction volumes in this element
auto fvGeometry = localView(gridGeometry).bind(element);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bind(element, fvGeometry, x);
auto elemFluxVarsCache = localView(gridVariables.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
const auto fvGeometry = localView(gridGeometry).bind(element);
const auto elemVolVars = localView(gridVariables.curGridVolVars()).bind(element, fvGeometry, x);
const auto elemFluxVarsCache = localView(gridVariables.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
for (const auto& scvf : scvfs(fvGeometry))
{
......
......@@ -103,8 +103,8 @@ public:
for (const auto& element : elements(gridGeometry.gridView()))
{
// Prepare the geometries within the elements of the 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))
{
......
......@@ -71,7 +71,7 @@ public:
for(auto&& element: elements(gridGeometry.gridView()))
{
// restrict the FvGeometry locally and bind to the element
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
// loop over sub control faces
for (auto&& scvf : scvfs(fvGeometry))
......
......@@ -172,7 +172,7 @@ public:
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
......
......@@ -89,7 +89,7 @@ public:
for (auto&& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry).bindElement(element);
const auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scvf : scvfs(fvGeometry))
{
......
......@@ -117,8 +117,8 @@ public:
for (const auto& element : elements(gridGeometry.gridView()))
{
// Prepare the geometries within the elements of the 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))
{
......
......@@ -96,7 +96,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();
......@@ -129,7 +129,7 @@ public:
}
// Adjust for dirichlet boundary conditions
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
const auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scvf : scvfs(fvGeometry))
{
const unsigned int normDim = scvf.directionIndex();
......
......@@ -457,7 +457,7 @@ private:
// calculate cell-center-averaged velocities
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
const auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
unsigned int elementIdx = this->gridGeometry().elementMapper().index(element);
// calculate velocities
......@@ -497,7 +497,7 @@ private:
}
}
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
const auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scvf : scvfs(fvGeometry))
{
// adapt calculations for Dirichlet condition
......@@ -684,7 +684,7 @@ private:
for (const auto& element : elements(this->gridGeometry().gridView()))
{
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();
......
......@@ -122,7 +122,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();
......
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