Skip to content
Snippets Groups Projects
Commit 0eeb3161 authored by Timo Koch's avatar Timo Koch
Browse files

[fvGeometry] Make range generators free functions / friend functions

We iterate over all scvs of a fvElementGeometry like this
for (const auto& scv : scvs(fvGeometry))
This is closer to the way we speak "For each scv in all scvs of the fvElementGeometry do..."
and analogously to how we iterate over elements of a gridView.
parent 2a63d3f4
No related branches found
No related tags found
1 merge request!617[WIP] Next
...@@ -164,7 +164,7 @@ public: ...@@ -164,7 +164,7 @@ public:
this->curVolVars_().bindElement(element); this->curVolVars_().bindElement(element);
const auto& fvGeometry = this->fvGeometries(element); const auto& fvGeometry = this->fvGeometries(element);
for (const auto& scv : fvGeometry.scvs()) for (const auto& scv : scvs(fvGeometry))
{ {
auto dofIdxGlobal = scv.dofIndex(); auto dofIdxGlobal = scv.dofIndex();
if (priVarSwitch_().wasSwitched(dofIdxGlobal)) if (priVarSwitch_().wasSwitched(dofIdxGlobal))
...@@ -306,7 +306,7 @@ public: ...@@ -306,7 +306,7 @@ public:
this->curVolVars_().bindElement(element); this->curVolVars_().bindElement(element);
const auto& fvGeometry = this->fvGeometries(element); const auto& fvGeometry = this->fvGeometries(element);
for (const auto& scv : fvGeometry.scvs()) for (const auto& scv : scvs(fvGeometry))
{ {
const auto& volVars = this->curVolVars(scv); const auto& volVars = this->curVolVars(scv);
int dofIdxGlobal = scv.dofIndex(); int dofIdxGlobal = scv.dofIndex();
......
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
problem.model().fvGeometries_().bindElement(element); problem.model().fvGeometries_().bindElement(element);
const auto& fvGeometry = problem.model().fvGeometries(element); const auto& fvGeometry = problem.model().fvGeometries(element);
for (auto&& scv : fvGeometry.scvs()) for (const auto& scv : scvs(fvGeometry))
{ {
auto dofIdxGlobal = scv.dofIndex(); auto dofIdxGlobal = scv.dofIndex();
phasePresence_[dofIdxGlobal] = problem.initialPhasePresence(scv); phasePresence_[dofIdxGlobal] = problem.initialPhasePresence(scv);
...@@ -128,7 +128,7 @@ public: ...@@ -128,7 +128,7 @@ public:
volVarsVector.bindElement(element); volVarsVector.bindElement(element);
const auto& fvGeometry = problem.model().fvGeometries(element); const auto& fvGeometry = problem.model().fvGeometries(element);
for (const auto& scv : fvGeometry.scvs()) for (const auto& scv : scvs(fvGeometry))
{ {
auto dofIdxGlobal = scv.dofIndex(); auto dofIdxGlobal = scv.dofIndex();
if (!visited_[dofIdxGlobal]) if (!visited_[dofIdxGlobal])
......
...@@ -114,22 +114,22 @@ int main (int argc, char *argv[]) try ...@@ -114,22 +114,22 @@ int main (int argc, char *argv[]) try
std::cout << std::endl << "Checking fvGeometry of element " << eIdx << std::endl; std::cout << std::endl << "Checking fvGeometry of element " << eIdx << std::endl;
auto fvGeometry = fvGeometries.fvGeometry(eIdx); auto fvGeometry = fvGeometries.fvGeometry(eIdx);
auto range = fvGeometry.scvs(); auto range = scvs(fvGeometry);
NoopFunctor<SubControlVolume> op; NoopFunctor<SubControlVolume> op;
if(0 != testForwardIterator(range.begin(), range.end(), op)) if(0 != testForwardIterator(range.begin(), range.end(), op))
DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept");
for (auto&& scv : fvGeometry.scvs()) for (const auto& scv : scvs(fvGeometry))
{ {
std::cout << "-- scv center at: " << scv.center() << std::endl; std::cout << "-- scv center at: " << scv.center() << std::endl;
} }
auto range2 = fvGeometry.scvfs(); auto range2 = scvfs(fvGeometry);
NoopFunctor<SubControlVolumeFace> op2; NoopFunctor<SubControlVolumeFace> op2;
if(0 != testForwardIterator(range2.begin(), range2.end(), op2)) if(0 != testForwardIterator(range2.begin(), range2.end(), op2))
DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept");
for (auto&& scvf : fvGeometry.scvfs()) for (const auto& scvf : scvfs(fvGeometry))
{ {
std::cout << "-- scvf center at: " << scvf.center(); std::cout << "-- scvf center at: " << scvf.center();
if (scvf.boundary()) std::cout << " (on boundary)."; if (scvf.boundary()) std::cout << " (on boundary).";
......
...@@ -347,7 +347,7 @@ public: ...@@ -347,7 +347,7 @@ public:
this->model().fvGeometries_().bindElement(element); this->model().fvGeometries_().bindElement(element);
const auto& fvGeometry = this->model().fvGeometries(element); const auto& fvGeometry = this->model().fvGeometries(element);
for (const auto& scv : fvGeometry.scvs()) for (const auto& scv : scvs(fvGeometry))
{ {
auto dofIdxGlobal = scv.dofIndex(); auto dofIdxGlobal = scv.dofIndex();
(*Kxx)[dofIdxGlobal] = this->spatialParams().intrinsicPermeability(scv); (*Kxx)[dofIdxGlobal] = this->spatialParams().intrinsicPermeability(scv);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment