mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#1356 Added possibility to change sour sim file for eclipse result case
This commit is contained in:
parent
62d345cf1e
commit
24d4e6d094
@ -454,12 +454,27 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
|
||||
RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
CVF_ASSERT(matrixModelResults);
|
||||
|
||||
RiaLogging::info(QString("HDF: Start import of data from : ").arg(fileName));
|
||||
|
||||
RiaLogging::info("HDF: Removing all existing Sour Sim data ...");
|
||||
matrixModelResults->eraseAllSourSimData();
|
||||
|
||||
if (m_dynamicResultsAccess.isNull())
|
||||
{
|
||||
m_timeSteps.clear();
|
||||
}
|
||||
|
||||
std::unique_ptr<RifHdf5ReaderInterface> myReader;
|
||||
#ifdef USE_HDF5
|
||||
myReader = std::unique_ptr<RifHdf5ReaderInterface>(new RifHdf5Reader(fileName));
|
||||
#endif // USE_HDF5
|
||||
|
||||
if (!myReader) return;
|
||||
if (!myReader)
|
||||
{
|
||||
RiaLogging::error("HDF: Failed to import Sour Sim data ");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<QDateTime> hdfTimeSteps = myReader->timeSteps();
|
||||
if (m_timeSteps.size() > 0)
|
||||
@ -505,6 +520,7 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
|
||||
{
|
||||
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false);
|
||||
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers);
|
||||
matrixModelResults->setSourSimData(resIndex);
|
||||
}
|
||||
|
||||
m_hdfReaderInterface = std::move(myReader);
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "RigFlowDiagSolverInterface.h"
|
||||
|
||||
#include "cafPdmSettings.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
@ -71,7 +72,7 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
//flipYAxis.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", "");
|
||||
//m_sourSimFileName.uiCapability()->setUiReadOnly(true);
|
||||
m_sourSimFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
@ -209,6 +210,20 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::loadAndUpdateSourSimData()
|
||||
{
|
||||
if (!results(RifReaderInterface::MATRIX_RESULTS)) return;
|
||||
|
||||
RifReaderEclipseOutput* rifReaderOutput = dynamic_cast<RifReaderEclipseOutput*>(results(RifReaderInterface::MATRIX_RESULTS)->readerInterface());
|
||||
if (rifReaderOutput)
|
||||
{
|
||||
rifReaderOutput->setHdf5FileName(m_sourSimFileName);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -421,11 +436,7 @@ void RimEclipseResultCase::setSourSimFileName(const QString& fileName)
|
||||
{
|
||||
m_sourSimFileName = fileName;
|
||||
|
||||
RifReaderEclipseOutput* rifReaderOutput = dynamic_cast<RifReaderEclipseOutput*>(results(RifReaderInterface::FRACTURE_RESULTS)->readerInterface());
|
||||
if (rifReaderOutput)
|
||||
{
|
||||
rifReaderOutput->setHdf5FileName(fileName);
|
||||
}
|
||||
loadAndUpdateSourSimData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -455,3 +466,16 @@ void RimEclipseResultCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
|
||||
uiOrdering.add(&caseFileName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_sourSimFileName)
|
||||
{
|
||||
loadAndUpdateSourSimData();
|
||||
}
|
||||
|
||||
return RimEclipseCase::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,12 @@ public:
|
||||
std::vector<RimFlowDiagSolution*> flowDiagSolutions();
|
||||
RigFlowDiagSolverInterface* flowDiagSolverInterface();
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
|
||||
private:
|
||||
void loadAndUpdateSourSimData();
|
||||
|
||||
private:
|
||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||
|
||||
@ -77,4 +83,5 @@ private:
|
||||
|
||||
bool m_gridAndWellDataIsReadFromFile;
|
||||
bool m_activeCellInfoIsReadFromFile;
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user