Merge branch 'master' into hdf-prototype

This commit is contained in:
Bjørnar Grip Fjær
2017-06-22 10:16:09 +02:00
3912 changed files with 18718 additions and 174224 deletions

View File

@@ -322,3 +322,46 @@ exceptions:
CRAVA is a software package for seismic inversion and conditioning of CRAVA is a software package for seismic inversion and conditioning of
geological reservoir models. CRAVA is copyrighted by the Norwegian geological reservoir models. CRAVA is copyrighted by the Norwegian
Computing Center and Statoil and licensed under GPLv3+. Computing Center and Statoil and licensed under GPLv3+.
===============================================================================
Notice for opm-flowdiagnostics and opm-flowdiagnostics-applications libraries
===============================================================================
Copyright 2016, 2017 Statoil ASA.
This file is part of the Open Porous Media Project (OPM).
OPM 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.
OPM 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 for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
===============================================================================
Notice for the NightCharts code
===============================================================================
NightCharts
Copyright (C) 2010 by Alexander A. Avdonin, Artem N. Ivanov / ITGears Co.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Please contact gordos.kund@gmail.com with any questions on this license.

View File

@@ -143,7 +143,7 @@ namespace RegTestNames
const QString generatedFolderName = "RegTestGeneratedImages"; const QString generatedFolderName = "RegTestGeneratedImages";
const QString diffFolderName = "RegTestDiffImages"; const QString diffFolderName = "RegTestDiffImages";
const QString baseFolderName = "RegTestBaseImages"; const QString baseFolderName = "RegTestBaseImages";
const QString testProjectName = "RegressionTest.rip"; const QString testProjectName = "RegressionTest";
const QString testFolderFilter = "TestCase*"; const QString testFolderFilter = "TestCase*";
const QString imageCompareExeName = "compare"; const QString imageCompareExeName = "compare";
const QString reportFileName = "ResInsightRegressionTestReport.html"; const QString reportFileName = "ResInsightRegressionTestReport.html";
@@ -348,7 +348,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
// Open the project file and read the serialized data. // Open the project file and read the serialized data.
// Will initialize itself. // Will initialize itself.
if (!QFile::exists(projectFileName)) if (!caf::Utils::fileExists(projectFileName))
{ {
RiaLogging::info(QString("File does not exist : '%1'").arg(projectFileName)); RiaLogging::info(QString("File does not exist : '%1'").arg(projectFileName));
return false; return false;
@@ -714,7 +714,7 @@ bool RiaApplication::saveProject()
{ {
CVF_ASSERT(m_project.notNull()); CVF_ASSERT(m_project.notNull());
if (!QFile::exists(m_project->fileName())) if (!caf::Utils::fileExists(m_project->fileName()))
{ {
return saveProjectPromptForFileName(); return saveProjectPromptForFileName();
} }
@@ -940,7 +940,7 @@ QString RiaApplication::createAbsolutePathFromProjectRelativePath(QString projec
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaApplication::openEclipseCaseFromFile(const QString& fileName) bool RiaApplication::openEclipseCaseFromFile(const QString& fileName)
{ {
if (!QFile::exists(fileName)) return false; if (!caf::Utils::fileExists(fileName)) return false;
QFileInfo gridFileName(fileName); QFileInfo gridFileName(fileName);
QString caseName = gridFileName.completeBaseName(); QString caseName = gridFileName.completeBaseName();
@@ -1113,7 +1113,7 @@ bool RiaApplication::openInputEclipseCaseFromFileNames(const QStringList& fileNa
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaApplication::openOdbCaseFromFile(const QString& fileName) bool RiaApplication::openOdbCaseFromFile(const QString& fileName)
{ {
if (!QFile::exists(fileName)) return false; if (!caf::Utils::fileExists(fileName)) return false;
QFileInfo gridFileName(fileName); QFileInfo gridFileName(fileName);
QString caseName = gridFileName.completeBaseName(); QString caseName = gridFileName.completeBaseName();
@@ -1399,7 +1399,8 @@ bool RiaApplication::parseArguments()
std::vector<QString> gridFiles = readFileListFromTextFile(gridListFile); std::vector<QString> gridFiles = readFileListFromTextFile(gridListFile);
runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots"); runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
closeProject(); closeAllWindows();
processEvents();
return false; return false;
} }
@@ -1478,14 +1479,14 @@ bool RiaApplication::parseArguments()
foreach (QString caseName, caseNames) foreach (QString caseName, caseNames)
{ {
QString caseFileNameWithExt = caseName + ".EGRID"; QString caseFileNameWithExt = caseName + ".EGRID";
if (QFile::exists(caseFileNameWithExt)) if (caf::Utils::fileExists(caseFileNameWithExt))
{ {
openEclipseCaseFromFile(caseFileNameWithExt); openEclipseCaseFromFile(caseFileNameWithExt);
} }
else else
{ {
caseFileNameWithExt = caseName + ".GRID"; caseFileNameWithExt = caseName + ".GRID";
if (QFile::exists(caseFileNameWithExt)) if (caf::Utils::fileExists(caseFileNameWithExt))
{ {
openEclipseCaseFromFile(caseFileNameWithExt); openEclipseCaseFromFile(caseFileNameWithExt);
} }
@@ -1552,7 +1553,8 @@ bool RiaApplication::parseArguments()
} }
} }
closeProject(); closeAllWindows();
processEvents();
} }
// Returning false will exit the application // Returning false will exit the application
@@ -1708,6 +1710,24 @@ RimViewWindow* RiaApplication::activeViewWindow()
return viewWindow; return viewWindow;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::isMain3dWindowVisible() const
{
return RiuMainWindow::instance()->isVisible();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::isMainPlotWindowVisible() const
{
if (!m_mainPlotWindow) return false;
return m_mainPlotWindow->isVisible();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -2115,7 +2135,7 @@ void RiaApplication::setLastUsedDialogDirectory(const QString& dialogName, const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaApplication::openFile(const QString& fileName) bool RiaApplication::openFile(const QString& fileName)
{ {
if (!QFile::exists(fileName)) return false; if (!caf::Utils::fileExists(fileName)) return false;
bool loadingSucceded = false; bool loadingSucceded = false;
@@ -2259,6 +2279,18 @@ void removeDirectoryWithContent(QDir dirToDelete )
dirToDelete.rmdir("."); dirToDelete.rmdir(".");
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void logInfoTextWithTimeInSeconds(const QTime& time, const QString& msg)
{
double timeRunning = time.elapsed() / 1000.0;
QString timeText = QString("(%1 s) ").arg(timeRunning, 0, 'f', 1);
RiaLogging::info(timeText + msg);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -2315,6 +2347,11 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
} }
} }
QTime timeStamp;
timeStamp.start();
logInfoTextWithTimeInSeconds(timeStamp, "Starting regression tests\n");
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx) for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{ {
QDir testCaseFolder(folderList[dirIdx].filePath()); QDir testCaseFolder(folderList[dirIdx].filePath());
@@ -2336,9 +2373,24 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx) for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{ {
QDir testCaseFolder(folderList[dirIdx].filePath()); QDir testCaseFolder(folderList[dirIdx].filePath());
if (testCaseFolder.exists(regTestProjectName))
QString projectFileName;
if (testCaseFolder.exists(regTestProjectName + ".rip"))
{ {
loadProject(testCaseFolder.filePath(regTestProjectName)); projectFileName = regTestProjectName + ".rip";
}
if (testCaseFolder.exists(regTestProjectName + ".rsp"))
{
projectFileName = regTestProjectName + ".rsp";
}
if (!projectFileName.isEmpty())
{
logInfoTextWithTimeInSeconds(timeStamp, "Initializing test :" + testCaseFolder.absolutePath());
loadProject(testCaseFolder.filePath(projectFileName));
// Wait until all command objects have completed // Wait until all command objects have completed
while (!m_commandQueueLock.tryLock()) while (!m_commandQueueLock.tryLock())
@@ -2349,6 +2401,8 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
regressionTestConfigureProject(); regressionTestConfigureProject();
resizeMaximizedPlotWindows();
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName); QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
saveSnapshotForAllViews(fullPathGeneratedFolder); saveSnapshotForAllViews(fullPathGeneratedFolder);
@@ -2373,12 +2427,49 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
} }
closeProject(); closeProject();
logInfoTextWithTimeInSeconds(timeStamp, "Completed test :" + testCaseFolder.absolutePath());
} }
} }
RiaLogging::info("\n");
logInfoTextWithTimeInSeconds(timeStamp, "Completed regression tests");
m_runningRegressionTests = false; m_runningRegressionTests = false;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::resizeMaximizedPlotWindows()
{
std::vector<RimViewWindow*> viewWindows;
m_project->mainPlotCollection()->descendantsIncludingThisOfType(viewWindows);
for (auto viewWindow : viewWindows)
{
if (viewWindow->isMdiWindow())
{
RimMdiWindowGeometry wndGeo = viewWindow->mdiWindowGeometry();
if (wndGeo.isMaximized)
{
QWidget* viewWidget = viewWindow->viewWidget();
if (viewWidget)
{
QMdiSubWindow* mdiWindow = m_mainPlotWindow->findMdiSubWindow(viewWidget);
if (mdiWindow)
{
mdiWindow->showNormal();
viewWidget->resize(RiaApplication::regressionDefaultImageSize());
}
}
}
}
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -2773,7 +2864,6 @@ void RiaApplication::executeRegressionTests(const QString& regressionTestPath)
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -2808,8 +2898,16 @@ void RiaApplication::regressionTestConfigureProject()
} }
// This size is set to match the regression test reference images // This size is set to match the regression test reference images
riv->viewer()->setFixedSize(1000, 745); riv->viewer()->setFixedSize(RiaApplication::regressionDefaultImageSize());
} }
} }
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiaApplication::regressionDefaultImageSize()
{
return QSize(1000, 745);
}

View File

@@ -137,8 +137,6 @@ public:
void saveSnapshotForAllViews(const QString& snapshotFolderName); void saveSnapshotForAllViews(const QString& snapshotFolderName);
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName); void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
void runRegressionTest(const QString& testRootPath); void runRegressionTest(const QString& testRootPath);
void updateRegressionTest(const QString& testRootPath );
void regressionTestConfigureProject();
void processNonGuiEvents(); void processNonGuiEvents();
@@ -187,6 +185,9 @@ public:
static RimViewWindow* activeViewWindow(); static RimViewWindow* activeViewWindow();
bool isMain3dWindowVisible() const;
bool isMainPlotWindowVisible() const;
bool tryCloseMainWindow(); bool tryCloseMainWindow();
bool tryClosePlotWindow(); bool tryClosePlotWindow();
@@ -215,6 +216,11 @@ private:
void storeTreeViewState(); void storeTreeViewState();
void resizeMaximizedPlotWindows();
void updateRegressionTest(const QString& testRootPath);
void regressionTestConfigureProject();
static QSize regressionDefaultImageSize();
private slots: private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void slotUpdateScheduledDisplayModels(); void slotUpdateScheduledDisplayModels();

View File

