mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#963 Batch : Parse multiple entries of replaceCase and replaceSourceCases
This commit is contained in:
parent
cf223f8043
commit
29f766edc7
@ -1182,8 +1182,8 @@ bool RiaApplication::parseArguments()
|
|||||||
progOpt.registerOption("startdir", "<folder>", "Set startup directory.", cvf::ProgramOptions::SINGLE_VALUE);
|
progOpt.registerOption("startdir", "<folder>", "Set startup directory.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||||
progOpt.registerOption("savesnapshots", "all|views|plots", "Save snapshot of all views or plots to project file location sub folder 'snapshots'. Option 'all' will include both views and plots. Application closes after snapshots have been written.", cvf::ProgramOptions::OPTIONAL_MULTI_VALUE);
|
progOpt.registerOption("savesnapshots", "all|views|plots", "Save snapshot of all views or plots to project file location sub folder 'snapshots'. Option 'all' will include both views and plots. Application closes after snapshots have been written.", cvf::ProgramOptions::OPTIONAL_MULTI_VALUE);
|
||||||
progOpt.registerOption("size", "<width> <height>", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE);
|
progOpt.registerOption("size", "<width> <height>", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE);
|
||||||
progOpt.registerOption("replaceCase", "[<caseId>] <newGridFile>", "Replace grid in <caseId> or first case with <newgridFile>.", cvf::ProgramOptions::MULTI_VALUE);
|
progOpt.registerOption("replaceCase", "[<caseId>] <newGridFile>", "Replace grid in <caseId> or first case with <newgridFile>. Repeat option for multiple replace operations.", cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::COMBINE_REPEATED);
|
||||||
progOpt.registerOption("replaceSourceCases", "[<caseGroupId>] <gridListFile>", "Replace source cases in <caseGroupId> or first grid case group with the grid files listed in the <gridListFile> file.", cvf::ProgramOptions::MULTI_VALUE);
|
progOpt.registerOption("replaceSourceCases", "[<caseGroupId>] <gridListFile>", "Replace source cases in <caseGroupId> or first grid case group with the grid files listed in the <gridListFile> file. Repeat option for multiple replace operations.", cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::COMBINE_REPEATED);
|
||||||
progOpt.registerOption("multiCaseSnapshots", "<gridListFile>", "For each grid file listed in the <gridListFile> file, replace the first case in the project and save snapshot of all views.", cvf::ProgramOptions::SINGLE_VALUE);
|
progOpt.registerOption("multiCaseSnapshots", "<gridListFile>", "For each grid file listed in the <gridListFile> file, replace the first case in the project and save snapshot of all views.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||||
progOpt.registerOption("help", "", "Displays help text.");
|
progOpt.registerOption("help", "", "Displays help text.");
|
||||||
progOpt.registerOption("?", "", "Displays help text.");
|
progOpt.registerOption("?", "", "Displays help text.");
|
||||||
@ -1294,16 +1294,26 @@ bool RiaApplication::parseArguments()
|
|||||||
{
|
{
|
||||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||||
|
|
||||||
const int caseId = o.safeValue(0).toInt(-1);
|
if (o.valueCount() == 1)
|
||||||
if (caseId != -1 && o.valueCount() > 1)
|
|
||||||
{
|
{
|
||||||
QString gridFileName = cvfqt::Utils::toQString(o.value(1));
|
// One argument is available, use replace case for first occurrence in the project
|
||||||
projectModifier->setReplaceCase(caseId, gridFileName);
|
|
||||||
|
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(0));
|
||||||
|
projectModifier->setReplaceCaseFirstOccurrence(gridFileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(0));
|
size_t optionIdx = 0;
|
||||||
projectModifier->setReplaceCaseFirstOccurence(gridFileName);
|
while (optionIdx < o.valueCount())
|
||||||
|
{
|
||||||
|
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||||
|
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||||
|
|
||||||
|
if (caseId != -1 && !gridFileName.isEmpty())
|
||||||
|
{
|
||||||
|
projectModifier->setReplaceCase(caseId, gridFileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1311,16 +1321,26 @@ bool RiaApplication::parseArguments()
|
|||||||
{
|
{
|
||||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||||
|
|
||||||
const int caseGroupId = o.safeValue(0).toInt(-1);
|
if (o.valueCount() == 1)
|
||||||
if (caseGroupId != -1 && o.valueCount() > 1)
|
|
||||||
{
|
{
|
||||||
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.value(1)));
|
// One argument is available, use replace case for first occurrence in the project
|
||||||
projectModifier->setReplaceSourceCasesById(caseGroupId, gridFileNames);
|
|
||||||
|
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0)));
|
||||||
|
projectModifier->setReplaceSourceCasesFirstOccurrence(gridFileNames);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0)));
|
size_t optionIdx = 0;
|
||||||
projectModifier->setReplaceSourceCasesFirstOccurence(gridFileNames);
|
while (optionIdx < o.valueCount())
|
||||||
|
{
|
||||||
|
const int groupId = o.safeValue(optionIdx++).toInt(-1);
|
||||||
|
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++)));
|
||||||
|
|
||||||
|
if (groupId != -1 && gridFileNames.size() > 0)
|
||||||
|
{
|
||||||
|
projectModifier->setReplaceSourceCasesById(groupId, gridFileNames);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
projectLoadAction = PLA_CALCULATE_STATISTICS;
|
projectLoadAction = PLA_CALCULATE_STATISTICS;
|
||||||
@ -2083,7 +2103,7 @@ void RiaApplication::runMultiCaseSnapshots(const QString& templateProjectFileNam
|
|||||||
QString gridFn = gridFileNames[i];
|
QString gridFn = gridFileNames[i];
|
||||||
|
|
||||||
RiaProjectModifier modifier;
|
RiaProjectModifier modifier;
|
||||||
modifier.setReplaceCaseFirstOccurence(gridFn);
|
modifier.setReplaceCaseFirstOccurrence(gridFn);
|
||||||
|
|
||||||
bool loadOk = loadProject(templateProjectFileName, PLA_NONE, &modifier);
|
bool loadOk = loadProject(templateProjectFileName, PLA_NONE, &modifier);
|
||||||
if (loadOk)
|
if (loadOk)
|
||||||
|
@ -19,58 +19,32 @@
|
|||||||
|
|
||||||
#include "RiaProjectModifier.h"
|
#include "RiaProjectModifier.h"
|
||||||
|
|
||||||
#include "RimProject.h"
|
|
||||||
#include "RimEclipseCaseCollection.h"
|
|
||||||
#include "RimOilField.h"
|
|
||||||
#include "RimIdenticalGridCaseGroup.h"
|
|
||||||
#include "RimCaseCollection.h"
|
#include "RimCaseCollection.h"
|
||||||
|
#include "RimEclipseCaseCollection.h"
|
||||||
#include "RimEclipseResultCase.h"
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimIdenticalGridCaseGroup.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimOilField.h"
|
||||||
#include "RimWellPathCollection.h"
|
#include "RimProject.h"
|
||||||
#include "RimScriptCollection.h"
|
|
||||||
#include "RimEclipsePropertyFilterCollection.h"
|
|
||||||
#include "RimEclipsePropertyFilter.h"
|
|
||||||
#include "RimReservoirCellResultsStorage.h"
|
|
||||||
#include "RimEclipseCellColors.h"
|
|
||||||
#include "RimCellEdgeColors.h"
|
|
||||||
#include "RimCellRangeFilterCollection.h"
|
|
||||||
#include "RimEclipseWellCollection.h"
|
|
||||||
#include "Rim3dOverlayInfoConfig.h"
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//==================================================================================================
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaProjectModifier::RiaProjectModifier()
|
RiaProjectModifier::RiaProjectModifier()
|
||||||
: m_replaceCase_caseId(UNDEFINED),
|
|
||||||
m_replaceSourceCases_caseGroupId(UNDEFINED)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaProjectModifier::setReplaceCaseFirstOccurence(QString newGridFileName)
|
void RiaProjectModifier::setReplaceCaseFirstOccurrence(QString newGridFileName)
|
||||||
{
|
{
|
||||||
m_replaceCase_caseId = FIRST_OCCURENCE;
|
m_caseIdToGridFileNameMap[FIRST_OCCURENCE] = makeFilePathAbsolute(newGridFileName);
|
||||||
m_replaceCase_gridFileName = makeFilePathAbsolute(newGridFileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -78,27 +52,18 @@ void RiaProjectModifier::setReplaceCase(int caseIdToReplace, QString newGridFile
|
|||||||
{
|
{
|
||||||
if (caseIdToReplace >= 0)
|
if (caseIdToReplace >= 0)
|
||||||
{
|
{
|
||||||
m_replaceCase_caseId = caseIdToReplace;
|
m_caseIdToGridFileNameMap[caseIdToReplace] = makeFilePathAbsolute(newGridFileName);
|
||||||
m_replaceCase_gridFileName = makeFilePathAbsolute(newGridFileName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaProjectModifier::setReplaceSourceCasesFirstOccurence(std::vector<QString> newGridFileNames)
|
void RiaProjectModifier::setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames)
|
||||||
{
|
{
|
||||||
m_replaceSourceCases_caseGroupId = FIRST_OCCURENCE;
|
m_groupIdToGridFileNamesMap[FIRST_OCCURENCE] = newGridFileNames;
|
||||||
|
|
||||||
m_replaceSourceCases_gridFileNames.clear();
|
|
||||||
foreach (QString fn, newGridFileNames)
|
|
||||||
{
|
|
||||||
m_replaceSourceCases_gridFileNames.push_back(makeFilePathAbsolute(fn));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -106,28 +71,21 @@ void RiaProjectModifier::setReplaceSourceCasesById(int caseGroupIdToReplace, std
|
|||||||
{
|
{
|
||||||
if (caseGroupIdToReplace >= 0)
|
if (caseGroupIdToReplace >= 0)
|
||||||
{
|
{
|
||||||
m_replaceSourceCases_caseGroupId = caseGroupIdToReplace;
|
m_groupIdToGridFileNamesMap[caseGroupIdToReplace] = newGridFileNames;
|
||||||
|
|
||||||
m_replaceSourceCases_gridFileNames.clear();
|
|
||||||
foreach (QString fn, newGridFileNames)
|
|
||||||
{
|
|
||||||
m_replaceSourceCases_gridFileNames.push_back(makeFilePathAbsolute(fn));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaProjectModifier::applyModificationsToProject(RimProject* project)
|
bool RiaProjectModifier::applyModificationsToProject(RimProject* project)
|
||||||
{
|
{
|
||||||
if (m_replaceCase_caseId != UNDEFINED && !m_replaceCase_gridFileName.isEmpty())
|
if (m_caseIdToGridFileNameMap.size() > 0)
|
||||||
{
|
{
|
||||||
replaceCase(project);
|
replaceCase(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_replaceSourceCases_caseGroupId != UNDEFINED && m_replaceSourceCases_gridFileNames.size() > 0)
|
if (m_groupIdToGridFileNamesMap.size() > 0)
|
||||||
{
|
{
|
||||||
replaceSourceCases(project);
|
replaceSourceCases(project);
|
||||||
}
|
}
|
||||||
@ -135,33 +93,33 @@ bool RiaProjectModifier::applyModificationsToProject(RimProject* project)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaProjectModifier::replaceSourceCases(RimProject* project)
|
void RiaProjectModifier::replaceSourceCases(RimProject* project)
|
||||||
{
|
{
|
||||||
bool didReplacement = false;
|
for (RimOilField* oilField : project->oilFields())
|
||||||
|
|
||||||
for (size_t oilFieldIdx = 0; oilFieldIdx < project->oilFields().size(); oilFieldIdx++)
|
|
||||||
{
|
{
|
||||||
RimOilField* oilField = project->oilFields[oilFieldIdx];
|
|
||||||
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
|
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
|
||||||
if (analysisModels)
|
if (analysisModels)
|
||||||
{
|
{
|
||||||
const size_t numCaseGroups = analysisModels->caseGroups.size();
|
for (RimIdenticalGridCaseGroup* caseGroup : analysisModels->caseGroups)
|
||||||
for (size_t caseGrpIdx = 0; caseGrpIdx < numCaseGroups; ++caseGrpIdx)
|
|
||||||
{
|
{
|
||||||
RimIdenticalGridCaseGroup* caseGroup = analysisModels->caseGroups[caseGrpIdx];
|
for (auto item : m_groupIdToGridFileNamesMap)
|
||||||
if (m_replaceSourceCases_caseGroupId == FIRST_OCCURENCE ||
|
{
|
||||||
m_replaceSourceCases_caseGroupId == caseGroup->groupId)
|
int groupIdToReplace = item.first;
|
||||||
|
if (groupIdToReplace == FIRST_OCCURENCE)
|
||||||
|
{
|
||||||
|
groupIdToReplace = firstGroupId(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupIdToReplace == caseGroup->groupId())
|
||||||
{
|
{
|
||||||
RimCaseCollection* caseCollection = caseGroup->caseCollection;
|
RimCaseCollection* caseCollection = caseGroup->caseCollection;
|
||||||
caseCollection->reservoirs.deleteAllChildObjects();
|
caseCollection->reservoirs.deleteAllChildObjects();
|
||||||
|
|
||||||
for (size_t i = 0; i < m_replaceSourceCases_gridFileNames.size(); i++)
|
for (QString fileName : item.second)
|
||||||
{
|
{
|
||||||
QString fileName = m_replaceSourceCases_gridFileNames[i];
|
|
||||||
QString caseName = caseNameFromGridFileName(fileName);
|
QString caseName = caseNameFromGridFileName(fileName);
|
||||||
|
|
||||||
// Use this slightly hackish method in order to get a new unique ID
|
// Use this slightly hackish method in order to get a new unique ID
|
||||||
@ -170,55 +128,45 @@ bool RiaProjectModifier::replaceSourceCases(RimProject* project)
|
|||||||
|
|
||||||
caseCollection->reservoirs.push_back(resCase);
|
caseCollection->reservoirs.push_back(resCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
didReplacement = true;
|
|
||||||
|
|
||||||
if (m_replaceSourceCases_caseGroupId == FIRST_OCCURENCE)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return didReplacement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaProjectModifier::replaceCase(RimProject* project)
|
void RiaProjectModifier::replaceCase(RimProject* project)
|
||||||
{
|
{
|
||||||
bool didReplacement = false;
|
|
||||||
std::vector<RimCase*> allCases;
|
std::vector<RimCase*> allCases;
|
||||||
project->allCases(allCases);
|
project->allCases(allCases);
|
||||||
|
|
||||||
for (size_t caseIdx = 0; caseIdx < allCases.size(); ++caseIdx)
|
for (RimCase* rimCase : allCases)
|
||||||
{
|
{
|
||||||
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(allCases[caseIdx]);
|
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase);
|
||||||
if (resultCase)
|
if (resultCase)
|
||||||
{
|
{
|
||||||
if (m_replaceCase_caseId == FIRST_OCCURENCE ||
|
for (auto item : m_caseIdToGridFileNameMap)
|
||||||
m_replaceCase_caseId == resultCase->caseId())
|
|
||||||
{
|
{
|
||||||
resultCase->setGridFileName(m_replaceCase_gridFileName);
|
int caseIdToReplace = item.first;
|
||||||
resultCase->caseUserDescription = caseNameFromGridFileName(m_replaceCase_gridFileName);
|
if (caseIdToReplace == FIRST_OCCURENCE)
|
||||||
didReplacement = true;
|
|
||||||
|
|
||||||
if (m_replaceCase_caseId == FIRST_OCCURENCE)
|
|
||||||
{
|
{
|
||||||
return true;
|
caseIdToReplace = firstCaseId(project);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return didReplacement;
|
if (caseIdToReplace == resultCase->caseId())
|
||||||
|
{
|
||||||
|
QString replaceFileName = item.second;
|
||||||
|
resultCase->setGridFileName(replaceFileName);
|
||||||
|
resultCase->caseUserDescription = caseNameFromGridFileName(replaceFileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Returns absolute path name to the specified file.
|
/// Returns absolute path name to the specified file.
|
||||||
///
|
///
|
||||||
@ -232,7 +180,6 @@ QString RiaProjectModifier::makeFilePathAbsolute(QString relOrAbsolutePath)
|
|||||||
return theFile.filePath();
|
return theFile.filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -248,4 +195,44 @@ QString RiaProjectModifier::caseNameFromGridFileName(QString fullGridFilePathNam
|
|||||||
return deepestDirPlusFileName;
|
return deepestDirPlusFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RiaProjectModifier::firstCaseId(RimProject* project)
|
||||||
|
{
|
||||||
|
std::vector<RimCase*> allCases;
|
||||||
|
project->allCases(allCases);
|
||||||
|
|
||||||
|
for (RimCase* rimCase : allCases)
|
||||||
|
{
|
||||||
|
RimEclipseResultCase* resultCase = dynamic_cast<RimEclipseResultCase*>(rimCase);
|
||||||
|
if (resultCase)
|
||||||
|
{
|
||||||
|
return resultCase->caseId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RiaProjectModifier::firstGroupId(RimProject* project)
|
||||||
|
{
|
||||||
|
for (size_t oilFieldIdx = 0; oilFieldIdx < project->oilFields().size(); oilFieldIdx++)
|
||||||
|
{
|
||||||
|
RimOilField* oilField = project->oilFields[oilFieldIdx];
|
||||||
|
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
|
||||||
|
if (analysisModels)
|
||||||
|
{
|
||||||
|
if (analysisModels->caseGroups.size() > 0)
|
||||||
|
{
|
||||||
|
return analysisModels->caseGroups[0]->groupId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
class RimProject;
|
class RimProject;
|
||||||
|
|
||||||
@ -40,32 +41,27 @@ class RiaProjectModifier : public cvf::Object
|
|||||||
public:
|
public:
|
||||||
RiaProjectModifier();
|
RiaProjectModifier();
|
||||||
|
|
||||||
void setReplaceCaseFirstOccurence(QString newGridFileName);
|
void setReplaceCaseFirstOccurrence(QString newGridFileName);
|
||||||
void setReplaceCase(int caseIdToReplace, QString newGridFileName);
|
void setReplaceCase(int caseIdToReplace, QString newGridFileName);
|
||||||
|
|
||||||
void setReplaceSourceCasesFirstOccurence(std::vector<QString> newGridFileNames);
|
void setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames);
|
||||||
void setReplaceSourceCasesById(int caseGroupIdToReplace, std::vector<QString> newGridFileNames);
|
void setReplaceSourceCasesById(int caseGroupIdToReplace, std::vector<QString> newGridFileNames);
|
||||||
|
|
||||||
bool applyModificationsToProject(RimProject* project);
|
bool applyModificationsToProject(RimProject* project);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool replaceSourceCases(RimProject* project);
|
void replaceSourceCases(RimProject* project);
|
||||||
bool replaceCase(RimProject* project);
|
void replaceCase(RimProject* project);
|
||||||
static QString makeFilePathAbsolute(QString relOrAbsolutePath);
|
static QString makeFilePathAbsolute(QString relOrAbsolutePath);
|
||||||
static QString caseNameFromGridFileName(QString fullGridFilePathName);
|
static QString caseNameFromGridFileName(QString fullGridFilePathName);
|
||||||
|
|
||||||
|
static int firstCaseId(RimProject* project);
|
||||||
|
static int firstGroupId(RimProject* project);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_replaceCase_caseId;
|
std::map<int, QString> m_caseIdToGridFileNameMap;
|
||||||
QString m_replaceCase_gridFileName;
|
std::map<int, std::vector<QString> > m_groupIdToGridFileNamesMap;
|
||||||
|
|
||||||
int m_replaceSourceCases_caseGroupId;
|
|
||||||
std::vector<QString> m_replaceSourceCases_gridFileNames;
|
|
||||||
|
|
||||||
static const int UNDEFINED = -1;
|
|
||||||
static const int FIRST_OCCURENCE = -999;
|
static const int FIRST_OCCURENCE = -999;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user