#5279 Formations GeoMech : Add const and simplify access

This commit is contained in:
Magne Sjaastad
2020-01-03 11:59:17 +01:00
parent afc9ace33e
commit 1c4feade71
5 changed files with 23 additions and 19 deletions

View File

@@ -139,7 +139,20 @@ void RigFemPartResultsCollection::setActiveFormationNames( RigFormationNames* ac
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigFormationNames* RigFemPartResultsCollection::activeFormationNames() std::vector<QString> RigFemPartResultsCollection::formationNames() const
{
if ( activeFormationNames() )
{
return activeFormationNames()->formationNames();
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFormationNames* RigFemPartResultsCollection::activeFormationNames() const
{ {
return m_activeFormationNamesData.p(); return m_activeFormationNamesData.p();
} }
@@ -2037,7 +2050,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateFormationIndices
float inf = std::numeric_limits<float>::infinity(); float inf = std::numeric_limits<float>::infinity();
dstFrameData.resize( valCount, inf ); dstFrameData.resize( valCount, inf );
RigFormationNames* activeFormNames = m_activeFormationNamesData.p(); const RigFormationNames* activeFormNames = m_activeFormationNamesData.p();
frameCountProgress.incrementProgress(); frameCountProgress.incrementProgress();

View File

@@ -56,7 +56,7 @@ public:
~RigFemPartResultsCollection() override; ~RigFemPartResultsCollection() override;
void setActiveFormationNames( RigFormationNames* activeFormationNames ); void setActiveFormationNames( RigFormationNames* activeFormationNames );
RigFormationNames* activeFormationNames(); std::vector<QString> formationNames() const;
void addElementPropertyFiles( const std::vector<QString>& filenames ); void addElementPropertyFiles( const std::vector<QString>& filenames );
std::vector<RigFemResultAddress> removeElementPropertyFiles( const std::vector<QString>& filenames ); std::vector<RigFemResultAddress> removeElementPropertyFiles( const std::vector<QString>& filenames );
@@ -157,12 +157,14 @@ private:
RigFemScalarResultFrames* calculateGamma( int partIndex, const RigFemResultAddress& resVarAddr ); RigFemScalarResultFrames* calculateGamma( int partIndex, const RigFemResultAddress& resVarAddr );
RigFemScalarResultFrames* calculateFormationIndices( int partIndex, const RigFemResultAddress& resVarAddr ); RigFemScalarResultFrames* calculateFormationIndices( int partIndex, const RigFemResultAddress& resVarAddr );
const RigFormationNames* activeFormationNames() const;
private: private:
cvf::Collection<RigFemPartResults> m_femPartResults; cvf::Collection<RigFemPartResults> m_femPartResults;
cvf::ref<RifGeoMechReaderInterface> m_readerInterface; cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
cvf::ref<RifElementPropertyReader> m_elementPropertyReader; cvf::ref<RifElementPropertyReader> m_elementPropertyReader;
cvf::cref<RigFemPartCollection> m_femParts; cvf::cref<RigFemPartCollection> m_femParts;
cvf::ref<RigFormationNames> m_activeFormationNamesData; cvf::cref<RigFormationNames> m_activeFormationNamesData;
double m_cohesion; double m_cohesion;
double m_frictionAngleRad; double m_frictionAngleRad;

View File

@@ -269,11 +269,7 @@ void RimGeoMechPropertyFilter::computeResultValueRange()
{ {
if ( resultDefinition->hasCategoryResult() ) if ( resultDefinition->hasCategoryResult() )
{ {
std::vector<QString> fnVector; std::vector<QString> fnVector = resultDefinition->ownerCaseData()->femPartResults()->formationNames();
if ( resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames() )
{
fnVector = resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames()->formationNames();
}
setCategoryNames( fnVector ); setCategoryNames( fnVector );
} }
else else

View File

@@ -697,11 +697,7 @@ void RimGeoMechResultDefinition::updateLegendTextAndRanges( RimRegularLegendConf
if ( this->hasCategoryResult() ) if ( this->hasCategoryResult() )
{ {
std::vector<QString> fnVector; std::vector<QString> fnVector = gmCase->femPartResults()->formationNames();
if ( gmCase->femPartResults()->activeFormationNames() )
{
fnVector = gmCase->femPartResults()->activeFormationNames()->formationNames();
}
legendConfigToUpdate->setNamedCategoriesInverse( fnVector ); legendConfigToUpdate->setNamedCategoriesInverse( fnVector );
} }

View File

@@ -2031,10 +2031,7 @@ std::vector<QString> RimWellLogTrack::formationNamesVector( RimCase* rimCase )
} }
else if ( geoMechCase ) else if ( geoMechCase )
{ {
if ( geoMechCase->geoMechData()->femPartResults()->activeFormationNames() ) return geoMechCase->geoMechData()->femPartResults()->formationNames();
{
return geoMechCase->geoMechData()->femPartResults()->activeFormationNames()->formationNames();
}
} }
return std::vector<QString>(); return std::vector<QString>();