@@ -33,7 +33,7 @@ CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaPreferences::RiaPreferences(void) RiaPreferences::RiaPreferences(void)
{ {
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_CEETRON), "Navigation mode", "", "", ""); CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_CEETRON), "Navigation Mode", "", "", "");
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", ""); CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
@@ -41,27 +41,27 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", ""); CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", "");
scriptEditorExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); scriptEditorExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave executable location", "", "", ""); CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave Executable Location", "", "", "");
octaveExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName()); octaveExecutable.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
octaveExecutable.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); octaveExecutable.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, "Show text header when executing scripts", "", "", ""); CAF_PDM_InitField(&octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, "Show Text Header When Executing Scripts", "", "", "");
octaveShowHeaderInfoWhenExecutingScripts.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); octaveShowHeaderInfoWhenExecutingScripts.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&ssihubAddress, "ssihubAddress", QString("http://"), "ssihub Address", "", "", ""); CAF_PDM_InitField(&ssihubAddress, "ssihubAddress", QString("http://"), "SSIHUB Address", "", "", "");
ssihubAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); ssihubAddress.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&defaultGridLines, "defaultGridLines", true, "Gridlines", "", "", ""); CAF_PDM_InitField(&defaultGridLines, "defaultGridLines", true, "Gridlines", "", "", "");
CAF_PDM_InitField(&defaultGridLineColors, "defaultGridLineColors", cvf::Color3f(0.92f, 0.92f, 0.92f), "Mesh color", "", "", ""); CAF_PDM_InitField(&defaultGridLineColors, "defaultGridLineColors", cvf::Color3f(0.92f, 0.92f, 0.92f), "Mesh Color", "", "", "");
CAF_PDM_InitField(&defaultFaultGridLineColors, "defaultFaultGridLineColors", cvf::Color3f(0.08f, 0.08f, 0.08f), "Mesh color along faults", "", "", ""); CAF_PDM_InitField(&defaultFaultGridLineColors, "defaultFaultGridLineColors", cvf::Color3f(0.08f, 0.08f, 0.08f), "Mesh Color Along Faults", "", "", "");
CAF_PDM_InitField(&defaultWellLabelColor, "defaultWellLableColor", cvf::Color3f(0.92f, 0.92f, 0.92f), "Well label color", "", "The default well label color in new views", ""); CAF_PDM_InitField(&defaultWellLabelColor, "defaultWellLableColor", cvf::Color3f(0.92f, 0.92f, 0.92f), "Well Label Color", "", "The default well label color in new views", "");
CAF_PDM_InitField(&defaultViewerBackgroundColor, "defaultViewerBackgroundColor", cvf::Color3f(0.69f, 0.77f, 0.87f), "Viewer background", "", "The viewer background color for new views", ""); CAF_PDM_InitField(&defaultViewerBackgroundColor, "defaultViewerBackgroundColor", cvf::Color3f(0.69f, 0.77f, 0.87f), "Viewer Background", "", "The viewer background color for new views", "");
CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z scale factor", "", "", ""); CAF_PDM_InitField(&defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "");
CAF_PDM_InitField(&fontSizeInScene, "fontSizeInScene", QString("8"), "Font size", "", "", ""); CAF_PDM_InitField(&fontSizeInScene, "fontSizeInScene", QString("8"), "Font Size", "", "", "");
CAF_PDM_InitField(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS curve without TVD warning", "", "", ""); CAF_PDM_InitField(&showLasCurveWithoutTvdWarning, "showLasCurveWithoutTvdWarning", true, "Show LAS Curve Without TVD Warning", "", "", "");
showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); showLasCurveWithoutTvdWarning.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", ""); CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", "");
@@ -77,21 +77,22 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", ""); CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.uiCapability()->setUiHidden(true); lastUsedProjectFileName.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "Compute DEPTH related properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", ""); CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "Compute DEPTH Related Properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
autocomputeDepthRelatedProperties.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); autocomputeDepthRelatedProperties.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and show SOIL", "", "", ""); CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL", "", "", "");
loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", ""); CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader Settings", "", "", "");
readerSettings = new RifReaderSettings; readerSettings = new RifReaderSettings;
CAF_PDM_InitField(&autoCreatePlotsOnImport, "AutoCreatePlotsOnImport", true, "Create Summary Plots When Importing Eclipse Case", "", "", ""); CAF_PDM_InitField(&autoCreatePlotsOnImport, "AutoCreatePlotsOnImport", true, "Automatically Create Summary Plots On Import", "", "", "");
autoCreatePlotsOnImport.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); autoCreatePlotsOnImport.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&defaultCurveFilter, "DefaultCurveFilter", QString("F*PT"), "Default Vector Selection Filter", "", "", ""); CAF_PDM_InitField(&defaultCurveFilter, "DefaultCurveFilter", QString("F*PT"), "Default Vector Selection Filter", "", "", "");
m_tabNames << "General"; m_tabNames << "General";
m_tabNames << "Eclipse";
m_tabNames << "Octave"; m_tabNames << "Octave";
m_tabNames << "Summary"; m_tabNames << "Summary";
} }
@@ -113,7 +114,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
if (field == &scriptDirectories) if (field == &scriptDirectories)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;
@@ -129,7 +130,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
field == &showLasCurveWithoutTvdWarning || field == &showLasCurveWithoutTvdWarning ||
field == &autoCreatePlotsOnImport) field == &autoCreatePlotsOnImport)
{ {
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute); caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_useNativeCheckBoxLabel = true; myAttr->m_useNativeCheckBoxLabel = true;
@@ -144,33 +145,36 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{ {
if (uiConfigName == m_tabNames[0]) if (uiConfigName == m_tabNames[0])
{ {
caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default settings"); caf::PdmUiGroup* defaultSettingsGroup = uiOrdering.addNewGroup("Default Settings");
defaultSettingsGroup->add(&defaultViewerBackgroundColor); defaultSettingsGroup->add(&defaultViewerBackgroundColor);
defaultSettingsGroup->add(&defaultGridLines); defaultSettingsGroup->add(&defaultGridLines);
defaultSettingsGroup->add(&defaultGridLineColors); defaultSettingsGroup->add(&defaultGridLineColors);
defaultSettingsGroup->add(&defaultFaultGridLineColors); defaultSettingsGroup->add(&defaultFaultGridLineColors);
defaultSettingsGroup->add(&defaultWellLabelColor); defaultSettingsGroup->add(&defaultWellLabelColor);
defaultSettingsGroup->add(&fontSizeInScene); defaultSettingsGroup->add(&fontSizeInScene);
defaultSettingsGroup->add(&defaultScaleFactorZ);
caf::PdmUiGroup* viewsGroup = uiOrdering.addNewGroup("3D views"); caf::PdmUiGroup* viewsGroup = uiOrdering.addNewGroup("3D Views");
viewsGroup->add(&navigationPolicy); viewsGroup->add(&navigationPolicy);
viewsGroup->add(&useShaders); viewsGroup->add(&useShaders);
viewsGroup->add(&showHud); viewsGroup->add(&showHud);
caf::PdmUiGroup* newCaseBehaviourGroup = uiOrdering.addNewGroup("Behavior when loading new case");
newCaseBehaviourGroup->add(&defaultScaleFactorZ);
newCaseBehaviourGroup->add(&autocomputeDepthRelatedProperties);
newCaseBehaviourGroup->add(&loadAndShowSoil);
newCaseBehaviourGroup->add(&showLasCurveWithoutTvdWarning);
readerSettings->defineUiOrdering(uiConfigName, *newCaseBehaviourGroup); caf::PdmUiGroup* otherGroup = uiOrdering.addNewGroup("Other");
otherGroup->add(&ssihubAddress);
caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup("SSIHUB"); otherGroup->add(&showLasCurveWithoutTvdWarning);
ssihubGroup->add(&ssihubAddress);
uiOrdering.add(&appendClassNameToUiText); uiOrdering.add(&appendClassNameToUiText);
} }
else if (uiConfigName == m_tabNames[1]) else if (uiConfigName == m_tabNames[1])
{
caf::PdmUiGroup* newCaseBehaviourGroup = uiOrdering.addNewGroup("Behavior When Loading Data");
newCaseBehaviourGroup->add(&autocomputeDepthRelatedProperties);
newCaseBehaviourGroup->add(&loadAndShowSoil);
readerSettings->defineUiOrdering(uiConfigName, *newCaseBehaviourGroup);
}
else if (uiConfigName == m_tabNames[2])
{ {
caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave"); caf::PdmUiGroup* octaveGroup = uiOrdering.addNewGroup("Octave");
octaveGroup->add(&octaveExecutable); octaveGroup->add(&octaveExecutable);
@@ -180,7 +184,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
scriptGroup->add(&scriptDirectories); scriptGroup->add(&scriptDirectories);
scriptGroup->add(&scriptEditorExecutable); scriptGroup->add(&scriptEditorExecutable);
} }
else if (uiConfigName == m_tabNames[2]) else if (uiConfigName == m_tabNames[3])
{ {
uiOrdering.add(&autoCreatePlotsOnImport); uiOrdering.add(&autoCreatePlotsOnImport);
uiOrdering.add(&defaultCurveFilter); uiOrdering.add(&defaultCurveFilter);

View File

@@ -51,7 +51,7 @@ void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field,
{ {
if (field == &applicationWorkingFolder || field == &regressionTestFolder) if (field == &applicationWorkingFolder || field == &regressionTestFolder)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;

View File

@@ -51,4 +51,5 @@ void RicExitApplicationFeature::onActionTriggered(bool isChecked)
void RicExitApplicationFeature::setupActionLook(QAction* actionToSetup) void RicExitApplicationFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("E&xit"); actionToSetup->setText("E&xit");
actionToSetup->setShortcuts(QKeySequence::Quit);
} }

View File

@@ -66,4 +66,5 @@ void RicOpenProjectFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Open Project"); actionToSetup->setText("Open Project");
actionToSetup->setIcon(QIcon(":/openFolder24x24.png")); actionToSetup->setIcon(QIcon(":/openFolder24x24.png"));
actionToSetup->setShortcuts(QKeySequence::Open);
} }

View File

@@ -54,4 +54,5 @@ void RicSaveProjectAsFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Save Project &As"); actionToSetup->setText("Save Project &As");
actionToSetup->setIcon(QIcon(":/Save.png")); actionToSetup->setIcon(QIcon(":/Save.png"));
actionToSetup->setShortcuts(QKeySequence::SaveAs);
} }

View File

@@ -51,6 +51,7 @@ void RicSaveProjectFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("&Save Project"); actionToSetup->setText("&Save Project");
actionToSetup->setIcon(QIcon(":/Save.png")); actionToSetup->setIcon(QIcon(":/Save.png"));
actionToSetup->setShortcuts(QKeySequence::Save);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -103,7 +103,8 @@ void RiuQPlainTextEdit::slotSelectAll()
/// ///
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RicTextWidget::RicTextWidget(QWidget* parent) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint) RicTextWidget::RicTextWidget(QWidget* parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
{ {
m_textEdit = new RiuQPlainTextEdit(this); m_textEdit = new RiuQPlainTextEdit(this);
m_textEdit->setReadOnly(true); m_textEdit->setReadOnly(true);

View File

@@ -45,6 +45,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h ${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h ${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@@ -83,6 +85,8 @@ ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@@ -94,9 +94,8 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
if (propertyDialog.exec() == QDialog::Accepted) if (propertyDialog.exec() == QDialog::Accepted)
{ {
size_t timeStep = m_cellColors->reservoirView()->currentTimeStep(); size_t timeStep = m_cellColors->reservoirView()->currentTimeStep();
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_cellColors->porosityModel());
bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData(), porosityModel, timeStep, m_cellColors->resultVariable(), exportSettings.eclipseKeyword, exportSettings.undefinedValue); bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData(), timeStep, m_cellColors, exportSettings.eclipseKeyword, exportSettings.undefinedValue);
if (!isOk) if (!isOk)
{ {
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName); QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);

View File

@@ -22,8 +22,10 @@
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RifEclipseSummaryAddress.h" #include "RifEclipseSummaryAddress.h"
#include "RifReaderEclipseSummary.h"
#include "RigSingleWellResultsData.h" #include "RigSingleWellResultsData.h"
#include "RigSummaryCaseData.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
@@ -33,7 +35,7 @@
#include "RimProject.h" #include "RimProject.h"
#include "RimSummaryCaseCollection.h" #include "RimSummaryCaseCollection.h"
#include "RimSummaryCurve.h" #include "RimSummaryCurve.h"
#include "RimSummaryCurveFilter.h" #include "RimSummaryCurveAppearanceCalculator.h"
#include "RimSummaryPlot.h" #include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h" #include "RimSummaryPlotCollection.h"
#include "RimView.h" #include "RimView.h"
@@ -94,67 +96,92 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well); RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
if (!gridSummaryCase) continue; if (!gridSummaryCase) continue;
QString curveFilterText = "W*PR:";
QString description = "Well Production Rates : "; QString description = "Well Production Rates : ";
RigSingleWellResultsData* wRes = well->wellResults(); if (isInjector(well))
if (wRes)
{ {
RimView* rimView = nullptr;
well->firstAncestorOrThisOfTypeAsserted(rimView);
int currentTimeStep = rimView->currentTimeStep();
if (wRes->hasWellResult(currentTimeStep))
{
const RigWellResultFrame& wrf = wRes->wellResultFrame(currentTimeStep);
if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR)
{
curveFilterText = "W*IR:";
description = "Well Injection Rates : "; description = "Well Injection Rates : ";
} }
}
}
curveFilterText += well->name();
description += well->name();
RimSummaryPlot* plot = new RimSummaryPlot(); RimSummaryPlot* plot = new RimSummaryPlot();
summaryPlotColl->summaryPlots().push_back(plot); summaryPlotColl->summaryPlots().push_back(plot);
description += well->name();
plot->setDescription(description); plot->setDescription(description);
if (isInjector(well))
{ {
RimSummaryCurveFilter* newCurveFilter = new RimSummaryCurveFilter(); // Left Axis
plot->addCurveFilter(newCurveFilter);
newCurveFilter->createCurves(gridSummaryCase, curveFilterText); RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_LEFT;
{
// Note : The parameter "WOIR" is probably never-existing, but we check for existence before creating curve
// Oil
QString parameterName = "WOIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
}
{
// Water
QString parameterName = "WWIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
}
{
// Gas
QString parameterName = "WGIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
}
}
else
{
// Left Axis
RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_LEFT;
{
// Oil
QString parameterName = "WOPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
}
{
// Water
QString parameterName = "WWPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
}
{
// Gas
QString parameterName = "WGPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
}
} }
// Right Axis
{ {
RimSummaryCurve* newCurve = new RimSummaryCurve(); RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_RIGHT;
plot->addCurve(newCurve);
newCurve->setSummaryCase(gridSummaryCase); {
QString parameterName = "WTHP";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(0));
}
RifEclipseSummaryAddress addr( RifEclipseSummaryAddress::SUMMARY_WELL, {
"WBHP", QString parameterName = "WBHP";
-1, RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
-1, plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(1));
"", }
well->name().toStdString(),
-1,
"",
-1,
-1,
-1);
newCurve->setSummaryAddress(addr);
newCurve->setYAxis(RimDefines::PlotAxis::PLOT_AXIS_RIGHT);
} }
summaryPlotColl->updateConnectedEditors(); summaryPlotColl->updateConnectedEditors();
@@ -210,3 +237,71 @@ RimGridSummaryCase* RicPlotProductionRateFeature::gridSummaryCaseForWell(RimEcli
return nullptr; return nullptr;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPlotProductionRateFeature::isInjector(RimEclipseWell* well)
{
RigSingleWellResultsData* wRes = well->wellResults();
if (wRes)
{
RimView* rimView = nullptr;
well->firstAncestorOrThisOfTypeAsserted(rimView);
int currentTimeStep = rimView->currentTimeStep();
if (wRes->hasWellResult(currentTimeStep))
{
const RigWellResultFrame& wrf = wRes->wellResultFrame(currentTimeStep);
if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR)
{
return true;
}
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* plot, const RimEclipseWell* well,
RimGridSummaryCase* gridSummaryCase, const QString& vectorName,
RimDefines::PlotAxis plotAxis, const cvf::Color3f& color)
{
CVF_ASSERT(plot);
CVF_ASSERT(gridSummaryCase);
CVF_ASSERT(well);
RifEclipseSummaryAddress addr(RifEclipseSummaryAddress::SUMMARY_WELL,
vectorName.toStdString(),
-1,
-1,
"",
well->name().toStdString(),
-1,
"",
-1,
-1,
-1);
if (!gridSummaryCase->caseData()->summaryReader()->hasAddress(addr))
{
return nullptr;
}
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurve(newCurve);
newCurve->setSummaryCase(gridSummaryCase);
newCurve->setSummaryAddress(addr);
newCurve->setColor(color);
newCurve->setYAxis(plotAxis);
return newCurve;
}

View File

@@ -21,9 +21,12 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include "RimFlowDiagSolution.h" #include "RimFlowDiagSolution.h"
#include "RimDefines.h"
class RimGridSummaryCase; class RimGridSummaryCase;
class RimEclipseWell; class RimEclipseWell;
class RimSummaryPlot;
class RimSummaryCurve;
//================================================================================================== //==================================================================================================
/// ///
@@ -40,6 +43,10 @@ protected:
private: private:
static RimGridSummaryCase* gridSummaryCaseForWell(RimEclipseWell* well); static RimGridSummaryCase* gridSummaryCaseForWell(RimEclipseWell* well);
static bool isInjector(RimEclipseWell* well);
static RimSummaryCurve* addSummaryCurve(RimSummaryPlot* plot, const RimEclipseWell* well,
RimGridSummaryCase* gridSummaryCase, const QString& vectorName,
RimDefines::PlotAxis plotAxis, const cvf::Color3f& color);
}; };

View File

@@ -54,8 +54,7 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
int timeStep = wellAllocationPlot->timeStep(); int timeStep = wellAllocationPlot->timeStep();
QString wellName = wellAllocationPlot->wellName(); QString wellName = wellAllocationPlot->wellName();
RimEclipseResultCase* wellAllocationResultCase = nullptr; RimEclipseResultCase* wellAllocationResultCase = wellAllocationPlot->rimCase();
wellAllocationPlot->flowDiagSolution()->firstAncestorOrThisOfTypeAsserted(wellAllocationResultCase);
RicShowContributingWellsFeatureImpl::maniuplateSelectedView(wellAllocationResultCase, wellName, timeStep); RicShowContributingWellsFeatureImpl::maniuplateSelectedView(wellAllocationResultCase, wellName, timeStep);
} }

View File

@@ -23,6 +23,8 @@
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimFlowCharacteristicsPlot.h" #include "RimFlowCharacteristicsPlot.h"
#include "RigFlowDiagResults.h"
#include "RimFlowDiagSolution.h"
#include "RimFlowPlotCollection.h" #include "RimFlowPlotCollection.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
@@ -71,6 +73,16 @@ void RicShowFlowCharacteristicsPlotFeature::onActionTriggered(bool isChecked)
if (eclCase && eclCase->defaultFlowDiagSolution()) if (eclCase && eclCase->defaultFlowDiagSolution())
{ {
// Make sure flow results for the the active timestep is calculated, to avoid an empty plot
{
RimView * activeView = RiaApplication::instance()->activeReservoirView();
if (activeView && eclCase->defaultFlowDiagSolution()->flowDiagResults())
{
// Trigger calculation
eclCase->defaultFlowDiagSolution()->flowDiagResults()->maxAbsPairFlux(activeView->currentTimeStep());
}
}
if (RiaApplication::instance()->project()) if (RiaApplication::instance()->project())
{ {
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection(); RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();

View File

@@ -76,7 +76,7 @@ void RicShowTotalAllocationDataFeature::onActionTriggered(bool isChecked)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicShowTotalAllocationDataFeature::setupActionLook(QAction* actionToSetup) void RicShowTotalAllocationDataFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Show Total Allocation"); actionToSetup->setText("Show Total Allocation Data");
//actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png")); //actionToSetup->setIcon(QIcon(":/PlotWindow24x24.png"));
} }

View File

@@ -29,6 +29,8 @@
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "cafUtils.h"
#include <QAction> #include <QAction>
#include <QFileInfo> #include <QFileInfo>
#include <QInputDialog> #include <QInputDialog>
@@ -76,7 +78,7 @@ void RicNewScriptFeature::onActionTriggered(bool isChecked)
fullPathFilenameNewScript = fullPathNewScript + "/untitled.m"; fullPathFilenameNewScript = fullPathNewScript + "/untitled.m";
int num= 1; int num= 1;
while (QFileInfo(fullPathFilenameNewScript).exists()) while (caf::Utils::fileExists(fullPathFilenameNewScript))
{ {
fullPathFilenameNewScript = fullPathNewScript + "/untitled" + QString::number(num) + ".m"; fullPathFilenameNewScript = fullPathNewScript + "/untitled" + QString::number(num) + ".m";
num++; num++;

View File

@@ -95,8 +95,8 @@ void RicExportMultipleSnapshotsFeature::onActionTriggered(bool isChecked)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExportMultipleSnapshotsFeature::setupActionLook(QAction* actionToSetup) void RicExportMultipleSnapshotsFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Export Multiple Snapshots ..."); actionToSetup->setText("Advanced Snapshot Export ...");
//actionToSetup->setIcon(QIcon(":/Save.png")); actionToSetup->setIcon(QIcon(":/SnapShotSaveViews.png"));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -121,7 +121,7 @@ void RicExportToLasFileResampleUi::defineEditorAttribute(const caf::PdmFieldHand
{ {
if (field == &exportFolder) if (field == &exportFolder)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;
@@ -130,7 +130,7 @@ void RicExportToLasFileResampleUi::defineEditorAttribute(const caf::PdmFieldHand
if (field == &exportTvdrkb || field == &activateResample) if (field == &exportTvdrkb || field == &activateResample)
{ {
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute); caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_useNativeCheckBoxLabel = true; myAttr->m_useNativeCheckBoxLabel = true;

View File

@@ -19,6 +19,7 @@
#include "RicImportSummaryCaseFeature.h" #include "RicImportSummaryCaseFeature.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RimGridSummaryCase.h" #include "RimGridSummaryCase.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
@@ -102,10 +103,14 @@ bool RicImportSummaryCaseFeature::createAndAddSummaryCaseFromFile(const QString&
RimSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromFileName(fileName); RimSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromFileName(fileName);
newSumCase->loadCase(); newSumCase->loadCase();
if (app->preferences()->autoCreatePlotsOnImport())
{
RimMainPlotCollection* mainPlotColl = proj->mainPlotCollection(); RimMainPlotCollection* mainPlotColl = proj->mainPlotCollection();
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection(); RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
RicNewSummaryPlotFeature::createNewSummaryPlot(summaryPlotColl, newSumCase); RicNewSummaryPlotFeature::createNewSummaryPlot(summaryPlotColl, newSumCase);
}
sumCaseColl->updateConnectedEditors(); sumCaseColl->updateConnectedEditors();
app->addToRecentFiles(fileName); app->addToRecentFiles(fileName);

View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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 "RicReloadCaseFeature.h"
#include "RimEclipseCase.h"
#include "cafPdmObject.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicReloadCaseFeature, "RicReloadCaseFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicReloadCaseFeature::isCommandEnabled()
{
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
caf::SelectionManager::instance()->objectsByType(&selectedFormationNamesCollObjs);
for (caf::PdmObject* pdmObject : selectedFormationNamesCollObjs) {
if (dynamic_cast<RimEclipseCase*>(pdmObject))
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicReloadCaseFeature::onActionTriggered(bool isChecked)
{
std::vector<RimEclipseCase*> selectedEclipseCases;
caf::SelectionManager::instance()->objectsByType(&selectedEclipseCases);
for (RimEclipseCase* selectedCase : selectedEclipseCases)
{
selectedCase->reloadDataAndUpdate();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicReloadCaseFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Reload");
actionToSetup->setIcon(QIcon(":/Refresh-32.png"));
}

View File

@@ -0,0 +1,32 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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 "cafCmdFeature.h"
class RicReloadCaseFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual bool isCommandEnabled();
virtual void onActionTriggered(bool isChecked);
virtual void setupActionLook(QAction* actionToSetup);
};

View File

@@ -146,7 +146,7 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
startPath += "/image.png"; startPath += "/image.png";
QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath, tr("Image files (*.bmp *.png * *.jpg)")); QString fileName = QFileDialog::getSaveFileName(NULL, tr("Export to File"), startPath);
if (fileName.isEmpty()) if (fileName.isEmpty())
{ {
return; return;
@@ -278,6 +278,6 @@ void RicSnapshotAllPlotsToFileFeature::onActionTriggered(bool isChecked)
void RicSnapshotAllPlotsToFileFeature::setupActionLook(QAction* actionToSetup) void RicSnapshotAllPlotsToFileFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setText("Snapshot All Plots To File"); actionToSetup->setText("Snapshot All Plots To File");
actionToSetup->setIcon(QIcon(":/SnapShotSave.png")); actionToSetup->setIcon(QIcon(":/SnapShotSaveViews.png"));
} }

View File

@@ -95,7 +95,7 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir); bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir);
if (!writeFiles) return; if (!writeFiles) return;
RiaLogging::debug(QString("Writing to directory %1").arg(saveDir)); RiaLogging::info(QString("Writing to directory %1").arg(saveDir));
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots) for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
{ {
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".ascii"; QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".ascii";

View File

@@ -216,6 +216,15 @@ bool RicNewGridTimeHistoryCurveFeature::isCommandEnabled()
if (items.size() > 0) if (items.size() > 0)
{ {
const RiuEclipseSelectionItem* eclSelectionItem = dynamic_cast<const RiuEclipseSelectionItem*>(items[0]);
if (eclSelectionItem)
{
if (eclSelectionItem->m_view->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
return false;
}
}
return true; return true;
} }

View File

@@ -93,7 +93,7 @@ void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir); bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir);
if (!writeFiles) return; if (!writeFiles) return;
RiaLogging::debug(QString("Writing to directory %!").arg(saveDir)); RiaLogging::info(QString("Writing to directory %!").arg(saveDir));
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots) for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
{ {
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".ascii"; QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".ascii";

View File

@@ -41,6 +41,8 @@
#include <QAction> #include <QAction>
#include <vector> #include <vector>
#include "RimEclipseWell.h"
#include "RiuSelectionManager.h"
CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature"); CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtractionFeature");
@@ -51,8 +53,8 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogCurveExtractionFeature, "RicNewWellLogCurveExtr
bool RicNewWellLogCurveExtractionFeature::isCommandEnabled() bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
{ {
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false; if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;
int branchIndex;
return (selectedWellLogPlotTrack() != NULL || selectedWellPath() != NULL) && caseAvailable(); return (selectedWellLogPlotTrack() != nullptr || selectedWellPath() != nullptr || selectedSimulationWell(&branchIndex) != nullptr) && caseAvailable();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -65,15 +67,17 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack(); RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
if (wellLogPlotTrack) if (wellLogPlotTrack)
{ {
addCurve(wellLogPlotTrack, NULL, NULL); addCurve(wellLogPlotTrack, NULL, NULL, nullptr, -1);
} }
else else
{ {
RimWellPath* wellPath = selectedWellPath(); RimWellPath* wellPath = selectedWellPath();
if (wellPath) int branchIndex = -1;
RimEclipseWell* simWell = selectedSimulationWell(&branchIndex);
if (wellPath || simWell)
{ {
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath); RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath, simWell, branchIndex);
plotCurve->loadDataAndUpdate(); plotCurve->loadDataAndUpdate();
@@ -118,6 +122,27 @@ RimWellPath* RicNewWellLogCurveExtractionFeature::selectedWellPath() const
return selection.size() > 0 ? selection[0] : NULL; return selection.size() > 0 ? selection[0] : NULL;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseWell* RicNewWellLogCurveExtractionFeature::selectedSimulationWell(int * branchIndex) const
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimEclipseWell*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : NULL;
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -132,14 +157,16 @@ bool RicNewWellLogCurveExtractionFeature::caseAvailable() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath) RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath, const RimEclipseWell* simWell, int branchIndex)
{ {
CVF_ASSERT(plotTrack); CVF_ASSERT(plotTrack);
RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve(); RimWellLogExtractionCurve* curve = new RimWellLogExtractionCurve();
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount()); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable(plotTrack->curveCount());
curve->setColor(curveColor); curve->setColor(curveColor);
curve->setWellPath(wellPath); if (wellPath) curve->setWellPath(wellPath);
if (simWell) curve->setFromSimulationWellName(simWell->name(), branchIndex);
curve->setPropertiesFromView(view); curve->setPropertiesFromView(view);
plotTrack->addCurve(curve); plotTrack->addCurve(curve);

View File

@@ -21,10 +21,11 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
class RimEclipseWell;
class RimView;
class RimWellLogExtractionCurve; class RimWellLogExtractionCurve;
class RimWellLogTrack; class RimWellLogTrack;
class RimWellPath; class RimWellPath;
class RimView;
//================================================================================================== //==================================================================================================
/// ///
@@ -34,7 +35,7 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public: public:
static RimWellLogExtractionCurve* addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath); static RimWellLogExtractionCurve* addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath, const RimEclipseWell* simWell, int branchIndex);
protected: protected:
@@ -46,5 +47,6 @@ protected:
private: private:
RimWellLogTrack* selectedWellLogPlotTrack() const; RimWellLogTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPath() const; RimWellPath* selectedWellPath() const;
RimEclipseWell* selectedSimulationWell(int * branchIndex) const;
bool caseAvailable() const; bool caseAvailable() const;
}; };

View File

@@ -51,7 +51,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked) void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{ {
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(); RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL); RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -57,7 +57,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount())); plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
wellLogPlot->updateConnectedEditors(); wellLogPlot->updateConnectedEditors();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL); RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL, nullptr, -1);
} }
} }

