diff --git a/opm/models/discretization/common/fvbaseelementcontext.hh b/opm/models/discretization/common/fvbaseelementcontext.hh index 36bfada036..55e1cdc51e 100644 --- a/opm/models/discretization/common/fvbaseelementcontext.hh +++ b/opm/models/discretization/common/fvbaseelementcontext.hh @@ -347,7 +347,7 @@ public: * \param timeIdx The index of the solution vector used by the * time discretization. */ - const GlobalPosition& pos(unsigned dofIdx, unsigned) const + decltype(auto) pos(unsigned dofIdx, unsigned) const { return stencil_.subControlVolume(dofIdx).globalPos(); } /*! diff --git a/opm/models/discretization/ecfv/ecfvstencil.hh b/opm/models/discretization/ecfv/ecfvstencil.hh index c5c522f35f..a83cfd9e38 100644 --- a/opm/models/discretization/ecfv/ecfvstencil.hh +++ b/opm/models/discretization/ecfv/ecfvstencil.hh @@ -101,29 +101,25 @@ public: { element_ = element; } void update() - { - const auto& geometry = element_.geometry(); - centerPos_ = geometry.center(); - volume_ = geometry.volume(); - } + { } /*! * \brief The global position associated with the sub-control volume */ - const GlobalPosition& globalPos() const - { return centerPos_; } + decltype(auto) globalPos() const + { return element_.geometry().center(); } /*! * \brief The center of the sub-control volume */ - const GlobalPosition& center() const - { return centerPos_; } + decltype(auto) center() const + { return element_.geometry().center(); } /*! * \brief The volume [m^3] occupied by the sub-control volume */ Scalar volume() const - { return volume_; } + { return element_.geometry().volume(); } /*! * \brief The geometry of the sub-control volume. @@ -138,8 +134,6 @@ public: { return element_.geometryInFather(); } private: - GlobalPosition centerPos_; - Scalar volume_; Element element_; }; diff --git a/opm/models/parallel/threadedentityiterator.hh b/opm/models/parallel/threadedentityiterator.hh index e928ddf96a..e57f29180d 100644 --- a/opm/models/parallel/threadedentityiterator.hh +++ b/opm/models/parallel/threadedentityiterator.hh @@ -45,8 +45,7 @@ class ThreadedEntityIterator using EntityIterator = typename GridView::template Codim::Iterator; public: ThreadedEntityIterator(const GridView& gridView) - : gridView_(gridView) - , sequentialIt_(gridView_.template begin()) + : sequentialIt_(gridView.template begin()) , sequentialEnd_(gridView.template end()) { } @@ -90,7 +89,6 @@ public: } private: - GridView gridView_; EntityIterator sequentialIt_; EntityIterator sequentialEnd_;