Commit 256ab1ce authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[staggered][gridGeometry] Make scvs(fvGeometry) iterate directly over global vector

parent 219fc32e
...@@ -105,12 +105,7 @@ public: ...@@ -105,12 +105,7 @@ public:
//! for (auto&& scv : scvs(fvGeometry)) //! for (auto&& scv : scvs(fvGeometry))
friend inline auto friend inline auto
scvs(const FaceCenteredStaggeredFVElementGeometry& fvGeometry) scvs(const FaceCenteredStaggeredFVElementGeometry& fvGeometry)
{ { return fvGeometry.gridGeometry().scvs(fvGeometry); }
using IndexContainerType = std::decay_t<decltype(fvGeometry.scvIndices_())>;
using ScvIterator = Dumux::ScvIterator<SubControlVolume, IndexContainerType, ThisType>;
return Dune::IteratorRange<ScvIterator>(ScvIterator(fvGeometry.scvIndices_().begin(), fvGeometry),
ScvIterator(fvGeometry.scvIndices_().end(), fvGeometry));
}
//! iterator range for sub control volumes faces. Iterates over //! iterator range for sub control volumes faces. Iterates over
//! all scvfs of the bound element. //! all scvfs of the bound element.
......
...@@ -199,6 +199,15 @@ public: ...@@ -199,6 +199,15 @@ public:
const SubControlVolume& scv(GridIndexType scvIdx) const const SubControlVolume& scv(GridIndexType scvIdx) const
{ return scvs_[scvIdx]; } { return scvs_[scvIdx]; }
//! Iterator range for sub control volumes. Iterates over
//! all scvs of the element-local fvGeometry.
auto scvs(const LocalView& fvGeometry) const
{
const auto begin = scvs_.cbegin() + numScvsPerElement*fvGeometry.elementIndex();
const auto end = begin + numScvsPerElement;
return Dune::IteratorRange<decltype(begin)>(begin, end);
}
//! Get a sub control volume face with a global scvf index //! Get a sub control volume face with a global scvf index
const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const const SubControlVolumeFace& scvf(GridIndexType scvfIdx) const
{ return scvfs_[scvfIdx]; } { return scvfs_[scvfIdx]; }
......
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