mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1793 Ensure current case name is included when exporting property through command file
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfExportProperty, "exportProperty");
|
||||
@@ -54,15 +56,8 @@ RicfExportProperty::RicfExportProperty()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportProperty::execute()
|
||||
{
|
||||
QString fileName = m_path;
|
||||
if (fileName.isNull())
|
||||
{
|
||||
QDir propertiesDir(RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::PROPERTIES));
|
||||
fileName = propertiesDir.filePath(m_propertyName);
|
||||
}
|
||||
|
||||
RimEclipseCase* eclipseCase;
|
||||
|
||||
{
|
||||
bool foundCase = false;
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels()->cases)
|
||||
@@ -81,6 +76,15 @@ void RicfExportProperty::execute()
|
||||
}
|
||||
}
|
||||
|
||||
QString filePath = m_path;
|
||||
if (filePath.isNull())
|
||||
{
|
||||
QDir propertiesDir(RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::PROPERTIES));
|
||||
QString fileName = QString("%1-%2").arg(eclipseCase->caseUserDescription()).arg(m_propertyName);
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
filePath = propertiesDir.filePath(fileName);
|
||||
}
|
||||
|
||||
// FIXME : Select correct view?
|
||||
RimEclipseView* view;
|
||||
for (RimView* v : eclipseCase->views())
|
||||
@@ -102,5 +106,5 @@ void RicfExportProperty::execute()
|
||||
view->cellResult->setResultVariable(m_propertyName);
|
||||
view->loadDataAndUpdate();
|
||||
|
||||
RifEclipseInputFileTools::writeBinaryResultToTextFile(fileName, eclipseCase->eclipseCaseData(), m_timeStepIndex, view->cellResult, m_eclipseKeyword, m_undefinedValue);
|
||||
RifEclipseInputFileTools::writeBinaryResultToTextFile(filePath, eclipseCase->eclipseCaseData(), m_timeStepIndex, view->cellResult, m_eclipseKeyword, m_undefinedValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user