mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #804 from atgeirr/small-improvements
Avoid copying data for minor speed improvement
This commit is contained in:
commit
0b4a8661fd
@ -347,7 +347,7 @@ public:
|
|||||||
* \param timeIdx The index of the solution vector used by the
|
* \param timeIdx The index of the solution vector used by the
|
||||||
* time discretization.
|
* time discretization.
|
||||||
*/
|
*/
|
||||||
const GlobalPosition& pos(unsigned dofIdx, unsigned) const
|
decltype(auto) pos(unsigned dofIdx, unsigned) const
|
||||||
{ return stencil_.subControlVolume(dofIdx).globalPos(); }
|
{ return stencil_.subControlVolume(dofIdx).globalPos(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -101,29 +101,25 @@ public:
|
|||||||
{ element_ = element; }
|
{ element_ = element; }
|
||||||
|
|
||||||
void update()
|
void update()
|
||||||
{
|
{ }
|
||||||
const auto& geometry = element_.geometry();
|
|
||||||
centerPos_ = geometry.center();
|
|
||||||
volume_ = geometry.volume();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The global position associated with the sub-control volume
|
* \brief The global position associated with the sub-control volume
|
||||||
*/
|
*/
|
||||||
const GlobalPosition& globalPos() const
|
decltype(auto) globalPos() const
|
||||||
{ return centerPos_; }
|
{ return element_.geometry().center(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The center of the sub-control volume
|
* \brief The center of the sub-control volume
|
||||||
*/
|
*/
|
||||||
const GlobalPosition& center() const
|
decltype(auto) center() const
|
||||||
{ return centerPos_; }
|
{ return element_.geometry().center(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The volume [m^3] occupied by the sub-control volume
|
* \brief The volume [m^3] occupied by the sub-control volume
|
||||||
*/
|
*/
|
||||||
Scalar volume() const
|
Scalar volume() const
|
||||||
{ return volume_; }
|
{ return element_.geometry().volume(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The geometry of the sub-control volume.
|
* \brief The geometry of the sub-control volume.
|
||||||
@ -138,8 +134,6 @@ public:
|
|||||||
{ return element_.geometryInFather(); }
|
{ return element_.geometryInFather(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GlobalPosition centerPos_;
|
|
||||||
Scalar volume_;
|
|
||||||
Element element_;
|
Element element_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,8 +45,7 @@ class ThreadedEntityIterator
|
|||||||
using EntityIterator = typename GridView::template Codim<codim>::Iterator;
|
using EntityIterator = typename GridView::template Codim<codim>::Iterator;
|
||||||
public:
|
public:
|
||||||
ThreadedEntityIterator(const GridView& gridView)
|
ThreadedEntityIterator(const GridView& gridView)
|
||||||
: gridView_(gridView)
|
: sequentialIt_(gridView.template begin<codim>())
|
||||||
, sequentialIt_(gridView_.template begin<codim>())
|
|
||||||
, sequentialEnd_(gridView.template end<codim>())
|
, sequentialEnd_(gridView.template end<codim>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -90,7 +89,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GridView gridView_;
|
|
||||||
EntityIterator sequentialIt_;
|
EntityIterator sequentialIt_;
|
||||||
EntityIterator sequentialEnd_;
|
EntityIterator sequentialEnd_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user