From 388b92c092b0e44e1289afb16f7a04b593c59e50 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 7 Nov 2019 09:01:31 +0100 Subject: [PATCH] #5007 Janitor : Do not call virtual methods from constructors --- .../GeoMech/GeoMechDataModel/RigFemPart.cpp | 3 ++- .../GeoMech/GeoMechDataModel/RigFemPartGrid.cpp | 14 +++++++++++--- .../GeoMech/GeoMechDataModel/RigFemPartGrid.h | 4 +++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp index 0b3379eedc..451f954768 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp @@ -72,7 +72,8 @@ const RigFemPartGrid* RigFemPart::getOrCreateStructGrid() const { if ( m_structGrid.isNull() ) { - m_structGrid = new RigFemPartGrid( this ); + m_structGrid = new RigFemPartGrid(); + m_structGrid->setFemPart( this ); } return m_structGrid.p(); diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.cpp index cbe5283411..9861d33b3c 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.cpp @@ -26,10 +26,9 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigFemPartGrid::RigFemPartGrid( const RigFemPart* femPart ) +RigFemPartGrid::RigFemPartGrid() + : m_femPart( nullptr ) { - m_femPart = femPart; - generateStructGridData(); } //-------------------------------------------------------------------------------------------------- @@ -37,6 +36,15 @@ RigFemPartGrid::RigFemPartGrid( const RigFemPart* femPart ) //-------------------------------------------------------------------------------------------------- RigFemPartGrid::~RigFemPartGrid() {} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemPartGrid::setFemPart( const RigFemPart* femPart ) +{ + m_femPart = femPart; + generateStructGridData(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.h index f01e859e9a..7c72aa9259 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartGrid.h @@ -26,9 +26,11 @@ class RigFemPart; class RigFemPartGrid : public cvf::StructGridInterface { public: - explicit RigFemPartGrid( const RigFemPart* femPart ); + RigFemPartGrid(); ~RigFemPartGrid() override; + void setFemPart( const RigFemPart* femPart ); + bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override; size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override;