mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#82 Import ascii grdecl input properties into simulation case.
This allows data from text files to be imported into a binary Eclipse case imported based on *.EGRID.
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "RimEclipseInputCase.h"
|
#include "RimEclipseInputCase.h"
|
||||||
#include "RimEclipseInputPropertyCollection.h"
|
#include "RimEclipseInputPropertyCollection.h"
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "Riu3DMainWindowTools.h"
|
#include "Riu3DMainWindowTools.h"
|
||||||
@@ -39,7 +40,8 @@ CAF_CMD_SOURCE_INIT( RicAddEclipseInputPropertyFeature, "RicAddEclipseInputPrope
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
|
bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
return selectedInputPropertyCollection() != nullptr;
|
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputPropertyCollection>() ||
|
||||||
|
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseResultCase>();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -47,17 +49,29 @@ bool RicAddEclipseInputPropertyFeature::isCommandEnabled()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicAddEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
|
void RicAddEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
|
||||||
{
|
{
|
||||||
RimEclipseInputPropertyCollection* inputPropertyCollection = selectedInputPropertyCollection();
|
RimEclipseCase* eclipseCase = nullptr;
|
||||||
if ( !inputPropertyCollection ) return;
|
|
||||||
|
|
||||||
QString casePath;
|
RimEclipseInputPropertyCollection* inputPropertyCollection =
|
||||||
|
caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputPropertyCollection>();
|
||||||
|
if ( !inputPropertyCollection )
|
||||||
{
|
{
|
||||||
RimEclipseInputCase* inputReservoir = nullptr;
|
// No property collection selected: triggered from RimEclipseResultCase.
|
||||||
inputPropertyCollection->firstAncestorOrThisOfTypeAsserted( inputReservoir );
|
eclipseCase = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
|
||||||
|
if ( eclipseCase )
|
||||||
QFileInfo fi( inputReservoir->gridFileName() );
|
{
|
||||||
casePath = fi.absolutePath();
|
inputPropertyCollection = eclipseCase->inputPropertyCollection();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Triggered from collection: get eclipse case ancestor
|
||||||
|
inputPropertyCollection->firstAncestorOrThisOfTypeAsserted( eclipseCase );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !inputPropertyCollection || !eclipseCase ) return;
|
||||||
|
|
||||||
|
QFileInfo fi( eclipseCase->gridFileName() );
|
||||||
|
QString casePath = fi.absolutePath();
|
||||||
|
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
QString defaultDir = app->lastUsedDialogDirectoryWithFallback( "INPUT_FILES", casePath );
|
QString defaultDir = app->lastUsedDialogDirectoryWithFallback( "INPUT_FILES", casePath );
|
||||||
@@ -71,8 +85,8 @@ void RicAddEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
|
|||||||
// Remember the directory to next time
|
// Remember the directory to next time
|
||||||
defaultDir = QFileInfo( fileNames.last() ).absolutePath();
|
defaultDir = QFileInfo( fileNames.last() ).absolutePath();
|
||||||
app->setLastUsedDialogDirectory( "INPUT_FILES", defaultDir );
|
app->setLastUsedDialogDirectory( "INPUT_FILES", defaultDir );
|
||||||
|
eclipseCase->importAsciiInputProperties( fileNames );
|
||||||
addEclipseInputProperty( fileNames, inputPropertyCollection );
|
inputPropertyCollection->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -82,26 +96,3 @@ void RicAddEclipseInputPropertyFeature::setupActionLook( QAction* actionToSetup
|
|||||||
{
|
{
|
||||||
actionToSetup->setText( "Add Input Property" );
|
actionToSetup->setText( "Add Input Property" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimEclipseInputPropertyCollection* RicAddEclipseInputPropertyFeature::selectedInputPropertyCollection() const
|
|
||||||
{
|
|
||||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputPropertyCollection>();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RicAddEclipseInputPropertyFeature::addEclipseInputProperty( const QStringList& fileNames,
|
|
||||||
RimEclipseInputPropertyCollection* inputPropertyCollection )
|
|
||||||
{
|
|
||||||
CVF_ASSERT( inputPropertyCollection );
|
|
||||||
|
|
||||||
RimEclipseInputCase* inputReservoir = nullptr;
|
|
||||||
inputPropertyCollection->firstAncestorOrThisOfTypeAsserted( inputReservoir );
|
|
||||||
inputReservoir->openDataFileSet( fileNames );
|
|
||||||
|
|
||||||
inputPropertyCollection->updateConnectedEditors();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
menuBuilder << "RicNewContourMapViewFeature";
|
menuBuilder << "RicNewContourMapViewFeature";
|
||||||
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
|
menuBuilder << "RicShowFlowCharacteristicsPlotFeature";
|
||||||
menuBuilder << "RicEclipseCaseNewGroupFeature";
|
menuBuilder << "RicEclipseCaseNewGroupFeature";
|
||||||
|
menuBuilder << "RicAddEclipseInputPropertyFeature";
|
||||||
menuBuilder << "Separator";
|
menuBuilder << "Separator";
|
||||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||||
menuBuilder << "Separator";
|
menuBuilder << "Separator";
|
||||||
|
|||||||
@@ -999,3 +999,8 @@ std::vector<QDateTime> RimEclipseCase::timeStepDates() const
|
|||||||
}
|
}
|
||||||
return std::vector<QDateTime>();
|
return std::vector<QDateTime>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RimEclipseCase::importAsciiInputProperties( const QStringList& fileNames )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public:
|
|||||||
bool ensureReservoirCaseIsOpen();
|
bool ensureReservoirCaseIsOpen();
|
||||||
bool openReserviorCase();
|
bool openReserviorCase();
|
||||||
virtual bool openEclipseGridFile() = 0;
|
virtual bool openEclipseGridFile() = 0;
|
||||||
|
virtual bool importAsciiInputProperties( const QStringList& fileNames );
|
||||||
|
|
||||||
RigEclipseCaseData* eclipseCaseData();
|
RigEclipseCaseData* eclipseCaseData();
|
||||||
const RigEclipseCaseData* eclipseCaseData() const;
|
const RigEclipseCaseData* eclipseCaseData() const;
|
||||||
|
|||||||
@@ -73,6 +73,15 @@ RimEclipseInputCase::RimEclipseInputCase()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimEclipseInputCase::~RimEclipseInputCase() {}
|
RimEclipseInputCase::~RimEclipseInputCase() {}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Import ascii properties. If no grid data has been read, it will first find the possible
|
||||||
|
/// grid data among the files then read all supported properties from the files matching the grid
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimEclipseInputCase::importAsciiInputProperties( const QStringList& fileNames )
|
||||||
|
{
|
||||||
|
return openDataFileSet( fileNames );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Open the supplied file set. If no grid data has been read, it will first find the possible
|
/// Open the supplied file set. If no grid data has been read, it will first find the possible
|
||||||
/// grid data among the files then read all supported properties from the files matching the grid
|
/// grid data among the files then read all supported properties from the files matching the grid
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public:
|
|||||||
|
|
||||||
// File open methods
|
// File open methods
|
||||||
bool openDataFileSet( const QStringList& fileNames );
|
bool openDataFileSet( const QStringList& fileNames );
|
||||||
|
bool importAsciiInputProperties( const QStringList& fileNames ) override;
|
||||||
void loadAndSyncronizeInputProperties();
|
void loadAndSyncronizeInputProperties();
|
||||||
|
|
||||||
// RimCase overrides
|
// RimCase overrides
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "RicfCommandObject.h"
|
#include "RicfCommandObject.h"
|
||||||
|
|
||||||
|
#include "RifEclipseInputPropertyLoader.h"
|
||||||
#include "RifEclipseOutputFileTools.h"
|
#include "RifEclipseOutputFileTools.h"
|
||||||
#include "RifReaderEclipseOutput.h"
|
#include "RifReaderEclipseOutput.h"
|
||||||
#include "RifReaderEclipseRft.h"
|
#include "RifReaderEclipseRft.h"
|
||||||
@@ -41,6 +42,8 @@
|
|||||||
|
|
||||||
#include "RimDialogData.h"
|
#include "RimDialogData.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
|
#include "RimEclipseInputProperty.h"
|
||||||
|
#include "RimEclipseInputPropertyCollection.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimFlowDiagSolution.h"
|
#include "RimFlowDiagSolution.h"
|
||||||
#include "RimMockModelSettings.h"
|
#include "RimMockModelSettings.h"
|
||||||
@@ -239,6 +242,18 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimEclipseResultCase::importAsciiInputProperties( const QStringList& fileNames )
|
||||||
|
{
|
||||||
|
bool importFaults = false;
|
||||||
|
return RifEclipseInputPropertyLoader::readInputPropertiesFromFiles( m_inputPropertyCollection,
|
||||||
|
this->eclipseCaseData(),
|
||||||
|
importFaults,
|
||||||
|
fileNames.toVector().toStdVector() );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -26,11 +26,13 @@
|
|||||||
|
|
||||||
#include <cafPdmProxyValueField.h>
|
#include <cafPdmProxyValueField.h>
|
||||||
|
|
||||||
class RifReaderInterface;
|
|
||||||
class RigMainGrid;
|
|
||||||
class RimFlowDiagSolution;
|
|
||||||
class RigFlowDiagSolverInterface;
|
|
||||||
class RifReaderEclipseRft;
|
class RifReaderEclipseRft;
|
||||||
|
class RifReaderInterface;
|
||||||
|
class RigFlowDiagSolverInterface;
|
||||||
|
class RigMainGrid;
|
||||||
|
class RimEclipseInputProperty;
|
||||||
|
class RimEclipseInputPropertyCollection;
|
||||||
|
class RimFlowDiagSolution;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
@@ -53,6 +55,7 @@ public:
|
|||||||
bool openEclipseGridFile() override;
|
bool openEclipseGridFile() override;
|
||||||
|
|
||||||
bool importGridAndResultMetaData( bool showTimeStepFilter );
|
bool importGridAndResultMetaData( bool showTimeStepFilter );
|
||||||
|
bool importAsciiInputProperties( const QStringList& fileNames );
|
||||||
|
|
||||||
void reloadEclipseGridFile() override;
|
void reloadEclipseGridFile() override;
|
||||||
bool openAndReadActiveCellData( RigEclipseCaseData* mainEclipseCase );
|
bool openAndReadActiveCellData( RigEclipseCaseData* mainEclipseCase );
|
||||||
|
|||||||
Reference in New Issue
Block a user