View File

@@ -27,6 +27,8 @@
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiuWellImportWizard.h" #include "RiuWellImportWizard.h"
#include "cafUtils.h"
#include <QAction> #include <QAction>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@@ -47,7 +49,7 @@ bool RicWellPathsImportSsihubFeature::isCommandEnabled()
return false; return false;
} }
if (!QFile::exists(app->project()->fileName())) if (!caf::Utils::fileExists(app->project()->fileName()))
{ {
return false; return false;
} }
@@ -66,7 +68,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered(bool isChecked)
return; return;
} }
if (!QFile::exists(app->project()->fileName())) if (!caf::Utils::fileExists(app->project()->fileName()))
{ {
return; return;
} }

View File

@@ -121,22 +121,22 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigEclipseC
bool allKwReadOk = true; bool allKwReadOk = true;
fseek(gridFilePointer, specgridPos, SEEK_SET); fseek(gridFilePointer, specgridPos, SEEK_SET);
allKwReadOk = allKwReadOk && NULL != (specGridKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_INT_TYPE)); allKwReadOk = allKwReadOk && NULL != (specGridKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ecl_type_create_from_type(ECL_INT_TYPE)));
progress.setProgress(1); progress.setProgress(1);
fseek(gridFilePointer, zcornPos, SEEK_SET); fseek(gridFilePointer, zcornPos, SEEK_SET);
allKwReadOk = allKwReadOk && NULL != (zCornKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE)); allKwReadOk = allKwReadOk && NULL != (zCornKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ecl_type_create_from_type(ECL_FLOAT_TYPE)));
progress.setProgress(2); progress.setProgress(2);
fseek(gridFilePointer, coordPos, SEEK_SET); fseek(gridFilePointer, coordPos, SEEK_SET);
allKwReadOk = allKwReadOk && NULL != (coordKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE)); allKwReadOk = allKwReadOk && NULL != (coordKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ecl_type_create_from_type(ECL_FLOAT_TYPE)));
progress.setProgress(3); progress.setProgress(3);
// If ACTNUM is not defined, this pointer will be NULL, which is a valid condition // If ACTNUM is not defined, this pointer will be NULL, which is a valid condition
if (actnumPos >= 0) if (actnumPos >= 0)
{ {
fseek(gridFilePointer, actnumPos, SEEK_SET); fseek(gridFilePointer, actnumPos, SEEK_SET);
allKwReadOk = allKwReadOk && NULL != (actNumKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_INT_TYPE)); allKwReadOk = allKwReadOk && NULL != (actNumKw = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ecl_type_create_from_type(ECL_INT_TYPE)));
progress.setProgress(4); progress.setProgress(4);
} }
@@ -144,7 +144,7 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigEclipseC
if (mapaxesPos >= 0) if (mapaxesPos >= 0)
{ {
fseek(gridFilePointer, mapaxesPos, SEEK_SET); fseek(gridFilePointer, mapaxesPos, SEEK_SET);
mapAxesKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer, false , ECL_FLOAT_TYPE); mapAxesKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer, false , ecl_type_create_from_type(ECL_FLOAT_TYPE));
} }
if (!allKwReadOk) if (!allKwReadOk)
@@ -228,7 +228,7 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStrin
fseek(gridFilePointer, fileKeywords[i].filePos, SEEK_SET); fseek(gridFilePointer, fileKeywords[i].filePos, SEEK_SET);
ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false, ECL_FLOAT_TYPE); ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false, ecl_type_create_from_type(ECL_FLOAT_TYPE));
if (eclipseKeywordData) if (eclipseKeywordData)
{ {
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword); QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword);
@@ -261,7 +261,7 @@ bool RifEclipseInputFileTools::readProperty(const QString& fileName, RigEclipseC
FILE* filePointer = util_fopen(fileName.toLatin1().data(), "r"); FILE* filePointer = util_fopen(fileName.toLatin1().data(), "r");
if (!filePointer) return false; if (!filePointer) return false;
ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_grdecl_dynamic__(filePointer, eclipseKeyWord.toLatin1().data(), false, ECL_FLOAT_TYPE); ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_grdecl_dynamic__(filePointer, eclipseKeyWord.toLatin1().data(), false, ecl_type_create_from_type(ECL_FLOAT_TYPE));
bool isOk = false; bool isOk = false;
if (eclipseKeywordData) if (eclipseKeywordData)
{ {
@@ -476,16 +476,15 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileName, bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileName,
RigEclipseCaseData* eclipseCase, RigEclipseCaseData* eclipseCase,
RifReaderInterface::PorosityModelResultType porosityModel,
size_t timeStep, size_t timeStep,
const QString& resultName, RimEclipseResultDefinition* resultDefinition,
const QString& eclipseKeyWord, const QString& eclipseKeyWord,
const double undefinedValue) const double undefinedValue)
{ {
CVF_ASSERT(eclipseCase); CVF_ASSERT(eclipseCase);
size_t resultIndex = eclipseCase->results(porosityModel)->findScalarResultIndex(resultName); cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, eclipseCase->mainGrid()->gridIndex(), timeStep, resultDefinition);
if (resultIndex == cvf::UNDEFINED_SIZE_T) if (resultAccessor.isNull())
{ {
return false; return false;
} }
@@ -496,12 +495,6 @@ bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileNa
return false; return false;
} }
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromUiResultName(eclipseCase, eclipseCase->mainGrid()->gridIndex(), porosityModel, timeStep, resultName);
if (resultAccessor.isNull())
{
return false;
}
std::vector<double> resultData; std::vector<double> resultData;
size_t i, j, k; size_t i, j, k;
for (k = 0; k < eclipseCase->mainGrid()->cellCountK(); k++) for (k = 0; k < eclipseCase->mainGrid()->cellCountK(); k++)

View File

@@ -36,6 +36,7 @@
class RigEclipseCaseData; class RigEclipseCaseData;
class QFile; class QFile;
class RimEclipseResultDefinition;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -76,7 +77,7 @@ public:
static bool writePropertyToTextFile(const QString& fileName, RigEclipseCaseData* eclipseCase, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord); static bool writePropertyToTextFile(const QString& fileName, RigEclipseCaseData* eclipseCase, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord);
static bool writeBinaryResultToTextFile(const QString& fileName, RigEclipseCaseData* eclipseCase, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord, const double undefinedValue); static bool writeBinaryResultToTextFile(const QString& fileName, RigEclipseCaseData* eclipseCase, size_t timeStep, RimEclipseResultDefinition* resultdefinition, const QString& eclipseKeyWord, const double undefinedValue);
static bool readFaultsAndParseIncludeStatementsRecursively( QFile& file, static bool readFaultsAndParseIncludeStatementsRecursively( QFile& file,
qint64 startPos, qint64 startPos,

View File

@@ -115,7 +115,7 @@ void getDayMonthYear(const ecl_kw_type* intehead_kw, int* day, int* month, int*
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get list of time step texts (dates) /// Get list of time step texts (dates)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<QDateTime>* timeSteps) void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart)
{ {
if (!ecl_file) return; if (!ecl_file) return;
@@ -127,7 +127,7 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
// Get the number of occurrences of the DOUBHEAD keyword // Get the number of occurrences of the DOUBHEAD keyword
int numDOUBHEAD = ecl_file_get_num_named_kw(ecl_file, DOUBHEAD_KW); int numDOUBHEAD = ecl_file_get_num_named_kw(ecl_file, DOUBHEAD_KW);
std::vector<double> dayFractions(numINTEHEAD, 0.0); // Init fraction to zero std::vector<double> dayValues(numINTEHEAD, 0.0); // Init fraction to zero
// Read out fraction of day if number of keywords are identical // Read out fraction of day if number of keywords are identical
if (numINTEHEAD == numDOUBHEAD) if (numINTEHEAD == numDOUBHEAD)
@@ -137,12 +137,7 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
ecl_kw_type* kwDOUBHEAD = ecl_file_iget_named_kw(ecl_file, DOUBHEAD_KW, i); ecl_kw_type* kwDOUBHEAD = ecl_file_iget_named_kw(ecl_file, DOUBHEAD_KW, i);
if (kwDOUBHEAD) if (kwDOUBHEAD)
{ {
double dayValue = ecl_kw_iget_double(kwDOUBHEAD, DOUBHEAD_DAYS_INDEX); dayValues[i] = ecl_kw_iget_double(kwDOUBHEAD, DOUBHEAD_DAYS_INDEX);
double floorDayValue = cvf::Math::floor(dayValue);
double dayDelta = dayValue - floorDayValue;
dayFractions[i] = dayDelta;
} }
} }
} }
@@ -159,7 +154,8 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
QDateTime reportDateTime(QDate(year, month, day)); QDateTime reportDateTime(QDate(year, month, day));
CVF_ASSERT(reportDateTime.isValid()); CVF_ASSERT(reportDateTime.isValid());
double dayFraction = dayFractions[i]; double dayValue = dayValues[i];
double dayFraction = dayValue - cvf::Math::floor(dayValue);
int milliseconds = static_cast<int>(dayFraction * 24.0 * 60.0 * 60.0 * 1000.0); int milliseconds = static_cast<int>(dayFraction * 24.0 * 60.0 * 60.0 * 1000.0);
int seconds = milliseconds % 1000; int seconds = milliseconds % 1000;
milliseconds -= seconds * 1000; milliseconds -= seconds * 1000;
@@ -172,6 +168,7 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
if (std::find(timeSteps->begin(), timeSteps->end(), reportDateTime) == timeSteps->end()) if (std::find(timeSteps->begin(), timeSteps->end(), reportDateTime) == timeSteps->end())
{ {
timeSteps->push_back(reportDateTime); timeSteps->push_back(reportDateTime);
daysSinceSimulationStart->push_back(dayValue);
} }
} }
} }
@@ -382,8 +379,9 @@ void RifEclipseOutputFileTools::createReportStepsMetaData(std::vector<ecl_file_t
int namedKeywordCount = ecl_file_get_num_named_kw(ecl_file, kw); int namedKeywordCount = ecl_file_get_num_named_kw(ecl_file, kw);
for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++) for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++)
{ {
ecl_type_enum dataType = ecl_file_iget_named_type(ecl_file, kw, iOcc); ecl_data_type dataType = ecl_file_iget_named_data_type(ecl_file, kw, iOcc);
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE) ecl_type_enum dataTypeEmum = ecl_type_get_type(dataType);
if (dataTypeEmum != ECL_DOUBLE_TYPE && dataTypeEmum != ECL_FLOAT_TYPE && dataTypeEmum != ECL_INT_TYPE)
{ {
continue; continue;
} }

View File

@@ -51,7 +51,7 @@ public:
static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<double>* values); static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<double>* values);
static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<int>* values); static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<int>* values);
static void timeSteps(ecl_file_type* ecl_file, std::vector<QDateTime>* timeSteps); static void timeSteps(ecl_file_type* ecl_file, std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart);
static bool findSiblingFilesWithSameBaseName(const QString& fileName, QStringList* fileSet); static bool findSiblingFilesWithSameBaseName(const QString& fileName, QStringList* fileSet);

View File

@@ -98,7 +98,7 @@ public:
virtual void setTimeSteps(const std::vector<QDateTime>& timeSteps) {}; virtual void setTimeSteps(const std::vector<QDateTime>& timeSteps) {};
virtual size_t timeStepCount() = 0; virtual size_t timeStepCount() = 0;
virtual std::vector<QDateTime> timeSteps() = 0; virtual void timeSteps(std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart) = 0;
virtual std::vector<int> reportNumbers() = 0; virtual std::vector<int> reportNumbers() = 0;
virtual void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts) = 0; virtual void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts) = 0;

View File

@@ -119,7 +119,7 @@ size_t RifEclipseRestartFilesetAccess::timeStepCount()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get the time steps /// Get the time steps
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RifEclipseRestartFilesetAccess::timeSteps() void RifEclipseRestartFilesetAccess::timeSteps(std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart)
{ {
if (m_timeSteps.size() == 0) if (m_timeSteps.size() == 0)
{ {
@@ -128,24 +128,28 @@ std::vector<QDateTime> RifEclipseRestartFilesetAccess::timeSteps()
for (i = 0; i < numSteps; i++) for (i = 0; i < numSteps; i++)
{ {
std::vector<QDateTime> stepTime; std::vector<QDateTime> stepTime;
std::vector<double> stepDays;
openTimeStep(i); openTimeStep(i);
RifEclipseOutputFileTools::timeSteps(m_ecl_files[i], &stepTime); RifEclipseOutputFileTools::timeSteps(m_ecl_files[i], &stepTime, &stepDays);
if (stepTime.size() == 1) if (stepTime.size() == 1)
{ {
m_timeSteps.push_back(stepTime[0]); m_timeSteps.push_back(stepTime[0]);
m_daysSinceSimulationStart.push_back(stepDays[0]);
} }
else else
{ {
m_timeSteps.push_back(QDateTime()); m_timeSteps.push_back(QDateTime());
m_daysSinceSimulationStart.push_back(0.0);
} }
} }
} }
return m_timeSteps; *timeSteps = m_timeSteps;
*daysSinceSimulationStart = m_daysSinceSimulationStart;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -43,7 +43,7 @@ public:
void setTimeSteps(const std::vector<QDateTime>& timeSteps); void setTimeSteps(const std::vector<QDateTime>& timeSteps);
size_t timeStepCount(); size_t timeStepCount();
std::vector<QDateTime> timeSteps(); void timeSteps(std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart) override;
std::vector<int> reportNumbers(); std::vector<int> reportNumbers();
void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts); void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
@@ -58,6 +58,7 @@ private:
private: private:
QStringList m_fileNames; QStringList m_fileNames;
std::vector<QDateTime> m_timeSteps; std::vector<QDateTime> m_timeSteps;
std::vector<double> m_daysSinceSimulationStart;
std::vector< ecl_file_type* > m_ecl_files; std::vector< ecl_file_type* > m_ecl_files;
}; };

View File

@@ -85,23 +85,23 @@ size_t RifEclipseUnifiedRestartFileAccess::timeStepCount()
{ {
return 0; return 0;
} }
std::vector<QDateTime> timeSteps;
std::vector<double> daysSinceSimulationStart;
return timeSteps().size(); this->timeSteps(&timeSteps, &daysSinceSimulationStart);
return timeSteps.size();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get the time steps /// Get the time steps
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<QDateTime> RifEclipseUnifiedRestartFileAccess::timeSteps() void RifEclipseUnifiedRestartFileAccess::timeSteps(std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart)
{ {
std::vector<QDateTime> timeSteps;
if (openFile()) if (openFile())
{ {
RifEclipseOutputFileTools::timeSteps(m_ecl_file, &timeSteps); RifEclipseOutputFileTools::timeSteps(m_ecl_file, timeSteps, daysSinceSimulationStart);
} }
return timeSteps;
} }

View File

@@ -46,7 +46,7 @@ public:
void close(); void close();
size_t timeStepCount(); size_t timeStepCount();
std::vector<QDateTime> timeSteps(); void timeSteps(std::vector<QDateTime>* timeSteps, std::vector<double>* daysSinceSimulationStart) override;
std::vector<int> reportNumbers(); std::vector<int> reportNumbers();
void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts); void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);

View File

