Skip to content

Commit

Permalink
Merge pull request #4758 from OPM/patch-2018.08.2
Browse files Browse the repository at this point in the history
Patch release 2019.08.2
  • Loading branch information
magnesj authored Oct 1, 2019
2 parents cdf1b85 + 459f470 commit fa27234
Show file tree
Hide file tree
Showing 97 changed files with 2,550 additions and 1,969 deletions.
6 changes: 3 additions & 3 deletions ApplicationCode/Application/RiaGuiApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments(cvf::Progra

// 2016-11-09 : Location of snapshot folder was previously located in 'snapshot' folder
// relative to current working folder. Now harmonized to behave as RiuMainWindow::slotSnapshotAllViewsToFile()
QString absolutePathToSnapshotDir = createAbsolutePathFromProjectRelativePath("snapshots");
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
QString absolutePathToSnapshotDir = createAbsolutePathFromProjectRelativePath( "snapshots" );
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( absolutePathToSnapshotDir );

mainWnd->loadWinGeoAndDockToolBarLayout();
}
Expand Down Expand Up @@ -1787,7 +1787,7 @@ void RiaGuiApplication::runMultiCaseSnapshots(const QString& templateProje
bool loadOk = loadProject(templateProjectFileName, PLA_NONE, &modifier);
if (loadOk)
{
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(snapshotFolderName);
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( snapshotFolderName );
}
}

Expand Down
2 changes: 1 addition & 1 deletion ApplicationCode/Application/RiaSummaryCurveDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ QString RiaSummaryCurveDefinition::curveDefinitionText() const
{
QString caseName;
if (summaryCase())
caseName = summaryCase()->caseName();
caseName = summaryCase()->shortName();
else if (ensemble())
caseName = ensemble()->name();

Expand Down
4 changes: 2 additions & 2 deletions ApplicationCode/Application/Tools/RiaRegressionTestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ void RiaRegressionTestRunner::runRegressionTest()

resizePlotWindows();

QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(fullPathGeneratedFolder);
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName );
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( fullPathGeneratedFolder );

RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(fullPathGeneratedFolder);

Expand Down
3 changes: 3 additions & 0 deletions ApplicationCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ void RiaSummaryCurveAnalyzer::clear()
m_wellCompletions.clear();
m_wellSegmentNumbers.clear();
m_blocks.clear();

m_quantitiesNoMatchingHistory.clear();
m_quantitiesWithMatchingHistory.clear();
}

