mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5213 Show file name in biot coefficient from file UI.
This commit is contained in:
parent
1fde4a09b5
commit
ecf61f9854
@ -218,6 +218,25 @@ std::vector<RigFemResultAddress>
|
||||
return addressesToRemove;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<std::string, QString>
|
||||
RigFemPartResultsCollection::addressesInElementPropertyFiles( const std::vector<QString>& filenames )
|
||||
{
|
||||
std::map<std::string, QString> fieldsInFile;
|
||||
for ( const QString& filename : filenames )
|
||||
{
|
||||
std::vector<std::string> fields = m_elementPropertyReader->fieldsInFile( filename.toStdString() );
|
||||
for ( const std::string& field : fields )
|
||||
{
|
||||
fieldsInFile[field] = filename;
|
||||
}
|
||||
}
|
||||
|
||||
return fieldsInFile;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
|
||||
void addElementPropertyFiles( const std::vector<QString>& filenames );
|
||||
std::vector<RigFemResultAddress> removeElementPropertyFiles( const std::vector<QString>& filenames );
|
||||
std::map<std::string, QString> addressesInElementPropertyFiles( const std::vector<QString>& filenames );
|
||||
|
||||
void setCalculationParameters( double cohesion, double frictionAngleRad );
|
||||
double parameterCohesion() const { return m_cohesion; }
|
||||
|
@ -62,8 +62,7 @@
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QIcon>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <array>
|
||||
|
||||
@ -1025,16 +1024,48 @@ QList<caf::PdmOptionItemInfo> RimGeoMechCase::calculateValueOptions( const caf::
|
||||
else if ( fieldNeedingOptions == &m_biotResultAddress )
|
||||
{
|
||||
std::vector<std::string> elementProperties = possibleElementPropertyFieldNames();
|
||||
|
||||
std::vector<QString> paths;
|
||||
for ( auto path : m_elementPropertyFileNames.v() )
|
||||
{
|
||||
paths.push_back( path.path() );
|
||||
}
|
||||
|
||||
std::map<std::string, QString> addressesInFile =
|
||||
geoMechData()->femPartResults()->addressesInElementPropertyFiles( paths );
|
||||
|
||||
for ( const std::string elementProperty : elementProperties )
|
||||
{
|
||||
QString result = QString::fromStdString( elementProperty );
|
||||
options.push_back( caf::PdmOptionItemInfo( result, result ) );
|
||||
QString result = QString::fromStdString( elementProperty );
|
||||
QString filename = findFileNameForElementProperty( elementProperty, addressesInFile );
|
||||
options.push_back( caf::PdmOptionItemInfo( result + " (" + filename + ")", result ) );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGeoMechCase::findFileNameForElementProperty( const std::string& elementProperty,
|
||||
const std::map<std::string, QString> addressesInFiles ) const
|
||||
{
|
||||
auto it = addressesInFiles.find( elementProperty );
|
||||
if ( it != addressesInFiles.end() )
|
||||
{
|
||||
QFileInfo fileInfo( it->second );
|
||||
return fileInfo.fileName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString( "Unknown file" );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechCase::updateConnectedViews()
|
||||
{
|
||||
std::vector<Rim3dView*> views = this->views();
|
||||
@ -1047,6 +1078,9 @@ void RimGeoMechCase::updateConnectedViews()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RimGeoMechCase::possibleElementPropertyFieldNames()
|
||||
{
|
||||
std::vector<std::string> fieldNames;
|
||||
|
@ -114,6 +114,9 @@ private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
QString findFileNameForElementProperty( const std::string& elementProperty,
|
||||
const std::map<std::string, QString> addressesInFiles ) const;
|
||||
|
||||
void updateFormationNamesData() override;
|
||||
|
||||
void initAfterRead() override;
|
||||
|
Loading…
Reference in New Issue
Block a user