@@ -529,7 +529,7 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
for (int i = 0; i < resultNames.size(); ++i) for (int i = 0; i < resultNames.size(); ++i)
{ {
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false); size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false);
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers); matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, m_daysSinceSimulationStart, reportNumbers);
matrixModelResults->setSourSimData(resIndex); matrixModelResults->setSourSimData(resIndex);
} }
@@ -757,7 +757,7 @@ void RifReaderEclipseOutput::buildMetaData()
progInfo.incrementProgress(); progInfo.incrementProgress();
// Get time steps // Get time steps
m_timeSteps = m_dynamicResultsAccess->timeSteps(); m_dynamicResultsAccess->timeSteps(&m_timeSteps, &m_daysSinceSimulationStart);
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers(); std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
QStringList resultNames; QStringList resultNames;
@@ -773,7 +773,7 @@ void RifReaderEclipseOutput::buildMetaData()
for (int i = 0; i < matrixResultNames.size(); ++i) for (int i = 0; i < matrixResultNames.size(); ++i)
{ {
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, matrixResultNames[i], false); size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers); matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, m_daysSinceSimulationStart, reportNumbers);
} }
} }
@@ -786,7 +786,7 @@ void RifReaderEclipseOutput::buildMetaData()
for (int i = 0; i < fractureResultNames.size(); ++i) for (int i = 0; i < fractureResultNames.size(); ++i)
{ {
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, fractureResultNames[i], false); size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers); fractureModelResults->setTimeStepDates(resIndex, m_timeSteps, m_daysSinceSimulationStart, reportNumbers);
} }
} }
@@ -823,12 +823,17 @@ void RifReaderEclipseOutput::buildMetaData()
RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, &resultNames, &resultNamesDataItemCounts); RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, &resultNames, &resultNamesDataItemCounts);
std::vector<QDateTime> staticDate; std::vector<QDateTime> staticDate;
std::vector<double> staticDay;
std::vector<int> staticReportNumber; std::vector<int> staticReportNumber;
{ {
if ( m_timeSteps.size() > 0 ) if ( m_timeSteps.size() > 0 )
{ {
staticDate.push_back(m_timeSteps.front()); staticDate.push_back(m_timeSteps.front());
} }
if (m_daysSinceSimulationStart.size() > 0)
{
staticDay.push_back(m_daysSinceSimulationStart.front());
}
std::vector<int> reportNumbers; std::vector<int> reportNumbers;
if (m_dynamicResultsAccess.notNull()) if (m_dynamicResultsAccess.notNull())
@@ -854,7 +859,7 @@ void RifReaderEclipseOutput::buildMetaData()
for (int i = 0; i < matrixResultNames.size(); ++i) for (int i = 0; i < matrixResultNames.size(); ++i)
{ {
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, matrixResultNames[i], false); size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, matrixResultNames[i], false);
matrixModelResults->setTimeStepDates(resIndex, staticDate, staticReportNumber); matrixModelResults->setTimeStepDates(resIndex, staticDate, staticDay, staticReportNumber);
} }
} }
@@ -869,7 +874,7 @@ void RifReaderEclipseOutput::buildMetaData()
for (int i = 0; i < fractureResultNames.size(); ++i) for (int i = 0; i < fractureResultNames.size(); ++i)
{ {
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, fractureResultNames[i], false); size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, fractureResultNames[i], false);
fractureModelResults->setTimeStepDates(resIndex, staticDate, staticReportNumber); fractureModelResults->setTimeStepDates(resIndex, staticDate, staticDay, staticReportNumber);
} }
} }
} }
@@ -1041,6 +1046,9 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
int cellK = well_conn_get_k( ert_connection ); int cellK = well_conn_get_k( ert_connection );
bool isCellOpen = well_conn_open( ert_connection ); bool isCellOpen = well_conn_open( ert_connection );
double volumeRate = well_conn_get_volume_rate( ert_connection); double volumeRate = well_conn_get_volume_rate( ert_connection);
double oilRate = well_conn_get_oil_rate(ert_connection) ;
double gasRate = well_conn_get_gas_rate(ert_connection);
double waterRate = well_conn_get_water_rate(ert_connection);
// If a well is defined in fracture region, the K-value is from (cellCountK - 1) -> cellCountK*2 - 1 // If a well is defined in fracture region, the K-value is from (cellCountK - 1) -> cellCountK*2 - 1
// Adjust K so index is always in valid grid region // Adjust K so index is always in valid grid region
@@ -1093,6 +1101,27 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
resultPoint.m_ertBranchId = ertBranchId; resultPoint.m_ertBranchId = ertBranchId;
resultPoint.m_ertSegmentId = ertSegmentId; resultPoint.m_ertSegmentId = ertSegmentId;
resultPoint.m_flowRate = volumeRate; resultPoint.m_flowRate = volumeRate;
resultPoint.m_oilRate = oilRate;
resultPoint.m_waterRate = waterRate;
/// Unit conversion for use with Well Allocation plots
// Convert Gas to oil equivalents
// If field unit, the Gas is in Mega ft^3 while the others are in [stb] (barrel)
// Unused Gas to Barrel conversion
// we convert gas to stb as well. Based on
// 1 [stb] = 0.15898729492800007 [m^3]
// 1 [ft] = 0.3048 [m]
// megaFt3ToStbFactor = 1.0 / (1.0e-6 * 0.15898729492800007 * ( 1.0 / 0.3048 )^3 )
// double megaFt3ToStbFactor = 178107.60668;
double fieldGasToOilEquivalent = 1.0e6/5800; // Mega ft^3 to BOE
double metricGasToOilEquivalent = 1.0/1.0e3; // Sm^3 Gas to Sm^3 oe
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_FIELD) gasRate = fieldGasToOilEquivalent * gasRate;
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_METRIC) gasRate = metricGasToOilEquivalent * gasRate;
resultPoint.m_gasRate = gasRate;
} }
return resultPoint; return resultPoint;
@@ -1251,7 +1280,9 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, boo
m_dynamicResultsAccess->readWellData(ert_well_info, importCompleteMswData); m_dynamicResultsAccess->readWellData(ert_well_info, importCompleteMswData);
std::vector<QDateTime> timeSteps = m_dynamicResultsAccess->timeSteps(); std::vector<double> daysSinceSimulationStart;
std::vector<QDateTime> timeSteps;
m_dynamicResultsAccess->timeSteps(&timeSteps, &daysSinceSimulationStart);
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers(); std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
bool sameCount = false; bool sameCount = false;

View File

@@ -73,7 +73,7 @@ private:
std::string ertGridName( size_t gridNr ); std::string ertGridName( size_t gridNr );
static RigWellResultPoint createWellResultPoint(const RigGridBase* grid, const well_conn_type* ert_connection, int ertBranchId, int ertSegmentId, const char* wellName); RigWellResultPoint createWellResultPoint(const RigGridBase* grid, const well_conn_type* ert_connection, int ertBranchId, int ertSegmentId, const char* wellName);
void importFaults(const QStringList& fileSet, cvf::Collection<RigFault>* faults); void importFaults(const QStringList& fileSet, cvf::Collection<RigFault>* faults);
@@ -97,6 +97,7 @@ private:
RigEclipseCaseData* m_eclipseCase; RigEclipseCaseData* m_eclipseCase;
std::vector<QDateTime> m_timeSteps; std::vector<QDateTime> m_timeSteps;
std::vector<double> m_daysSinceSimulationStart;
ecl_file_type* m_ecl_init_file; // File access to static results ecl_file_type* m_ecl_init_file; // File access to static results
cvf::ref<RifEclipseRestartDataAccess> m_dynamicResultsAccess; // File access to dynamic results cvf::ref<RifEclipseRestartDataAccess> m_dynamicResultsAccess; // File access to dynamic results

View File

@@ -38,24 +38,28 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
std::vector<QDateTime> dates; std::vector<QDateTime> dates;
std::vector<double> days;
std::vector<int> repNumbers; std::vector<int> repNumbers;
for (int i = 0; i < static_cast<int>(m_reservoirBuilder.timeStepCount()); i++) for (int i = 0; i < static_cast<int>(m_reservoirBuilder.timeStepCount()); i++)
{ {
dates.push_back(QDateTime(QDate(2012+i, 6, 1))); dates.push_back(QDateTime(QDate(2012+i, 6, 1)));
days.push_back(i);
repNumbers.push_back(i); repNumbers.push_back(i);
} }
for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++) for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++)
{ {
size_t resIdx = cellResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false); size_t resIdx = cellResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false);
cellResults->setTimeStepDates(resIdx, dates, repNumbers); cellResults->setTimeStepDates(resIdx, dates, days, repNumbers);
} }
if (m_reservoirBuilder.timeStepCount() == 0) return true; if (m_reservoirBuilder.timeStepCount() == 0) return true;
std::vector<QDateTime> staticDates; std::vector<QDateTime> staticDates;
staticDates.push_back(dates[0]); staticDates.push_back(dates[0]);
std::vector<double> staticDays;
staticDays.push_back(days[0]);
std::vector<int> staticRepNumbers; std::vector<int> staticRepNumbers;
staticRepNumbers.push_back(0); staticRepNumbers.push_back(0);
@@ -68,7 +72,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
if (i > 1) resIndex = i; if (i > 1) resIndex = i;
size_t resIdx = cellResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false); size_t resIdx = cellResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false);
cellResults->setTimeStepDates(resIdx, staticDates, staticRepNumbers); cellResults->setTimeStepDates(resIdx, staticDates, staticDays, staticRepNumbers);
} }
@@ -77,7 +81,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
size_t resIdx; \ size_t resIdx; \
QString resultName(Name); \ QString resultName(Name); \
resIdx = cellResults->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, resultName, false); \ resIdx = cellResults->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, resultName, false); \
cellResults->setTimeStepDates(resIdx, staticDates, staticRepNumbers); \ cellResults->setTimeStepDates(resIdx, staticDates, staticDays, staticRepNumbers); \
cellResults->cellScalarResults(resIdx).resize(1); \ cellResults->cellScalarResults(resIdx).resize(1); \
std::vector<double>& values = cellResults->cellScalarResults(resIdx)[0]; \ std::vector<double>& values = cellResults->cellScalarResults(resIdx)[0]; \
this->inputProperty(resultName, &values); \ this->inputProperty(resultName, &values); \

View File

@@ -31,13 +31,13 @@ RifReaderSettings::RifReaderSettings()
{ {
CAF_PDM_InitObject("RifReaderSettings", "", "", ""); CAF_PDM_InitObject("RifReaderSettings", "", "", "");
CAF_PDM_InitField(&importFaults, "importFaults", true, "Import faults", "", "", ""); CAF_PDM_InitField(&importFaults, "importFaults", true, "Import Faults", "", "", "");
importFaults.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); importFaults.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&importNNCs, "importSimulationNNCs", true, "Import NNCs", "", "", ""); CAF_PDM_InitField(&importNNCs, "importSimulationNNCs", true, "Import NNCs", "", "", "");
importNNCs.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); importNNCs.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&importAdvancedMswData, "importAdvancedMswData", false, "Import advanced MSW data", "", "", ""); CAF_PDM_InitField(&importAdvancedMswData, "importAdvancedMswData", false, "Import Advanced MSW Data", "", "", "");
importAdvancedMswData.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); importAdvancedMswData.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&faultIncludeFileAbsolutePathPrefix, "faultIncludeFileAbsolutePathPrefix", QString(), "Fault Include File Absolute Path Prefix", "", "Path used to prefix absolute UNIX paths in fault include statements on Windows", ""); CAF_PDM_InitField(&faultIncludeFileAbsolutePathPrefix, "faultIncludeFileAbsolutePathPrefix", QString(), "Fault Include File Absolute Path Prefix", "", "Path used to prefix absolute UNIX paths in fault include statements on Windows", "");
@@ -52,7 +52,7 @@ void RifReaderSettings::defineEditorAttribute(const caf::PdmFieldHandle* field,
field == &importAdvancedMswData || field == &importAdvancedMswData ||
field == &importNNCs) field == &importNNCs)
{ {
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute); caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_useNativeCheckBoxLabel = true; myAttr->m_useNativeCheckBoxLabel = true;

View File

@@ -38,3 +38,11 @@ RimEclipseWell* RivSimWellPipeSourceInfo::well() const
{ {
return m_eclipseWell.p(); return m_eclipseWell.p();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RivSimWellPipeSourceInfo::branchIndex() const
{
return m_branchIndex;
}

View File

@@ -32,6 +32,8 @@ public:
RimEclipseWell* well() const; RimEclipseWell* well() const;
size_t branchIndex() const;
private: private:
caf::PdmPointer<RimEclipseWell> m_eclipseWell; caf::PdmPointer<RimEclipseWell> m_eclipseWell;
size_t m_branchIndex; size_t m_branchIndex;

View File

@@ -26,6 +26,8 @@
#include "RiuFlowCharacteristicsPlot.h" #include "RiuFlowCharacteristicsPlot.h"
#include "cafPdmUiCheckBoxEditor.h"
#include <cmath> // Needed for HUGE_VAL on Linux #include <cmath> // Needed for HUGE_VAL on Linux
@@ -57,6 +59,8 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
this->m_showWindow = false; this->m_showWindow = false;
setAsPlotMdiWindow(); setAsPlotMdiWindow();
} }
@@ -137,14 +141,16 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
{ {
std::vector<RimEclipseResultCase*> cases; std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases); proj->descendantsIncludingThisOfType(cases);
RimEclipseResultCase* defaultCase = nullptr;
for ( RimEclipseResultCase* c : cases ) for ( RimEclipseResultCase* c : cases )
{ {
if ( c->defaultFlowDiagSolution() ) if ( c->defaultFlowDiagSolution() )
{ {
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon())); options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
if (!defaultCase) defaultCase = c; // Select first
} }
} }
if (!m_case() && defaultCase) m_case = defaultCase;
} }
} }
else if ( fieldNeedingOptions == &m_flowDiagSolution ) else if ( fieldNeedingOptions == &m_flowDiagSolution )
@@ -167,11 +173,11 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults(); RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(); std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
std::vector<QDateTime> timeStepDates = m_case->timeStepDates(); QStringList timeStepDates = m_case->timeStepStrings();
for ( int tsIdx : calculatedTimesteps ) for ( int tsIdx : calculatedTimesteps )
{ {
options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx].toString(), tsIdx)); options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx], tsIdx));
} }
} }
} }
@@ -191,6 +197,8 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
if (m_timeStepSelectionType == SELECT_AVAILABLE) uiOrdering.add(&m_selectedTimeSteps); if (m_timeStepSelectionType == SELECT_AVAILABLE) uiOrdering.add(&m_selectedTimeSteps);
uiOrdering.add(&m_showLegend);
uiOrdering.skipRemainingFields(); uiOrdering.skipRemainingFields();
} }
@@ -210,7 +218,6 @@ void RimFlowCharacteristicsPlot::zoomAll()
if (m_flowCharPlotWidget) m_flowCharPlotWidget->zoomAll(); if (m_flowCharPlotWidget) m_flowCharPlotWidget->zoomAll();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -229,7 +236,6 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
this->loadDataAndUpdate(); this->loadDataAndUpdate();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -246,8 +252,6 @@ QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
return image; return image;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -277,6 +281,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
m_currentlyPlottedTimeSteps = calculatedTimesteps; m_currentlyPlottedTimeSteps = calculatedTimesteps;
std::vector<QDateTime> timeStepDates = m_case->timeStepDates(); std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
QStringList timeStepStrings = m_case->timeStepStrings();
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL); std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
m_flowCharPlotWidget->removeAllCurves(); m_flowCharPlotWidget->removeAllCurves();
@@ -285,7 +290,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
{ {
lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx).m_lorenzCoefficient; lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx).m_lorenzCoefficient;
} }
m_flowCharPlotWidget->setLorenzCurve(timeStepDates, lorenzVals); m_flowCharPlotWidget->setLorenzCurve(timeStepStrings, timeStepDates, lorenzVals);
for ( int timeStepIdx: calculatedTimesteps ) for ( int timeStepIdx: calculatedTimesteps )
{ {
@@ -299,6 +304,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
flowCharResults.m_sweepEfficiencyCurve.second); flowCharResults.m_sweepEfficiencyCurve.second);
} }
m_flowCharPlotWidget->showLegend(m_showLegend());
} }
} }

View File

@@ -86,6 +86,7 @@ private:
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution; caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType; caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType;
caf::PdmField<std::vector<int> > m_selectedTimeSteps; caf::PdmField<std::vector<int> > m_selectedTimeSteps;
caf::PdmField<bool> m_showLegend;
std::vector<int> m_currentlyPlottedTimeSteps; std::vector<int> m_currentlyPlottedTimeSteps;

View File

