mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5147 RimEclipseResultCase::caseFileName -> PdmField<caf::FilePath>
This commit is contained in:
parent
18cf59530f
commit
d19c87c23a
@ -72,7 +72,7 @@ RimEclipseResultCase::RimEclipseResultCase()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Eclipse Case", ":/Case48x48.png", "", "" );
|
CAF_PDM_InitObject( "Eclipse Case", ":/Case48x48.png", "", "" );
|
||||||
|
|
||||||
RICF_InitField( &caseFileName, "CaseFileName", QString(), "Case File Name", "", "", "" );
|
RICF_InitFieldNoDefault( &caseFileName, "CaseFileName", "Case File Name", "", "", "" );
|
||||||
caseFileName.uiCapability()->setUiReadOnly( true );
|
caseFileName.uiCapability()->setUiReadOnly( true );
|
||||||
caseFileName.capability<RicfFieldHandle>()->setIOWriteable( false );
|
caseFileName.capability<RicfFieldHandle>()->setIOWriteable( false );
|
||||||
|
|
||||||
@ -127,13 +127,13 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
|
|
||||||
cvf::ref<RifReaderInterface> readerInterface;
|
cvf::ref<RifReaderInterface> readerInterface;
|
||||||
|
|
||||||
if ( caseFileName().contains( "Result Mock Debug Model" ) )
|
if ( caseFileName().path().contains( "Result Mock Debug Model" ) )
|
||||||
{
|
{
|
||||||
readerInterface = this->createMockModel( this->caseFileName() );
|
readerInterface = this->createMockModel( this->caseFileName().path() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !caf::Utils::fileExists( caseFileName() ) )
|
if ( !caf::Utils::fileExists( caseFileName().path() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
readerEclipseOutput->setFilenamesWithFaults( this->filesContainingFaults() );
|
readerEclipseOutput->setFilenamesWithFaults( this->filesContainingFaults() );
|
||||||
|
|
||||||
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess = RifEclipseOutputFileTools::createDynamicResultAccess(
|
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess = RifEclipseOutputFileTools::createDynamicResultAccess(
|
||||||
caseFileName() );
|
caseFileName().path() );
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<QDateTime> timeSteps;
|
std::vector<QDateTime> timeSteps;
|
||||||
@ -177,11 +177,12 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
}
|
}
|
||||||
m_timeStepFilter->updateFilteredTimeStepsFromUi();
|
m_timeStepFilter->updateFilteredTimeStepsFromUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
readerEclipseOutput->setFileDataAccess( restartDataAccess.p() );
|
readerEclipseOutput->setFileDataAccess( restartDataAccess.p() );
|
||||||
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(), eclipseCase.p() ) )
|
if ( !readerEclipseOutput->open( caseFileName().path(), eclipseCase.p() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -209,7 +210,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
m_gridAndWellDataIsReadFromFile = true;
|
m_gridAndWellDataIsReadFromFile = true;
|
||||||
m_activeCellInfoIsReadFromFile = true;
|
m_activeCellInfoIsReadFromFile = true;
|
||||||
|
|
||||||
QFileInfo eclipseCaseFileInfo( caseFileName() );
|
QFileInfo eclipseCaseFileInfo( caseFileName().path() );
|
||||||
QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT";
|
QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT";
|
||||||
QFileInfo rftFileInfo( rftFileName );
|
QFileInfo rftFileInfo( rftFileName );
|
||||||
|
|
||||||
@ -274,13 +275,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().contains( "Result Mock Debug Model" ) )
|
if ( caseFileName().path().contains( "Result Mock Debug Model" ) )
|
||||||
{
|
{
|
||||||
readerInterface = this->createMockModel( this->caseFileName() );
|
readerInterface = this->createMockModel( this->caseFileName().path() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !caf::Utils::fileExists( caseFileName() ) )
|
if ( !caf::Utils::fileExists( caseFileName().path() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -292,7 +293,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(), timeStepDates, eclipseCase.p() ) )
|
if ( !readerEclipseOutput->openAndReadActiveCellData( caseFileName().path(), timeStepDates, eclipseCase.p() ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -468,7 +469,7 @@ RimEclipseResultCase::~RimEclipseResultCase()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimEclipseResultCase::locationOnDisc() const
|
QString RimEclipseResultCase::locationOnDisc() const
|
||||||
{
|
{
|
||||||
QFileInfo fi( caseFileName() );
|
QFileInfo fi( caseFileName().path() );
|
||||||
return fi.absolutePath();
|
return fi.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +478,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(), gridDimensions );
|
RifEclipseOutputFileTools::readGridDimensions( caseFileName().path(), gridDimensions );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -489,7 +490,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(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
// caseFileName = RimTools::relocateFile( caseFileName().path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||||
|
|
||||||
std::vector<QString> relocatedFaultFiles;
|
std::vector<QString> relocatedFaultFiles;
|
||||||
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
|
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
|
||||||
@ -597,7 +598,7 @@ 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().isEmpty() )
|
if ( caseFileName().path().isEmpty() )
|
||||||
{
|
{
|
||||||
if ( !this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty() )
|
if ( !this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty() )
|
||||||
{
|
{
|
||||||
@ -658,7 +659,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() ).absolutePath();
|
myAttr->m_defaultPath = QFileInfo( caseFileName().path() ).absolutePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
|
|
||||||
|
#include "cafFilePath.h"
|
||||||
#include <cafPdmProxyValueField.h>
|
#include <cafPdmProxyValueField.h>
|
||||||
|
|
||||||
class RifReaderEclipseRft;
|
class RifReaderEclipseRft;
|
||||||
@ -65,7 +66,7 @@ public:
|
|||||||
QString locationOnDisc() const override;
|
QString locationOnDisc() const override;
|
||||||
QString gridFileName() const override
|
QString gridFileName() const override
|
||||||
{
|
{
|
||||||
return caseFileName();
|
return caseFileName().path();
|
||||||
}
|
}
|
||||||
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override;
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ private:
|
|||||||
cvf::ref<RifReaderEclipseRft> m_readerEclipseRft;
|
cvf::ref<RifReaderEclipseRft> m_readerEclipseRft;
|
||||||
|
|
||||||
// Fields:
|
// Fields:
|
||||||
caf::PdmField<QString> caseFileName;
|
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<QString> m_sourSimFileName;
|
caf::PdmField<QString> m_sourSimFileName;
|
||||||
|
Loading…
Reference in New Issue
Block a user