2013-12-04 05:04:42 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-24 00:14:52 -05:00
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-12-04 05:04:42 -06:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-12-04 05:04:42 -06:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2013-12-04 05:04:42 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RiaProjectModifier.h"
|
|
|
|
|
|
|
|
#include "RimCaseCollection.h"
|
2016-11-25 07:21:40 -06:00
|
|
|
#include "RimEclipseCaseCollection.h"
|
2017-06-28 13:10:06 -05:00
|
|
|
#include "RimEclipseInputCase.h"
|
2015-06-25 06:23:36 -05:00
|
|
|
#include "RimEclipseResultCase.h"
|
2018-09-19 03:36:48 -05:00
|
|
|
#include "RimGeoMechCase.h"
|
2016-11-25 07:21:40 -06:00
|
|
|
#include "RimIdenticalGridCaseGroup.h"
|
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimProject.h"
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2015-09-25 08:57:43 -05:00
|
|
|
#include <QDir>
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <QFileInfo>
|
2013-12-04 05:04:42 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RiaProjectModifier::RiaProjectModifier()
|
2020-10-13 04:40:06 -05:00
|
|
|
: m_invalidateExternalFilePaths( false )
|
2020-02-12 04:13:38 -06:00
|
|
|
{
|
|
|
|
}
|
2013-12-04 05:04:42 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-03 07:08:21 -06:00
|
|
|
void RiaProjectModifier::setReplaceCaseFirstOccurrence( const QString& newGridFileName )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_caseIdToGridFileNameMap[RiaProjectModifier::firstOccurrenceId()] = makeFilePathAbsolute( newGridFileName );
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-03 07:08:21 -06:00
|
|
|
void RiaProjectModifier::setReplaceCase( int caseIdToReplace, const QString& newGridFileName )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caseIdToReplace >= 0 )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_caseIdToGridFileNameMap[caseIdToReplace] = makeFilePathAbsolute( newGridFileName );
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-03 07:08:21 -06:00
|
|
|
void RiaProjectModifier::setReplaceSourceCasesFirstOccurrence( const std::vector<QString>& newGridFileNames )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2016-11-28 04:30:03 -06:00
|
|
|
m_groupIdToGridFileNamesMap[RiaProjectModifier::firstOccurrenceId()] = newGridFileNames;
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:43:15 -06:00
|
|
|
void RiaProjectModifier::setReplaceSourceCasesById( int caseGroupIdToReplace, const std::vector<QString>& newGridFileNames )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caseGroupIdToReplace >= 0 )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2016-11-25 07:21:40 -06:00
|
|
|
m_groupIdToGridFileNamesMap[caseGroupIdToReplace] = newGridFileNames;
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-28 13:10:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiaProjectModifier::setReplacePropertiesFolderFirstOccurrence( QString newPropertiesFolder )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_caseIdToPropertiesFolderMap[RiaProjectModifier::firstOccurrenceId()] = makeFilePathAbsolute( newPropertiesFolder );
|
2017-06-28 13:10:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-28 13:10:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiaProjectModifier::setReplacePropertiesFolder( int caseIdToReplace, QString newPropertiesFolder )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caseIdToReplace >= 0 )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_caseIdToPropertiesFolderMap[caseIdToReplace] = makeFilePathAbsolute( newPropertiesFolder );
|
2017-06-28 13:10:06 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 06:17:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-10-13 04:40:06 -05:00
|
|
|
void RiaProjectModifier::setInvalidateExternalFilePaths()
|
2020-10-12 06:17:47 -05:00
|
|
|
{
|
2020-10-13 04:40:06 -05:00
|
|
|
m_invalidateExternalFilePaths = true;
|
2020-10-12 06:17:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-10-13 04:40:06 -05:00
|
|
|
void RiaProjectModifier::invalidateExternalFilePaths( RimProject* project )
|
2020-10-12 06:17:47 -05:00
|
|
|
{
|
|
|
|
std::vector<caf::FilePath*> filePaths = project->allFilePaths();
|
|
|
|
|
|
|
|
const QString invalidPath = "path_does_not_exist";
|
|
|
|
for ( caf::FilePath* filePath : filePaths )
|
|
|
|
{
|
|
|
|
filePath->setPath( invalidPath );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
bool RiaProjectModifier::applyModificationsToProject( RimProject* project )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_caseIdToGridFileNameMap.size() > 0 )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
replaceCase( project );
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_groupIdToGridFileNamesMap.size() > 0 )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
replaceSourceCases( project );
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_caseIdToPropertiesFolderMap.size() > 0 )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
replacePropertiesFolder( project );
|
2017-06-28 13:10:06 -05:00
|
|
|
}
|
|
|
|
|
2020-10-13 04:40:06 -05:00
|
|
|
if ( m_invalidateExternalFilePaths )
|
2020-10-12 06:17:47 -05:00
|
|
|
{
|
2020-10-13 04:40:06 -05:00
|
|
|
invalidateExternalFilePaths( project );
|
2020-10-12 06:17:47 -05:00
|
|
|
}
|
|
|
|
|
2013-12-04 05:04:42 -06:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiaProjectModifier::replaceSourceCases( RimProject* project )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimOilField* oilField : project->oilFields() )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2018-02-18 11:56:43 -06:00
|
|
|
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( analysisModels )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimIdenticalGridCaseGroup* caseGroup : analysisModels->caseGroups )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto item : m_groupIdToGridFileNamesMap )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2016-11-25 07:21:40 -06:00
|
|
|
int groupIdToReplace = item.first;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( groupIdToReplace == RiaProjectModifier::firstOccurrenceId() )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
groupIdToReplace = firstGroupId( project );
|
2016-11-25 07:21:40 -06:00
|
|
|
}
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( groupIdToReplace == caseGroup->groupId() )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2016-11-25 07:21:40 -06:00
|
|
|
RimCaseCollection* caseCollection = caseGroup->caseCollection;
|
2022-05-31 06:08:07 -05:00
|
|
|
caseCollection->reservoirs.deleteChildren();
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( QString fileName : item.second )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString caseName = caseNameFromGridFileName( fileName );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2016-11-25 07:21:40 -06:00
|
|
|
// Use this slightly hackish method in order to get a new unique ID
|
|
|
|
RimEclipseResultCase* resCase = new RimEclipseResultCase;
|
2019-09-06 03:40:57 -05:00
|
|
|
resCase->setCaseInfo( caseName, fileName );
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
caseCollection->reservoirs.push_back( resCase );
|
2016-11-25 07:21:40 -06:00
|
|
|
}
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiaProjectModifier::replaceCase( RimProject* project )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2015-05-15 11:51:49 -05:00
|
|
|
std::vector<RimCase*> allCases;
|
2019-09-06 03:40:57 -05:00
|
|
|
project->allCases( allCases );
|
|
|
|
|
|
|
|
for ( RimCase* rimCase : allCases )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>( rimCase );
|
|
|
|
RimGeoMechCase* geomechCase = dynamic_cast<RimGeoMechCase*>( rimCase );
|
|
|
|
if ( eclipseResultCase || geomechCase )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto item : m_caseIdToGridFileNameMap )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2016-11-25 07:21:40 -06:00
|
|
|
int caseIdToReplace = item.first;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caseIdToReplace == RiaProjectModifier::firstOccurrenceId() )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caseIdToReplace = firstCaseId( project );
|
2016-11-25 07:21:40 -06:00
|
|
|
}
|
2015-05-15 01:18:11 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caseIdToReplace == rimCase->caseId() )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2016-11-25 07:21:40 -06:00
|
|
|
QString replaceFileName = item.second;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( eclipseResultCase )
|
2018-09-19 03:36:48 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
eclipseResultCase->setGridFileName( replaceFileName );
|
2022-08-18 00:12:23 -05:00
|
|
|
eclipseResultCase->setCaseUserDescription( caseNameFromGridFileName( replaceFileName ) );
|
2018-09-19 03:36:48 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( geomechCase )
|
2018-09-19 03:36:48 -05:00
|
|
|
{
|
2020-02-21 05:07:15 -06:00
|
|
|
geomechCase->setGridFileName( replaceFileName );
|
2022-08-18 00:12:23 -05:00
|
|
|
geomechCase->setCaseUserDescription( caseNameFromGridFileName( replaceFileName ) );
|
2018-09-19 03:36:48 -05:00
|
|
|
}
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-28 13:10:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RiaProjectModifier::replacePropertiesFolder( RimProject* project )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
|
|
|
std::vector<RimCase*> allCases;
|
2019-09-06 03:40:57 -05:00
|
|
|
project->allCases( allCases );
|
2017-06-28 13:10:06 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimCase* rimCase : allCases )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimEclipseInputCase* inputCase = dynamic_cast<RimEclipseInputCase*>( rimCase );
|
2017-06-28 13:10:06 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( inputCase )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto item : m_caseIdToPropertiesFolderMap )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
|
|
|
int caseIdToReplace = item.first;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caseIdToReplace == RiaProjectModifier::firstOccurrenceId() )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caseIdToReplace = firstInputCaseId( project );
|
2017-06-28 13:10:06 -05:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( caseIdToReplace == inputCase->caseId() )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
inputCase->updateAdditionalFileFolder( item.second );
|
2017-06-28 13:10:06 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
/// Returns absolute path name to the specified file.
|
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
/// If \a relOrAbsolutePath is a relative, the current working directory for the process will be
|
|
|
|
/// used in order to make the path absolute.
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-03 07:08:21 -06:00
|
|
|
QString RiaProjectModifier::makeFilePathAbsolute( const QString& relOrAbsolutePath )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QFileInfo theFile( relOrAbsolutePath );
|
2013-12-04 05:04:42 -06:00
|
|
|
theFile.makeAbsolute();
|
|
|
|
return theFile.filePath();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-04 05:04:42 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-03 07:08:21 -06:00
|
|
|
QString RiaProjectModifier::caseNameFromGridFileName( const QString& fullGridFilePathName )
|
2013-12-04 05:04:42 -06:00
|
|
|
{
|
2020-11-11 07:26:49 -06:00
|
|
|
QFileInfo fi( fullGridFilePathName );
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2020-11-11 07:26:49 -06:00
|
|
|
return fi.baseName();
|
2013-12-04 05:04:42 -06:00
|
|
|
}
|
|
|
|
|
2016-11-25 07:21:40 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-25 07:21:40 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
int RiaProjectModifier::firstCaseId( RimProject* project )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
|
|
|
std::vector<RimCase*> allCases;
|
2019-09-06 03:40:57 -05:00
|
|
|
project->allCases( allCases );
|
2016-11-25 07:21:40 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimCase* rimCase : allCases )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>( rimCase );
|
|
|
|
if ( resultCase )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
|
|
|
return resultCase->caseId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-25 07:21:40 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
int RiaProjectModifier::firstGroupId( RimProject* project )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( size_t oilFieldIdx = 0; oilFieldIdx < project->oilFields().size(); oilFieldIdx++ )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimOilField* oilField = project->oilFields[oilFieldIdx];
|
2018-02-18 11:56:43 -06:00
|
|
|
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( analysisModels )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( analysisModels->caseGroups.size() > 0 )
|
2016-11-25 07:21:40 -06:00
|
|
|
{
|
|
|
|
return analysisModels->caseGroups[0]->groupId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2013-12-04 05:04:42 -06:00
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-28 13:10:06 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
int RiaProjectModifier::firstInputCaseId( RimProject* project )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
|
|
|
std::vector<RimCase*> allCases;
|
2019-09-06 03:40:57 -05:00
|
|
|
project->allCases( allCases );
|
2017-06-28 13:10:06 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( RimCase* rimCase : allCases )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RimEclipseInputCase* resultCase = dynamic_cast<RimEclipseInputCase*>( rimCase );
|
|
|
|
if ( resultCase )
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
|
|
|
return resultCase->caseId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-11-28 04:30:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-11-28 04:30:03 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
int RiaProjectModifier::firstOccurrenceId()
|
|
|
|
{
|
|
|
|
return -999;
|
|
|
|
}
|