Commit b9c19e95 authored by Ned Coltman's avatar Ned Coltman Committed by Timo Koch
Browse files

[test][bind] Simplify the bind calls for fvgeometry, elemvolvars, and elemfluxvarcache.

parent 9984a392
......@@ -155,8 +155,7 @@ int main (int argc, char *argv[])
//! iterate over elements and check for each element the number of scvfs
for (const auto& element : elements(leafGridView))
{
auto fvGeometry = localView(gridGeometry);
fvGeometry.bind(element);
auto fvGeometry = localView(gridGeometry).bind(element);
//! For the tpfa scheme there is always one scv per element
if (fvGeometry.numScv() != 1)
......
......@@ -43,8 +43,7 @@ void runTest(const GG& gg, const double refVolume, const double refSurface)
double surface = 0.0;
for (const auto& element : elements(gg.gridView()))
{
auto fvGeometry = localView(gg);
fvGeometry.bind(element);
auto fvGeometry = localView(gg).bind(element);
for (const auto& scv : scvs(fvGeometry))
volume += GG::Extrusion::volume(scv);
......
......@@ -106,8 +106,7 @@ int main (int argc, char *argv[])
if(eIdx == 12 || eIdx == 0)
{
std::cout << std::endl << "Checking fvGeometry of element " << eIdx << std::endl;
auto fvGeometry = localView(gridGeometry);
fvGeometry.bind(element);
auto fvGeometry = localView(gridGeometry).bind(element);
auto range = scvs(fvGeometry);
Detail::NoopFunctor<SubControlVolume> op;
......
......@@ -73,8 +73,7 @@ auto createAnalyticalSolution(const Problem& problem)
using Indices = typename Problem::Indices;
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry);
fvGeometry.bindElement(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......
......@@ -324,8 +324,7 @@ private:
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......
......@@ -380,8 +380,7 @@ private:
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......
......@@ -294,8 +294,7 @@ private:
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......
......@@ -253,8 +253,7 @@ private:
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......
......@@ -65,8 +65,7 @@ public:
for (const auto& element : elements(problem.gridGeometry().gridView()))
{
auto fvGeometry = localView(problem.gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(problem.gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
......
......@@ -76,8 +76,7 @@ auto createAnalyticalSolution(const Scalar time, const Problem& problem)
using Indices = typename Problem::Indices;
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry);
fvGeometry.bindElement(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......@@ -120,8 +119,7 @@ auto createSource(const Problem& problem)
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry);
fvGeometry.bindElement(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......
......@@ -211,14 +211,12 @@ public:
{
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
auto elemVolVars = localView(gridVariables.curGridVolVars());
elemVolVars.bindElement(element, fvGeometry, sol);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bindElement(element, fvGeometry, sol);
deltaP_[ccDofIdx] = elemVolVars[scv].pressure() - 1.1e5;
}
......
......@@ -193,14 +193,11 @@ public:
{
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
auto elemVolVars = localView(gridVariables.curGridVolVars());
elemVolVars.bind(element, fvGeometry, sol);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bind(element, fvGeometry, sol);
deltaRho_[ccDofIdx] = elemVolVars[scv].density() - 999.694;
}
......
......@@ -98,11 +98,8 @@ public:
Scalar j = 0.0;
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto elemVolVars = localView(gridVariables.curGridVolVars());
elemVolVars.bind(element, fvGeometry, curSol);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bind(element, fvGeometry, curSol);
for (auto&& scv : scvs(fvGeometry))
{
const auto globalPos = scv.dofPosition();
......
......@@ -80,8 +80,7 @@ computeL2Error(const double t,
typename SolutionVector::block_type l2Error(0.0);
for (const auto& element : elements(gridGeometry.gridView(), Dune::Partitions::interior))
{
auto fvGeometry = localView(gridGeometry);
fvGeometry.bindElement(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
using std::pow;
for (auto&& scv : scvs(fvGeometry))
......
......@@ -108,11 +108,8 @@ public:
//compute solution for all elements
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto elemVolVars = localView(gridVariables.curGridVolVars());
elemVolVars.bindElement(element, fvGeometry, curSol);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bindElement(element, fvGeometry, curSol);
const auto& globalPos = element.geometry().center();
......
......@@ -64,11 +64,8 @@ void assembleElementStresses(SigmaStorage& sigmaStorage,
{
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry);
auto elemVolVars = localView(gridVariables.curGridVolVars());
fvGeometry.bind(element);
elemVolVars.bind(element, fvGeometry, x);
auto fvGeometry = localView(gridGeometry).bind(element);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bind(element, fvGeometry, x);
// evaluate flux variables cache at cell center
using FluxVarsCache = typename GridVariables::GridFluxVariablesCache::FluxVariablesCache;
......
......@@ -51,8 +51,7 @@ public:
for(const auto& element : elements(leafGridView))
{
auto fvGeometry = localView(*gridGeometry);
fvGeometry.bind(element);
auto fvGeometry = localView(*gridGeometry).bind(element);
for (auto&& scvf : scvfs(fvGeometry))
{
......
......@@ -108,11 +108,8 @@ public:
// bulk elements
for (const auto& element : elements(this->gridGeometry().gridView()))
{
auto fvGeometry = localView(this->gridGeometry());
fvGeometry.bindElement(element);
auto elemVolVars = localView(gridVariables.curGridVolVars());
elemVolVars.bindElement(element, fvGeometry, curSol);
auto fvGeometry = localView(this->gridGeometry()).bindElement(element);
auto elemVolVars = localView(gridVariables.curGridVolVars()).bindElement(element, fvGeometry, curSol);
for (auto&& scv : scvs(fvGeometry))
{
......
......@@ -74,8 +74,7 @@ auto createFreeFlowAnalyticalSolution(const Problem& problem)
using Indices = typename Problem::Indices;
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry);
fvGeometry.bindElement(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
auto ccDofIdx = scv.dofIndex();
......@@ -126,8 +125,7 @@ auto createDarcyAnalyticalSolution(const Problem& problem)
for (const auto& element : elements(gridGeometry.gridView()))
{
auto fvGeometry = localView(gridGeometry);
fvGeometry.bindElement(element);
auto fvGeometry = localView(gridGeometry).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
const auto ccDofIdx = scv.dofIndex();
......@@ -183,8 +181,7 @@ void printDarcyL2Error(const Problem& problem, const SolutionVector& x)
for (const auto& element : elements(problem.gridGeometry().gridView()))
{
auto fvGeometry = localView(problem.gridGeometry());
fvGeometry.bindElement(element);
auto fvGeometry = localView(problem.gridGeometry()).bindElement(element);
for (auto&& scv : scvs(fvGeometry))
{
......
......@@ -59,11 +59,8 @@ double computeSourceIntegral(const Problem& problem, const SolutionVector& sol,
typename SolutionVector::block_type source(0.0);
for (const auto& element : elements(gg.gridView()))
{
auto fvGeometry = localView(gg);
fvGeometry.bindElement(element);
auto elemVolVars = localView(gridVars.curGridVolVars());
elemVolVars.bindElement(element, fvGeometry, sol);
auto fvGeometry = localView(gg).bindElement(element);
auto elemVolVars = localView(gridVars.curGridVolVars()).bindElement(element, fvGeometry, sol);
for (auto&& scv : scvs(fvGeometry))
{
......@@ -94,11 +91,8 @@ double computeGlobalMass(const Problem& problem, const SolutionVector& sol, cons
const auto& gg = problem.gridGeometry();
for (const auto& element : elements(gg.gridView()))
{
auto fvGeometry = localView(gg);
fvGeometry.bindElement(element);
auto elemVolVars = localView(gridVars.curGridVolVars());
elemVolVars.bindElement(element, fvGeometry, sol);
auto fvGeometry = localView(gg).bindElement(element);
auto elemVolVars = localView(gridVars.curGridVolVars()).bindElement(element, fvGeometry, sol);
for (auto&& scv : scvs(fvGeometry))
{
......@@ -122,14 +116,9 @@ double computeGlobalBoundaryMass(const Problem& problem, const SolutionVector& s
const auto& gg = problem.gridGeometry();
for (const auto& element : elements(gg.gridView()))
{
auto fvGeometry = localView(gg);
fvGeometry.bind(element);
auto elemVolVars = localView(gridVars.curGridVolVars());
elemVolVars.bind(element, fvGeometry, sol);
auto elemFluxVarsCache = localView(gridVars.gridFluxVarsCache());
elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);
auto fvGeometry = localView(gg).bind(element);
auto elemVolVars = localView(gridVars.curGridVolVars()).bind(element, fvGeometry, sol);
auto elemFluxVarsCache = localView(gridVars.gridFluxVarsCache()).bind(element, fvGeometry, elemVolVars);
for (auto&& scvf : scvfs(fvGeometry))
if (scvf.boundary())
......
Markdown is supported
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