//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ RiaTimeHistoryCurveResampler::RiaTimeHistoryCurveResampler()
//--------------------------------------------------------------------------------------------------
void RiaTimeHistoryCurveResampler::setCurveData(const std::vector<double>& values, const std::vector<time_t>& timeSteps)
{
if (values.empty() || timeSteps.empty())
{
return;
}

CVF_ASSERT(values.size() == timeSteps.size());

clearData();
Expand Down
22 changes: 22 additions & 0 deletions ApplicationCode/CommandFileInterface/RicfApplicationTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,25 @@ RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewName(int caseId, cons
}
return nullptr;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicfApplicationTools::viewFromCaseIdAndViewId( int caseId, int viewId )
{
for ( RimEclipseCase* c : RiaApplication::instance()->project()->eclipseCases() )
{
if ( c->caseId() == caseId )
{
for ( auto v : c->views() )
{
auto eclipseView = dynamic_cast<RimEclipseView*>( v );
if ( eclipseView && eclipseView->id() == viewId )
{
return eclipseView;
}
}
}
}
return nullptr;
}
7 changes: 4 additions & 3 deletions ApplicationCode/CommandFileInterface/RicfApplicationTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ class QStringList;
class RicfApplicationTools
{
public:
static std::vector<RimWellPath*> wellPathsFromNames(const QStringList& wellPathNames, QStringList* wellsNotFound);
static RimEclipseCase* caseFromId(int caseId);
static RimEclipseView* viewFromCaseIdAndViewName(int caseId, const QString& viewName);
static std::vector<RimWellPath*> wellPathsFromNames( const QStringList& wellPathNames, QStringList* wellsNotFound );
static RimEclipseCase* caseFromId( int caseId );
static RimEclipseView* viewFromCaseIdAndViewName( int caseId, const QString& viewName );
static RimEclipseView* viewFromCaseIdAndViewId( int caseId, int viewId );

static std::vector<QString> toStringVector(const QStringList& stringList);
static QStringList toQStringList(const std::vector<QString>& v);
Expand Down
32 changes: 23 additions & 9 deletions ApplicationCode/CommandFileInterface/RicfExportPropertyInViews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ CAF_PDM_SOURCE_INIT(RicfExportPropertyInViews, "exportPropertyInViews");
//--------------------------------------------------------------------------------------------------
RicfExportPropertyInViews::RicfExportPropertyInViews()
{
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
RICF_InitField(&m_viewNames, "viewNames", std::vector<QString>(), "View Names", "", "", "");
RICF_InitField(&m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "");
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
RICF_InitField( &m_viewIds, "viewIds", std::vector<int>(), "View IDs", "", "", "" );
RICF_InitField( &m_viewNames, "viewNames", std::vector<QString>(), "View Names", "", "", "" );
RICF_InitField( &m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "" );
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -74,22 +75,35 @@ RicfCommandResponse RicfExportPropertyInViews::execute()
RimEclipseView* view = dynamic_cast<RimEclipseView*>(v);
if (!view) continue;

if (m_viewNames().empty())
if ( m_viewNames().empty() && m_viewIds().empty() )
{
viewsForExport.push_back(view);
}
else
{
bool matchingName = false;
for (const auto& viewName : m_viewNames())
bool matchingIdOrName = false;

for ( auto viewId : m_viewIds() )
{
if ( view->id() == viewId )
{
matchingIdOrName = true;
break;
}
}

if ( !matchingIdOrName )
{
if (view->name().compare(viewName, Qt::CaseInsensitive) == 0)
for ( const auto& viewName : m_viewNames() )
{
matchingName = true;
if ( view->name().compare( viewName, Qt::CaseInsensitive ) == 0 )
{
matchingIdOrName = true;
}
}
}

if (matchingName)
if ( matchingIdOrName )
{
viewsForExport.push_back(view);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class RicfExportPropertyInViews : public RicfCommandObject

private:
caf::PdmField<int> m_caseId;
caf::PdmField<std::vector<int>> m_viewIds;
caf::PdmField<std::vector<QString>> m_viewNames;
caf::PdmField<double> m_undefinedValue;
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ CAF_PDM_SOURCE_INIT(RicfExportSimWellFractureCompletions, "exportSimWellFracture
//--------------------------------------------------------------------------------------------------
RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions()
{
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
RICF_InitField(&m_viewName, "viewName", QString(""), "View Name", "", "", "");
RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", "");
RICF_InitField(&m_simWellNames, "simulationWellNames", std::vector<QString>(), "Simulation Well Names", "", "", "");
RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "");
RICF_InitField(&m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), "Compdat Export", "", "", "");
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
RICF_InitField( &m_viewId, "viewId", -1, "View ID", "", "", "" );
RICF_InitField( &m_viewName, "viewName", QString( "" ), "View Name", "", "", "" );
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" );
RICF_InitField( &m_simWellNames, "simulationWellNames", std::vector<QString>(), "Simulation Well Names", "", "", "" );
RICF_InitField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "" );
RICF_InitField( &m_compdatExport,
"compdatExport",
RicExportCompletionDataSettingsUi::CompdatExportType(),
"Compdat Export",
"",
"",
"" );
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -88,17 +95,22 @@ RicfCommandResponse RicfExportSimWellFractureCompletions::execute()
std::vector<RimEclipseView*> views;
for (Rim3dView* v : exportSettings->caseToApply->views())
{
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(v);
if (eclipseView && eclipseView->name() == m_viewName())
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( v );
if ( eclipseView && ( eclipseView->id() == m_viewId() || eclipseView->name() == m_viewName() ) )
{
views.push_back(eclipseView);
}
}
if (views.empty())
{
QString error = QString("exportSimWellCompletions: Could not find any views named \"%1\" in the case with ID %2").arg(m_viewName).arg(m_caseId());
RiaLogging::error(error);
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
QString error =
QString(
"exportSimWellCompletions: Could not find any views with id %1 or named \"%2\" in the case with ID %3" )
.arg( m_viewId )
.arg( m_viewName )
.arg( m_caseId() );
RiaLogging::error( error );
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
}

RicfCommandResponse response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ class RicfExportSimWellFractureCompletions : public RicfCommandObject
RicfCommandResponse execute() override;

private:
caf::PdmField<int> m_caseId;
caf::PdmField<QString> m_viewName;
caf::PdmField<int> m_timeStep;
caf::PdmField< std::vector<QString> > m_simWellNames;

caf::PdmField<int> m_caseId;
caf::PdmField<int> m_viewId;
caf::PdmField<QString> m_viewName;
caf::PdmField<int> m_timeStep;
caf::PdmField<std::vector<QString>> m_simWellNames;

caf::PdmField<RicExportCompletionDataSettingsUi::ExportSplitType> m_fileSplit;
caf::PdmField<RicExportCompletionDataSettingsUi::CompdatExportType> m_compdatExport;
};
12 changes: 8 additions & 4 deletions ApplicationCode/CommandFileInterface/RicfExportSnapshots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ void RicfExportSnapshots::SnapshotsTypeEnum::setUp()
//--------------------------------------------------------------------------------------------------
RicfExportSnapshots::RicfExportSnapshots()
{
RICF_InitField(&m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "");
RICF_InitField(&m_prefix, "prefix", QString(), "Prefix", "", "", "");
RICF_InitField(&m_caseId, "caseId", -1, "Case Id", "", "", "");
RICF_InitField( &m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "" );
RICF_InitField( &m_prefix, "prefix", QString(), "Prefix", "", "", "" );
RICF_InitField( &m_caseId, "caseId", -1, "Case Id", "", "", "" );
RICF_InitField( &m_viewId, "viewId", -1, "View Id", "", "", "" );
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -78,7 +79,10 @@ RicfCommandResponse RicfExportSnapshots::execute()
}
if (m_type == RicfExportSnapshots::VIEWS || m_type == RicfExportSnapshots::ALL)
{
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir, m_prefix, m_caseId());
RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( absolutePathToSnapshotDir,
m_prefix,
m_caseId(),
m_viewId() );
}
if (m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL)
{
Expand Down
1 change: 1 addition & 0 deletions ApplicationCode/CommandFileInterface/RicfExportSnapshots.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ class RicfExportSnapshots : public RicfCommandObject
caf::PdmField<SnapshotsTypeEnum> m_type;
caf::PdmField<QString> m_prefix;
caf::PdmField<int> m_caseId;
caf::PdmField<int> m_viewId;
};
50 changes: 33 additions & 17 deletions ApplicationCode/CommandFileInterface/RicfExportVisibleCells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,49 @@ void AppEnum<RicfExportVisibleCells::ExportKeyword>::setUp()
//--------------------------------------------------------------------------------------------------
RicfExportVisibleCells::RicfExportVisibleCells()
{
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
RICF_InitField(&m_viewName, "viewName", QString(), "View Name", "", "", "");
RICF_InitField(
&m_exportKeyword, "exportKeyword", caf::AppEnum<RicfExportVisibleCells::ExportKeyword>(), "Export Keyword", "", "", "");
RICF_InitField(&m_visibleActiveCellsValue, "visibleActiveCellsValue", 1, "Visible Active Cells Value", "", "", "");
RICF_InitField(&m_hiddenActiveCellsValue, "hiddenActiveCellsValue", 0, "Hidden Active Cells Value", "", "", "");
RICF_InitField(&m_inactiveCellsValue, "inactiveCellsValue", 0, "Inactive Cells Value", "", "", "");
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
RICF_InitField( &m_viewId, "viewId", -1, "View ID", "", "", "" );
RICF_InitField( &m_viewName, "viewName", QString(), "View Name", "", "", "" );
RICF_InitField( &m_exportKeyword,
"exportKeyword",
caf::AppEnum<RicfExportVisibleCells::ExportKeyword>(),
"Export Keyword",
"",
"",
"" );
RICF_InitField( &m_visibleActiveCellsValue, "visibleActiveCellsValue", 1, "Visible Active Cells Value", "", "", "" );
RICF_InitField( &m_hiddenActiveCellsValue, "hiddenActiveCellsValue", 0, "Hidden Active Cells Value", "", "", "" );
RICF_InitField( &m_inactiveCellsValue, "inactiveCellsValue", 0, "Inactive Cells Value", "", "", "" );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfCommandResponse RicfExportVisibleCells::execute()
{
if (m_caseId < 0 || m_viewName().isEmpty())
if ( m_caseId < 0 || ( m_viewName().isEmpty() && m_viewId() < 0 ) )
{
QString error("exportVisibleCells: CaseId or view name not specified");
RiaLogging::error(error);
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
QString error( "exportVisibleCells: CaseId or view name or view id not specified" );
RiaLogging::error( error );
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
}

auto eclipseView = RicfApplicationTools::viewFromCaseIdAndViewName(m_caseId, m_viewName);
if (!eclipseView)
RimEclipseView* eclipseView = nullptr;
if ( m_viewId() >= 0 )
{
eclipseView = RicfApplicationTools::viewFromCaseIdAndViewId( m_caseId, m_viewId() );
}
else
{
eclipseView = RicfApplicationTools::viewFromCaseIdAndViewName( m_caseId, m_viewName );
}
if ( !eclipseView )
{
QString error(QString("exportVisibleCells: Could not find view '%1' in case ID %2").arg(m_viewName).arg(m_caseId));
RiaLogging::error(error);
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
QString error( QString( "exportVisibleCells: Could not find view of id %1 or named '%2' in case ID %3" )
.arg( m_viewId )
.arg( m_viewName )
.arg( m_caseId ) );
RiaLogging::error( error );
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
}

QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::CELLS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class RicfExportVisibleCells : public RicfCommandObject
void buildExportSettings(const QString& exportFolder, RicSaveEclipseInputVisibleCellsUi* exportSettings);

caf::PdmField<int> m_caseId;
caf::PdmField<int> m_viewId;
caf::PdmField<QString> m_viewName;
caf::PdmField<caf::AppEnum<ExportKeyword>> m_exportKeyword;
caf::PdmField<int> m_visibleActiveCellsValue;
Expand Down
22 changes: 17 additions & 5 deletions ApplicationCode/CommandFileInterface/RicfSetTimeStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ CAF_PDM_SOURCE_INIT(RicfSetTimeStep, "setTimeStep");
//--------------------------------------------------------------------------------------------------
RicfSetTimeStep::RicfSetTimeStep()
{
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
RICF_InitField(&m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "");
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
RICF_InitField( &m_viewId, "viewId", -1, "View ID", "", "", "" );
RICF_InitField( &m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "" );
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -49,7 +50,15 @@ void RicfSetTimeStep::setCaseId(int caseId)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfSetTimeStep::setTimeStepIndex(int timeStepIndex)
void RicfSetTimeStep::setViewId( int viewId )
{
m_viewId = viewId;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfSetTimeStep::setTimeStepIndex( int timeStepIndex )
{
m_timeStepIndex = timeStepIndex;
}
Expand Down Expand Up @@ -93,8 +102,11 @@ RicfCommandResponse RicfSetTimeStep::execute()

for (Rim3dView* view : eclipseCase->views())
{
view->setCurrentTimeStepAndUpdate(m_timeStepIndex);
view->createDisplayModelAndRedraw();
if ( m_viewId() == -1 || view->id() == m_viewId() )
{
view->setCurrentTimeStepAndUpdate( m_timeStepIndex );
view->createDisplayModelAndRedraw();
}
}

return RicfCommandResponse();
Expand Down
Loading

0 comments on commit fa27234

Please sign in to comment.