@@ -250,7 +250,6 @@ void RimWellAllocationPlot::updateFromWell()
depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth(brIdx) : depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth(brIdx) :
std::vector<double>(); std::vector<double>();
if ( m_flowDiagSolution )
{ {
std::vector<QString> tracerNames = wfCalculator->tracerNames(); std::vector<QString> tracerNames = wfCalculator->tracerNames();
for (const QString& tracerName: tracerNames) for (const QString& tracerName: tracerNames)
@@ -273,24 +272,7 @@ void RimWellAllocationPlot::updateFromWell()
//TODO: THIs is the data to be plotted... //TODO: THIs is the data to be plotted...
} }
} }
else
{
const std::vector<double>* accFlow = nullptr;
if (depthType == RimWellLogPlot::CONNECTION_NUMBER)
{
accFlow = &(m_flowType == ACCUMULATED ?
wfCalculator->accumulatedFlowPrConnection(brIdx):
wfCalculator->flowPrConnection( brIdx));
}
else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
{
accFlow = &(m_flowType == ACCUMULATED ?
wfCalculator->accumulatedFlowPrPseudoLength(brIdx):
wfCalculator->flowPrPseudoLength( brIdx));
}
addStackedCurve("Total", depthValues, *accFlow, plotTrack);
}
updateWellFlowPlotXAxisTitle(plotTrack); updateWellFlowPlotXAxisTitle(plotTrack);
@@ -313,10 +295,10 @@ void RimWellAllocationPlot::updateFromWell()
for ( const auto& tracerVal : totalTracerFractions ) for ( const auto& tracerVal : totalTracerFractions )
{ {
cvf::Color3f color; cvf::Color3f color;
if ( m_flowDiagSolution ) if (m_flowDiagSolution)
color = m_flowDiagSolution->tracerColor(tracerVal.first); color = m_flowDiagSolution->tracerColor(tracerVal.first);
else else
color = cvf::Color3f::DARK_GRAY; color = getTracerColor(tracerVal.first);
double tracerPercent = 100*tracerVal.second; double tracerPercent = 100*tracerVal.second;
@@ -375,24 +357,48 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack) void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack)
{ {
RigEclipseCaseData::UnitsType unitSet = m_case->eclipseCaseData()->unitsType(); RigEclipseCaseData::UnitsType unitSet = m_case->eclipseCaseData()->unitsType();
if (m_flowDiagSolution)
{
QString unitText; QString unitText;
switch ( unitSet ) switch ( unitSet )
{ {
case RigEclipseCaseData::UNITS_METRIC: case RigEclipseCaseData::UNITS_METRIC:
unitText = "[m^3/day]"; unitText = "[m<sup>3</sup>/day]";
break; break;
case RigEclipseCaseData::UNITS_FIELD: case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Brl/day]"; unitText = "[Brl/day]";
break; break;
case RigEclipseCaseData::UNITS_LAB: case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm^3/hr]"; unitText = "[cm<sup>3</sup>/hr]";
break; break;
default: default:
break; break;
} }
plotTrack->setXAxisTitle("Reservoir Flow Rate " + unitText);
}
else
{
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Liquid BBL/day], [Gas BOE/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
plotTrack->setXAxisTitle("Flow Rate " + unitText); }
plotTrack->setXAxisTitle("Surface Flow Rate " + unitText);
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -407,9 +413,13 @@ void RimWellAllocationPlot::addStackedCurve(const QString& tracerName,
curve->setFlowValuesPrDepthValue(tracerName, depthValues, accFlow); curve->setFlowValuesPrDepthValue(tracerName, depthValues, accFlow);
if ( m_flowDiagSolution ) if ( m_flowDiagSolution )
{
curve->setColor(m_flowDiagSolution->tracerColor(tracerName)); curve->setColor(m_flowDiagSolution->tracerColor(tracerName));
}
else else
curve->setColor(cvf::Color3f::DARK_GRAY); {
curve->setColor(getTracerColor(tracerName));
}
plotTrack->addCurve(curve); plotTrack->addCurve(curve);
@@ -524,9 +534,9 @@ caf::PdmObject* RimWellAllocationPlot::plotLegend()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimWellAllocationPlot::flowDiagSolution() RimEclipseResultCase* RimWellAllocationPlot::rimCase()
{ {
return m_flowDiagSolution(); return m_case();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -775,4 +785,15 @@ QWidget* RimWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
return m_wellAllocationPlotWidget; return m_wellAllocationPlotWidget;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellAllocationPlot::getTracerColor(const QString& tracerName)
{
if (tracerName == RIG_FLOW_OIL_NAME) return cvf::Color3f::DARK_GREEN;
if (tracerName == RIG_FLOW_GAS_NAME) return cvf::Color3f::DARK_RED;
if (tracerName == RIG_FLOW_WATER_NAME) return cvf::Color3f::BLUE;
return cvf::Color3f::DARK_GRAY;
}

View File

@@ -37,6 +37,10 @@ class RiuWellAllocationPlot;
class RimWellLogTrack; class RimWellLogTrack;
class RigSingleWellResultsData; class RigSingleWellResultsData;
namespace cvf {
class Color3f;
}
namespace caf { namespace caf {
class PdmOptionItemInfo; class PdmOptionItemInfo;
} }
@@ -61,7 +65,7 @@ public:
void setDescription(const QString& description); void setDescription(const QString& description);
QString description() const; QString description() const;
void loadDataAndUpdate(); virtual void loadDataAndUpdate() override;
virtual QWidget* viewWidget() override; virtual QWidget* viewWidget() override;
virtual void zoomAll() override; virtual void zoomAll() override;
@@ -69,7 +73,7 @@ public:
RimWellLogPlot* accumulatedWellFlowPlot(); RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot(); RimTotalWellAllocationPlot* totalWellFlowPlot();
caf::PdmObject* plotLegend(); caf::PdmObject* plotLegend();
RimFlowDiagSolution* flowDiagSolution(); RimEclipseResultCase* rimCase();
int timeStep(); int timeStep();
QString wellName() const; QString wellName() const;
@@ -111,6 +115,8 @@ private:
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override; virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
virtual void deleteViewWidget() override; virtual void deleteViewWidget() override;
cvf::Color3f getTracerColor(const QString& tracerName);
private: private:
caf::PdmField<bool> m_showPlotTitle; caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName; caf::PdmField<QString> m_userName;

View File

@@ -43,7 +43,7 @@ void RimBinaryExportSettings::defineEditorAttribute(const caf::PdmFieldHandle* f
{ {
if (field == &fileName) if (field == &fileName)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectSaveFileName = true; myAttr->m_selectSaveFileName = true;

View File

@@ -171,7 +171,7 @@ RimCellRangeFilterCollection* RimCellRangeFilter::parentContainer()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
{ {
caf::PdmUiSliderEditorAttribute* myAttr = static_cast<caf::PdmUiSliderEditorAttribute*>(attribute); caf::PdmUiSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiSliderEditorAttribute*>(attribute);
if (!myAttr || !parentContainer()) if (!myAttr || !parentContainer())
{ {
return; return;

View File

@@ -333,6 +333,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
} }
else if (dynamic_cast<RimEclipseWell*>(uiItem)) else if (dynamic_cast<RimEclipseWell*>(uiItem))
{ {
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewSimWellIntersectionFeature"; commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicShowWellAllocationPlotFeature"; commandIds << "RicShowWellAllocationPlotFeature";
} }
@@ -407,6 +408,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
} }
else if (dynamic_cast<RimEclipseCase*>(uiItem)) else if (dynamic_cast<RimEclipseCase*>(uiItem))
{ {
commandIds << "RicReloadCaseFeature";
commandIds << "RicExecuteScriptForCasesFeature"; commandIds << "RicExecuteScriptForCasesFeature";
} }
else if (dynamic_cast<RimSummaryPlot*>(uiItem)) else if (dynamic_cast<RimSummaryPlot*>(uiItem))

View File

@@ -42,6 +42,12 @@
#include "RimProject.h" #include "RimProject.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCollection.h"
#include "RimSummaryPlotCollection.h"
#include "RimFlowPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimSummaryPlot.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimWellAllocationPlot.h"
#include "cafPdmDocument.h" #include "cafPdmDocument.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
@@ -70,14 +76,20 @@ RimEclipseCase::RimEclipseCase()
CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", ""); CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "");
CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", ""); CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "");
CAF_PDM_InitFieldNoDefault(&filesContainingFaults, "FilesContainingFaults", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", "");
filesContainingFaults.uiCapability()->setUiHidden(true); m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden(true);
// Obsolete fields
CAF_PDM_InitFieldNoDefault(&m_filesContainingFaults_OBSOLETE, "FilesContainingFaults", "", "", "", "");
m_filesContainingFaults_OBSOLETE.xmlCapability()->setIOWritable(false);
m_filesContainingFaults_OBSOLETE.uiCapability()->setUiHidden(true);
// Obsolete field
CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,""); CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,"");
caseName.xmlCapability()->setIOWritable(false); caseName.xmlCapability()->setIOWritable(false);
caseName.uiCapability()->setUiHidden(true); caseName.uiCapability()->setUiHidden(true);
// Init
m_matrixModelResults = new RimReservoirCellResultsStorage; m_matrixModelResults = new RimReservoirCellResultsStorage;
m_matrixModelResults.uiCapability()->setUiHidden(true); m_matrixModelResults.uiCapability()->setUiHidden(true);
m_matrixModelResults.uiCapability()->setUiTreeChildrenHidden(true); m_matrixModelResults.uiCapability()->setUiTreeChildrenHidden(true);
@@ -297,40 +309,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{ {
if (changedField == &releaseResultMemory) if (changedField == &releaseResultMemory)
{ {
if (this->eclipseCaseData()) reloadDataAndUpdate();
{
for (size_t i = 0; i < reservoirViews().size(); i++)
{
RimEclipseView* reservoirView = reservoirViews()[i];
CVF_ASSERT(reservoirView);
RimEclipseCellColors* result = reservoirView->cellResult;
CVF_ASSERT(result);
result->setResultVariable(RimDefines::undefinedResultName());
result->loadResult();
RimCellEdgeColors* cellEdgeResult = reservoirView->cellEdgeResult;
CVF_ASSERT(cellEdgeResult);
cellEdgeResult->setResultVariable(RimDefines::undefinedResultName());
cellEdgeResult->loadResult();
reservoirView->createDisplayModelAndRedraw();
}
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixModelResults)
{
matrixModelResults->clearAllResults();
}
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fractureModelResults)
{
fractureModelResults->clearAllResults();
}
}
releaseResultMemory = oldValue.toBool(); releaseResultMemory = oldValue.toBool();
} }
@@ -546,6 +525,39 @@ RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::Poro
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimEclipseCase::filesContainingFaults() const
{
QString separatedPaths = m_filesContainingFaultsSemColSeparated;
QStringList pathList = separatedPaths.split(";", QString::SkipEmptyParts);
std::vector<QString> stdPathList;
for (auto& path: pathList) stdPathList.push_back(path);
return stdPathList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::setFilesContainingFaults(const std::vector<QString>& val)
{
QString separatedPaths;
for (size_t i = 0; i < val.size(); ++i)
{
const auto& path = val[i];
separatedPaths += path;
if (!(i+1 >= val.size()) )
{
separatedPaths += ";";
}
}
m_filesContainingFaultsSemColSeparated = separatedPaths;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -664,6 +676,67 @@ QString RimEclipseCase::timeStepName(int frameIdx)
return date.toString(m_timeStepFormatString); return date.toString(m_timeStepFormatString);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::reloadDataAndUpdate()
{
if (this->eclipseCaseData())
{
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixModelResults)
{
matrixModelResults->clearAllResults();
}
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fractureModelResults)
{
fractureModelResults->clearAllResults();
}
reloadEclipseGridFile();
for (size_t i = 0; i < reservoirViews().size(); i++)
{
RimEclipseView* reservoirView = reservoirViews()[i];
CVF_ASSERT(reservoirView);
reservoirView->loadDataAndUpdate();
reservoirView->updateGridBoxData();
}
RimProject* project = RiaApplication::instance()->project();
if (project)
{
if (project->mainPlotCollection())
{
RimWellLogPlotCollection* wellPlotCollection = project->mainPlotCollection()->wellLogPlotCollection();
RimSummaryPlotCollection* summaryPlotCollection = project->mainPlotCollection()->summaryPlotCollection();
RimFlowPlotCollection* flowPlotCollection = project->mainPlotCollection()->flowPlotCollection();
if (wellPlotCollection)
{
for (size_t i = 0; i < wellPlotCollection->wellLogPlots().size(); ++i)
{
wellPlotCollection->wellLogPlots()[i]->loadDataAndUpdate();
}
}
if (summaryPlotCollection)
{
for (size_t i = 0; i < summaryPlotCollection->summaryPlots().size(); ++i)
{
summaryPlotCollection->summaryPlots()[i]->loadDataAndUpdate();
}
}
if (flowPlotCollection)
{
flowPlotCollection->loadDataAndUpdate();
}
}
}
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -62,8 +62,8 @@ public:
caf::PdmField<bool> flipXAxis; caf::PdmField<bool> flipXAxis;
caf::PdmField<bool> flipYAxis; caf::PdmField<bool> flipYAxis;
caf::PdmField<std::vector<QString> > filesContainingFaults; std::vector<QString> filesContainingFaults() const;
void setFilesContainingFaults(const std::vector<QString>& val);
bool openReserviorCase(); bool openReserviorCase();
virtual bool openEclipseGridFile() = 0; virtual bool openEclipseGridFile() = 0;
@@ -95,6 +95,9 @@ public:
virtual cvf::BoundingBox allCellsBoundingBox() const; virtual cvf::BoundingBox allCellsBoundingBox() const;
virtual cvf::Vec3d displayModelOffset() const; virtual cvf::Vec3d displayModelOffset() const;
void reloadDataAndUpdate();
virtual void reloadEclipseGridFile() = 0;
// Overridden methods from PdmObject // Overridden methods from PdmObject
public: public:
@@ -118,8 +121,13 @@ private:
QString m_timeStepFormatString; QString m_timeStepFormatString;
std::map<QString , cvf::Color3f> m_wellToColorMap; std::map<QString , cvf::Color3f> m_wellToColorMap;
caf::PdmField<QString > m_filesContainingFaultsSemColSeparated;
// Obsolete fields // Obsolete fields
protected: protected:
caf::PdmField<QString> caseName; caf::PdmField<QString> caseName;
private:
caf::PdmField<std::vector<QString> > m_filesContainingFaults_OBSOLETE;
}; };

View File

@@ -228,6 +228,15 @@ bool RimEclipseInputCase::openEclipseGridFile()
return true; return true;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseInputCase::reloadEclipseGridFile()
{
setReservoirData(nullptr);
openReserviorCase();
}
#define for_all(stdVector, indexName) for (size_t indexName = 0; indexName < stdVector.size(); ++indexName) #define for_all(stdVector, indexName) for (size_t indexName = 0; indexName < stdVector.size(); ++indexName)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Loads input property data from the gridFile and additional files /// Loads input property data from the gridFile and additional files

View File

@@ -53,6 +53,7 @@ public:
// RimCase overrides // RimCase overrides
virtual bool openEclipseGridFile(); // Find grid file among file set. Read, Find read and validate property date. Syncronize child property sets. virtual bool openEclipseGridFile(); // Find grid file among file set. Read, Find read and validate property date. Syncronize child property sets.
virtual void reloadEclipseGridFile();
// Overrides from RimCase // Overrides from RimCase
virtual QString locationOnDisc() const; virtual QString locationOnDisc() const;

View File

@@ -70,7 +70,10 @@ void RimEclipsePropertyFilterCollection::loadAndInitializePropertyFilters()
for (size_t i = 0; i < propertyFilters.size(); i++) for (size_t i = 0; i < propertyFilters.size(); i++)
{ {
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i]; RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
propertyFilter->resultDefinition->setEclipseCase(reservoirView()->eclipseCase());
propertyFilter->initAfterRead(); propertyFilter->initAfterRead();
propertyFilter->resultDefinition->loadResult();
propertyFilter->computeResultValueRange();
} }
} }

View File

@@ -42,6 +42,7 @@
#include "cafPdmUiFilePathEditor.h" #include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiPropertyViewDialog.h" #include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
#include "cafUtils.h"
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@@ -102,7 +103,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
} }
else else
{ {
if (!QFile::exists(caseFileName())) if (!caf::Utils::fileExists(caseFileName()))
{ {
return false; return false;
} }
@@ -118,7 +119,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
return false; return false;
} }
this->filesContainingFaults = readerInterface->filenamesWithFaults(); this->setFilesContainingFaults(readerInterface->filenamesWithFaults());
this->setReservoirData( eclipseCase.p() ); this->setReservoirData( eclipseCase.p() );
} }
@@ -156,6 +157,17 @@ bool RimEclipseResultCase::openEclipseGridFile()
return true; return true;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultCase::reloadEclipseGridFile()
{
m_gridAndWellDataIsReadFromFile = false;
m_activeCellInfoIsReadFromFile = false;
setReservoirData(nullptr);
openReserviorCase();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -171,7 +183,7 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
} }
else else
{ {
if (!QFile::exists(caseFileName())) if (!caf::Utils::fileExists(caseFileName()))
{ {
return false; return false;
} }
@@ -368,6 +380,16 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj
// Update filename and folder paths when opening project from a different file location // Update filename and folder paths when opening project from a different file location
caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths); caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
std::vector<QString> relocatedFaultFiles;
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
for (auto faultFileName : orgFilesContainingFaults)
{
QString relocatedFaultFile = RimTools::relocateFile(faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
relocatedFaultFiles.push_back(relocatedFaultFile);
}
setFilesContainingFaults(relocatedFaultFiles);
#if 0 // Output the search path for debugging #if 0 // Output the search path for debugging
for (size_t i = 0; i < searchedPaths.size(); ++i) for (size_t i = 0; i < searchedPaths.size(); ++i)
qDebug() << searchedPaths[i]; qDebug() << searchedPaths[i];

View File

@@ -45,6 +45,7 @@ public:
void setSourSimFileName(const QString& fileName); void setSourSimFileName(const QString& fileName);
virtual bool openEclipseGridFile(); virtual bool openEclipseGridFile();
virtual void reloadEclipseGridFile();
bool openAndReadActiveCellData(RigEclipseCaseData* mainEclipseCase); bool openAndReadActiveCellData(RigEclipseCaseData* mainEclipseCase);
void readGridDimensions(std::vector< std::vector<int> >& gridDimensions); void readGridDimensions(std::vector< std::vector<int> >& gridDimensions);

View File

@@ -37,6 +37,8 @@
#include "RimReservoirCellResultsStorage.h" #include "RimReservoirCellResultsStorage.h"
#include "RimView.h" #include "RimView.h"
#include "RimViewLinker.h" #include "RimViewLinker.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "cafPdmUiListEditor.h" #include "cafPdmUiListEditor.h"
@@ -137,6 +139,8 @@ void RimEclipseResultDefinition::simpleCopy(const RimEclipseResultDefinition* ot
void RimEclipseResultDefinition::setEclipseCase(RimEclipseCase* eclipseCase) void RimEclipseResultDefinition::setEclipseCase(RimEclipseCase* eclipseCase)
{ {
m_eclipseCase = eclipseCase; m_eclipseCase = eclipseCase;
assignFlowSolutionFromCase();
} }
@@ -323,16 +327,15 @@ void RimEclipseResultDefinition::setTofAndSelectTracer(const QString& tracerName
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::assignFlowSolutionFromCase() void RimEclipseResultDefinition::assignFlowSolutionFromCase()
{ {
RimEclipseResultCase* eclCase = nullptr; RimFlowDiagSolution* defaultFlowDiagSolution = nullptr;
this->firstAncestorOrThisOfType(eclCase);
RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
if (eclCase) if (eclCase)
{ {
RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution(); defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution();
if (defaultFlowDiagSolution) }
{
this->setFlowSolution(defaultFlowDiagSolution); this->setFlowSolution(defaultFlowDiagSolution);
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -425,9 +428,11 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes(); hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
} }
// Do not include flow diag results if not available RimGridTimeHistoryCurve* timeHistoryCurve;
this->firstAncestorOrThisOfType(timeHistoryCurve);
if ( !hasFlowDiagFluxes ) // Do not include flow diagnostics results if not available or is a time history curve
if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr )
{ {
using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >; using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >;
for ( size_t i = 0; i < ResCatEnum::size(); ++i ) for ( size_t i = 0; i < ResCatEnum::size(); ++i )
@@ -464,8 +469,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
} }
else if (fieldNeedingOptions == &m_flowSolutionUiField) else if (fieldNeedingOptions == &m_flowSolutionUiField)
{ {
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
this->firstAncestorOrThisOfType(eclCase);
if (eclCase) if (eclCase)
{ {
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions(); std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
@@ -662,6 +666,18 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
{ {
timeStep = rimView->currentTimeStep(); timeStep = rimView->currentTimeStep();
} }
RimWellLogExtractionCurve* wellLogExtractionCurve = nullptr;
this->firstAncestorOrThisOfType(wellLogExtractionCurve);
if (wellLogExtractionCurve)
{
timeStep = static_cast<size_t>(wellLogExtractionCurve->currentTimeStep());
}
// Time history curves are not supported, since it requires the time
// step to access to be supplied.
RimGridTimeHistoryCurve* timeHistoryCurve = nullptr;
this->firstAncestorOrThisOfType(timeHistoryCurve);
CVF_ASSERT(timeHistoryCurve == nullptr);
std::set<std::string> selTracerNames; std::set<std::string> selTracerNames;
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION) if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)

View File

@@ -174,6 +174,15 @@ bool RimEclipseStatisticsCase::openEclipseGridFile()
return true; return true;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::reloadEclipseGridFile()
{
setReservoirData(nullptr);
openReserviorCase();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -604,14 +613,20 @@ void RimEclipseStatisticsCase::defineEditorAttribute(const caf::PdmFieldHandle*
if (&m_selectionSummary == field) if (&m_selectionSummary == field)
{ {
caf::PdmUiTextEditorAttribute* textEditAttrib = dynamic_cast<caf::PdmUiTextEditorAttribute*> (attribute); caf::PdmUiTextEditorAttribute* textEditAttrib = dynamic_cast<caf::PdmUiTextEditorAttribute*> (attribute);
if (textEditAttrib)
{
textEditAttrib->textMode = caf::PdmUiTextEditorAttribute::HTML; textEditAttrib->textMode = caf::PdmUiTextEditorAttribute::HTML;
} }
}
if (&m_calculateEditCommand == field) if (&m_calculateEditCommand == field)
{ {
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute); caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (attrib)
{
attrib->m_buttonText = hasComputedStatistics() ? "Edit (Will DELETE current results)": "Compute"; attrib->m_buttonText = hasComputedStatistics() ? "Edit (Will DELETE current results)": "Compute";
} }
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -61,6 +61,7 @@ public:
void updateConnectedEditorsAndReservoirViews(); void updateConnectedEditorsAndReservoirViews();
virtual bool openEclipseGridFile(); virtual bool openEclipseGridFile();
virtual void reloadEclipseGridFile();
RimCaseCollection* parentStatisticsCaseCollection(); RimCaseCollection* parentStatisticsCaseCollection();

View File

@@ -44,12 +44,13 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d
CVF_ASSERT(m_sourceCases.size() > 0); CVF_ASSERT(m_sourceCases.size() > 0);
std::vector<QDateTime> sourceTimeStepDates = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0); std::vector<QDateTime> sourceTimeStepDates = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0);
std::vector<double> sourceDaysSinceSimulationStart = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->daysSinceSimulationStart(0);
std::vector<int> sourceReportStepNumbers = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->reportStepNumbers(0); std::vector<int> sourceReportStepNumbers = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->reportStepNumbers(0);
size_t destinationScalarResultIndex = destinationCellResults->addEmptyScalarResult(resultType, resultName, true); size_t destinationScalarResultIndex = destinationCellResults->addEmptyScalarResult(resultType, resultName, true);
CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T); CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T);
destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates, sourceReportStepNumbers); destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates, sourceDaysSinceSimulationStart, sourceReportStepNumbers);
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex); std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex);
dataValues.resize(sourceTimeStepDates.size()); dataValues.resize(sourceTimeStepDates.size());

View File

@@ -42,7 +42,7 @@ void RimExportInputSettings::defineEditorAttribute(const caf::PdmFieldHandle* fi
{ {
if (field == &fileName) if (field == &fileName)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr) if (myAttr)
{ {
myAttr->m_selectSaveFileName = true; myAttr->m_selectSaveFileName = true;

View File

@@ -40,6 +40,8 @@
#include "RimGeoMechResultDefinition.h" #include "RimGeoMechResultDefinition.h"
#include "RimGeoMechPropertyFilter.h" #include "RimGeoMechPropertyFilter.h"
#include "cafUtils.h"
#include <QFile> #include <QFile>
CAF_PDM_SOURCE_INIT(RimGeoMechCase, "ResInsightGeoMechCase"); CAF_PDM_SOURCE_INIT(RimGeoMechCase, "ResInsightGeoMechCase");
@@ -110,7 +112,7 @@ bool RimGeoMechCase::openGeoMechCase(std::string* errorMessage)
// If read already, return // If read already, return
if (this->m_geoMechCaseData.notNull()) return true; if (this->m_geoMechCaseData.notNull()) return true;
if (!QFile::exists(m_caseFileName())) if (!caf::Utils::fileExists(m_caseFileName()))
{ {
return false; return false;
} }

View File

@@ -114,10 +114,13 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_resultPositionTypeUiField); uiOrdering.add(&m_resultPositionTypeUiField);
uiOrdering.add(&m_resultVariableUiField); uiOrdering.add(&m_resultVariableUiField);
if ( m_resultPositionTypeUiField() != RIG_FORMATION_NAMES )
{
caf::PdmUiGroup * timeLapseGr = uiOrdering.addNewGroup("Relative Result Options"); caf::PdmUiGroup * timeLapseGr = uiOrdering.addNewGroup("Relative Result Options");
timeLapseGr->add(&m_isTimeLapseResultUiField); timeLapseGr->add(&m_isTimeLapseResultUiField);
if (m_isTimeLapseResultUiField()) if ( m_isTimeLapseResultUiField() )
timeLapseGr->add(&m_timeLapseBaseTimestepUiField); timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
}
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields(true);
} }
@@ -137,7 +140,9 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting(); std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
QStringList uiVarNames; QStringList uiVarNames;
QStringList varNames; QStringList varNames;
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, m_isTimeLapseResultUiField, m_timeLapseBaseTimestepUiField); bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField() && (m_resultPositionTypeUiField() != RIG_FORMATION_NAMES);
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, isNeedingTimeLapseStrings, m_timeLapseBaseTimestepUiField);
for (int oIdx = 0; oIdx < uiVarNames.size(); ++oIdx) for (int oIdx = 0; oIdx < uiVarNames.size(); ++oIdx)
{ {
@@ -189,7 +194,8 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting(); std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
QStringList uiVarNames; QStringList uiVarNames;
QStringList varNames; QStringList varNames;
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, m_isTimeLapseResultUiField, m_timeLapseBaseTimestepUiField); bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField() && (m_resultPositionTypeUiField() != RIG_FORMATION_NAMES);
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, isNeedingTimeLapseStrings, m_timeLapseBaseTimestepUiField);
if (m_resultPositionTypeUiField() == m_resultPositionType() if (m_resultPositionTypeUiField() == m_resultPositionType()
&& m_isTimeLapseResultUiField() == m_isTimeLapseResult() && m_isTimeLapseResultUiField() == m_isTimeLapseResult()

View File

@@ -294,7 +294,6 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate()
if (isCurveVisible()) if (isCurveVisible())
{ {
std::vector<time_t> dateTimes;
std::vector<double> values; std::vector<double> values;
RimEclipseGeometrySelectionItem* eclTopItem = eclipseGeomSelectionItem(); RimEclipseGeometrySelectionItem* eclTopItem = eclipseGeomSelectionItem();
@@ -309,40 +308,44 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate()
m_geoMechResultDefinition->loadResult(); m_geoMechResultDefinition->loadResult();
} }
dateTimes = timeStepValues();
values = yValues(); values = yValues();
RimSummaryPlot* plot = nullptr; RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfType(plot); firstAncestorOrThisOfType(plot);
bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis()); bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis());
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
{
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE) if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
{
std::vector<time_t> dateTimes = timeStepValues();
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
{ {
m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve); m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve);
} }
else else
{ {
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale(); m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
std::vector<double> times;
if (dateTimes.size())
{
time_t startDate = dateTimes[0];
for (time_t& date : dateTimes)
{
times.push_back(timeScale*(date - startDate));
}
}
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
} }
} }
else else
{
std::vector<double> days = daysSinceSimulationStart();
if (days.size() > 0 && days.size() == values.size())
{
double timeScale = plot->timeAxisProperties()->fromDaysToDisplayUnitScale();
std::vector<double> times;
for (double day : days)
{
times.push_back(timeScale * day);
}
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
}
else
{ {
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve); m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
} }
}
updateZoomInParentPlot(); updateZoomInParentPlot();
@@ -404,6 +407,56 @@ std::vector<time_t> RimGridTimeHistoryCurve::timeStepValues() const
return dateTimes; return dateTimes;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimGridTimeHistoryCurve::daysSinceSimulationStart() const
{
std::vector<double> daysSinceSimulationStart;
RimEclipseGeometrySelectionItem* eclTopItem = eclipseGeomSelectionItem();
if (eclTopItem && eclTopItem->eclipseCase())
{
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
daysSinceSimulationStart = cellResultsData->daysSinceSimulationStart();
}
RimGeoMechGeometrySelectionItem* geoMechTopItem = geoMechGeomSelectionItem();
if (geoMechTopItem && geoMechTopItem->geoMechCase())
{
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
if (timeHistResultAccessor)
{
std::vector<double> values = timeHistResultAccessor->timeHistoryValues();
QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings();
std::vector<QDateTime> dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames);
if (dates.size() == values.size())
{
if (!dates.empty()) {
time_t startDate = dates[0].toTime_t();
double secondsToDaysConversion = (24.0 * 60.0 * 60.0);
for (QDateTime dt : dates)
{
double timeDifference = static_cast<double>(dt.toTime_t() - startDate);
daysSinceSimulationStart.push_back(timeDifference / secondsToDaysConversion);
}
}
}
else
{
for (size_t i = 0; i < values.size(); i++)
{
daysSinceSimulationStart.push_back(i);
}
}
}
}
return daysSinceSimulationStart;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -434,6 +487,7 @@ void RimGridTimeHistoryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiO
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->setCollapsedByDefault(true); nameGroup->setCollapsedByDefault(true);
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup); RimPlotCurve::curveNameUiOrdering(*nameGroup);
} }

