mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' into hdf-prototype
This commit is contained in:
36
ApplicationCode/Application/CMakeLists_files.cmake
Normal file
36
ApplicationCode/Application/CMakeLists_files.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaDefines.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaPreferences.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaPorosityModel.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaDefines.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaMain.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaPreferences.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaPorosityModel.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.h
|
||||
)
|
||||
|
||||
|
||||
source_group( "Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimDefines.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
@@ -88,9 +87,13 @@
|
||||
#include "RiuFlowCharacteristicsPlot.h"
|
||||
|
||||
#include "RicImportSummaryCaseFeature.h"
|
||||
#include "RicSnapshotViewToClipboardFeature.h"
|
||||
#include "ExportCommands/RicSnapshotViewToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "cafFixedAtlasFont.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
@@ -215,6 +218,8 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
|
||||
m_runningRegressionTests = false;
|
||||
|
||||
m_runningWorkerProcess = false;
|
||||
|
||||
m_mainPlotWindow = NULL;
|
||||
|
||||
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
|
||||
@@ -967,7 +972,7 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
|
||||
RimEclipseView* riv = rimResultReservoir->createAndAddReservoirView();
|
||||
|
||||
// Select SOIL as default result variable
|
||||
riv->cellResult()->setResultType(RimDefines::DYNAMIC_NATIVE);
|
||||
riv->cellResult()->setResultType(RiaDefines::DYNAMIC_NATIVE);
|
||||
|
||||
if (m_preferences->loadAndShowSoil)
|
||||
{
|
||||
@@ -1056,7 +1061,7 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
analysisModels->updateConnectedEditors();
|
||||
@@ -1085,14 +1090,14 @@ bool RiaApplication::openInputEclipseCaseFromFileNames(const QStringList& fileNa
|
||||
|
||||
RimEclipseView* riv = rimInputReservoir->createAndAddReservoirView();
|
||||
|
||||
riv->cellResult()->setResultType(RimDefines::INPUT_PROPERTY);
|
||||
riv->cellResult()->setResultType(RiaDefines::INPUT_PROPERTY);
|
||||
riv->hasUserRequestedAnimation = true;
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
analysisModels->updateConnectedEditors();
|
||||
@@ -1141,7 +1146,7 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName)
|
||||
|
||||
//if (!riv->cellResult()->hasResult())
|
||||
//{
|
||||
// riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
// riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
|
||||
//}
|
||||
progress.incrementProgress();
|
||||
progress.setProgressDescription("Loading results information");
|
||||
@@ -1160,7 +1165,7 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::createMockModel()
|
||||
{
|
||||
openEclipseCase(RimDefines::mockModelBasic(), RimDefines::mockModelBasic());
|
||||
openEclipseCase(RiaDefines::mockModelBasic(), RiaDefines::mockModelBasic());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1168,7 +1173,7 @@ void RiaApplication::createMockModel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::createResultsMockModel()
|
||||
{
|
||||
openEclipseCase(RimDefines::mockModelBasicWithResults(), RimDefines::mockModelBasicWithResults());
|
||||
openEclipseCase(RiaDefines::mockModelBasicWithResults(), RiaDefines::mockModelBasicWithResults());
|
||||
}
|
||||
|
||||
|
||||
@@ -1177,7 +1182,7 @@ void RiaApplication::createResultsMockModel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::createLargeResultsMockModel()
|
||||
{
|
||||
openEclipseCase(RimDefines::mockModelLargeWithResults(), RimDefines::mockModelLargeWithResults());
|
||||
openEclipseCase(RiaDefines::mockModelLargeWithResults(), RiaDefines::mockModelLargeWithResults());
|
||||
}
|
||||
|
||||
|
||||
@@ -1186,7 +1191,7 @@ void RiaApplication::createLargeResultsMockModel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::createMockModelCustomized()
|
||||
{
|
||||
openEclipseCase(RimDefines::mockModelCustomized(), RimDefines::mockModelCustomized());
|
||||
openEclipseCase(RiaDefines::mockModelCustomized(), RiaDefines::mockModelCustomized());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1194,7 +1199,7 @@ void RiaApplication::createMockModelCustomized()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::createInputMockModel()
|
||||
{
|
||||
openInputEclipseCaseFromFileNames(QStringList(RimDefines::mockModelBasicInputCase()));
|
||||
openInputEclipseCaseFromFileNames(QStringList(RiaDefines::mockModelBasicInputCase()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1305,7 +1310,9 @@ bool RiaApplication::parseArguments()
|
||||
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>. Repeat parameter 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. Repeat parameter for multiple replace operations.", cvf::ProgramOptions::MULTI_VALUE, cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt.registerOption("replacePropertiesFolder", "[<caseId>] <newPropertiesFolder>", "Replace the folder containing property files for an eclipse input case.", cvf::ProgramOptions::MULTI_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("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("help", "", "Displays help text.");
|
||||
progOpt.registerOption("?", "", "Displays help text.");
|
||||
progOpt.registerOption("regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
@@ -1468,6 +1475,30 @@ bool RiaApplication::parseArguments()
|
||||
projectLoadAction = PLA_CALCULATE_STATISTICS;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("replacePropertiesFolder"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplacePropertiesFolderFirstOccurrence(propertiesFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !propertiesFolder.isEmpty())
|
||||
{
|
||||
projectModifier->setReplacePropertiesFolder(caseId, propertiesFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadProject(projectFileName, projectLoadAction, projectModifier.p());
|
||||
}
|
||||
@@ -1478,18 +1509,27 @@ bool RiaApplication::parseArguments()
|
||||
QStringList caseNames = cvfqt::Utils::toQStringList(o.values());
|
||||
foreach (QString caseName, caseNames)
|
||||
{
|
||||
QString caseFileNameWithExt = caseName + ".EGRID";
|
||||
if (caf::Utils::fileExists(caseFileNameWithExt))
|
||||
QString fileExtension = caf::Utils::fileExtension(caseName);
|
||||
if (caf::Utils::fileExists(caseName) &&
|
||||
(fileExtension == "EGRID" || fileExtension == "GRID"))
|
||||
{
|
||||
openEclipseCaseFromFile(caseFileNameWithExt);
|
||||
openEclipseCaseFromFile(caseName);
|
||||
}
|
||||
else
|
||||
{
|
||||
caseFileNameWithExt = caseName + ".GRID";
|
||||
QString caseFileNameWithExt = caseName + ".EGRID";
|
||||
if (caf::Utils::fileExists(caseFileNameWithExt))
|
||||
{
|
||||
openEclipseCaseFromFile(caseFileNameWithExt);
|
||||
}
|
||||
else
|
||||
{
|
||||
caseFileNameWithExt = caseName + ".GRID";
|
||||
if (caf::Utils::fileExists(caseFileNameWithExt))
|
||||
{
|
||||
openEclipseCaseFromFile(caseFileNameWithExt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1535,7 +1575,7 @@ bool RiaApplication::parseArguments()
|
||||
// 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");
|
||||
saveSnapshotForAllViews(absolutePathToSnapshotDir);
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
@@ -1561,6 +1601,24 @@ bool RiaApplication::parseArguments()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("commandFile"))
|
||||
{
|
||||
QString commandFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
QFile file(commandFile);
|
||||
RicfMessages messages;
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
// TODO : Error logging?
|
||||
return false;
|
||||
}
|
||||
|
||||
QTextStream in(&file);
|
||||
RicfCommandFileExecutor::instance()->executeCommands(in);
|
||||
closeAllWindows();
|
||||
processEvents();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1780,6 +1838,14 @@ std::vector<QAction*> RiaApplication::recentFileActions() const
|
||||
return m_recentFileActionProvider->actions();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setStartDir(const QString& startDir)
|
||||
{
|
||||
m_startupDefaultDirectory = startDir;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1880,6 +1946,7 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
|
||||
if (exitStatus == QProcess::CrashExit)
|
||||
{
|
||||
// MFLog::error("Simulation execution crashed or was aborted.");
|
||||
m_runningWorkerProcess = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1891,6 +1958,7 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
|
||||
if (exitCode != 0)
|
||||
{
|
||||
// MFLog::error(QString("Simulation execution failed (exit code %1).").arg(exitCode));
|
||||
m_runningWorkerProcess = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1903,6 +1971,7 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
|
||||
{
|
||||
// Disable concept of current case
|
||||
m_socketServer->setCurrentCaseId(-1);
|
||||
m_runningWorkerProcess = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1927,6 +1996,7 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
||||
m_socketServer->setCurrentCaseId(-1);
|
||||
}
|
||||
|
||||
m_runningWorkerProcess = true;
|
||||
m_workerProcess = new caf::UiProcess(this);
|
||||
|
||||
QProcessEnvironment penv = QProcessEnvironment::systemEnvironment();
|
||||
@@ -1963,6 +2033,7 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
||||
{
|
||||
m_workerProcess->close();
|
||||
m_workerProcess = NULL;
|
||||
m_runningWorkerProcess = false;
|
||||
|
||||
RiuMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
|
||||
|
||||
@@ -2082,9 +2153,26 @@ void RiaApplication::terminateProcess()
|
||||
m_workerProcess->close();
|
||||
}
|
||||
|
||||
m_runningWorkerProcess = false;
|
||||
m_workerProcess = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::waitForProcess() const
|
||||
{
|
||||
while (m_runningWorkerProcess)
|
||||
{
|
||||
#ifdef WIN32
|
||||
Sleep(100);
|
||||
#else
|
||||
usleep(100000);
|
||||
#endif
|
||||
processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2182,62 +2270,6 @@ bool RiaApplication::openFile(const QString& fileName)
|
||||
return loadingSucceded;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::saveSnapshotForAllViews(const QString& snapshotFolderName)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if (!mainWnd) return;
|
||||
|
||||
if (m_project.isNull()) return;
|
||||
|
||||
QDir snapshotPath(snapshotFolderName);
|
||||
if (!snapshotPath.exists())
|
||||
{
|
||||
if (!snapshotPath.mkpath(".")) return;
|
||||
}
|
||||
|
||||
const QString absSnapshotPath = snapshotPath.absolutePath();
|
||||
|
||||
std::vector<RimCase*> projectCases;
|
||||
m_project->allCases(projectCases);
|
||||
|
||||
for (size_t i = 0; i < projectCases.size(); i++)
|
||||
{
|
||||
RimCase* cas = projectCases[i];
|
||||
if (!cas) continue;
|
||||
|
||||
std::vector<RimView*> views = cas->views();
|
||||
|
||||
for (size_t j = 0; j < views.size(); j++)
|
||||
{
|
||||
RimView* riv = views[j];
|
||||
|
||||
if (riv && riv->viewer())
|
||||
{
|
||||
setActiveReservoirView(riv);
|
||||
|
||||
RiuViewer* viewer = riv->viewer();
|
||||
mainWnd->setActiveViewer(viewer->layoutWidget());
|
||||
|
||||
clearViewsScheduledForUpdate();
|
||||
|
||||
//riv->updateCurrentTimeStepAndRedraw();
|
||||
riv->createDisplayModelAndRedraw();
|
||||
viewer->repaint();
|
||||
|
||||
QString fileName = cas->caseUserDescription() + "-" + riv->name();
|
||||
fileName = caf::Utils::makeValidFileBasename(fileName);
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(absSnapshotPath, fileName, ".png");
|
||||
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, riv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2259,7 +2291,7 @@ void RiaApplication::runMultiCaseSnapshots(const QString& templateProjectFileNam
|
||||
bool loadOk = loadProject(templateProjectFileName, PLA_NONE, &modifier);
|
||||
if (loadOk)
|
||||
{
|
||||
saveSnapshotForAllViews(snapshotFolderName);
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(snapshotFolderName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2404,7 +2436,7 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
|
||||
resizeMaximizedPlotWindows();
|
||||
|
||||
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
|
||||
saveSnapshotForAllViews(fullPathGeneratedFolder);
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(fullPathGeneratedFolder);
|
||||
|
||||
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(fullPathGeneratedFolder);
|
||||
|
||||
|
||||
@@ -82,6 +82,12 @@ public:
|
||||
NAVIGATION_POLICY_RMS
|
||||
};
|
||||
|
||||
enum ProjectLoadAction
|
||||
{
|
||||
PLA_NONE = 0,
|
||||
PLA_CALCULATE_STATISTICS = 1
|
||||
};
|
||||
|
||||
public:
|
||||
RiaApplication(int& argc, char** argv);
|
||||
~RiaApplication();
|
||||
@@ -123,6 +129,7 @@ public:
|
||||
QString currentProjectPath() const;
|
||||
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
|
||||
bool loadProject(const QString& projectFileName);
|
||||
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
||||
bool saveProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
bool saveProjectPromptForFileName();
|
||||
@@ -134,7 +141,6 @@ public:
|
||||
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||
|
||||
void saveSnapshotForAllViews(const QString& snapshotFolderName);
|
||||
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
||||
void runRegressionTest(const QString& testRootPath);
|
||||
|
||||
@@ -158,6 +164,7 @@ public:
|
||||
bool launchProcess(const QString& program, const QStringList& arguments);
|
||||
bool launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds);
|
||||
void terminateProcess();
|
||||
void waitForProcess() const;
|
||||
|
||||
RiaPreferences* preferences();
|
||||
void applyPreferences();
|
||||
@@ -194,20 +201,16 @@ public:
|
||||
void addToRecentFiles(const QString& fileName);
|
||||
std::vector<QAction*> recentFileActions() const;
|
||||
|
||||
private:
|
||||
enum ProjectLoadAction
|
||||
{
|
||||
PLA_NONE = 0,
|
||||
PLA_CALCULATE_STATISTICS = 1
|
||||
};
|
||||
void setStartDir(const QString& startDir);
|
||||
|
||||
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
||||
static std::vector<QString> readFileListFromTextFile(QString listFileName);
|
||||
|
||||
void clearViewsScheduledForUpdate();
|
||||
|
||||
private:
|
||||
|
||||
void onProjectOpenedOrClosed();
|
||||
std::vector<QString> readFileListFromTextFile(QString listFileName);
|
||||
void setWindowCaptionFromAppState();
|
||||
|
||||
void clearViewsScheduledForUpdate();
|
||||
|
||||
void createMainPlotWindow();
|
||||
void deleteMainPlotWindow();
|
||||
@@ -264,6 +267,8 @@ private:
|
||||
QString m_helpText;
|
||||
bool m_runningRegressionTests;
|
||||
|
||||
bool m_runningWorkerProcess;
|
||||
|
||||
RiuMainPlotWindow* m_mainPlotWindow;
|
||||
|
||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||
|
||||
352
ApplicationCode/Application/RiaDefines.cpp
Normal file
352
ApplicationCode/Application/RiaDefines.cpp
Normal file
@@ -0,0 +1,352 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum< RiaDefines::ResultCatType >::setUp()
|
||||
{
|
||||
addItem(RiaDefines::DYNAMIC_NATIVE, "DYNAMIC_NATIVE", "Dynamic");
|
||||
addItem(RiaDefines::STATIC_NATIVE, "STATIC_NATIVE", "Static");
|
||||
addItem(RiaDefines::SOURSIMRL, "SOURSIMRL", "SourSimRL");
|
||||
addItem(RiaDefines::GENERATED, "GENERATED", "Generated");
|
||||
addItem(RiaDefines::INPUT_PROPERTY, "INPUT_PROPERTY", "Input Property");
|
||||
addItem(RiaDefines::FORMATION_NAMES, "FORMATION_NAMES", "Formation Names");
|
||||
addItem(RiaDefines::FLOW_DIAGNOSTICS, "FLOW_DIAGNOSTICS", "Flow Diagnostics");
|
||||
setDefault(RiaDefines::DYNAMIC_NATIVE);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RiaDefines::DepthUnitType >::setUp()
|
||||
{
|
||||
addItem(RiaDefines::UNIT_METER, "UNIT_METER", "Meter");
|
||||
addItem(RiaDefines::UNIT_FEET, "UNIT_FEET", "Feet");
|
||||
addItem(RiaDefines::UNIT_NONE, "UNIT_NONE", "None");
|
||||
|
||||
|
||||
setDefault(RiaDefines::UNIT_METER);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RiaDefines::PlotAxis >::setUp()
|
||||
{
|
||||
addItem(RiaDefines::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left");
|
||||
addItem(RiaDefines::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right");
|
||||
|
||||
setDefault(RiaDefines::PLOT_AXIS_LEFT);
|
||||
}
|
||||
|
||||
template<>
|
||||
void caf::AppEnum< RiaDefines::CompletionType >::setUp()
|
||||
{
|
||||
addItem(RiaDefines::WELL_PATH, "WELL_PATH", "Well Path");
|
||||
addItem(RiaDefines::PERFORATION_INTERVAL, "PERFORATION_INTERVAL", "Perforation Interval");
|
||||
addItem(RiaDefines::FISHBONES, "FISHBONES", "Fishbones");
|
||||
|
||||
setDefault(RiaDefines::WELL_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaDefines::isPerCellFaceResult(const QString& resultName)
|
||||
{
|
||||
if (resultName.compare(RiaDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::ternarySaturationResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedRiTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedRiMultResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedRiAreaNormTranResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedWaterFluxResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedOilFluxResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.compare(RiaDefines::combinedGasFluxResultName(), Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (resultName.endsWith("IJK"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::undefinedResultName()
|
||||
{
|
||||
return "None";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::undefinedGridFaultName()
|
||||
{
|
||||
return "Undefined Grid Faults";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::undefinedGridFaultWithInactiveName()
|
||||
{
|
||||
return "Undefined Grid Faults With Inactive";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedTransmissibilityResultName()
|
||||
{
|
||||
return "TRANXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedWaterFluxResultName()
|
||||
{
|
||||
return "FLRWATIJK";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedOilFluxResultName()
|
||||
{
|
||||
return "FLROILIJK";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedGasFluxResultName()
|
||||
{
|
||||
return "FLRGASIJK";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::ternarySaturationResultName()
|
||||
{
|
||||
return "TERNARY";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedMultResultName()
|
||||
{
|
||||
return "MULTXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riTranXResultName()
|
||||
{
|
||||
return "riTRANX";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riTranYResultName()
|
||||
{
|
||||
return "riTRANY";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riTranZResultName()
|
||||
{
|
||||
return "riTRANZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedRiTranResultName()
|
||||
{
|
||||
return "riTRANXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riMultXResultName()
|
||||
{
|
||||
return "riMULTX";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riMultYResultName()
|
||||
{
|
||||
return "riMULTY";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riMultZResultName()
|
||||
{
|
||||
return "riMULTZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedRiMultResultName()
|
||||
{
|
||||
return "riMULTXYZ";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riAreaNormTranXResultName()
|
||||
{
|
||||
return "riTRANXbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riAreaNormTranYResultName()
|
||||
{
|
||||
return "riTRANYbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::riAreaNormTranZResultName()
|
||||
{
|
||||
return "riTRANZbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::combinedRiAreaNormTranResultName()
|
||||
{
|
||||
return "riTRANXYZbyArea";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::completionTypeResultName()
|
||||
{
|
||||
return "Completion Type";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelBasic()
|
||||
{
|
||||
return "Result Mock Debug Model Simple";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelBasicWithResults()
|
||||
{
|
||||
return "Result Mock Debug Model With Results";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelLargeWithResults()
|
||||
{
|
||||
return "Result Mock Debug Model Large With Results";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelCustomized()
|
||||
{
|
||||
return "Result Mock Debug Model Customized";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaDefines::mockModelBasicInputCase()
|
||||
{
|
||||
return "Input Mock Debug Model Simple";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaDefines::minimumDefaultValuePlot()
|
||||
{
|
||||
return -10.0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaDefines::maximumDefaultValuePlot()
|
||||
{
|
||||
return 100.0;
|
||||
}
|
||||
103
ApplicationCode/Application/RiaDefines.h
Normal file
103
ApplicationCode/Application/RiaDefines.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace RiaDefines
|
||||
{
|
||||
enum ResultCatType
|
||||
{
|
||||
DYNAMIC_NATIVE,
|
||||
STATIC_NATIVE,
|
||||
SOURSIMRL,
|
||||
GENERATED,
|
||||
INPUT_PROPERTY,
|
||||
FORMATION_NAMES,
|
||||
FLOW_DIAGNOSTICS,
|
||||
REMOVED
|
||||
};
|
||||
|
||||
enum CompletionType {
|
||||
WELL_PATH,
|
||||
PERFORATION_INTERVAL,
|
||||
FISHBONES
|
||||
};
|
||||
|
||||
bool isPerCellFaceResult(const QString& resultName);
|
||||
|
||||
QString undefinedResultName();
|
||||
QString undefinedGridFaultName();
|
||||
QString undefinedGridFaultWithInactiveName();
|
||||
QString combinedTransmissibilityResultName();
|
||||
QString combinedWaterFluxResultName();
|
||||
QString combinedOilFluxResultName();
|
||||
QString combinedGasFluxResultName();
|
||||
|
||||
QString ternarySaturationResultName();
|
||||
QString combinedMultResultName();
|
||||
|
||||
QString riTranXResultName();
|
||||
QString riTranYResultName();
|
||||
QString riTranZResultName();
|
||||
QString combinedRiTranResultName();
|
||||
|
||||
QString riMultXResultName();
|
||||
QString riMultYResultName();
|
||||
QString riMultZResultName();
|
||||
QString combinedRiMultResultName();
|
||||
|
||||
QString riAreaNormTranXResultName();
|
||||
QString riAreaNormTranYResultName();
|
||||
QString riAreaNormTranZResultName();
|
||||
QString combinedRiAreaNormTranResultName();
|
||||
|
||||
QString completionTypeResultName();
|
||||
|
||||
// Mock model text identifiers
|
||||
QString mockModelBasic();
|
||||
QString mockModelBasicWithResults();
|
||||
QString mockModelLargeWithResults();
|
||||
QString mockModelCustomized();
|
||||
QString mockModelBasicInputCase();
|
||||
|
||||
|
||||
//Units and conversions
|
||||
enum DepthUnitType
|
||||
{
|
||||
UNIT_METER,
|
||||
UNIT_FEET,
|
||||
UNIT_NONE
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Defines relate to plotting
|
||||
enum PlotAxis
|
||||
{
|
||||
PLOT_AXIS_LEFT,
|
||||
PLOT_AXIS_RIGHT
|
||||
};
|
||||
|
||||
double minimumDefaultValuePlot();
|
||||
double maximumDefaultValuePlot();
|
||||
};
|
||||
|
||||
62
ApplicationCode/Application/RiaMain.cpp
Normal file
62
ApplicationCode/Application/RiaMain.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMessagePanel.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
RiaApplication app(argc, argv);
|
||||
|
||||
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
|
||||
int unitTestResult = app.parseArgumentsAndRunUnitTestsIfRequested();
|
||||
if (unitTestResult > -1)
|
||||
{
|
||||
return unitTestResult;
|
||||
}
|
||||
|
||||
RiuMainWindow window;
|
||||
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
||||
window.setWindowTitle("ResInsight " + platform);
|
||||
window.setDefaultWindowSize();
|
||||
window.loadWinGeoAndDockToolBarLayout();
|
||||
window.showWindow();
|
||||
|
||||
if (app.parseArguments())
|
||||
{
|
||||
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(window.messagePanel()));
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
int exitCode = app.exec();
|
||||
RiaLogging::deleteLoggerInstance();
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
RiaLogging::deleteLoggerInstance();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
34
ApplicationCode/Application/RiaPorosityModel.cpp
Normal file
34
ApplicationCode/Application/RiaPorosityModel.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void caf::AppEnum< RiaDefines::PorosityModelType >::setUp()
|
||||
{
|
||||
addItem(RiaDefines::MATRIX_MODEL, "MATRIX_MODEL", "Matrix");
|
||||
addItem(RiaDefines::FRACTURE_MODEL, "FRACTURE_MODEL", "Fracture");
|
||||
|
||||
setDefault(RiaDefines::MATRIX_MODEL);
|
||||
}
|
||||
}
|
||||
31
ApplicationCode/Application/RiaPorosityModel.h
Normal file
31
ApplicationCode/Application/RiaPorosityModel.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
namespace RiaDefines
|
||||
{
|
||||
enum PorosityModelType
|
||||
{
|
||||
MATRIX_MODEL,
|
||||
FRACTURE_MODEL
|
||||
};
|
||||
};
|
||||
41
ApplicationCode/Application/Tools/CMakeLists_files.cmake
Normal file
41
ApplicationCode/Application/Tools/CMakeLists_files.cmake
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTables.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaEclipseUnitTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaLogging.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTables.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaEclipseUnitTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaLogging.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
)
|
||||
|
||||
|
||||
source_group( "Application\\Tools" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
||||
84
ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp
Normal file
84
ApplicationCode/Application/Tools/RiaEclipseUnitTools.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RiaEclipseUnitTools::UnitSystemType::setUp()
|
||||
{
|
||||
addItem(RiaEclipseUnitTools::UNITS_METRIC, "UNITS_METRIC", "Metric");
|
||||
addItem(RiaEclipseUnitTools::UNITS_FIELD, "UNITS_FIELD", "Field");
|
||||
addItem(RiaEclipseUnitTools::UNITS_UNKNOWN, "UNITS_UNKNOWN", "Unknown");
|
||||
|
||||
setDefault(RiaEclipseUnitTools::UNITS_METRIC);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaEclipseUnitTools::darcysConstant(UnitSystem unitSystem)
|
||||
{
|
||||
// See "Cartesian transmissibility calculations" in the "Eclipse Technical Description"
|
||||
// CDARCY Darcys constant
|
||||
// = 0.00852702 (E300); 0.008527 (ECLIPSE 100) (METRIC)
|
||||
// = 0.00112712 (E300); 0.001127 (ECLIPSE 100) (FIELD)
|
||||
// = 3.6 (LAB)
|
||||
// = 0.00864 (PVT - M)
|
||||
switch (unitSystem)
|
||||
{
|
||||
case UNITS_FIELD:
|
||||
return 0.001127;
|
||||
case UNITS_METRIC:
|
||||
return 0.008527;
|
||||
default:
|
||||
CVF_ASSERT(false);
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaEclipseUnitTools::convertConductivtyValue(double Kw, UnitSystem fromUnit, UnitSystem toUnit)
|
||||
{
|
||||
|
||||
if (fromUnit == toUnit) return Kw;
|
||||
|
||||
else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD)
|
||||
{
|
||||
return meterToFeet(Kw);
|
||||
}
|
||||
else if (fromUnit == UNITS_METRIC && toUnit == UNITS_FIELD)
|
||||
{
|
||||
return feetToMeter(Kw);
|
||||
}
|
||||
|
||||
CVF_ASSERT(false);
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
51
ApplicationCode/Application/Tools/RiaEclipseUnitTools.h
Normal file
51
ApplicationCode/Application/Tools/RiaEclipseUnitTools.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
class RiaEclipseUnitTools
|
||||
{
|
||||
|
||||
public:
|
||||
enum UnitSystem
|
||||
{
|
||||
UNITS_METRIC,
|
||||
UNITS_FIELD,
|
||||
UNITS_LAB,
|
||||
UNITS_UNKNOWN,
|
||||
};
|
||||
|
||||
typedef caf::AppEnum< RiaEclipseUnitTools::UnitSystem > UnitSystemType;
|
||||
|
||||
static double feetPerMeter() { return 3.2808399; }
|
||||
static double meterPerFeet() { return 0.3048000; }
|
||||
|
||||
static double meterToFeet(double meter) { return meter*feetPerMeter(); }
|
||||
static double feetToMeter(double feet) { return feet*meterPerFeet();}
|
||||
static double meterToInch(double meter) { return meter*feetPerMeter()*12; }
|
||||
static double inchToMeter(double inch) { return (inch / 12)*meterPerFeet(); }
|
||||
static double inchToFeet(double inch) { return inch / 12.0; }
|
||||
|
||||
static double darcysConstant(UnitSystem unitSystem);
|
||||
|
||||
static double convertConductivtyValue(double Kw, UnitSystem fromUnit, UnitSystem toUnit);
|
||||
|
||||
};
|
||||
|
||||
@@ -1,156 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::RiaImageFileCompare(QString compareExecutable)
|
||||
: m_compareExecutable(compareExecutable)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::~RiaImageFileCompare()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaImageFileCompare::reset()
|
||||
{
|
||||
m_imagesEqual = false;
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_errorMsg = "";
|
||||
m_errorDetails = "";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (m_compareExecutable.isEmpty())
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Cannot compare images, no compare executable set";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
// The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options
|
||||
// Use GCC version as a crude mechanism for disabling use of this option on RedHat5
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
|
||||
QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#else
|
||||
QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#endif
|
||||
QString completeCommand = QString("\"%1\" %2").arg(m_compareExecutable).arg(args);
|
||||
|
||||
// Launch process and wait
|
||||
QProcess proc;
|
||||
proc.start(completeCommand);
|
||||
proc.waitForFinished(30000);
|
||||
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if (procError != QProcess::UnknownError)
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray stdErr = proc.readAllStandardError();
|
||||
int procExitCode = proc.exitCode();
|
||||
if (procExitCode == 0)
|
||||
{
|
||||
// Strip out whitespace and look for 0 (as in zero pixel differences)
|
||||
stdErr = stdErr.simplified();
|
||||
if (!stdErr.isEmpty() && stdErr[0] == '0')
|
||||
{
|
||||
m_imagesEqual = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Report non-severe error
|
||||
m_lastError = IC_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = stdErr;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::imagesEqual() const
|
||||
{
|
||||
return m_imagesEqual;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::ErrorType RiaImageFileCompare::error() const
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorMessage() const
|
||||
{
|
||||
return m_errorMsg;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorDetails() const
|
||||
{
|
||||
return m_errorDetails;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::RiaImageFileCompare(QString compareExecutable)
|
||||
: m_compareExecutable(compareExecutable)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::~RiaImageFileCompare()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaImageFileCompare::reset()
|
||||
{
|
||||
m_imagesEqual = false;
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_errorMsg = "";
|
||||
m_errorDetails = "";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (m_compareExecutable.isEmpty())
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Cannot compare images, no compare executable set";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
// The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options
|
||||
// Use GCC version as a crude mechanism for disabling use of this option on RedHat5
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
|
||||
QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#else
|
||||
QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#endif
|
||||
QString completeCommand = QString("\"%1\" %2").arg(m_compareExecutable).arg(args);
|
||||
|
||||
// Launch process and wait
|
||||
QProcess proc;
|
||||
proc.start(completeCommand);
|
||||
proc.waitForFinished(30000);
|
||||
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if (procError != QProcess::UnknownError)
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray stdErr = proc.readAllStandardError();
|
||||
int procExitCode = proc.exitCode();
|
||||
if (procExitCode == 0)
|
||||
{
|
||||
// Strip out whitespace and look for 0 (as in zero pixel differences)
|
||||
stdErr = stdErr.simplified();
|
||||
if (!stdErr.isEmpty() && stdErr[0] == '0')
|
||||
{
|
||||
m_imagesEqual = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Report non-severe error
|
||||
m_lastError = IC_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = stdErr;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::imagesEqual() const
|
||||
{
|
||||
return m_imagesEqual;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::ErrorType RiaImageFileCompare::error() const
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorMessage() const
|
||||
{
|
||||
return m_errorMsg;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorDetails() const
|
||||
{
|
||||
return m_errorDetails;
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimOilField.h"
|
||||
@@ -75,6 +76,25 @@ void RiaProjectModifier::setReplaceSourceCasesById(int caseGroupIdToReplace, std
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaProjectModifier::setReplacePropertiesFolderFirstOccurrence(QString newPropertiesFolder)
|
||||
{
|
||||
m_caseIdToPropertiesFolderMap[RiaProjectModifier::firstOccurrenceId()] = makeFilePathAbsolute(newPropertiesFolder);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaProjectModifier::setReplacePropertiesFolder(int caseIdToReplace, QString newPropertiesFolder)
|
||||
{
|
||||
if (caseIdToReplace >= 0)
|
||||
{
|
||||
m_caseIdToPropertiesFolderMap[caseIdToReplace] = makeFilePathAbsolute(newPropertiesFolder);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -90,6 +110,11 @@ bool RiaProjectModifier::applyModificationsToProject(RimProject* project)
|
||||
replaceSourceCases(project);
|
||||
}
|
||||
|
||||
if (m_caseIdToPropertiesFolderMap.size() > 0)
|
||||
{
|
||||
replacePropertiesFolder(project);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -167,6 +192,38 @@ void RiaProjectModifier::replaceCase(RimProject* project)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaProjectModifier::replacePropertiesFolder(RimProject* project)
|
||||
{
|
||||
std::vector<RimCase*> allCases;
|
||||
project->allCases(allCases);
|
||||
|
||||
for (RimCase* rimCase : allCases)
|
||||
{
|
||||
RimEclipseInputCase* inputCase = dynamic_cast<RimEclipseInputCase*>(rimCase);
|
||||
|
||||
if (inputCase)
|
||||
{
|
||||
for (auto item : m_caseIdToPropertiesFolderMap)
|
||||
{
|
||||
int caseIdToReplace = item.first;
|
||||
|
||||
if (caseIdToReplace == RiaProjectModifier::firstOccurrenceId())
|
||||
{
|
||||
caseIdToReplace = firstInputCaseId(project);
|
||||
}
|
||||
|
||||
if (caseIdToReplace == inputCase->caseId())
|
||||
{
|
||||
inputCase->updateAdditionalFileFolder(item.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Returns absolute path name to the specified file.
|
||||
///
|
||||
@@ -236,6 +293,26 @@ int RiaProjectModifier::firstGroupId(RimProject* project)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaProjectModifier::firstInputCaseId(RimProject * project)
|
||||
{
|
||||
std::vector<RimCase*> allCases;
|
||||
project->allCases(allCases);
|
||||
|
||||
for (RimCase* rimCase : allCases)
|
||||
{
|
||||
RimEclipseInputCase* resultCase = dynamic_cast<RimEclipseInputCase*>(rimCase);
|
||||
if (resultCase)
|
||||
{
|
||||
return resultCase->caseId();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -47,21 +47,28 @@ public:
|
||||
void setReplaceSourceCasesFirstOccurrence(std::vector<QString> newGridFileNames);
|
||||
void setReplaceSourceCasesById(int caseGroupIdToReplace, std::vector<QString> newGridFileNames);
|
||||
|
||||
void setReplacePropertiesFolderFirstOccurrence(QString newPropertiesFolder);
|
||||
void setReplacePropertiesFolder(int caseIdToReplace, QString newPropertiesFolder);
|
||||
|
||||
bool applyModificationsToProject(RimProject* project);
|
||||
|
||||
private:
|
||||
void replaceSourceCases(RimProject* project);
|
||||
void replaceCase(RimProject* project);
|
||||
void replacePropertiesFolder(RimProject* project);
|
||||
|
||||
static QString makeFilePathAbsolute(QString relOrAbsolutePath);
|
||||
static QString caseNameFromGridFileName(QString fullGridFilePathName);
|
||||
|
||||
static int firstCaseId(RimProject* project);
|
||||
static int firstGroupId(RimProject* project);
|
||||
static int firstInputCaseId(RimProject* project);
|
||||
|
||||
static int firstOccurrenceId();
|
||||
|
||||
private:
|
||||
std::map<int, QString> m_caseIdToGridFileNameMap;
|
||||
std::map<int, std::vector<QString> > m_groupIdToGridFileNamesMap;
|
||||
std::map<int, QString> m_caseIdToPropertiesFolderMap;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user