From 9c5852b6fc820ae11ef1f4e0cdcf9cef04197973 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Sat, 27 Feb 2016 11:44:08 +0100 Subject: [PATCH] [pointsource][fixup] Iterate over scvs --- dumux/common/pointsource.hh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dumux/common/pointsource.hh b/dumux/common/pointsource.hh index de844ea491..77f3f315ac 100644 --- a/dumux/common/pointsource.hh +++ b/dumux/common/pointsource.hh @@ -44,6 +44,7 @@ NEW_PROP_TAG(PrimaryVariables); NEW_PROP_TAG(Problem); NEW_PROP_TAG(Scalar); NEW_PROP_TAG(TimeManager); +NEW_PROP_TAG(SubControlVolume); } // end namespace Properties // forward declarations @@ -312,21 +313,20 @@ public: if(isBox) { // check in which subcontrolvolume(s) we are + // TODO mapper/problem in bboxtree would allow to make this much better const auto element = boundingBoxTree.entity(eIdx); - FVElementGeometry fvGeometry; - fvGeometry.update(problem.gridView(), element); + auto fvGeometry = problem.model().fvGeometries(element); const auto globalPos = source.position(); // loop over all sub control volumes and check if the point source is inside std::vector<unsigned int> scvs; - for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx) + for (auto&& scv : fvGeometry.scvs()) { - auto geometry = fvGeometry.subContVolGeometries[scvIdx]; - if (BoundingBoxTreeHelper<dimworld>::pointInGeometry(geometry, globalPos)) - scvs.push_back(scvIdx); + if (BoundingBoxTreeHelper<dimworld>::pointInGeometry(scv.geometry(), globalPos)) + scvs.push_back(scv.indexInElement()); } // for all scvs that where tested positiv add the point sources // to the element/scv to point source map - for (unsigned int scvIdx : scvs) + for (auto scvIdx : scvs) { const auto key = std::make_pair(eIdx, scvIdx); if (pointSourceMap.count(key)) -- GitLab