View File

@@ -56,6 +56,7 @@ public:
std::vector<double> yValues() const; std::vector<double> yValues() const;
std::vector<time_t> timeStepValues() const; std::vector<time_t> timeStepValues() const;
std::vector<double> daysSinceSimulationStart() const;
QString quantityName() const; QString quantityName() const;
QString caseName() const; QString caseName() const;

View File

@@ -239,6 +239,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS; RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS;
std::vector<QDateTime> timeStepDates = rigCaseData->results(poroModel)->timeStepDates(0); std::vector<QDateTime> timeStepDates = rigCaseData->results(poroModel)->timeStepDates(0);
std::vector<double> daysSinceSimulationStart = rigCaseData->results(poroModel)->daysSinceSimulationStart(0);
std::vector<int> reportStepNumbers = rigCaseData->results(poroModel)->reportStepNumbers(0); std::vector<int> reportStepNumbers = rigCaseData->results(poroModel)->reportStepNumbers(0);
const std::vector<RigCaseCellResultsData::ResultInfo> resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex(); const std::vector<RigCaseCellResultsData::ResultInfo> resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex();
@@ -264,7 +265,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
if (mustBeCalculated) cellResultsStorage->cellResults()->setMustBeCalculated(scalarResultIndex); if (mustBeCalculated) cellResultsStorage->cellResults()->setMustBeCalculated(scalarResultIndex);
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates, reportStepNumbers); cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates, daysSinceSimulationStart, reportStepNumbers);
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex); std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex);
dataValues.resize(timeStepDates.size()); dataValues.resize(timeStepDates.size());

View File

@@ -553,6 +553,8 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
{ {
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute); caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (attrib)
{
if (inputPolyLineFromViewerEnabled) if (inputPolyLineFromViewerEnabled)
{ {
attrib->m_buttonText = "Stop picking points"; attrib->m_buttonText = "Stop picking points";
@@ -562,6 +564,7 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
attrib->m_buttonText = "Start picking points"; attrib->m_buttonText = "Start picking points";
} }
} }
}
else if (field == &m_userPolyline) else if (field == &m_userPolyline)
{ {
caf::PdmUiListEditorAttribute* myAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute); caf::PdmUiListEditorAttribute* myAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute);
@@ -574,6 +577,8 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
{ {
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute); caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (attrib)
{
if (inputExtrusionPointsFromViewerEnabled) if (inputExtrusionPointsFromViewerEnabled)
{ {
attrib->m_buttonText = "Stop picking points"; attrib->m_buttonText = "Stop picking points";
@@ -583,6 +588,7 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
attrib->m_buttonText = "Start picking points"; attrib->m_buttonText = "Start picking points";
} }
} }
}
else if (field == &m_customExtrusionPoints) else if (field == &m_customExtrusionPoints)
{ {
caf::PdmUiListEditorAttribute* myAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute); caf::PdmUiListEditorAttribute* myAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>(attribute);

View File

@@ -404,6 +404,8 @@ void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field,
{ {
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute); caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (attrib)
{
if (m_show3DManipulator) if (m_show3DManipulator)
{ {
attrib->m_buttonText = "Hide 3D manipulator"; attrib->m_buttonText = "Hide 3D manipulator";
@@ -413,6 +415,8 @@ void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field,
attrib->m_buttonText = "Show 3D manipulator"; attrib->m_buttonText = "Show 3D manipulator";
} }
} }
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -62,16 +62,16 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
CAF_PDM_InitFieldNoDefault(&view, "View", "View", "", "", ""); CAF_PDM_InitFieldNoDefault(&view, "View", "View", "", "", "");
CAF_PDM_InitFieldNoDefault(&eclipseResultType, "EclipseResultType", "Result Type", "", "", ""); CAF_PDM_InitFieldNoDefault(&eclipseResultType, "EclipseResultType", "Result Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&selectedEclipseResults, "SelectedEclipseResults", "Result Name", "", "", ""); CAF_PDM_InitFieldNoDefault(&selectedEclipseResults, "SelectedEclipseResults", "Properties", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", ""); CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Start Time", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", ""); CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "End Time", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", ""); CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter Slice", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", ""); CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "Range Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", ""); CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "Range End", "", "", "");
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Case List", "", "", ""); CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Cases", "", "", "");
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -90,6 +90,8 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitField(&m_symbolSkipPixelDistance, "SymbolSkipPxDist", 0.0f, "Symbol Skip Distance", "", "Minimum pixel distance between symbols", ""); CAF_PDM_InitField(&m_symbolSkipPixelDistance, "SymbolSkipPxDist", 0.0f, "Symbol Skip Distance", "", "Minimum pixel distance between symbols", "");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "");
m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve; m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve;
m_parentQwtPlot = NULL; m_parentQwtPlot = NULL;
@@ -139,6 +141,10 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
updateCurveName(); updateCurveName();
} }
else if (changedField == &m_showLegend)
{
updateLegendVisibility();
}
if (m_parentQwtPlot) m_parentQwtPlot->replot(); if (m_parentQwtPlot) m_parentQwtPlot->replot();
} }
@@ -255,6 +261,7 @@ void RimPlotCurve::updateCurveName()
} }
m_qwtPlotCurve->setTitle(m_curveName); m_qwtPlotCurve->setTitle(m_curveName);
updateLegendVisibility();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -420,3 +427,37 @@ void RimPlotCurve::setLineThickness(int thickness)
m_curveThickness = thickness; m_curveThickness = thickness;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::showLegend(bool show)
{
m_showLegend = show;
updateLegendVisibility();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updateLegendVisibility()
{
if (m_showLegend()) {
if (m_curveName().isEmpty())
{
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, false);
}
else
{
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, true);
}
}
else
{
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, false);
}
if (m_parentQwtPlot != nullptr)
{
m_parentQwtPlot->updateLegend();
}
}

View File

@@ -78,6 +78,9 @@ public:
QString curveName() const { return m_curveName; } QString curveName() const { return m_curveName; }
void updateCurveVisibility(); void updateCurveVisibility();
void updateLegendVisibility();
void showLegend(bool show);
protected: protected:
@@ -107,6 +110,7 @@ protected:
caf::PdmField<bool> m_showCurve; caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_curveName; caf::PdmField<QString> m_curveName;
caf::PdmField<QString> m_customCurveName; caf::PdmField<QString> m_customCurveName;
caf::PdmField<bool> m_showLegend;
caf::PdmField<bool> m_isUsingAutoName; caf::PdmField<bool> m_isUsingAutoName;
caf::PdmField<cvf::Color3f> m_curveColor; caf::PdmField<cvf::Color3f> m_curveColor;

View File

@@ -417,20 +417,20 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
} }
// Update path to well path file cache // Update path to well path file cache
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = oilFields[oilFieldIdx];
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
oilField->wellPathCollection->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
for(RimOilField* oilField: oilFields) for(RimOilField* oilField: oilFields)
{ {
if(oilField == NULL) continue; if (oilField == NULL) continue;
if(oilField->formationNamesCollection() != NULL) if (oilField->wellPathCollection() != NULL)
{
oilField->wellPathCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
if (oilField->formationNamesCollection() != NULL)
{ {
oilField->formationNamesCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath); oilField->formationNamesCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
} }
if (oilField->summaryCaseCollection() != NULL) {
oilField->summaryCaseCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
} }

View File

@@ -29,6 +29,7 @@
#include "RimTools.h" #include "RimTools.h"
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
#include "cafUtils.h"
#include "cvfGeometryTools.h" #include "cvfGeometryTools.h"
@@ -137,6 +138,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave()
cacheEntry->m_resultType = resInfo[rIdx].m_resultType; cacheEntry->m_resultType = resInfo[rIdx].m_resultType;
cacheEntry->m_resultName = resInfo[rIdx].m_resultName; cacheEntry->m_resultName = resInfo[rIdx].m_resultName;
cacheEntry->m_timeStepDates = resInfo[rIdx].m_timeStepDates; cacheEntry->m_timeStepDates = resInfo[rIdx].m_timeStepDates;
cacheEntry->m_daysSinceSimulationStart = resInfo[rIdx].m_daysSinceSimulationStart;
// Take note of the file position for fast lookup later // Take note of the file position for fast lookup later
cacheEntry->m_filePosition = cacheFile.pos(); cacheEntry->m_filePosition = cacheFile.pos();
@@ -1393,16 +1395,15 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
// Get the name of the cache name relative to the current project file position // Get the name of the cache name relative to the current project file position
QString newValidCacheFileName = getValidCacheFileName(); QString newValidCacheFileName = getValidCacheFileName();
QFile storageFile(newValidCacheFileName);
// Warn if we thought we were to find some data on the storage file // Warn if we thought we were to find some data on the storage file
if (!storageFile.exists() && m_resultCacheMetaData.size()) if (!caf::Utils::fileExists(newValidCacheFileName) && m_resultCacheMetaData.size())
{ {
qWarning() << "Reading stored results: Missing the storage file : " + newValidCacheFileName; qWarning() << "Reading stored results: Missing the storage file : " + newValidCacheFileName;
return; return;
} }
QFile storageFile(newValidCacheFileName);
if (!storageFile.open(QIODevice::ReadOnly)) if (!storageFile.open(QIODevice::ReadOnly))
{ {
qWarning() << "Reading stored results: Can't open the file : " + newValidCacheFileName; qWarning() << "Reading stored results: Can't open the file : " + newValidCacheFileName;
@@ -1436,7 +1437,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
RimReservoirCellResultsStorageEntryInfo* resInfo = m_resultCacheMetaData[rIdx]; RimReservoirCellResultsStorageEntryInfo* resInfo = m_resultCacheMetaData[rIdx];
size_t resultIndex = m_cellResults->addEmptyScalarResult(resInfo->m_resultType(), resInfo->m_resultName(), true); size_t resultIndex = m_cellResults->addEmptyScalarResult(resInfo->m_resultType(), resInfo->m_resultName(), true);
m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates(), std::vector<int>()); // Hack: Using no report step numbers. Not really used except for Flow Diagnostics... m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates(), resInfo->m_daysSinceSimulationStart(), std::vector<int>()); // Hack: Using no report step numbers. Not really used except for Flow Diagnostics...
progress.setProgressDescription(resInfo->m_resultName); progress.setProgressDescription(resInfo->m_resultName);
@@ -1556,6 +1557,7 @@ RimReservoirCellResultsStorageEntryInfo::RimReservoirCellResultsStorageEntryInfo
CAF_PDM_InitField(&m_resultType, "ResultType", caf::AppEnum<RimDefines::ResultCatType>(RimDefines::REMOVED), "ResultType", "", "" ,""); CAF_PDM_InitField(&m_resultType, "ResultType", caf::AppEnum<RimDefines::ResultCatType>(RimDefines::REMOVED), "ResultType", "", "" ,"");
CAF_PDM_InitField(&m_resultName, "ResultName", QString(), "ResultName", "", "" ,""); CAF_PDM_InitField(&m_resultName, "ResultName", QString(), "ResultName", "", "" ,"");
CAF_PDM_InitFieldNoDefault(&m_timeStepDates, "TimeSteps", "TimeSteps", "", "" ,""); CAF_PDM_InitFieldNoDefault(&m_timeStepDates, "TimeSteps", "TimeSteps", "", "" ,"");
CAF_PDM_InitFieldNoDefault(&m_daysSinceSimulationStart, "DaysSinceSimulationStart", "DaysSinceSimulationStart", "", "", "");
CAF_PDM_InitField(&m_filePosition, "FilePositionDataStart", qint64(-1), "FilePositionDataStart", "", "" ,""); CAF_PDM_InitField(&m_filePosition, "FilePositionDataStart", qint64(-1), "FilePositionDataStart", "", "" ,"");
} }

