mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Move Case file name to the base RimCase class and make consistent
This commit is contained in:
parent
169bea818a
commit
ae3651ab30
@ -829,7 +829,7 @@ bool RiaApplication::openOdbCaseFromFile( const QString& fileName, bool applyTim
|
|||||||
QString caseName = gridFileName.completeBaseName();
|
QString caseName = gridFileName.completeBaseName();
|
||||||
|
|
||||||
RimGeoMechCase* geoMechCase = new RimGeoMechCase();
|
RimGeoMechCase* geoMechCase = new RimGeoMechCase();
|
||||||
geoMechCase->setFileName( fileName );
|
geoMechCase->setGridFileName( fileName );
|
||||||
geoMechCase->caseUserDescription = caseName;
|
geoMechCase->caseUserDescription = caseName;
|
||||||
geoMechCase->setApplyTimeFilter( applyTimeStepFilter );
|
geoMechCase->setApplyTimeFilter( applyTimeStepFilter );
|
||||||
m_project->assignCaseIdToCase( geoMechCase );
|
m_project->assignCaseIdToCase( geoMechCase );
|
||||||
|
@ -192,7 +192,7 @@ void RiaProjectModifier::replaceCase( RimProject* project )
|
|||||||
}
|
}
|
||||||
else if ( geomechCase )
|
else if ( geomechCase )
|
||||||
{
|
{
|
||||||
geomechCase->setFileName( replaceFileName );
|
geomechCase->setGridFileName( replaceFileName );
|
||||||
geomechCase->caseUserDescription = caseNameFromGridFileName( replaceFileName );
|
geomechCase->caseUserDescription = caseNameFromGridFileName( replaceFileName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "RimExtrudedCurveIntersection.h"
|
#include "RimExtrudedCurveIntersection.h"
|
||||||
#include "RimGridView.h"
|
#include "RimGridView.h"
|
||||||
|
|
||||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCase, "RimCase" );
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCase, "Case", "RimCase" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -43,14 +43,22 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCase, "RimCase" );
|
|||||||
RimCase::RimCase()
|
RimCase::RimCase()
|
||||||
: m_isInActiveDestruction( false )
|
: m_isInActiveDestruction( false )
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Case", ":/Case48x48.png", "", "" );
|
CAF_PDM_InitObject( "Case", ":/Case48x48.png", "", "The ResInsight base class for Cases" );
|
||||||
|
|
||||||
RICF_InitField( &caseUserDescription, "CaseUserDescription", QString(), "Case Name", "", "", "" );
|
RICF_InitField( &caseUserDescription, "Name", QString(), "Case Name", "", "", "" );
|
||||||
|
caseUserDescription.xmlCapability()->registerKeywordAlias( "CaseUserDescription" );
|
||||||
|
|
||||||
RICF_InitField( &caseId, "CaseId", -1, "Case ID", "", "", "" );
|
RICF_InitField( &caseId, "Id", -1, "Case ID", "", "", "" );
|
||||||
|
caseId.xmlCapability()->registerKeywordAlias( "CaseId" );
|
||||||
caseId.uiCapability()->setUiReadOnly( true );
|
caseId.uiCapability()->setUiReadOnly( true );
|
||||||
caseId.capability<RicfFieldHandle>()->setIOWriteable( false );
|
caseId.capability<RicfFieldHandle>()->setIOWriteable( false );
|
||||||
|
|
||||||
|
RICF_InitFieldNoDefault( &m_caseFileName, "FilePath", "Case File Name", "", "", "" );
|
||||||
|
m_caseFileName.xmlCapability()->registerKeywordAlias( "CaseFileName" );
|
||||||
|
m_caseFileName.xmlCapability()->registerKeywordAlias( "GridFileName" );
|
||||||
|
|
||||||
|
m_caseFileName.uiCapability()->setUiReadOnly( true );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_activeFormationNames, "DefaultFormationNames", "Formation Names File", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_activeFormationNames, "DefaultFormationNames", "Formation Names File", "", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Time Step Filter", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Time Step Filter", "", "", "" );
|
||||||
@ -76,6 +84,22 @@ RimCase::~RimCase()
|
|||||||
m_isInActiveDestruction = true; // Needed because destruction of m_intersectionViews results in call to views()
|
m_isInActiveDestruction = true; // Needed because destruction of m_intersectionViews results in call to views()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCase::setGridFileName( const QString& fileName )
|
||||||
|
{
|
||||||
|
m_caseFileName.v().setPath( fileName );
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimCase::gridFileName() const
|
||||||
|
{
|
||||||
|
return m_caseFileName().path();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -53,6 +53,9 @@ public:
|
|||||||
caf::PdmField<int> caseId;
|
caf::PdmField<int> caseId;
|
||||||
caf::PdmField<QString> caseUserDescription;
|
caf::PdmField<QString> caseUserDescription;
|
||||||
|
|
||||||
|
void setGridFileName( const QString& fileName );
|
||||||
|
QString gridFileName() const;
|
||||||
|
|
||||||
std::vector<Rim3dView*> views() const;
|
std::vector<Rim3dView*> views() const;
|
||||||
std::vector<RimGridView*> gridViews() const;
|
std::vector<RimGridView*> gridViews() const;
|
||||||
|
|
||||||
@ -88,6 +91,7 @@ private:
|
|||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
caf::PdmField<caf::FilePath> m_caseFileName;
|
||||||
caf::PdmChildField<RimTimeStepFilter*> m_timeStepFilter;
|
caf::PdmChildField<RimTimeStepFilter*> m_timeStepFilter;
|
||||||
caf::PdmChildField<Rim2dIntersectionViewCollection*> m_2dIntersectionViewCollection;
|
caf::PdmChildField<Rim2dIntersectionViewCollection*> m_2dIntersectionViewCollection;
|
||||||
caf::PdmPtrField<RimFormationNames*> m_activeFormationNames;
|
caf::PdmPtrField<RimFormationNames*> m_activeFormationNames;
|
||||||
|
@ -93,7 +93,6 @@ public:
|
|||||||
const RigVirtualPerforationTransmissibilities* computeAndGetVirtualPerforationTransmissibilities();
|
const RigVirtualPerforationTransmissibilities* computeAndGetVirtualPerforationTransmissibilities();
|
||||||
|
|
||||||
virtual QString locationOnDisc() const { return QString(); }
|
virtual QString locationOnDisc() const { return QString(); }
|
||||||
virtual QString gridFileName() const { return QString(); }
|
|
||||||
|
|
||||||
RimCaseCollection* parentCaseCollection();
|
RimCaseCollection* parentCaseCollection();
|
||||||
RimEclipseContourMapViewCollection* contourMapCollection();
|
RimEclipseContourMapViewCollection* contourMapCollection();
|
||||||
|
@ -55,8 +55,6 @@ RimEclipseInputCase::RimEclipseInputCase()
|
|||||||
: RimEclipseCase()
|
: RimEclipseCase()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "RimInputCase", ":/EclipseInput48x48.png", "", "" );
|
CAF_PDM_InitObject( "RimInputCase", ":/EclipseInput48x48.png", "", "" );
|
||||||
CAF_PDM_InitFieldNoDefault( &m_gridFileName, "GridFileName", "Case File Name", "", "", "" );
|
|
||||||
m_gridFileName.uiCapability()->setUiReadOnly( true );
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_additionalFiles, "AdditionalFileNamesProxy", "Additional Files", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_additionalFiles, "AdditionalFileNamesProxy", "Additional Files", "", "", "" );
|
||||||
m_additionalFiles.registerGetMethod( this, &RimEclipseInputCase::additionalFiles );
|
m_additionalFiles.registerGetMethod( this, &RimEclipseInputCase::additionalFiles );
|
||||||
@ -125,7 +123,7 @@ bool RimEclipseInputCase::openDataFileSet( const QStringList& fileNames )
|
|||||||
QString errorMessages;
|
QString errorMessages;
|
||||||
if ( RifEclipseInputFileTools::openGridFile( fileNames[i], this->eclipseCaseData(), importFaults, &errorMessages ) )
|
if ( RifEclipseInputFileTools::openGridFile( fileNames[i], this->eclipseCaseData(), importFaults, &errorMessages ) )
|
||||||
{
|
{
|
||||||
m_gridFileName = fileNames[i];
|
setGridFileName( fileNames[i] );
|
||||||
|
|
||||||
QFileInfo gridFileName( fileNames[i] );
|
QFileInfo gridFileName( fileNames[i] );
|
||||||
QString caseName = gridFileName.completeBaseName();
|
QString caseName = gridFileName.completeBaseName();
|
||||||
@ -192,16 +190,16 @@ bool RimEclipseInputCase::openEclipseGridFile()
|
|||||||
{
|
{
|
||||||
cvf::ref<RifReaderInterface> readerInterface;
|
cvf::ref<RifReaderInterface> readerInterface;
|
||||||
|
|
||||||
if ( m_gridFileName().path().contains( RiaDefines::mockModelBasicInputCase() ) )
|
if ( gridFileName().contains( RiaDefines::mockModelBasicInputCase() ) )
|
||||||
{
|
{
|
||||||
readerInterface = this->createMockModel( this->m_gridFileName().path() );
|
readerInterface = this->createMockModel( gridFileName() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readerInterface = new RifReaderEclipseInput;
|
readerInterface = new RifReaderEclipseInput;
|
||||||
|
|
||||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
||||||
if ( !readerInterface->open( m_gridFileName().path(), eclipseCase.p() ) )
|
if ( !readerInterface->open( gridFileName(), eclipseCase.p() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -260,7 +258,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
|
|||||||
{
|
{
|
||||||
filenames.push_back( fileName );
|
filenames.push_back( fileName );
|
||||||
}
|
}
|
||||||
filenames.push_back( m_gridFileName().path() );
|
filenames.push_back( gridFileName() );
|
||||||
|
|
||||||
RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( inputPropertyCollection(), eclipseCaseData(), filenames );
|
RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( inputPropertyCollection(), eclipseCaseData(), filenames );
|
||||||
}
|
}
|
||||||
@ -275,7 +273,7 @@ cvf::ref<RifReaderInterface> RimEclipseInputCase::createMockModel( QString model
|
|||||||
|
|
||||||
if ( modelName == RiaDefines::mockModelBasicInputCase() )
|
if ( modelName == RiaDefines::mockModelBasicInputCase() )
|
||||||
{
|
{
|
||||||
m_gridFileName = modelName;
|
setGridFileName( modelName );
|
||||||
|
|
||||||
// Create the mock file interface and and RigSerervoir and set them up.
|
// Create the mock file interface and and RigSerervoir and set them up.
|
||||||
mockFileInterface->setWorldCoordinates( cvf::Vec3d( 10, 10, 10 ), cvf::Vec3d( 20, 20, 20 ) );
|
mockFileInterface->setWorldCoordinates( cvf::Vec3d( 10, 10, 10 ), cvf::Vec3d( 20, 20, 20 ) );
|
||||||
@ -318,7 +316,7 @@ void RimEclipseInputCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
|||||||
{
|
{
|
||||||
uiOrdering.add( &caseUserDescription );
|
uiOrdering.add( &caseUserDescription );
|
||||||
uiOrdering.add( &caseId );
|
uiOrdering.add( &caseId );
|
||||||
uiOrdering.add( &m_gridFileName );
|
uiOrdering.add( &m_caseFileName );
|
||||||
uiOrdering.add( &m_additionalFiles );
|
uiOrdering.add( &m_additionalFiles );
|
||||||
|
|
||||||
auto group = uiOrdering.addNewGroup( "Case Options" );
|
auto group = uiOrdering.addNewGroup( "Case Options" );
|
||||||
@ -332,9 +330,9 @@ void RimEclipseInputCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimEclipseInputCase::locationOnDisc() const
|
QString RimEclipseInputCase::locationOnDisc() const
|
||||||
{
|
{
|
||||||
if ( m_gridFileName().path().isEmpty() ) return QString();
|
if ( gridFileName().isEmpty() ) return QString();
|
||||||
|
|
||||||
QFileInfo fi( m_gridFileName().path() );
|
QFileInfo fi( gridFileName() );
|
||||||
return fi.absolutePath();
|
return fi.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +365,7 @@ void RimEclipseInputCase::updateAdditionalFileFolder( const QString& newFolder )
|
|||||||
QDir newDir( newFolder );
|
QDir newDir( newFolder );
|
||||||
for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
||||||
{
|
{
|
||||||
if ( inputProperty->fileName == m_gridFileName().path() ) continue;
|
if ( inputProperty->fileName == gridFileName() ) continue;
|
||||||
|
|
||||||
QFileInfo oldFilePath( inputProperty->fileName().path() );
|
QFileInfo oldFilePath( inputProperty->fileName().path() );
|
||||||
QFileInfo newFilePath( newDir, oldFilePath.fileName() );
|
QFileInfo newFilePath( newDir, oldFilePath.fileName() );
|
||||||
@ -383,7 +381,7 @@ std::vector<QString> RimEclipseInputCase::additionalFiles() const
|
|||||||
std::vector<QString> additionalFiles;
|
std::vector<QString> additionalFiles;
|
||||||
for ( const RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
for ( const RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
|
||||||
{
|
{
|
||||||
if ( inputProperty->fileName == m_gridFileName().path() ) continue;
|
if ( inputProperty->fileName == gridFileName() ) continue;
|
||||||
|
|
||||||
additionalFiles.push_back( inputProperty->fileName().path() );
|
additionalFiles.push_back( inputProperty->fileName().path() );
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,6 @@ public:
|
|||||||
|
|
||||||
// Overrides from RimCase
|
// Overrides from RimCase
|
||||||
QString locationOnDisc() const override;
|
QString locationOnDisc() const override;
|
||||||
QString gridFileName() const override { return m_gridFileName().path(); }
|
|
||||||
|
|
||||||
void updateFilePathsFromProjectPath( const QString& projectPath, const QString& oldProjectPath ) override;
|
void updateFilePathsFromProjectPath( const QString& projectPath, const QString& oldProjectPath ) override;
|
||||||
|
|
||||||
@ -72,7 +71,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Fields
|
// Fields
|
||||||
caf::PdmField<caf::FilePath> m_gridFileName;
|
|
||||||
caf::PdmProxyValueField<std::vector<QString>> m_additionalFiles;
|
caf::PdmProxyValueField<std::vector<QString>> m_additionalFiles;
|
||||||
|
|
||||||
// Obsolete fields
|
// Obsolete fields
|
||||||
|
@ -63,18 +63,14 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimEclipseResultCase, "EclipseCase" );
|
CAF_PDM_SCRIPTABLE_SOURCE_INIT( RimEclipseResultCase, "EclipseCase" );
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimEclipseResultCase::RimEclipseResultCase()
|
RimEclipseResultCase::RimEclipseResultCase()
|
||||||
: RimEclipseCase()
|
: RimEclipseCase()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Eclipse Case", ":/Case48x48.png", "", "" );
|
CAF_PDM_InitObject( "Eclipse Case", ":/Case48x48.png", "", "The Regular Eclipse Results Case" );
|
||||||
|
|
||||||
RICF_InitFieldNoDefault( &caseFileName, "CaseFileName", "Case File Name", "", "", "" );
|
|
||||||
caseFileName.uiCapability()->setUiReadOnly( true );
|
|
||||||
caseFileName.capability<RicfFieldHandle>()->setIOWriteable( false );
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_unitSystem, "UnitSystem", "Unit System", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_unitSystem, "UnitSystem", "Unit System", "", "", "" );
|
||||||
m_unitSystem.registerGetMethod( RiaApplication::instance()->project(), &RimProject::commonUnitSystemForAllCases );
|
m_unitSystem.registerGetMethod( RiaApplication::instance()->project(), &RimProject::commonUnitSystemForAllCases );
|
||||||
@ -127,13 +123,13 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
|
|
||||||
cvf::ref<RifReaderInterface> readerInterface;
|
cvf::ref<RifReaderInterface> readerInterface;
|
||||||
|
|
||||||
if ( caseFileName().path().contains( "Result Mock Debug Model" ) )
|
if ( gridFileName().contains( "Result Mock Debug Model" ) )
|
||||||
{
|
{
|
||||||
readerInterface = this->createMockModel( this->caseFileName().path() );
|
readerInterface = this->createMockModel( this->gridFileName() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !caf::Utils::fileExists( caseFileName().path() ) )
|
if ( !caf::Utils::fileExists( gridFileName() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -142,7 +138,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
readerEclipseOutput->setFilenamesWithFaults( this->filesContainingFaults() );
|
readerEclipseOutput->setFilenamesWithFaults( this->filesContainingFaults() );
|
||||||
|
|
||||||
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess =
|
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess =
|
||||||
RifEclipseOutputFileTools::createDynamicResultAccess( caseFileName().path() );
|
RifEclipseOutputFileTools::createDynamicResultAccess( gridFileName() );
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<QDateTime> timeSteps;
|
std::vector<QDateTime> timeSteps;
|
||||||
@ -182,7 +178,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
readerEclipseOutput->setTimeStepFilter( m_timeStepFilter->filteredTimeSteps() );
|
readerEclipseOutput->setTimeStepFilter( m_timeStepFilter->filteredTimeSteps() );
|
||||||
|
|
||||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
||||||
if ( !readerEclipseOutput->open( caseFileName().path(), eclipseCase.p() ) )
|
if ( !readerEclipseOutput->open( gridFileName(), eclipseCase.p() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -210,7 +206,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
m_gridAndWellDataIsReadFromFile = true;
|
m_gridAndWellDataIsReadFromFile = true;
|
||||||
m_activeCellInfoIsReadFromFile = true;
|
m_activeCellInfoIsReadFromFile = true;
|
||||||
|
|
||||||
QFileInfo eclipseCaseFileInfo( caseFileName().path() );
|
QFileInfo eclipseCaseFileInfo( gridFileName() );
|
||||||
QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT";
|
QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT";
|
||||||
QFileInfo rftFileInfo( rftFileName );
|
QFileInfo rftFileInfo( rftFileName );
|
||||||
|
|
||||||
@ -275,13 +271,13 @@ bool RimEclipseResultCase::openAndReadActiveCellData( RigEclipseCaseData* mainEc
|
|||||||
if ( m_activeCellInfoIsReadFromFile ) return true;
|
if ( m_activeCellInfoIsReadFromFile ) return true;
|
||||||
|
|
||||||
cvf::ref<RifReaderInterface> readerInterface;
|
cvf::ref<RifReaderInterface> readerInterface;
|
||||||
if ( caseFileName().path().contains( "Result Mock Debug Model" ) )
|
if ( gridFileName().contains( "Result Mock Debug Model" ) )
|
||||||
{
|
{
|
||||||
readerInterface = this->createMockModel( this->caseFileName().path() );
|
readerInterface = this->createMockModel( this->gridFileName() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !caf::Utils::fileExists( caseFileName().path() ) )
|
if ( !caf::Utils::fileExists( gridFileName() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -293,7 +289,7 @@ bool RimEclipseResultCase::openAndReadActiveCellData( RigEclipseCaseData* mainEc
|
|||||||
|
|
||||||
std::vector<QDateTime> timeStepDates = mainEclipseCase->results( RiaDefines::MATRIX_MODEL )->timeStepDates();
|
std::vector<QDateTime> timeStepDates = mainEclipseCase->results( RiaDefines::MATRIX_MODEL )->timeStepDates();
|
||||||
cvf::ref<RifReaderEclipseOutput> readerEclipseOutput = new RifReaderEclipseOutput;
|
cvf::ref<RifReaderEclipseOutput> readerEclipseOutput = new RifReaderEclipseOutput;
|
||||||
if ( !readerEclipseOutput->openAndReadActiveCellData( caseFileName().path(), timeStepDates, eclipseCase.p() ) )
|
if ( !readerEclipseOutput->openAndReadActiveCellData( gridFileName(), timeStepDates, eclipseCase.p() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -469,7 +465,7 @@ RimEclipseResultCase::~RimEclipseResultCase()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimEclipseResultCase::locationOnDisc() const
|
QString RimEclipseResultCase::locationOnDisc() const
|
||||||
{
|
{
|
||||||
QFileInfo fi( caseFileName().path() );
|
QFileInfo fi( gridFileName() );
|
||||||
return fi.absolutePath();
|
return fi.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +474,7 @@ QString RimEclipseResultCase::locationOnDisc() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipseResultCase::readGridDimensions( std::vector<std::vector<int>>& gridDimensions )
|
void RimEclipseResultCase::readGridDimensions( std::vector<std::vector<int>>& gridDimensions )
|
||||||
{
|
{
|
||||||
RifEclipseOutputFileTools::readGridDimensions( caseFileName().path(), gridDimensions );
|
RifEclipseOutputFileTools::readGridDimensions( gridFileName(), gridDimensions );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -490,7 +486,7 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath( const QString& newPro
|
|||||||
// std::vector<QString> searchedPaths;
|
// std::vector<QString> searchedPaths;
|
||||||
|
|
||||||
// Update filename and folder paths when opening project from a different file location
|
// Update filename and folder paths when opening project from a different file location
|
||||||
// caseFileName = RimTools::relocateFile( caseFileName().path(), newProjectPath, oldProjectPath, &foundFile,
|
// caseFileName = RimTools::relocateFile( caseFileName(), newProjectPath, oldProjectPath, &foundFile,
|
||||||
// &searchedPaths );
|
// &searchedPaths );
|
||||||
|
|
||||||
// std::vector<QString> relocatedFaultFiles;
|
// std::vector<QString> relocatedFaultFiles;
|
||||||
@ -553,21 +549,13 @@ RifReaderEclipseRft* RimEclipseResultCase::rftReader()
|
|||||||
return m_readerEclipseRft.p();
|
return m_readerEclipseRft.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimEclipseResultCase::setGridFileName( const QString& fileName )
|
|
||||||
{
|
|
||||||
this->caseFileName = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipseResultCase::setCaseInfo( const QString& userDescription, const QString& fileName )
|
void RimEclipseResultCase::setCaseInfo( const QString& userDescription, const QString& fileName )
|
||||||
{
|
{
|
||||||
this->caseUserDescription = userDescription;
|
this->caseUserDescription = userDescription;
|
||||||
this->caseFileName = fileName;
|
setGridFileName( fileName );
|
||||||
|
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
proj->assignCaseIdToCase( this );
|
proj->assignCaseIdToCase( this );
|
||||||
@ -599,11 +587,11 @@ void RimEclipseResultCase::initAfterRead()
|
|||||||
RimEclipseCase::initAfterRead();
|
RimEclipseCase::initAfterRead();
|
||||||
|
|
||||||
// Convert from old (9.0.2) way of storing the case file
|
// Convert from old (9.0.2) way of storing the case file
|
||||||
if ( caseFileName().path().isEmpty() )
|
if ( gridFileName().isEmpty() )
|
||||||
{
|
{
|
||||||
if ( !this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty() )
|
if ( !this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty() )
|
||||||
{
|
{
|
||||||
caseFileName = QDir::fromNativeSeparators( caseDirectory() ) + "/" + m_caseName_OBSOLETE() + ".EGRID";
|
setGridFileName( QDir::fromNativeSeparators( caseDirectory() ) + "/" + m_caseName_OBSOLETE() + ".EGRID" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -615,7 +603,7 @@ void RimEclipseResultCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd
|
|||||||
{
|
{
|
||||||
uiOrdering.add( &caseUserDescription );
|
uiOrdering.add( &caseUserDescription );
|
||||||
uiOrdering.add( &caseId );
|
uiOrdering.add( &caseId );
|
||||||
uiOrdering.add( &caseFileName );
|
uiOrdering.add( &m_caseFileName );
|
||||||
uiOrdering.add( &m_unitSystem );
|
uiOrdering.add( &m_unitSystem );
|
||||||
|
|
||||||
auto group = uiOrdering.addNewGroup( "Case Options" );
|
auto group = uiOrdering.addNewGroup( "Case Options" );
|
||||||
@ -660,7 +648,7 @@ void RimEclipseResultCase::defineEditorAttribute( const caf::PdmFieldHandle* fie
|
|||||||
if ( myAttr )
|
if ( myAttr )
|
||||||
{
|
{
|
||||||
myAttr->m_fileSelectionFilter = "SourSim (*.sourres)";
|
myAttr->m_fileSelectionFilter = "SourSim (*.sourres)";
|
||||||
myAttr->m_defaultPath = QFileInfo( caseFileName().path() ).absolutePath();
|
myAttr->m_defaultPath = QFileInfo( gridFileName() ).absolutePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ public:
|
|||||||
RimEclipseResultCase();
|
RimEclipseResultCase();
|
||||||
~RimEclipseResultCase() override;
|
~RimEclipseResultCase() override;
|
||||||
|
|
||||||
void setGridFileName( const QString& fileName );
|
|
||||||
void setCaseInfo( const QString& userDescription, const QString& fileName );
|
void setCaseInfo( const QString& userDescription, const QString& fileName );
|
||||||
void setSourSimFileName( const QString& fileName );
|
void setSourSimFileName( const QString& fileName );
|
||||||
bool hasSourSimFile();
|
bool hasSourSimFile();
|
||||||
@ -64,7 +63,6 @@ public:
|
|||||||
|
|
||||||
// Overrides from RimCase
|
// Overrides from RimCase
|
||||||
QString locationOnDisc() const override;
|
QString locationOnDisc() const override;
|
||||||
QString gridFileName() const override { return caseFileName().path(); }
|
|
||||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
||||||
|
|
||||||
RimFlowDiagSolution* defaultFlowDiagSolution();
|
RimFlowDiagSolution* defaultFlowDiagSolution();
|
||||||
@ -94,7 +92,6 @@ private:
|
|||||||
cvf::ref<RifReaderEclipseRft> m_readerEclipseRft;
|
cvf::ref<RifReaderEclipseRft> m_readerEclipseRft;
|
||||||
|
|
||||||
// Fields:
|
// Fields:
|
||||||
caf::PdmField<caf::FilePath> caseFileName;
|
|
||||||
caf::PdmProxyValueField<RiaEclipseUnitTools::UnitSystemType> m_unitSystem;
|
caf::PdmProxyValueField<RiaEclipseUnitTools::UnitSystemType> m_unitSystem;
|
||||||
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;
|
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;
|
||||||
caf::PdmField<caf::FilePath> m_sourSimFileName;
|
caf::PdmField<caf::FilePath> m_sourSimFileName;
|
||||||
|
@ -61,17 +61,15 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimGeoMechCase, "ResInsightGeoMechCase" );
|
CAF_PDM_SCRIPTABLE_SOURCE_INIT( RimGeoMechCase, "GeoMechCase", "ResInsightGeoMechCase" );
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimGeoMechCase::RimGeoMechCase( void )
|
RimGeoMechCase::RimGeoMechCase( void )
|
||||||
: m_applyTimeFilter( false )
|
: m_applyTimeFilter( false )
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Geomechanical Case", ":/GeoMechCase48x48.png", "", "" );
|
CAF_PDM_InitObject( "Geomechanical Case", ":/GeoMechCase48x48.png", "", "The GeoMechanical Results Case" );
|
||||||
|
|
||||||
RICF_InitFieldNoDefault( &m_caseFileName, "CaseFileName", "Case File Name", "", "", "" );
|
|
||||||
m_caseFileName.uiCapability()->setUiReadOnly( true );
|
|
||||||
CAF_PDM_InitFieldNoDefault( &geoMechViews, "GeoMechViews", "", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &geoMechViews, "GeoMechViews", "", "", "", "" );
|
||||||
geoMechViews.uiCapability()->setUiHidden( true );
|
geoMechViews.uiCapability()->setUiHidden( true );
|
||||||
|
|
||||||
@ -132,22 +130,6 @@ RimGeoMechCase::~RimGeoMechCase( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimGeoMechCase::setFileName( const QString& fileName )
|
|
||||||
{
|
|
||||||
m_caseFileName.v().setPath( fileName );
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimGeoMechCase::caseFileName() const
|
|
||||||
{
|
|
||||||
return m_caseFileName().path();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -55,8 +55,6 @@ public:
|
|||||||
RimGeoMechCase( void );
|
RimGeoMechCase( void );
|
||||||
~RimGeoMechCase( void ) override;
|
~RimGeoMechCase( void ) override;
|
||||||
|
|
||||||
void setFileName( const QString& fileName );
|
|
||||||
QString caseFileName() const;
|
|
||||||
CaseOpenStatus openGeoMechCase( std::string* errorMessage );
|
CaseOpenStatus openGeoMechCase( std::string* errorMessage );
|
||||||
|
|
||||||
RigGeoMechCaseData* geoMechData();
|
RigGeoMechCaseData* geoMechData();
|
||||||
@ -115,7 +113,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::ref<RigGeoMechCaseData> m_geoMechCaseData;
|
cvf::ref<RigGeoMechCaseData> m_geoMechCaseData;
|
||||||
caf::PdmField<caf::FilePath> m_caseFileName;
|
|
||||||
caf::PdmField<double> m_cohesion;
|
caf::PdmField<double> m_cohesion;
|
||||||
caf::PdmField<double> m_frictionAngleDeg;
|
caf::PdmField<double> m_frictionAngleDeg;
|
||||||
caf::PdmField<std::vector<caf::FilePath>> m_elementPropertyFileNames;
|
caf::PdmField<std::vector<caf::FilePath>> m_elementPropertyFileNames;
|
||||||
|
@ -150,7 +150,7 @@ void RimGeoMechView::onLoadDataAndUpdate()
|
|||||||
if ( !RiaRegressionTestRunner::instance()->isRunningRegressionTests() )
|
if ( !RiaRegressionTestRunner::instance()->isRunningRegressionTests() )
|
||||||
{
|
{
|
||||||
QString displayMessage = errorMessage.empty()
|
QString displayMessage = errorMessage.empty()
|
||||||
? "Could not open the Odb file: \n" + m_geomechCase->caseFileName()
|
? "Could not open the Odb file: \n" + m_geomechCase->gridFileName()
|
||||||
: QString::fromStdString( errorMessage );
|
: QString::fromStdString( errorMessage );
|
||||||
|
|
||||||
if ( RiaGuiApplication::isRunning() )
|
if ( RiaGuiApplication::isRunning() )
|
||||||
|
Loading…
Reference in New Issue
Block a user