From 2ba830ebcacda21f99391e7eb7cb1b5c53f2388a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Fri, 3 Dec 2021 13:37:19 +0100 Subject: [PATCH] Remove some unneeded members to speed up stencil building. --- .../common/fvbaseelementcontext.hh | 2 +- opm/models/discretization/ecfv/ecfvstencil.hh | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/opm/models/discretization/common/fvbaseelementcontext.hh b/opm/models/discretization/common/fvbaseelementcontext.hh index 36bfada03..55e1cdc51 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 c5c522f35..a83cfd9e3 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_; };