View File

@@ -101,6 +101,7 @@ public:
caf::PdmField<caf::AppEnum< RimDefines::ResultCatType> > m_resultType; caf::PdmField<caf::AppEnum< RimDefines::ResultCatType> > m_resultType;
caf::PdmField<QString> m_resultName; caf::PdmField<QString> m_resultName;
caf::PdmField< std::vector <QDateTime> > m_timeStepDates; caf::PdmField< std::vector <QDateTime> > m_timeStepDates;
caf::PdmField< std::vector <double> > m_daysSinceSimulationStart;
caf::PdmField<qint64> m_filePosition; caf::PdmField<qint64> m_filePosition;
}; };

View File

@@ -87,11 +87,12 @@ void RimScriptCollection::readContentFromDisc()
{ {
QString fileName = fileList.at(i); QString fileName = fileList.at(i);
QFileInfo fi(fileName); if (caf::Utils::fileExists(fileName))
if (fi.exists())
{ {
RimCalcScript* calcScript = new RimCalcScript; RimCalcScript* calcScript = new RimCalcScript;
calcScript->absolutePath = fileName; calcScript->absolutePath = fileName;
QFileInfo fi(fileName);
calcScript->setUiName(fi.baseName()); calcScript->setUiName(fi.baseName());
calcScripts.push_back(calcScript); calcScripts.push_back(calcScript);
@@ -187,7 +188,10 @@ void RimScriptCollection::defineEditorAttribute(const caf::PdmFieldHandle* field
{ {
if (field == &directory) if (field == &directory)
{ {
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute); caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_selectDirectory = true; myAttr->m_selectDirectory = true;
} }
}
} }

View File

@@ -30,6 +30,7 @@
#include "RimWellPathCollection.h" #include "RimWellPathCollection.h"
#include "cafPdmUiItem.h" #include "cafPdmUiItem.h"
#include "cafUtils.h"
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
@@ -81,7 +82,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
bool isWindowsPath = false; bool isWindowsPath = false;
if (orgFileName.count("/")) isWindowsPath = false; // "/" are not allowed in a windows path if (orgFileName.count("/")) isWindowsPath = false; // "/" are not allowed in a windows path
else if (orgFileName.count("\\") else if (orgFileName.count("\\")
&& !QFile::exists(orgFileName)) // To make sure we do not convert single linux files containing "\" && !caf::Utils::fileExists(orgFileName)) // To make sure we do not convert single linux files containing "\"
{ {
isWindowsPath = true; isWindowsPath = true;
} }
@@ -93,7 +94,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
} }
if (searchedPaths) searchedPaths->push_back(fileName); if (searchedPaths) searchedPaths->push_back(fileName);
if (QFile::exists(fileName)) if (caf::Utils::fileExists(fileName))
{ {
return fileName; return fileName;
} }
@@ -104,7 +105,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
QString candidate = QDir::fromNativeSeparators(newProjectPath + QDir::separator() + fileNameWithoutPath); QString candidate = QDir::fromNativeSeparators(newProjectPath + QDir::separator() + fileNameWithoutPath);
if (searchedPaths) searchedPaths->push_back(candidate); if (searchedPaths) searchedPaths->push_back(candidate);
if (QFile::exists(candidate)) if (caf::Utils::fileExists(candidate))
{ {
return candidate; return candidate;
} }
@@ -130,7 +131,15 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
int firstDiffIdx = 0; int firstDiffIdx = 0;
for (firstDiffIdx = 0; firstDiffIdx < gridPathElements.size() && firstDiffIdx < oldProjPathElements.size(); ++firstDiffIdx) for (firstDiffIdx = 0; firstDiffIdx < gridPathElements.size() && firstDiffIdx < oldProjPathElements.size(); ++firstDiffIdx)
{ {
if (gridPathElements[firstDiffIdx] == oldProjPathElements[firstDiffIdx]) #ifdef WIN32
// When comparing parts of a file path, the drive letter has been seen to be a mix of
// upper and lower cases. Always use case insensitive compare on Windows, as this is a valid approach
// for all parts for a file path
Qt::CaseSensitivity cs = Qt::CaseInsensitive;
#else
Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
if (gridPathElements[firstDiffIdx].compare(oldProjPathElements[firstDiffIdx], cs) == 0)
{ {
pathStartsAreEqual = pathStartsAreEqual || !gridPathElements[firstDiffIdx].isEmpty(); pathStartsAreEqual = pathStartsAreEqual || !gridPathElements[firstDiffIdx].isEmpty();
} }
@@ -191,7 +200,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
if (searchedPaths) searchedPaths->push_back(relocatedFileName); if (searchedPaths) searchedPaths->push_back(relocatedFileName);
if (QFile::exists(relocatedFileName)) if (caf::Utils::fileExists(relocatedFileName))
{ {
return relocatedFileName; return relocatedFileName;
} }

View File

@@ -169,6 +169,7 @@ public:
public: public:
virtual void loadDataAndUpdate() = 0; virtual void loadDataAndUpdate() = 0;
void updateGridBoxData();
virtual RimCase* ownerCase() = 0; virtual RimCase* ownerCase() = 0;
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; } virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
@@ -187,7 +188,6 @@ protected:
virtual void createDisplayModel() = 0; virtual void createDisplayModel() = 0;
void createHighlightAndGridBoxDisplayModel(); void createHighlightAndGridBoxDisplayModel();
void updateGridBoxData();
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0; virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0;

View File

@@ -22,6 +22,7 @@
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimView.h" #include "RimView.h"
#include "RimCase.h"
#include "RiuViewer.h" #include "RiuViewer.h"
@@ -36,25 +37,35 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewManipulator::applySourceViewCameraOnDestinationViews(RimView* sourceView, std::vector<RimView*>& destinationViews) void RimViewManipulator::applySourceViewCameraOnDestinationViews(RimView* sourceView, std::vector<RimView*>& destinationViews)
{ {
bool setPointOfInterest = false;
cvf::Vec3d sourceCamUp; cvf::Vec3d sourceCamUp;
cvf::Vec3d sourceCamEye; cvf::Vec3d sourceCamEye;
cvf::Vec3d sourceCamViewRefPoint; cvf::Vec3d sourceCamViewRefPoint;
cvf::Vec3d sourcePointOfInterest;
sourceView->viewer()->mainCamera()->toLookAt(&sourceCamEye, &sourceCamViewRefPoint, &sourceCamUp); sourceView->viewer()->mainCamera()->toLookAt(&sourceCamEye, &sourceCamViewRefPoint, &sourceCamUp);
cvf::Vec3d sourceCamGlobalEye = sourceCamEye; cvf::Vec3d sourceCamGlobalEye = sourceCamEye;
cvf::Vec3d sourceCamGlobalViewRefPoint = sourceCamViewRefPoint; cvf::Vec3d sourceCamGlobalViewRefPoint = sourceCamViewRefPoint;
if (sourceView->viewer()->getNavigationPolicy() != nullptr)
{
setPointOfInterest = true;
sourcePointOfInterest = sourceView->viewer()->pointOfInterest();
}
// Source bounding box in global coordinates including scaleZ // Source bounding box in global coordinates including scaleZ
cvf::BoundingBox sourceSceneBB = sourceView->viewer()->currentScene()->boundingBox(); cvf::BoundingBox sourceSceneBB = sourceView->viewer()->currentScene()->boundingBox();
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(sourceView);
if (eclipseView && eclipseView->mainGrid())
{ {
cvf::Vec3d offset = eclipseView->mainGrid()->displayModelOffset(); cvf::Vec3d offset = cvf::Vec3d::ZERO;
offset.z() *= eclipseView->scaleZ(); RimCase* sourceOwnerCase = sourceView->ownerCase();
if (sourceOwnerCase)
{
offset = sourceOwnerCase->displayModelOffset();
offset.z() *= sourceView->scaleZ();
}
sourceCamGlobalEye += offset; sourceCamGlobalEye += offset;
sourceCamGlobalViewRefPoint += offset; sourceCamGlobalViewRefPoint += offset;
if (setPointOfInterest) sourcePointOfInterest += offset;
cvf::Mat4d trans; cvf::Mat4d trans;
trans.setTranslation(offset); trans.setTranslation(offset);
@@ -74,18 +85,22 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews(RimView* source
// Destination bounding box in global coordinates including scaleZ // Destination bounding box in global coordinates including scaleZ
cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox(); cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox();
cvf::Vec3d destinationCamEye = sourceCamGlobalEye;
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint;
cvf::Vec3d offset = cvf::Vec3d::ZERO;
RimEclipseView* destEclipseView = dynamic_cast<RimEclipseView*>(destinationView); RimCase* destinationOwnerCase = destinationView->ownerCase();
if (destEclipseView && destEclipseView->mainGrid()) if (destinationOwnerCase)
{ {
cvf::Vec3d destOffset = destEclipseView->mainGrid()->displayModelOffset(); offset = destinationOwnerCase->displayModelOffset();
destOffset.z() *= destEclipseView->scaleZ(); offset.z() *= destinationView->scaleZ();
}
cvf::Vec3d destinationCamEye = sourceCamGlobalEye - destOffset; destinationCamEye -= offset;
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint - destOffset; destinationCamViewRefPoint -= offset;
cvf::Mat4d trans; cvf::Mat4d trans;
trans.setTranslation(destOffset); trans.setTranslation(offset);
destSceneBB.transform(trans); destSceneBB.transform(trans);
if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB)) if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB))
@@ -97,21 +112,14 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews(RimView* source
// Fallback using values from source camera // Fallback using values from source camera
destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp); destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp);
} }
}
else
{
if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB))
{
destinationViewer->mainCamera()->setFromLookAt(sourceCamGlobalEye, sourceCamGlobalViewRefPoint, sourceCamUp);
}
else
{
// Fallback using values from source camera
destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp);
}
}
destinationViewer->updateParallelProjectionSettings(sourceView->viewer()); if (setPointOfInterest)
{
cvf::Vec3d pointOfInterest = sourcePointOfInterest;
pointOfInterest -= offset;
destinationViewer->updateParallelProjectionHeightFromMoveZoom(pointOfInterest);
destinationViewer->updateParallelProjectionCameraPosFromPointOfInterestMove(pointOfInterest);
}
destinationViewer->update(); destinationViewer->update();
} }

View File

