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