Code review, brush-up, and extended surface unit tests

This commit is contained in:
Stein Inge Dale
2020-06-03 13:34:18 +02:00
committed by Magne Sjaastad
parent e5f3a3b67d
commit 10e4c60073
5 changed files with 66 additions and 24 deletions

View File

@@ -53,23 +53,15 @@ std::pair<std::vector<cvf::Vec3d>, std::vector<unsigned>> RigGocadData::gocadGeo
//--------------------------------------------------------------------------------------------------
std::vector<float> RigGocadData::propertyValues( const QString& property )
{
size_t propertyIdx = 0;
for ( propertyIdx = 0; propertyIdx < m_propertyNames.size(); propertyIdx++ )
for ( size_t propertyIdx = 0; propertyIdx < m_propertyNames.size(); propertyIdx++ )
{
if ( m_propertyNames[propertyIdx] == property ) break;
if ( m_propertyNames[propertyIdx] == property )
{
return m_propertyValues[propertyIdx];
}
}
std::vector<float> propValues;
propValues.reserve( m_propertyValues.size() );
for ( size_t i = 0; i < m_propertyValues.size(); i++ )
{
propValues.push_back( m_propertyValues[i][propertyIdx] );
}
return propValues;
return std::vector<float>(); // return empty vector in case property was not found
}
//--------------------------------------------------------------------------------------------------