@@ -28,6 +28,9 @@
#include "RigGeoMechCaseData.h" #include "RigGeoMechCaseData.h"
#include "RigGeoMechWellLogExtractor.h" #include "RigGeoMechWellLogExtractor.h"
#include "RigResultAccessorFactory.h" #include "RigResultAccessorFactory.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigSimulationWellCoordsAndMD.h"
#include "RigSingleWellResultsData.h"
#include "RigWellLogCurveData.h" #include "RigWellLogCurveData.h"
#include "RigWellPath.h" #include "RigWellPath.h"
@@ -38,6 +41,7 @@
#include "RimGeoMechCase.h" #include "RimGeoMechCase.h"
#include "RimGeoMechResultDefinition.h" #include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimMainPlotCollection.h"
#include "RimOilField.h" #include "RimOilField.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimTools.h" #include "RimTools.h"
@@ -55,6 +59,7 @@
#include "cafUtils.h" #include "cafUtils.h"
#include <cmath> #include <cmath>
#include "RimEclipseWell.h"
//================================================================================================== //==================================================================================================
/// ///
@@ -63,6 +68,19 @@
CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurve, "RimWellLogExtractionCurve"); CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurve, "RimWellLogExtractionCurve");
namespace caf
{
template<>
void AppEnum< RimWellLogExtractionCurve::TrajectoryType >::setUp()
{
addItem(RimWellLogExtractionCurve::WELL_PATH, "WELL_PATH", "Well Path");
addItem(RimWellLogExtractionCurve::SIMULATION_WELL, "SIMULATION_WELL", "Simulation Well");
setDefault(RimWellLogExtractionCurve::WELL_PATH);
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -70,17 +88,22 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
{ {
CAF_PDM_InitObject("Well Log Curve", "", "", ""); CAF_PDM_InitObject("Well Log Curve", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", "Well Path", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_trajectoryType, "TrajectoryType", "Trajectory", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", " ", "", "", "");
m_wellPath.uiCapability()->setUiTreeChildrenHidden(true); m_wellPath.uiCapability()->setUiTreeChildrenHidden(true);
//m_wellPath.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_simWellName, "SimulationWellName", QString("None"), " ", "", "", "");
CAF_PDM_InitField(&m_branchIndex, "Branch", 0, " ", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", "");
m_case.uiCapability()->setUiTreeChildrenHidden(true); m_case.uiCapability()->setUiTreeChildrenHidden(true);
//m_case.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "");
m_eclipseResultDefinition.uiCapability()->setUiHidden(true); m_eclipseResultDefinition.uiCapability()->setUiHidden(true);
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true); m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
m_eclipseResultDefinition = new RimEclipseResultDefinition; m_eclipseResultDefinition = new RimEclipseResultDefinition;
m_eclipseResultDefinition->findField("MResultType")->uiCapability()->setUiName("Result Type");
CAF_PDM_InitFieldNoDefault(&m_geomResultDefinition, "CurveGeomechResult", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_geomResultDefinition, "CurveGeomechResult", "", "", "", "");
m_geomResultDefinition.uiCapability()->setUiHidden(true); m_geomResultDefinition.uiCapability()->setUiHidden(true);
@@ -102,6 +125,8 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve::~RimWellLogExtractionCurve() RimWellLogExtractionCurve::~RimWellLogExtractionCurve()
{ {
clearGeneratedSimWellPaths();
delete m_geomResultDefinition; delete m_geomResultDefinition;
delete m_eclipseResultDefinition; delete m_eclipseResultDefinition;
} }
@@ -123,12 +148,25 @@ RimWellPath* RimWellLogExtractionCurve::wellPath() const
return m_wellPath; return m_wellPath;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setFromSimulationWellName(const QString& simWellName, int branchIndex)
{
m_trajectoryType = SIMULATION_WELL;
m_simWellName = simWellName;
m_branchIndex = branchIndex;
clearGeneratedSimWellPaths();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setCase(RimCase* rimCase) void RimWellLogExtractionCurve::setCase(RimCase* rimCase)
{ {
m_case = rimCase; m_case = rimCase;
clearGeneratedSimWellPaths();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -165,6 +203,8 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view)
m_geomResultDefinition->setResultAddress(geoMechView->cellResultResultDefinition()->resultAddress()); m_geomResultDefinition->setResultAddress(geoMechView->cellResultResultDefinition()->resultAddress());
m_timeStep = geoMechView->currentTimeStep(); m_timeStep = geoMechView->currentTimeStep();
} }
clearGeneratedSimWellPaths();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -181,6 +221,23 @@ void RimWellLogExtractionCurve::clampTimestep()
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::clampBranchIndex()
{
int branchCount = static_cast<int>(m_generatedSimulationWellPathBranches.size());
if ( branchCount > 0 )
{
if ( m_branchIndex >= branchCount ) m_branchIndex = branchCount - 1;
else if ( m_branchIndex < 0 ) m_branchIndex = 0;
}
else
{
m_branchIndex = -1;
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -192,12 +249,28 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
{ {
clampTimestep(); clampTimestep();
auto wellNameSet = findSortedWellNames();
if (!wellNameSet.count(m_simWellName())) m_simWellName = "None";
clearGeneratedSimWellPaths();
this->loadDataAndUpdate(); this->loadDataAndUpdate();
} }
else if (changedField == &m_wellPath) else if (changedField == &m_wellPath)
{ {
this->loadDataAndUpdate(); this->loadDataAndUpdate();
} }
else if (changedField == &m_simWellName)
{
clearGeneratedSimWellPaths();
this->loadDataAndUpdate();
}
else if (changedField == &m_trajectoryType ||
changedField == &m_branchIndex)
{
this->loadDataAndUpdate();
}
else if (changedField == &m_timeStep) else if (changedField == &m_timeStep)
{ {
this->loadDataAndUpdate(); this->loadDataAndUpdate();
@@ -230,12 +303,27 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
m_eclipseResultDefinition->setEclipseCase(eclipseCase); m_eclipseResultDefinition->setEclipseCase(eclipseCase);
m_geomResultDefinition->setGeoMechCase(geomCase); m_geomResultDefinition->setGeoMechCase(geomCase);
RimWellLogPlotCollection* wellLogCollection = NULL; updateGeneratedSimulationWellpath();
this->firstAncestorOrThisOfType(wellLogCollection); clampBranchIndex();
CVF_ASSERT(wellLogCollection);
if (!wellLogCollection) return;
cvf::ref<RigEclipseWellLogExtractor> eclExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, eclipseCase); RimWellLogPlotCollection* wellLogCollection;
this->firstAncestorOrThisOfTypeAsserted(wellLogCollection);
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
if ( m_trajectoryType == WELL_PATH )
{
eclExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, eclipseCase);
}
else
{
if (m_branchIndex >= 0 && m_branchIndex < static_cast<int>(m_generatedSimulationWellPathBranches.size()) )
{
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor(m_simWellName,
eclipseCase->caseUserDescription(),
m_generatedSimulationWellPathBranches[m_branchIndex].p(),
eclipseCase->eclipseCaseData());
}
}
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, geomCase); cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, geomCase);
std::vector<double> values; std::vector<double> values;
@@ -321,6 +409,94 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<QString> RimWellLogExtractionCurve::findSortedWellNames()
{
std::set<QString> sortedWellNames;
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
if ( eclipseCase && eclipseCase->eclipseCaseData() )
{
const cvf::Collection<RigSingleWellResultsData>& wellRes = eclipseCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
{
sortedWellNames.insert(wellRes[wIdx]->m_wellName);
}
}
return sortedWellNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::updateGeneratedSimulationWellpath()
{
if (m_generatedSimulationWellPathBranches.size()) return; // Already created. Nothing to do
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
if (!(!m_simWellName().isEmpty() && m_simWellName() != "None" && eclipseCase && eclipseCase->eclipseCaseData()))
{
return ;
}
RigEclipseCaseData* eclCaseData = eclipseCase->eclipseCaseData();
const RigSingleWellResultsData* wellResults = eclCaseData->findWellResult(m_simWellName());
if (!wellResults) return;
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(eclCaseData,
wellResults,
-1,
true,
true,
pipeBranchesCLCoords,
pipeBranchesCellIds);
for ( size_t brIdx = 0; brIdx < pipeBranchesCLCoords.size(); ++brIdx )
{
auto wellMdCalculator = RigSimulationWellCoordsAndMD(pipeBranchesCLCoords[brIdx]); // Todo, branch index
cvf::ref<RigWellPath> newWellPath = new RigWellPath();
newWellPath->m_measuredDepths = wellMdCalculator.measuredDepths();
newWellPath->m_wellPathPoints = wellMdCalculator.wellPathPoints();
m_generatedSimulationWellPathBranches.push_back(newWellPath.p() );
}
}
//--------------------------------------------------------------------------------------------------
/// Clean up existing generated well paths
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::clearGeneratedSimWellPaths()
{
RimWellLogPlotCollection* wellLogCollection = nullptr;
// Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when deleted.
RimProject * proj = RiaApplication::instance()->project();
if (proj && proj->mainPlotCollection() ) wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection();
if (!wellLogCollection) return;
for ( size_t wpIdx = 0; wpIdx < m_generatedSimulationWellPathBranches.size(); ++wpIdx )
{
wellLogCollection->removeExtractors(m_generatedSimulationWellPathBranches[wpIdx].p());
}
m_generatedSimulationWellPathBranches.clear();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -335,20 +511,14 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
{ {
RimTools::wellPathOptionItems(&options); RimTools::wellPathOptionItems(&options);
if (options.size() > 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr)); options.push_front(caf::PdmOptionItemInfo("None", nullptr));
} }
}
else if (fieldNeedingOptions == &m_case) else if (fieldNeedingOptions == &m_case)
{ {
RimTools::caseOptionItems(&options); RimTools::caseOptionItems(&options);
if (options.size() > 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr)); options.push_front(caf::PdmOptionItemInfo("None", nullptr));
} }
}
else if (fieldNeedingOptions == &m_timeStep) else if (fieldNeedingOptions == &m_timeStep)
{ {
QStringList timeStepNames; QStringList timeStepNames;
@@ -363,7 +533,37 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i)); options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
} }
} }
else if (fieldNeedingOptions == &m_simWellName)
{
std::set<QString> sortedWellNames = this->findSortedWellNames();
QIcon simWellIcon(":/Well.png");
for ( const QString& wname: sortedWellNames )
{
options.push_back(caf::PdmOptionItemInfo(wname, wname, false, simWellIcon));
}
if ( options.size() == 0 )
{
options.push_front(caf::PdmOptionItemInfo("None", "None"));
}
}
else if (fieldNeedingOptions == &m_branchIndex)
{
updateGeneratedSimulationWellpath();
size_t branchCount = m_generatedSimulationWellPathBranches.size();
for ( int bIdx = 0; bIdx < static_cast<int>(branchCount); ++bIdx)
{
options.push_back(caf::PdmOptionItemInfo("Branch " + QString::number(bIdx + 1), QVariant::fromValue(bIdx) ));
}
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", -1));
}
}
return options; return options;
} }
@@ -377,25 +577,39 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data"); caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_wellPath);
curveDataGroup->add(&m_case); curveDataGroup->add(&m_case);
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
curveDataGroup->add(&m_trajectoryType);
if (m_trajectoryType() == WELL_PATH)
{
curveDataGroup->add(&m_wellPath);
}
else
{
curveDataGroup->add(&m_simWellName);
if ( m_generatedSimulationWellPathBranches.size() > 1 )
{
curveDataGroup->add(&m_branchIndex);
}
}
if (eclipseCase) if (eclipseCase)
{ {
m_eclipseResultDefinition->uiOrdering(uiConfigName, *curveDataGroup); m_eclipseResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
if (m_eclipseResultDefinition->hasDynamicResult())
{
curveDataGroup->add(&m_timeStep);
}
} }
else if (geomCase) else if (geomCase)
{ {
m_geomResultDefinition->uiOrdering(uiConfigName, *curveDataGroup); m_geomResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
}
if ( (eclipseCase && m_eclipseResultDefinition->hasDynamicResult())
|| geomCase)
{
curveDataGroup->add(&m_timeStep); curveDataGroup->add(&m_timeStep);
} }
@@ -404,6 +618,7 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->setCollapsedByDefault(true); nameGroup->setCollapsedByDefault(true);
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup); RimPlotCurve::curveNameUiOrdering(*nameGroup);
if (m_isUsingAutoName) if (m_isUsingAutoName)
@@ -471,9 +686,13 @@ QString RimWellLogExtractionCurve::createCurveAutoName()
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
QString generatedCurveName; QString generatedCurveName;
if (m_addWellNameToCurveName && m_wellPath) if (m_addWellNameToCurveName )
{ {
generatedCurveName += wellName(); generatedCurveName += wellName();
if (m_trajectoryType == SIMULATION_WELL && m_generatedSimulationWellPathBranches.size() > 1)
{
generatedCurveName += " Br" + QString::number(m_branchIndex + 1);
}
} }
if (m_addCaseNameToCurveName && m_case()) if (m_addCaseNameToCurveName && m_case())
@@ -578,7 +797,9 @@ QString RimWellLogExtractionCurve::wellLogChannelName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellLogExtractionCurve::wellName() const QString RimWellLogExtractionCurve::wellName() const
{ {
if (m_wellPath) if ( m_trajectoryType() == WELL_PATH )
{
if ( m_wellPath )
{ {
return m_wellPath->name(); return m_wellPath->name();
} }
@@ -586,6 +807,11 @@ QString RimWellLogExtractionCurve::wellName() const
{ {
return QString(); return QString();
} }
}
else
{
return m_simWellName;
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -674,3 +900,11 @@ double RimWellLogExtractionCurve::rkbDiff() const
return HUGE_VAL; return HUGE_VAL;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogExtractionCurve::currentTimeStep() const
{
return m_timeStep();
}

View File

@@ -23,12 +23,14 @@
#include "cafPdmPtrField.h" #include "cafPdmPtrField.h"
#include "cafPdmChildField.h" #include "cafPdmChildField.h"
#include "cvfCollection.h"
class RimCase; class RimCase;
class RimEclipseResultDefinition; class RimEclipseResultDefinition;
class RimGeoMechResultDefinition; class RimGeoMechResultDefinition;
class RimView; class RimView;
class RimWellPath; class RimWellPath;
class RigWellPath;
//================================================================================================== //==================================================================================================
/// ///
@@ -41,9 +43,13 @@ public:
RimWellLogExtractionCurve(); RimWellLogExtractionCurve();
virtual ~RimWellLogExtractionCurve(); virtual ~RimWellLogExtractionCurve();
enum TrajectoryType { WELL_PATH, SIMULATION_WELL};
void setWellPath(RimWellPath* wellPath); void setWellPath(RimWellPath* wellPath);
RimWellPath* wellPath() const; RimWellPath* wellPath() const;
void setFromSimulationWellName(const QString& simWellName, int branchIndex);
void setCase(RimCase* rimCase); void setCase(RimCase* rimCase);
RimCase* rimCase() const; RimCase* rimCase() const;
@@ -57,6 +63,8 @@ public:
QString caseName() const; QString caseName() const;
double rkbDiff() const; double rkbDiff() const;
int currentTimeStep() const;
protected: protected:
virtual QString createCurveAutoName(); virtual QString createCurveAutoName();
virtual void onLoadDataAndUpdate(); virtual void onLoadDataAndUpdate();
@@ -73,9 +81,16 @@ protected:
private: private:
void setLogScaleFromSelectedResult(); void setLogScaleFromSelectedResult();
void clampTimestep(); void clampTimestep();
void clampBranchIndex();
std::set<QString> findSortedWellNames();
void updateGeneratedSimulationWellpath();
void clearGeneratedSimWellPaths();
private: private:
caf::PdmPtrField<RimWellPath*> m_wellPath; caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<caf::AppEnum<TrajectoryType> > m_trajectoryType;
caf::PdmField<QString> m_simWellName;
caf::PdmField<int> m_branchIndex;
caf::PdmPtrField<RimCase*> m_case; caf::PdmPtrField<RimCase*> m_case;
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition; caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
caf::PdmChildField<RimGeoMechResultDefinition*> m_geomResultDefinition; caf::PdmChildField<RimGeoMechResultDefinition*> m_geomResultDefinition;
@@ -86,5 +101,7 @@ private:
caf::PdmField<bool> m_addWellNameToCurveName; caf::PdmField<bool> m_addWellNameToCurveName;
caf::PdmField<bool> m_addTimestepToCurveName; caf::PdmField<bool> m_addTimestepToCurveName;
caf::PdmField<bool> m_addDateToCurveName; caf::PdmField<bool> m_addDateToCurveName;
cvf::Collection<RigWellPath> m_generatedSimulationWellPathBranches;
}; };

View File

@@ -84,7 +84,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate()
{ {
if (RiaApplication::instance()->preferences()->showLasCurveWithoutTvdWarning()) if (RiaApplication::instance()->preferences()->showLasCurveWithoutTvdWarning())
{ {
QString tmp = QString("Display of True Vertical Depth (TVD) for LAS curves in not yet supported, and no LAS curve will be displayed in this mode.\n\n"); QString tmp = QString("Display of True Vertical Depth (TVD) for LAS curves is not yet supported, and the LAS curve will be hidden in this mode.\n\n");
tmp += "Control display of this warning from \"Preferences->Show LAS curve without TVD warning\""; tmp += "Control display of this warning from \"Preferences->Show LAS curve without TVD warning\"";
QMessageBox::warning(NULL, "LAS curve without TVD", tmp); QMessageBox::warning(NULL, "LAS curve without TVD", tmp);
@@ -179,6 +179,7 @@ void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
RimPlotCurve::appearanceUiOrdering(*appearanceGroup); RimPlotCurve::appearanceUiOrdering(*appearanceGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup); RimPlotCurve::curveNameUiOrdering(*nameGroup);
} }

View File

@@ -426,7 +426,14 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
if (curveNames.size() == 1) if (curveNames.size() == 1)
{ {
curveDepths = curveData->measuredDepthPlotValues(RimDefines::UNIT_NONE); if (depthType() == TRUE_VERTICAL_DEPTH)
{
curveDepths = curveData->trueDepthPlotValues(depthUnit());
}
else
{
curveDepths = curveData->measuredDepthPlotValues(depthUnit());
}
} }
std::vector<double> xPlotValues = curveData->xPlotValues(); std::vector<double> xPlotValues = curveData->xPlotValues();
@@ -435,9 +442,9 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
} }
for (int i = static_cast<int>(curveDepths.size()) - 1; i >= 0; i--) for (size_t i = 0; i < curveDepths.size(); ++i)
{ {
if (i == static_cast<int>(curveDepths.size()) - 1) if (i == 0)
{ {
if (depthType() == CONNECTION_NUMBER) out += "Connection"; if (depthType() == CONNECTION_NUMBER) out += "Connection";
else if (depthType() == MEASURED_DEPTH) out += "MD "; else if (depthType() == MEASURED_DEPTH) out += "MD ";
@@ -446,7 +453,7 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
for (QString name : curveNames) out += " \t" + name; for (QString name : curveNames) out += " \t" + name;
out += "\n"; out += "\n";
} }
else if (curveDepths[i] == curveDepths[i+1]) else if (curveDepths[i] == curveDepths[i-1])
{ {
continue; continue;
} }

View File

@@ -52,6 +52,34 @@ RimWellLogPlotCollection::~RimWellLogPlotCollection()
wellLogPlots.deleteAllChildObjects(); wellLogPlots.deleteAllChildObjects();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateSimWellExtractor(const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeom,
const RigEclipseCaseData* eclCaseData)
{
if (!(wellPathGeom && eclCaseData))
{
return nullptr;
}
for (size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx)
{
if (m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom)
{
return m_extractors[exIdx].p();
}
}
std::string errorIdName = (simWellName + " " + caseUserDescription).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = new RigEclipseWellLogExtractor(eclCaseData, wellPathGeom, errorIdName);
m_extractors.push_back(extractor.p());
return extractor.p();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -46,6 +46,11 @@ public:
RimWellLogPlotCollection(); RimWellLogPlotCollection();
virtual ~RimWellLogPlotCollection(); virtual ~RimWellLogPlotCollection();
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor(const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeom,
const RigEclipseCaseData* eclCaseData);
RigEclipseWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase); RigEclipseWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase);
RigGeoMechWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimGeoMechCase* eclCase); RigGeoMechWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimGeoMechCase* eclCase);

View File

@@ -36,6 +36,8 @@
#include "RivWellPathPartMgr.h" #include "RivWellPathPartMgr.h"
#include "cafUtils.h"
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
@@ -202,7 +204,7 @@ bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathAsciiFileRe
{ {
QFileInfo fileInf(filepath()); QFileInfo fileInf(filepath());
if (fileInf.isFile() && fileInf.exists()) if (caf::Utils::fileExists(filepath()))
{ {
if (fileInf.suffix().compare("json") == 0) if (fileInf.suffix().compare("json") == 0)
{ {
@@ -410,7 +412,7 @@ void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath,
{ {
QString newCacheFileName = getCacheFileName(); QString newCacheFileName = getCacheFileName();
if (QFile::exists(newCacheFileName)) if (caf::Utils::fileExists(newCacheFileName))
{ {
filepath = newCacheFileName; filepath = newCacheFileName;
} }

View File

@@ -17,6 +17,8 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RimFileSummaryCase.h" #include "RimFileSummaryCase.h"
#include "RimTools.h"
#include "QFileInfo" #include "QFileInfo"
@@ -71,3 +73,11 @@ QString RimFileSummaryCase::caseName()
return caseFileName.completeBaseName(); return caseFileName.completeBaseName();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
{
m_summaryHeaderFilename = RimTools::relocateFile(m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr);
}

View File

@@ -35,6 +35,7 @@ public:
void setSummaryHeaderFilename(const QString& fileName); void setSummaryHeaderFilename(const QString& fileName);
virtual QString summaryHeaderFilename() const override; virtual QString summaryHeaderFilename() const override;
virtual QString caseName() override; virtual QString caseName() override;
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) override;
private: private:
}; };

View File

@@ -154,3 +154,11 @@ QString RimGridSummaryCase::eclipseGridFileName() const
return m_eclipseCase()->gridFileName(); return m_eclipseCase()->gridFileName();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridSummaryCase::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
{
// Shouldn't have to do anything
}

View File

@@ -41,6 +41,7 @@ public:
virtual QString summaryHeaderFilename() const override; virtual QString summaryHeaderFilename() const override;
virtual QString caseName() override; virtual QString caseName() override;
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) override;
private: private:
QString eclipseGridFileName() const; QString eclipseGridFileName() const;

View File

@@ -48,6 +48,8 @@ public:
void loadCase(); void loadCase();
RigSummaryCaseData* caseData(); RigSummaryCaseData* caseData();
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) = 0;
protected: protected:
void updateTreeItemName(); void updateTreeItemName();

View File

@@ -264,3 +264,14 @@ QString RimSummaryCaseCollection::uniqueShortNameForCase(RimSummaryCase* summary
return shortName; return shortName;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseCollection::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
{
for (auto summaryCase : m_cases)
{
summaryCase->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
}

View File

@@ -47,6 +47,8 @@ public:
QString uniqueShortNameForCase(RimSummaryCase* summaryCase); QString uniqueShortNameForCase(RimSummaryCase* summaryCase);
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
private: private:
private: private:

View File

@@ -452,6 +452,7 @@ void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->setCollapsedByDefault(true); nameGroup->setCollapsedByDefault(true);
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup); RimPlotCurve::curveNameUiOrdering(*nameGroup);
if (m_isUsingAutoName) if (m_isUsingAutoName)

View File

@@ -150,7 +150,7 @@ void RimSummaryCurveAppearanceCalculator::updateApperanceIndices()
int idx = 0; int idx = 0;
for (auto& pair : m_caseToAppearanceIdxMap) for (auto& pair : m_caseToAppearanceIdxMap)
{ {
pair.second = static_cast<int>(caseAppearanceIndices[pair.first->caseName().toUtf8().constData()]); pair.second = static_cast<int>(caseAppearanceIndices[pair.first->summaryHeaderFilename().toUtf8().constData()]);
} }
} }
{ {

View File

@@ -55,19 +55,18 @@ public:
void setupCurveLook(RimSummaryCurve* curve); void setupCurveLook(RimSummaryCurve* curve);
static cvf::Color3f cycledPaletteColor(int colorIndex);
static cvf::Color3f cycledNoneRGBBrColor(int colorIndex);
static cvf::Color3f cycledGreenColor(int colorIndex);
static cvf::Color3f cycledBlueColor(int colorIndex);
static cvf::Color3f cycledRedColor(int colorIndex);
static cvf::Color3f cycledBrownColor(int colorIndex);
private: private:
void setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve); void setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve);
void updateApperanceIndices(); void updateApperanceIndices();
std::map<std::string, size_t> mapNameToAppearanceIndex(CurveAppearanceType & appearance, const std::set<std::string>& names); std::map<std::string, size_t> mapNameToAppearanceIndex(CurveAppearanceType & appearance, const std::set<std::string>& names);
cvf::Color3f cycledPaletteColor(int colorIndex);
cvf::Color3f cycledNoneRGBBrColor(int colorIndex);
cvf::Color3f cycledGreenColor(int colorIndex);
cvf::Color3f cycledBlueColor(int colorIndex);
cvf::Color3f cycledRedColor(int colorIndex);
cvf::Color3f cycledBrownColor(int colorIndex);
RimPlotCurve::LineStyleEnum cycledLineStyle(int index); RimPlotCurve::LineStyleEnum cycledLineStyle(int index);
RimPlotCurve::PointSymbolEnum cycledSymbol(int index); RimPlotCurve::PointSymbolEnum cycledSymbol(int index);

Some files were not shown because too many files have changed in this diff Show More