Merge branch 'annotation-items' into dev

This commit is contained in:
Magne Sjaastad 2019-03-19 15:00:30 +01:00
commit 59c83157d1
45 changed files with 2104 additions and 117 deletions

View File

@ -60,6 +60,8 @@
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
#include "RimSaturationPressurePlot.h"
#include "RimSaturationPressurePlotCollection.h"
#include "RimStimPlanColors.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
@ -214,7 +216,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
setWindowIcon(QIcon(":/AppLogo48x48.png"));
m_socketServer = new RiaSocketServer(this);
m_socketServer = new RiaSocketServer(this);
#ifdef WIN32
m_startupDefaultDirectory = QDir::homePath();
@ -227,7 +229,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
// The creation of a font is time consuming, so make sure you really need your own font
// instead of using the application font
m_standardFont = RiaFontCache::getFont(RiaFontCache::FONT_SIZE_8);
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
// Create main windows
@ -660,13 +662,14 @@ bool RiaApplication::loadProject(const QString& projectFileName)
//--------------------------------------------------------------------------------------------------
void RiaApplication::loadAndUpdatePlotData()
{
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
RimSummaryCrossPlotCollection* scpColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
RimRftPlotCollection* rftColl = nullptr;
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
RimSummaryCrossPlotCollection* scpColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
RimRftPlotCollection* rftColl = nullptr;
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
{
@ -696,6 +699,10 @@ void RiaApplication::loadAndUpdatePlotData()
{
gcpColl = m_project->mainPlotCollection()->gridCrossPlotCollection();
}
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->saturationPressurePlotCollection())
{
sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection();
}
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
@ -705,6 +712,7 @@ void RiaApplication::loadAndUpdatePlotData()
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
plotCount += sppColl ? sppColl->plots().size() : 0;
if (plotCount > 0)
{
@ -769,6 +777,15 @@ void RiaApplication::loadAndUpdatePlotData()
plotProgress.incrementProgress();
}
}
if (sppColl)
{
for (const auto& sppPlot : sppColl->plots())
{
sppPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}
}
@ -1420,7 +1437,7 @@ void RiaApplication::createMainWindow()
m_mainWindow->setDefaultWindowSize();
m_mainWindow->setDefaultToolbarVisibility();
m_mainWindow->loadWinGeoAndDockToolBarLayout();
m_mainWindow->showWindow();
m_mainWindow->showWindow();
}
//--------------------------------------------------------------------------------------------------
@ -1579,7 +1596,8 @@ void RiaApplication::closeMainPlotWindowIfOpenButHidden()
//--------------------------------------------------------------------------------------------------
void RiaApplication::addToRecentFiles(const QString& fileName)
{
CVF_ASSERT(m_recentFileActionProvider && "The provider needs to be created before any attempts to use the recent file actions");
CVF_ASSERT(m_recentFileActionProvider &&
"The provider needs to be created before any attempts to use the recent file actions");
m_recentFileActionProvider->addFileName(fileName);
}
@ -1588,7 +1606,8 @@ void RiaApplication::addToRecentFiles(const QString& fileName)
//--------------------------------------------------------------------------------------------------
std::vector<QAction*> RiaApplication::recentFileActions() const
{
CVF_ASSERT(m_recentFileActionProvider && "The provider needs to be created before any attempts to use the recent file actions");
CVF_ASSERT(m_recentFileActionProvider &&
"The provider needs to be created before any attempts to use the recent file actions");
return m_recentFileActionProvider->actions();
}
@ -1852,8 +1871,7 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
m_mainWindow->processMonitor()->stopMonitorWorkProcess();
QMessageBox::warning(
m_mainWindow, "Script execution", "Failed to start script executable located at\n" + program);
QMessageBox::warning(m_mainWindow, "Script execution", "Failed to start script executable located at\n" + program);
return false;
}
@ -1915,8 +1933,7 @@ void RiaApplication::applyPreferences()
if (m_mainWindow && m_mainWindow->projectTreeView())
{
m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText(
m_preferences->appendClassNameToUiText());
m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
if (mainPlotWindow())
mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
}

View File

@ -109,6 +109,7 @@ list( APPEND REFERENCED_CMAKE_FILES
ProjectDataModel/CMakeLists_files.cmake
ProjectDataModel/GridCrossPlots/CMakeLists_files.cmake
ProjectDataModel/GridCrossPlots/CellFilters/CMakeLists_files.cmake
ProjectDataModel/Summary/CMakeLists_files.cmake
ProjectDataModel/Flow/CMakeLists_files.cmake
ProjectDataModel/Annotations/CMakeLists_files.cmake

View File

@ -4,13 +4,18 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotCurveSetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSwapGridCrossPlotCurveSetAxesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteGridCrossPlotCurveSetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateSaturationPressurePlotsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSaturationPressureUi.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotCurveSetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSwapGridCrossPlotCurveSetAxesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteGridCrossPlotCurveSetFeature.cpp)
${CMAKE_CURRENT_LIST_DIR}/RicPasteGridCrossPlotCurveSetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateSaturationPressurePlotsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSaturationPressureUi.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}

View File

@ -0,0 +1,139 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicCreateSaturationPressurePlotsFeature.h"
#include "RicSaturationPressureUi.h"
#include "RiaApplication.h"
#include "RimEclipseResultCase.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSaturationPressurePlot.h"
#include "RimSaturationPressurePlotCollection.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicCreateSaturationPressurePlotsFeature, "RicCreateSaturationPressurePlotsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateSaturationPressurePlotsFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateSaturationPressurePlotsFeature::onActionTriggered(bool isChecked)
{
RimProject* project = RiaApplication::instance()->project();
bool launchedFromPlotCollection = true;
RimSaturationPressurePlotCollection* collection =
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimSaturationPressurePlotCollection>();
if (!collection)
{
collection = project->mainPlotCollection()->saturationPressurePlotCollection();
launchedFromPlotCollection = false;
}
std::vector<RimEclipseResultCase*> eclipseCases;
{
RiaApplication* app = RiaApplication::instance();
std::vector<RimCase*> cases;
app->project()->allCases(cases);
for (auto* rimCase : cases)
{
auto erc = dynamic_cast<RimEclipseResultCase*>(rimCase);
if (erc)
{
eclipseCases.push_back(erc);
}
}
}
RimEclipseResultCase* eclipseResultCase = nullptr;
if (!eclipseCases.empty())
{
if (eclipseCases.size() == 1)
{
eclipseResultCase = eclipseCases[0];
}
else
{
RicSaturationPressureUi saturationPressureUi;
saturationPressureUi.setSelectedCase(eclipseCases[0]);
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
caf::PdmUiPropertyViewDialog propertyDialog(
plotwindow, &saturationPressureUi, "Select Case to create Pressure Saturation plots", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(saturationPressureUi.selectedCase());
}
}
}
if (eclipseResultCase)
{
eclipseResultCase->ensureReservoirCaseIsOpen();
collection->createSaturationPressurePlots(eclipseResultCase);
std::vector<RimSaturationPressurePlot*> plots = collection->plots();
for (auto plot : plots)
{
plot->loadDataAndUpdate();
plot->zoomAll();
plot->updateConnectedEditors();
}
}
collection->updateAllRequiredEditors();
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateSaturationPressurePlotsFeature::setupActionLook(QAction* actionToSetup)
{
RimSaturationPressurePlotCollection* collection =
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimSaturationPressurePlotCollection>();
if (!collection)
{
actionToSetup->setText("New Grid Cross Plot from 3d View");
}
else
{
actionToSetup->setText("Create Saturation Pressure Plots");
}
actionToSetup->setIcon(QIcon(":/SummaryXPlotsLight16x16.png"));
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicCreateSaturationPressurePlotsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicSaturationPressureUi.h"
#include "RimTools.h"
#include "cafPdmUiFilePathEditor.h"
CAF_PDM_SOURCE_INIT(RicSaturationPressureUi, "RicSaturationPressureUi");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicSaturationPressureUi::RicSaturationPressureUi()
{
CAF_PDM_InitObject("RicSaturationPressureUi", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_caseToApply, "CaseToApply", "Case to Apply", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSaturationPressureUi::setSelectedCase(RimEclipseCase* eclipseCase)
{
m_caseToApply = eclipseCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RicSaturationPressureUi::selectedCase() const
{
return m_caseToApply();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RicSaturationPressureUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_caseToApply)
{
RimTools::caseOptionItems(&options);
}
return options;
}

View File

@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimEclipseCase.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
//==================================================================================================
///
///
//==================================================================================================
class RicSaturationPressureUi : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicSaturationPressureUi();
void setSelectedCase(RimEclipseCase* eclipseCase);
RimEclipseCase* selectedCase() const;
protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override;
private:
caf::PdmPtrField<RimEclipseCase*> m_caseToApply;
};

View File

@ -38,9 +38,10 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseResultInfo.h"
#include "RigEquil.h"
#include "RigMainGrid.h"
#include "RigSimWellData.h"
#include "RigEclipseResultInfo.h"
#include "cafProgressInfo.h"
@ -600,7 +601,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
}
{
auto task = progress.task("Reading faults", 10);
auto task = progress.task("Reading faults", 5);
if (isFaultImportEnabled())
{
@ -613,6 +614,12 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e
}
}
{
auto task = progress.task("Reading EQUIL", 5);
importEquilData(fileSet, eclipseCase);
}
m_eclipseCase = eclipseCase;
{
@ -820,6 +827,57 @@ void RifReaderEclipseOutput::importFaults(const QStringList& fileSet, cvf::Colle
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderEclipseOutput::importEquilData(const QStringList& fileSet, RigEclipseCaseData* eclipseCase)
{
QString dataFileName;
for (const QString& fileName : fileSet)
{
if (fileName.endsWith(".DATA"))
{
dataFileName = fileName;
}
}
if (!dataFileName.isEmpty())
{
QFile data(dataFileName);
if (data.open(QFile::ReadOnly))
{
const QString keyword("EQUIL");
const QString keywordToStopParsing("SCHEDULE");
const qint64 startPositionInFile = 0;
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
QStringList keywordContent;
std::vector<QString> fileNamesContainingKeyword;
bool isStopParsingKeywordDetected = false;
const QString includeStatementAbsolutePathPrefix = faultIncludeFileAbsolutePathPrefix();
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively(keyword,
keywordToStopParsing,
data,
startPositionInFile,
pathAliasDefinitions,
&keywordContent,
&fileNamesContainingKeyword,
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix);
std::vector<RigEquil> equilItems;
for (const auto& s : keywordContent)
{
RigEquil equilRec = RigEquil::parseString(s);
equilItems.push_back(equilRec);
}
eclipseCase->setEquilData(equilItems);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -94,6 +94,7 @@ private:
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 importEquilData(const QStringList& fileSet, RigEclipseCaseData* eclipseCase);
void openInitFile();

View File

@ -129,6 +129,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.h
${CMAKE_CURRENT_LIST_DIR}/RimRiuQwtPlotOwnerInterface.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h
)
@ -261,6 +262,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimViewNameConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimScaleLegendConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimReloadCaseTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -4,13 +4,18 @@ ${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurveSet.h
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlot.h
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlotCollection.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurveSet.cpp)
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlotCurveSet.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSaturationPressurePlotCollection.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}

View File

@ -0,0 +1,22 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilter.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilterCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellPropertyFilter.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilter.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellFilterCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPlotCellPropertyFilter.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "ProjectDataModel\\GridCrossPlots\\CellFilters" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimPlotCellFilter.h"
namespace caf
{
template<>
void caf::AppEnum<RimPlotCellFilter::FilterModeType>::setUp()
{
addItem(RimPlotCellFilter::INCLUDE, "INCLUDE", "Include");
addItem(RimPlotCellFilter::EXCLUDE, "EXCLUDE", "Exclude");
setDefault(RimPlotCellFilter::INCLUDE);
}
} // namespace caf
CAF_PDM_ABSTRACT_SOURCE_INIT(RimPlotCellFilter, "RimPlotCellFilter");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellFilter::RimPlotCellFilter()
{
CAF_PDM_InitFieldNoDefault(&m_filterMode, "FilterMode", "Filter Mode", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellFilter::updateCellVisibility(size_t timeStepIndex, cvf::UByteArray* cellVisibility)
{
if (isChecked())
{
updateCellVisibilityFromFilter(timeStepIndex, cellVisibility);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellFilter::FilterModeType RimPlotCellFilter::filterMode() const
{
return m_filterMode();
}

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimCheckableNamedObject.h"
#include "cvfArray.h"
#include "cvfBase.h"
//==================================================================================================
///
//==================================================================================================
class RimPlotCellFilter : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
enum FilterModeType
{
INCLUDE,
EXCLUDE
};
public:
RimPlotCellFilter();
void updateCellVisibility(size_t timeStepIndex, cvf::UByteArray* cellVisibility);
FilterModeType filterMode() const;
protected:
virtual void updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility) = 0;
private:
caf::PdmField<caf::AppEnum<FilterModeType>> m_filterMode;
};

View File

@ -0,0 +1,96 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimPlotCellFilterCollection.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseResultDefinition.h"
CAF_PDM_SOURCE_INIT(RimPlotCellFilterCollection, "RimPlotCellFilterCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellFilterCollection::RimPlotCellFilterCollection()
{
CAF_PDM_InitObject("Plot Cell Filters", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellFilters, "CellFilters", "Cell Filters", "", "", "");
m_cellFilters.uiCapability()->setUiHidden(true);
setName("Filter Collection");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellFilterCollection::addCellFilter(RimPlotCellFilter* cellFilter)
{
m_cellFilters.push_back(cellFilter);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimPlotCellFilterCollection::cellFilterCount() const
{
return m_cellFilters.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellFilterCollection::computeCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility)
{
if (isChecked())
{
updateCellVisibilityFromFilter(timeStepIndex, cellVisibility);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellFilterCollection::setCase(RimCase* gridCase)
{
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>(gridCase);
if (eclipseResultCase)
{
std::vector<RimEclipseResultDefinition*> resultDefinitions;
this->descendantsIncludingThisOfType(resultDefinitions);
for (auto r : resultDefinitions)
{
r->setEclipseCase(eclipseResultCase);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellFilterCollection::updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility)
{
for (RimPlotCellFilter* f : m_cellFilters())
{
if (f->isChecked())
{
f->updateCellVisibility(timeStepIndex, cellVisibility);
}
}
}

View File

@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimPlotCellFilter.h"
#include "cafPdmChildArrayField.h"
class RimCase;
//==================================================================================================
///
//==================================================================================================
class RimPlotCellFilterCollection : public RimPlotCellFilter
{
CAF_PDM_HEADER_INIT;
public:
RimPlotCellFilterCollection();
void addCellFilter(RimPlotCellFilter* cellFilter);
size_t cellFilterCount() const;
void computeCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility);
void setCase(RimCase* gridCase);
protected:
void updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* cellVisibility) override;
private:
caf::PdmChildArrayField<RimPlotCellFilter*> m_cellFilters;
};

View File

@ -0,0 +1,228 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimPlotCellPropertyFilter.h"
#include "RiaLogging.h"
#include "RigActiveCellInfo.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimGeoMechResultDefinition.h"
#include "cafPdmUiDoubleSliderEditor.h"
CAF_PDM_SOURCE_INIT(RimPlotCellPropertyFilter, "RimPlotCellPropertyFilter");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellPropertyFilter::RimPlotCellPropertyFilter()
{
CAF_PDM_InitObject("Plot Cell Property Filter", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "");
// Set to hidden to avoid this item to been displayed as a child item
// Fields in this object are displayed using defineUiOrdering()
m_resultDefinition.uiCapability()->setUiHidden(true);
m_resultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_lowerBound, "LowerBound", 0.0, "Min", "", "", "");
m_lowerBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_upperBound, "UpperBound", 0.0, "Max", "", "", "");
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellPropertyFilter::setResultDefinition(caf::PdmObject* resultDefinition)
{
m_resultDefinition = resultDefinition;
updateName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellPropertyFilter::setValueRange(double lowerBound, double upperBound)
{
m_lowerBound = lowerBound;
m_upperBound = upperBound;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultDefinition* RimPlotCellPropertyFilter::eclipseResultDefinition()
{
caf::PdmObject* pdmObj = m_resultDefinition;
return dynamic_cast<RimEclipseResultDefinition*>(pdmObj);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellPropertyFilter::findOrComputeMinMaxResultValues(double& minimumValue, double& maximumValue)
{
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
if (resDef)
{
RimEclipseCase* eclCase = resDef->eclipseCase();
if (!eclCase) return;
RigEclipseCaseData* eclipseCaseData = eclCase->eclipseCaseData();
if (!eclipseCaseData) return;
resDef->loadResult();
RigCaseCellResultsData* cellResultsData = resDef->currentGridCellResults();
if (!cellResultsData) return;
cellResultsData->minMaxCellScalarValues(resDef->eclipseResultAddress(), minimumValue, maximumValue);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellPropertyFilter::updateName()
{
QString name = "Property filter - ";
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
if (resDef)
{
name += resDef->resultVariableUiName();
}
setName(name);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellPropertyFilter::updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* visibleCells)
{
CVF_ASSERT(visibleCells);
RimEclipseResultDefinition* resDef = eclipseResultDefinition();
if (resDef)
{
RimEclipseCase* eclCase = resDef->eclipseCase();
if (!eclCase) return;
RigEclipseCaseData* eclipseCaseData = eclCase->eclipseCaseData();
if (!eclipseCaseData) return;
resDef->loadResult();
RigCaseCellResultsData* cellResultsData = resDef->currentGridCellResults();
if (!cellResultsData) return;
const std::vector<double>& cellResultValues =
cellResultsData->cellScalarResults(resDef->eclipseResultAddress(), timeStepIndex);
if (cellResultValues.empty()) return;
const RigActiveCellInfo* actCellInfo = cellResultsData->activeCellInfo();
size_t totalReservoirCellCount = actCellInfo->reservoirCellCount();
if (visibleCells->size() < totalReservoirCellCount)
{
QString message = QString("Size of visible Cells (%1) is less than total cell count (%2)")
.arg(visibleCells->size())
.arg(totalReservoirCellCount);
RiaLogging::error(message);
return;
}
bool isUsingGlobalActiveIndex = cellResultsData->isUsingGlobalActiveIndex(resDef->eclipseResultAddress());
double lowerBound = m_lowerBound;
double upperBound = m_upperBound;
size_t cellResultIndex = 0;
double scalarValue = 0.0;
FilterModeType currentFilterMode = filterMode();
for (size_t reservoirCellIndex = 0; reservoirCellIndex < totalReservoirCellCount; ++reservoirCellIndex)
{
if (!actCellInfo->isActive(reservoirCellIndex)) continue;
cellResultIndex = reservoirCellIndex;
if (isUsingGlobalActiveIndex)
{
cellResultIndex = actCellInfo->cellResultIndex(reservoirCellIndex);
}
if (cellResultIndex != cvf::UNDEFINED_SIZE_T && cellResultIndex < cellResultValues.size())
{
if ((*visibleCells)[reservoirCellIndex])
{
scalarValue = cellResultValues[cellResultIndex];
if (lowerBound <= scalarValue && scalarValue <= upperBound)
{
if (currentFilterMode == RimPlotCellFilter::EXCLUDE)
{
(*visibleCells)[reservoirCellIndex] = false;
}
}
else
{
if (currentFilterMode == RimPlotCellFilter::INCLUDE)
{
(*visibleCells)[reservoirCellIndex] = false;
}
}
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCellPropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute)
{
if (field == &m_lowerBound || field == &m_upperBound)
{
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
if (!myAttr)
{
return;
}
double minimumValue = 0.0;
double maximumValue = 0.0;
findOrComputeMinMaxResultValues(minimumValue, maximumValue);
myAttr->m_minimum = minimumValue;
myAttr->m_maximum = maximumValue;
}
}

View File

@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimPlotCellFilter.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cvfArray.h"
#include "cvfBase.h"
class RimEclipseResultDefinition;
//==================================================================================================
///
//==================================================================================================
class RimPlotCellPropertyFilter : public RimPlotCellFilter
{
CAF_PDM_HEADER_INIT;
public:
RimPlotCellPropertyFilter();
// Currently supported result definition is RimEclipseResultDefinition, but the interface is designed to also support
// RimGeoMechResultDefinition
void setResultDefinition(caf::PdmObject* resultDefinition);
void setValueRange(double lowerBound, double upperBound);
protected:
void updateCellVisibilityFromFilter(size_t timeStepIndex, cvf::UByteArray* visibleCells) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute) override;
private:
RimEclipseResultDefinition* eclipseResultDefinition();
void findOrComputeMinMaxResultValues(double& minimumValue, double& maximumValue);
void updateName();
private:
caf::PdmChildField<caf::PdmObject*> m_resultDefinition;
caf::PdmField<double> m_lowerBound;
caf::PdmField<double> m_upperBound;
};

View File

@ -151,6 +151,8 @@ QImage RimGridCrossPlot::snapshotWindowContent()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::zoomAll()
{
if (!m_qwtPlot) return;
setAutoZoomForAllAxes(true);
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
@ -277,8 +279,14 @@ void RimGridCrossPlot::updateAxisScaling()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisDisplay()
{
if (!m_qwtPlot) return;
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM);
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT);
m_qwtPlot->updateAnnotationObjects(m_xAxisProperties);
m_qwtPlot->updateAnnotationObjects(m_yAxisProperties);
m_qwtPlot->replot();
}
@ -667,6 +675,8 @@ QString RimGridCrossPlot::yAxisParameterString() const
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
{
if (!m_qwtPlot) return;
RimPlotAxisProperties* axisProperties = m_xAxisProperties();
QString axisParameterString = xAxisParameterString();
@ -803,6 +813,30 @@ std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const
return plotCurves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotAxisProperties* RimGridCrossPlot::xAxisProperties()
{
return m_xAxisProperties();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotAxisProperties* RimGridCrossPlot::yAxisProperties()
{
return m_yAxisProperties();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlotNameConfig* RimGridCrossPlot::nameConfig()
{
return m_nameConfig();
}
//--------------------------------------------------------------------------------------------------
/// Name Configuration
///

View File

@ -106,6 +106,11 @@ protected:
void updateAxisFromQwt(RiaDefines::PlotAxis axisType);
std::vector<const QwtPlotCurve*> visibleQwtCurves() const;
RimPlotAxisProperties* xAxisProperties();
RimPlotAxisProperties* yAxisProperties();
RimGridCrossPlotNameConfig* nameConfig();
private:
caf::PdmField<bool> m_showLegend;
caf::PdmField<int> m_legendFontSize;

View File

@ -17,7 +17,6 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
@ -43,8 +42,4 @@ public:
private:
caf::PdmChildArrayField<RimGridCrossPlot*> m_gridCrossPlots;
public:
};

View File

@ -15,6 +15,7 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGridCrossPlotCurveSet.h"
#include "RiaApplication.h"
@ -36,9 +37,10 @@
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCurve.h"
#include "RimGridView.h"
@ -46,6 +48,8 @@
#include "RimRegularLegendConfig.h"
#include "RimTools.h"
#include "CellFilters/RimPlotCellFilterCollection.h"
#include "cafCategoryMapper.h"
#include "cafColorTable.h"
#include "cafPdmUiComboBoxEditor.h"
@ -70,7 +74,7 @@ void RimGridCrossPlotCurveSet::CurveGroupingEnum::setUp()
addItem(RigGridCrossPlotCurveGrouping::GROUP_BY_RESULT, "RESULT", "Result Property");
setDefault(RigGridCrossPlotCurveGrouping::GROUP_BY_TIME);
}
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
@ -113,6 +117,13 @@ RimGridCrossPlotCurveSet::RimGridCrossPlotCurveSet()
CAF_PDM_InitFieldNoDefault(&m_crossPlotCurves, "CrossPlotCurves", "Curves", "", "", "");
m_crossPlotCurves.uiCapability()->setUiTreeHidden(true);
CAF_PDM_InitField(&m_useCustomColor, "UseCustomColor", false, "Use Custom Color", "", "", "");
CAF_PDM_InitField(&m_customColor, "CustomColor", cvf::Color3f(cvf::Color3f::BLACK), "Custom Color", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_plotCellFilterCollection, "PlotCellFilterCollection", "Cell Filters", "", "", "");
m_plotCellFilterCollection.uiCapability()->setUiTreeHidden(true);
m_plotCellFilterCollection = new RimPlotCellFilterCollection;
setDefaults();
}
@ -220,7 +231,7 @@ QString RimGridCrossPlotCurveSet::createAutoName() const
if (m_nameConfig->addTimestep() && !timeStepString().isEmpty())
{
nameTags += timeStepString();
nameTags += timeStepString();
}
if (m_nameConfig->addGrouping() && groupParameter() != "None")
@ -319,7 +330,7 @@ QString RimGridCrossPlotCurveSet::caseNameString() const
//--------------------------------------------------------------------------------------------------
QString RimGridCrossPlotCurveSet::axisVariableString() const
{
return QString("%1 x %2").arg(xAxisName(), yAxisName());
return QString("%1 x %2").arg(xAxisName(), yAxisName());
}
//--------------------------------------------------------------------------------------------------
@ -358,18 +369,13 @@ std::vector<QString> RimGridCrossPlotCurveSet::groupStrings() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<RimGridCrossPlotCurveSet::NameComponents, QString>
RimGridCrossPlotCurveSet::nameComponents() const
std::map<RimGridCrossPlotCurveSet::NameComponents, QString> RimGridCrossPlotCurveSet::nameComponents() const
{
std::map<RimGridCrossPlotCurveSet::NameComponents, QString> componentNames;
if (m_nameConfig->addCaseName())
componentNames[GCP_CASE_NAME] = caseNameString();
if (m_nameConfig->addAxisVariables())
componentNames[GCP_AXIS_VARIABLES] = axisVariableString();
if (m_nameConfig->addTimestep())
componentNames[GCP_TIME_STEP] = timeStepString();
if (m_nameConfig->addGrouping())
componentNames[GCP_GROUP_NAME] = groupTitle();
if (m_nameConfig->addCaseName()) componentNames[GCP_CASE_NAME] = caseNameString();
if (m_nameConfig->addAxisVariables()) componentNames[GCP_AXIS_VARIABLES] = axisVariableString();
if (m_nameConfig->addTimestep()) componentNames[GCP_TIME_STEP] = timeStepString();
if (m_nameConfig->addGrouping()) componentNames[GCP_GROUP_NAME] = groupTitle();
return componentNames;
}
@ -385,6 +391,7 @@ void RimGridCrossPlotCurveSet::initAfterRead()
m_xAxisProperty->setEclipseCase(eclipseCase);
m_yAxisProperty->setEclipseCase(eclipseCase);
m_groupingProperty->setEclipseCase(eclipseCase);
m_plotCellFilterCollection->setCase(eclipseCase);
}
}
@ -394,7 +401,7 @@ void RimGridCrossPlotCurveSet::initAfterRead()
void RimGridCrossPlotCurveSet::onLoadDataAndUpdate(bool updateParentPlot)
{
updateDataSetName();
detachAllCurves();
m_crossPlotCurves.deleteAllChildObjects();
@ -402,7 +409,7 @@ void RimGridCrossPlotCurveSet::onLoadDataAndUpdate(bool updateParentPlot)
{
return;
}
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
if (eclipseCase == nullptr)
@ -448,11 +455,17 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
m_groupedResults.clear();
if (!groupingEnabled())
{
const caf::ColorTable& colors = RiaColorTables::contrastCategoryPaletteColors();
int colorIndex = indexInPlot();
RimGridCrossPlotCurve* curve = new RimGridCrossPlotCurve();
curve->setColor(colors.cycledColor3f(colorIndex));
if (m_useCustomColor)
{
curve->setColor(m_customColor());
}
else
{
const caf::ColorTable& colors = RiaColorTables::contrastCategoryPaletteColors();
int colorIndex = indexInPlot();
curve->setColor(colors.cycledColor3f(colorIndex));
}
curve->setGroupingInformation(indexInPlot(), 0);
curve->setSamples(result.xValues, result.yValues);
curve->updateCurveAppearance();
@ -468,10 +481,8 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
{
for (size_t i = 0; i < result.xValues.size(); ++i)
{
int categoryNum =
m_grouping == GROUP_BY_RESULT
? static_cast<int>(result.groupValuesContinuous[i])
: result.groupValuesDiscrete[i];
int categoryNum = m_grouping == GROUP_BY_RESULT ? static_cast<int>(result.groupValuesContinuous[i])
: result.groupValuesDiscrete[i];
m_groupedResults[categoryNum].xValues.push_back(result.xValues[i]);
m_groupedResults[categoryNum].yValues.push_back(result.yValues[i]);
@ -479,7 +490,6 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
m_groupedResults[categoryNum].groupValuesContinuous.push_back(result.groupValuesContinuous[i]);
if (!result.groupValuesDiscrete.empty())
m_groupedResults[categoryNum].groupValuesDiscrete.push_back(result.groupValuesDiscrete[i]);
}
}
else
@ -488,9 +498,9 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
for (size_t i = 0; i < result.xValues.size(); ++i)
{
auto upperBoundIt = std::lower_bound(tickValues.begin(), tickValues.end(), result.groupValuesContinuous[i]);
auto upperBoundIt = std::lower_bound(tickValues.begin(), tickValues.end(), result.groupValuesContinuous[i]);
int upperBoundIndex = static_cast<int>(upperBoundIt - tickValues.begin());
int categoryNum = std::min((int) tickValues.size() - 2, std::max(0, upperBoundIndex - 1));
int categoryNum = std::min((int)tickValues.size() - 2, std::max(0, upperBoundIndex - 1));
m_groupedResults[categoryNum].xValues.push_back(result.xValues[i]);
m_groupedResults[categoryNum].yValues.push_back(result.yValues[i]);
if (!result.groupValuesContinuous.empty())
@ -506,7 +516,7 @@ void RimGridCrossPlotCurveSet::createCurves(const RigEclipseCrossPlotResult& res
curve->setGroupingInformation(indexInPlot(), it->first);
if (groupingByCategoryResult())
{
curve->setColor(cvf::Color3f(legendConfig()->scalarMapper()->mapToColor(it->first)));
curve->setColor(cvf::Color3f(legendConfig()->scalarMapper()->mapToColor(it->first)));
}
else
{
@ -571,6 +581,44 @@ std::map<int, cvf::UByteArray> RimGridCrossPlotCurveSet::calculateCellVisibility
}
}
}
else if (m_plotCellFilterCollection->cellFilterCount() > 0)
{
std::set<int> timeSteps;
if (m_timeStep() == -1)
{
for (int i = 0; i < (int)eclipseCase->timeStepDates().size(); ++i)
{
timeSteps.insert(i);
}
}
else
{
timeSteps.insert(m_timeStep());
}
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
if (eclipseCaseData)
{
RiaDefines::PorosityModelType porosityModel = RiaDefines::MATRIX_MODEL;
RigCaseCellResultsData* cellResultsData = eclipseCaseData->results(porosityModel);
if (cellResultsData)
{
const RigActiveCellInfo* actCellInfo = cellResultsData->activeCellInfo();
size_t cellCount = actCellInfo->reservoirCellCount();
for (int i : timeSteps)
{
cvf::UByteArray* cellVisibility = &timeStepCellVisibilityMap[i];
cellVisibility->resize(cellCount);
cellVisibility->setAll(true);
m_plotCellFilterCollection->computeCellVisibilityFromFilter(i, cellVisibility);
}
}
}
}
return timeStepCellVisibilityMap;
}
@ -586,8 +634,7 @@ void RimGridCrossPlotCurveSet::defineUiOrdering(QString uiConfigName, caf::PdmUi
uiOrdering.add(&m_cellFilterView);
uiOrdering.add(&m_grouping);
if (m_grouping() == GROUP_BY_TIME &&
!(m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult()))
if (m_grouping() == GROUP_BY_TIME && !(m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult()))
{
m_grouping = NO_GROUPING;
}
@ -659,9 +706,8 @@ void RimGridCrossPlotCurveSet::fieldChangedByUi(const caf::PdmFieldHandle* chang
{
legendConfig()->setColorRange(RimRegularLegendConfig::NORMAL);
legendConfig()->setMappingMode(RimRegularLegendConfig::LINEAR_DISCRETE);
}
loadDataAndUpdate(true);
}
else if (changedField == &m_cellFilterView)
@ -720,7 +766,7 @@ QList<caf::PdmOptionItemInfo> RimGridCrossPlotCurveSet::calculateValueOptions(co
}
else if (fieldNeedingOptions == &m_grouping)
{
std::set<RigGridCrossPlotCurveGrouping> validOptions = { NO_GROUPING, GROUP_BY_TIME, GROUP_BY_FORMATION, GROUP_BY_RESULT };
std::set<RigGridCrossPlotCurveGrouping> validOptions = {NO_GROUPING, GROUP_BY_TIME, GROUP_BY_FORMATION, GROUP_BY_RESULT};
if (!hasMultipleTimeSteps())
{
validOptions.erase(GROUP_BY_TIME);
@ -772,9 +818,9 @@ void RimGridCrossPlotCurveSet::updateLegend()
}
}
}
else if (m_grouping() == GROUP_BY_TIME)
else if (m_grouping() == GROUP_BY_TIME)
{
QStringList timeStepNames = m_case->timeStepStrings();
QStringList timeStepNames = m_case->timeStepStrings();
std::vector<QString> categoryNames;
for (auto name : timeStepNames)
{
@ -847,7 +893,7 @@ void RimGridCrossPlotCurveSet::swapAxisProperties(bool updatePlot)
m_yAxisProperty.removeChildObject(yAxisProperties);
m_yAxisProperty = xAxisProperties;
m_xAxisProperty = yAxisProperties;
updateConnectedEditors();
loadDataAndUpdate(updatePlot);
}
@ -857,8 +903,7 @@ void RimGridCrossPlotCurveSet::swapAxisProperties(bool updatePlot)
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter& formatter) const
{
if (m_groupedResults.empty())
return;
if (m_groupedResults.empty()) return;
if (m_grouping != NO_GROUPING)
{
@ -891,8 +936,8 @@ void RimGridCrossPlotCurveSet::exportFormattedData(RifEclipseDataTableFormatter&
}
else
{
int groupIndex = it->first;
QString groupName = createGroupName(groupIndex);
int groupIndex = it->first;
QString groupName = createGroupName(groupIndex);
formatter.add(res.xValues[i]);
formatter.add(res.yValues[i]);
formatter.add(groupIndex);
@ -923,6 +968,42 @@ bool RimGridCrossPlotCurveSet::isYAxisLogarithmic() const
return parent->isYAxisLogarithmic();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurveSet::configureForPressureSaturationCurves(RimEclipseResultCase* eclipseCase,
const QString& dynamicResultName)
{
m_case = eclipseCase;
m_xAxisProperty->setEclipseCase(eclipseCase);
m_xAxisProperty->setResultType(RiaDefines::DYNAMIC_NATIVE);
m_xAxisProperty->setResultVariable(dynamicResultName);
m_yAxisProperty->setEclipseCase(eclipseCase);
m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE);
m_yAxisProperty->setResultVariable("DEPTH");
m_grouping = NO_GROUPING;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurveSet::addCellFilter(RimPlotCellFilter* cellFilter)
{
m_plotCellFilterCollection->addCellFilter(cellFilter);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurveSet::setCustomColor(const cvf::Color3f color)
{
m_useCustomColor = true;
m_customColor = color;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -997,7 +1078,7 @@ void RimGridCrossPlotCurveSet::setDefaults()
if (!project->eclipseCases().empty())
{
RimEclipseCase* eclipseCase = project->eclipseCases().front();
m_case = eclipseCase;
m_case = eclipseCase;
m_xAxisProperty->setEclipseCase(eclipseCase);
m_yAxisProperty->setEclipseCase(eclipseCase);
m_groupingProperty->setEclipseCase(eclipseCase);
@ -1008,7 +1089,7 @@ void RimGridCrossPlotCurveSet::setDefaults()
m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE);
m_yAxisProperty->setResultVariable("PERMX");
}
}
}
}
//--------------------------------------------------------------------------------------------------
@ -1035,6 +1116,8 @@ void RimGridCrossPlotCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTr
uiTreeOrdering.add(curve);
}
uiTreeOrdering.add(&m_plotCellFilterCollection);
uiTreeOrdering.skipRemainingChildren(true);
}
@ -1044,7 +1127,6 @@ void RimGridCrossPlotCurveSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTr
bool RimGridCrossPlotCurveSet::hasMultipleTimeSteps() const
{
return m_timeStep() == -1 && (m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult());
}
//--------------------------------------------------------------------------------------------------
@ -1057,13 +1139,12 @@ void RimGridCrossPlotCurveSet::filterInvalidCurveValues(RigEclipseCrossPlotResul
if (xLog || yLog)
{
RigEclipseCrossPlotResult validResult;
for (size_t i = 0; i < result->xValues.size(); ++i)
{
double xValue = result->xValues[i];
double yValue = result->yValues[i];
bool invalid = (xLog && xValue <= 0.0) || (yLog && yValue <= 0.0);
double xValue = result->xValues[i];
double yValue = result->yValues[i];
bool invalid = (xLog && xValue <= 0.0) || (yLog && yValue <= 0.0);
if (!invalid)
{
validResult.xValues.push_back(xValue);

View File

@ -30,6 +30,9 @@
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
// Include to make Pdm work for cvf::Color
#include "cafPdmFieldCvfColor.h"
#include <cvfArray.h>
#include <QList>
@ -40,12 +43,15 @@ class RimCase;
class RimGridCrossPlotCurve;
class RimGridView;
class RimEclipseCase;
class RimEclipseResultCase;
class RimEclipseCellColors;
class RimEclipseResultDefinition;
class RimRegularLegendConfig;
class QwtPlot;
class QwtPlotCurve;
class QString;
class RimPlotCellFilterCollection;
class RimPlotCellFilter;
class RimGridCrossPlotCurveSetNameConfig : public RimNameConfig
{
@ -120,6 +126,10 @@ public:
bool isXAxisLogarithmic() const;
bool isYAxisLogarithmic() const;
void configureForPressureSaturationCurves(RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName);
void addCellFilter(RimPlotCellFilter* cellFilter);
void setCustomColor(const cvf::Color3f color);
protected:
void initAfterRead() override;
void onLoadDataAndUpdate(bool updateParentPlot);
@ -159,4 +169,8 @@ private:
std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
caf::PdmField<bool> m_useCustomColor;
caf::PdmField<cvf::Color3f> m_customColor;
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;;
};

View File

@ -0,0 +1,220 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimSaturationPressurePlot.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigEquil.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimGridCrossPlotCurveSet.h"
#include "RimPlotAxisAnnotation.h"
#include "RimPlotAxisProperties.h"
#include "CellFilters/RimPlotCellPropertyFilter.h"
CAF_PDM_SOURCE_INIT(RimSaturationPressurePlot, "RimSaturationPressurePlot");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSaturationPressurePlot::RimSaturationPressurePlot()
{
CAF_PDM_InitObject("Saturation Pressure Plot", ":/SummaryXPlotLight16x16.png", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion(RiaDefines::PorosityModelType porosityModel,
RimEclipseResultCase* eclipseResultCase,
int zeroBasedEquilRegionIndex)
{
nameConfig()->addDataSetNames = false;
QString caseName = eclipseResultCase->caseUserDescription();
QString plotTitle = QString("%1 - EQLNUM %2").arg(caseName).arg(zeroBasedEquilRegionIndex + 1);
nameConfig()->setCustomName(plotTitle);
auto equilData = eclipseResultCase->eclipseCaseData()->equilData();
auto eq = equilData[zeroBasedEquilRegionIndex];
double gasOilContactDepth = eq.gasOilContactDepth();
double waterOilContactDepth = eq.waterOilContactDepth();
{
// Blue PRESSURE curve with data for specified EQLNUM value
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PRESSURE");
curveSet->setCustomColor(cvf::Color3::BLUE);
RimPlotCellPropertyFilter* cellFilter =
createEquilibriumRegionPropertyFilter(eclipseResultCase, zeroBasedEquilRegionIndex);
curveSet->addCellFilter(cellFilter);
}
{
// Red dew pressure (PDEW) curve with data for specified EQLNUM value, filtered on depth by gasOilContact
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PDEW");
curveSet->setCustomColor(cvf::Color3::RED);
RimPlotCellPropertyFilter* cellFilter =
createEquilibriumRegionPropertyFilter(eclipseResultCase, zeroBasedEquilRegionIndex);
curveSet->addCellFilter(cellFilter);
{
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results(porosityModel);
if (caseCellResultsData)
{
RigEclipseResultAddress depthResultAddress(RiaDefines::STATIC_NATIVE, "DEPTH");
double minDepth = 0.0;
double maxDepth = 0.0;
caseCellResultsData->minMaxCellScalarValues(depthResultAddress, minDepth, maxDepth);
maxDepth = gasOilContactDepth;
RimPlotCellPropertyFilter* depthCellFilter = createDepthPropertyFilter(eclipseResultCase, minDepth, maxDepth);
curveSet->addCellFilter(depthCellFilter);
}
}
}
{
// Green bubble point pressure (PBUB) curve with data for specified EQLNUM value, filtered on depth between gasOilContact
// and waterOilContactDepth
RimGridCrossPlotCurveSet* curveSet = createCurveSet();
curveSet->configureForPressureSaturationCurves(eclipseResultCase, "PBUB");
curveSet->setCustomColor(cvf::Color3::GREEN);
{
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
{
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
resultDefinition->setEclipseCase(eclipseResultCase);
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
resultDefinition->setResultVariable("EQLNUM");
cellFilter->setResultDefinition(resultDefinition);
}
cellFilter->setValueRange(zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1);
curveSet->addCellFilter(cellFilter);
}
{
RigCaseCellResultsData* caseCellResultsData = eclipseResultCase->eclipseCaseData()->results(porosityModel);
if (caseCellResultsData)
{
RigEclipseResultAddress depthResultAddress(RiaDefines::STATIC_NATIVE, "DEPTH");
double minDepth = 0.0;
double maxDepth = 0.0;
caseCellResultsData->minMaxCellScalarValues(depthResultAddress, minDepth, maxDepth);
minDepth = gasOilContactDepth;
maxDepth = waterOilContactDepth;
RimPlotCellPropertyFilter* depthCellFilter = createDepthPropertyFilter(eclipseResultCase, minDepth, maxDepth);
curveSet->addCellFilter(depthCellFilter);
}
}
}
RimPlotAxisProperties* yAxisProps = yAxisProperties();
yAxisProps->setInvertedAxis(true);
{
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
annotation->setEquilibriumData(
eclipseResultCase, zeroBasedEquilRegionIndex, RimPlotAxisAnnotation::PL_EQUIL_GAS_OIL_CONTACT);
yAxisProps->appendAnnotation(annotation);
}
{
RimPlotAxisAnnotation* annotation = new RimPlotAxisAnnotation;
annotation->setEquilibriumData(
eclipseResultCase, zeroBasedEquilRegionIndex, RimPlotAxisAnnotation::PL_EQUIL_WATER_OIL_CONTACT);
yAxisProps->appendAnnotation(annotation);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSaturationPressurePlot::initAfterRead()
{
yAxisProperties()->showAnnotationObjectsInProjectTree();
RimGridCrossPlot::initAfterRead();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellPropertyFilter*
RimSaturationPressurePlot::createEquilibriumRegionPropertyFilter(RimEclipseResultCase* eclipseResultCase,
int zeroBasedEquilRegionIndex)
{
RimPlotCellPropertyFilter* cellFilter = new RimPlotCellPropertyFilter();
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
resultDefinition->setEclipseCase(eclipseResultCase);
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
resultDefinition->setResultVariable("EQLNUM");
cellFilter->setResultDefinition(resultDefinition);
cellFilter->setValueRange(zeroBasedEquilRegionIndex + 1, zeroBasedEquilRegionIndex + 1);
return cellFilter;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotCellPropertyFilter* RimSaturationPressurePlot::createDepthPropertyFilter(RimEclipseResultCase* eclipseResultCase,
double minDepth,
double maxDepth)
{
RimPlotCellPropertyFilter* depthCellFilter = new RimPlotCellPropertyFilter();
RimEclipseResultDefinition* resultDefinition = new RimEclipseResultDefinition();
resultDefinition->setEclipseCase(eclipseResultCase);
resultDefinition->setResultType(RiaDefines::STATIC_NATIVE);
resultDefinition->setResultVariable("DEPTH");
depthCellFilter->setResultDefinition(resultDefinition);
depthCellFilter->setValueRange(minDepth, maxDepth);
return depthCellFilter;
}

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaPorosityModel.h"
#include "RimGridCrossPlot.h"
class RimEclipseResultCase;
class RimPlotCellPropertyFilter;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RimSaturationPressurePlot : public RimGridCrossPlot
{
CAF_PDM_HEADER_INIT;
public:
RimSaturationPressurePlot();
void assignCaseAndEquilibriumRegion(RiaDefines::PorosityModelType porosityModel,
RimEclipseResultCase* eclipseResultCase,
int zeroBasedEquilRegionIndex);
protected:
void initAfterRead() override;
private:
RimPlotCellPropertyFilter* createEquilibriumRegionPropertyFilter(RimEclipseResultCase* eclipseResultCase,
int zeroBasedEquilRegionIndex);
RimPlotCellPropertyFilter*
createDepthPropertyFilter(RimEclipseResultCase* eclipseResultCase, double minDepth, double maxDepth);
};

View File

@ -0,0 +1,84 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimSaturationPressurePlotCollection.h"
#include "RigEclipseCaseData.h"
#include "RigEquil.h"
#include "RimEclipseResultCase.h"
#include "RimSaturationPressurePlot.h"
CAF_PDM_SOURCE_INIT(RimSaturationPressurePlotCollection, "RimSaturationPressurePlotCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSaturationPressurePlotCollection::RimSaturationPressurePlotCollection()
{
CAF_PDM_InitObject("Saturation Pressure Plots", ":/SummaryXPlotsLight16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_saturationPressurePlots, "SaturationPressurePlots", "Saturation Pressure Plots", "", "", "");
m_saturationPressurePlots.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSaturationPressurePlotCollection::~RimSaturationPressurePlotCollection() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSaturationPressurePlotCollection::createSaturationPressurePlots(RimEclipseResultCase* eclipseResultCase)
{
if (!eclipseResultCase) return;
RigEclipseCaseData* eclipseCaseData = eclipseResultCase->eclipseCaseData();
if (!eclipseCaseData) return;
m_saturationPressurePlots.deleteAllChildObjects();
std::vector<RigEquil> equilData = eclipseCaseData->equilData();
for (size_t i = 0; i < equilData.size(); i++)
{
RimSaturationPressurePlot* plot = new RimSaturationPressurePlot();
plot->setAsPlotMdiWindow();
int equilibriumRegion = static_cast<int>(i);
plot->assignCaseAndEquilibriumRegion(RiaDefines::MATRIX_MODEL, eclipseResultCase, equilibriumRegion);
m_saturationPressurePlots.push_back(plot);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots()
{
return m_saturationPressurePlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSaturationPressurePlotCollection::deleteAllChildObjects()
{
m_saturationPressurePlots.deleteAllChildObjects();
}

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimSaturationPressurePlot;
class RimEclipseResultCase;
//==================================================================================================
///
///
//==================================================================================================
class RimSaturationPressurePlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimSaturationPressurePlotCollection();
~RimSaturationPressurePlotCollection() override;
void createSaturationPressurePlots(RimEclipseResultCase* eclipseResultCase);
std::vector<RimSaturationPressurePlot*> plots();
void deleteAllChildObjects();
private:
caf::PdmChildArrayField<RimSaturationPressurePlot*> m_saturationPressurePlots;
};

View File

@ -95,6 +95,7 @@
#include "RimWellPathCollection.h"
#include "RimWellPltPlot.h"
#include "RimWellRftPlot.h"
#include "RimSaturationPressurePlotCollection.h"
#include "RimEllipseFractureTemplate.h"
#include "RimStimPlanFractureTemplate.h"
@ -472,6 +473,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
{
menuBuilder << "RicCreateGridCrossPlotFeature";
}
else if (dynamic_cast<RimSaturationPressurePlotCollection*>(uiItem))
{
menuBuilder << "RicCreateSaturationPressurePlotsFeature";
}
else if (dynamic_cast<RimGridCrossPlot*>(uiItem))
{
menuBuilder << "RicPasteGridCrossPlotCurveSetFeature";

View File

@ -186,6 +186,14 @@ void RimEclipseResultDefinition::setEclipseCase(RimEclipseCase* eclipseCase)
assignFlowSolutionFromCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimEclipseResultDefinition::eclipseCase()
{
return m_eclipseCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -76,6 +76,7 @@ public:
void simpleCopy(const RimEclipseResultDefinition* other);
void setEclipseCase(RimEclipseCase* eclipseCase);
RimEclipseCase* eclipseCase();
RiaDefines::ResultCatType resultType() const { return m_resultType(); }
void setResultType(RiaDefines::ResultCatType val);

View File

@ -19,13 +19,14 @@
#include "RimMainPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimFlowPlotCollection.h"
#include "RimGridCrossPlot.h"
#include "RimGridCrossPlotCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
#include "RimSaturationPressurePlotCollection.h"
#include "RimSummaryCrossPlotCollection.h"
#include "RimSummaryPlotCollection.h"
#include "RimViewWindow.h"
@ -70,6 +71,9 @@ RimMainPlotCollection::RimMainPlotCollection()
CAF_PDM_InitFieldNoDefault(&m_gridCrossPlotCollection, "Rim3dCrossPlotCollection", "3d Cross Plots", "", "", "");
m_gridCrossPlotCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_saturationPressurePlotCollection, "RimSaturationPressurePlotCollection", "Saturation Pressure Plots", "", "", "");
m_saturationPressurePlotCollection.uiCapability()->setUiHidden(true);
m_wellLogPlotCollection = new RimWellLogPlotCollection();
m_rftPlotCollection = new RimRftPlotCollection();
m_pltPlotCollection = new RimPltPlotCollection();
@ -77,6 +81,7 @@ RimMainPlotCollection::RimMainPlotCollection()
m_summaryCrossPlotCollection = new RimSummaryCrossPlotCollection();
m_flowPlotCollection = new RimFlowPlotCollection();
m_gridCrossPlotCollection = new RimGridCrossPlotCollection;
m_saturationPressurePlotCollection = new RimSaturationPressurePlotCollection;
}
//--------------------------------------------------------------------------------------------------
@ -158,6 +163,14 @@ RimGridCrossPlotCollection* RimMainPlotCollection::gridCrossPlotCollection()
return m_gridCrossPlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSaturationPressurePlotCollection* RimMainPlotCollection::saturationPressurePlotCollection()
{
return m_saturationPressurePlotCollection();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -170,6 +183,7 @@ void RimMainPlotCollection::deleteAllContainedObjects()
m_summaryCrossPlotCollection()->deleteAllChildObjects();
m_gridCrossPlotCollection->deleteAllChildObjects();
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
m_saturationPressurePlotCollection()->deleteAllChildObjects();
}

View File

@ -2,30 +2,29 @@
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include <QPointer>
#include <QDockWidget>
#include <QPointer>
class RimWellLogPlotCollection;
class RimRftPlotCollection;
@ -37,46 +36,49 @@ class RimSummaryPlot;
class RifReaderEclipseSummary;
class RimEclipseResultCase;
class RimFlowPlotCollection;
class RimSaturationPressurePlotCollection;
//==================================================================================================
///
///
///
///
//==================================================================================================
class RimMainPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimMainPlotCollection();
~RimMainPlotCollection() override;
RimWellLogPlotCollection* wellLogPlotCollection();
RimRftPlotCollection* rftPlotCollection();
RimPltPlotCollection* pltPlotCollection();
RimSummaryPlotCollection* summaryPlotCollection();
RimSummaryCrossPlotCollection* summaryCrossPlotCollection();
RimFlowPlotCollection* flowPlotCollection();
RimGridCrossPlotCollection* gridCrossPlotCollection();
RimWellLogPlotCollection* wellLogPlotCollection();
RimRftPlotCollection* rftPlotCollection();
RimPltPlotCollection* pltPlotCollection();
RimSummaryPlotCollection* summaryPlotCollection();
RimSummaryCrossPlotCollection* summaryCrossPlotCollection();
RimFlowPlotCollection* flowPlotCollection();
RimGridCrossPlotCollection* gridCrossPlotCollection();
RimSaturationPressurePlotCollection* saturationPressurePlotCollection();
void deleteAllContainedObjects();
void updateCurrentTimeStepInPlots();
void updatePlotsWithFormations();
void updatePlotsWithCompletions();
void deleteAllCachedData();
void deleteAllContainedObjects();
void updateCurrentTimeStepInPlots();
void updatePlotsWithFormations();
void updatePlotsWithCompletions();
void deleteAllCachedData();
private:
// Overridden PDM methods
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
caf::PdmChildField<RimRftPlotCollection*> m_rftPlotCollection;
caf::PdmChildField<RimPltPlotCollection*> m_pltPlotCollection;
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
caf::PdmChildField<RimSummaryCrossPlotCollection*> m_summaryCrossPlotCollection;
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
caf::PdmChildField<RimRftPlotCollection*> m_rftPlotCollection;
caf::PdmChildField<RimPltPlotCollection*> m_pltPlotCollection;
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
caf::PdmChildField<RimSummaryCrossPlotCollection*> m_summaryCrossPlotCollection;
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
caf::PdmChildField<RimGridCrossPlotCollection*> m_gridCrossPlotCollection;
caf::PdmChildField<RimSaturationPressurePlotCollection*> m_saturationPressurePlotCollection;
caf::PdmField<bool> m_show;
};

View File

@ -0,0 +1,236 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimPlotAxisAnnotation.h"
#include "RigEclipseCaseData.h"
#include "RigEquil.h"
#include "RimEclipseCase.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimTools.h"
#include "RimViewWindow.h"
namespace caf
{
template<>
void RimPlotAxisAnnotation::ExportKeywordEnum::setUp()
{
addItem(RimPlotAxisAnnotation::PL_USER_DEFINED, "User Defined", "User Defined");
addItem(RimPlotAxisAnnotation::PL_EQUIL_WATER_OIL_CONTACT, "PL_EQUIL_WATER_OIL_CONTACT", "PL_EQUIL_WATER_OIL_CONTACT");
addItem(RimPlotAxisAnnotation::PL_EQUIL_GAS_OIL_CONTACT, "PL_EQUIL_GAS_OIL_CONTACT", "PL_EQUIL_GAS_OIL_CONTACT");
setDefault(RimPlotAxisAnnotation::PL_USER_DEFINED);
}
} // namespace caf
CAF_PDM_SOURCE_INIT(RimPlotAxisAnnotation, "RimPlotAxisAnnotation");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPlotAxisAnnotation::RimPlotAxisAnnotation()
{
CAF_PDM_InitObject("Plot Axis Annotation", ":/LeftAxis16x16.png", "", "");
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
m_isActive.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_name, "Name", "Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_value, "Value", "Value", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_annotationType, "AnnotationType", "AnnotationType", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_sourceCase, "Associated3DCase", "Eclipse Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_equilNum, "m_equilNum", "equil Num", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisAnnotation::setName(const QString& name)
{
m_name = name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisAnnotation::setValue(double value)
{
m_value = value;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisAnnotation::setEquilibriumData(RimEclipseCase* eclipseCase,
int zeroBasedEquilRegionIndex,
PlotAxisAnnotationType annotationType)
{
m_sourceCase = eclipseCase;
m_equilNum = zeroBasedEquilRegionIndex + 1;
m_annotationType = annotationType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimPlotAxisAnnotation::name() const
{
if (m_annotationType() == PL_EQUIL_WATER_OIL_CONTACT)
{
QString text = QString("WOC %1").arg(value());
return text;
}
else if (m_annotationType() == PL_EQUIL_GAS_OIL_CONTACT)
{
QString text = QString("GOC %1").arg(value());
return text;
}
return m_name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPlotAxisAnnotation::value() const
{
if (m_annotationType() == PL_EQUIL_WATER_OIL_CONTACT)
{
return selectedItem().waterOilContactDepth();
}
else if (m_annotationType() == PL_EQUIL_GAS_OIL_CONTACT)
{
return selectedItem().gasOilContactDepth();
}
return m_value();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimPlotAxisAnnotation::userDescriptionField()
{
return &m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimPlotAxisAnnotation::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisAnnotation::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
/*
RimViewWindow* viewWindow = nullptr;
this->firstAncestorOrThisOfType(viewWindow);
if (viewWindow)
{
viewWindow->loadDataAndUpdate();
}
*/
RimRiuQwtPlotOwnerInterface* parentPlot = nullptr;
this->firstAncestorOrThisOfType(parentPlot);
if (parentPlot)
{
parentPlot->updateAxisDisplay();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimPlotAxisAnnotation::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_sourceCase)
{
RimTools::caseOptionItems(&options);
}
else if (fieldNeedingOptions == &m_equilNum)
{
for (int i = 0; i < equilItems().size(); i++)
{
QString uiText = QString("%1").arg(i + 1);
options.push_back(caf::PdmOptionItemInfo(uiText, i));
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisAnnotation::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_annotationType);
if (m_annotationType() == PL_USER_DEFINED)
{
uiOrdering.add(&m_name);
uiOrdering.add(&m_value);
}
else
{
uiOrdering.add(&m_sourceCase);
uiOrdering.add(&m_equilNum);
}
uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEquil RimPlotAxisAnnotation::selectedItem() const
{
int index = m_equilNum() - 1;
if (index < equilItems().size())
{
return equilItems()[index];
}
return RigEquil::defaultObject();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigEquil> RimPlotAxisAnnotation::equilItems() const
{
if (m_sourceCase && m_sourceCase->eclipseCaseData())
{
return m_sourceCase->eclipseCaseData()->equilData();
}
return std::vector<RigEquil>();
}

View File

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <QString>
class RimEclipseCase;
class RigEquil;
//==================================================================================================
///
///
//==================================================================================================
class RimPlotAxisAnnotation : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
enum PlotAxisAnnotationType
{
PL_USER_DEFINED,
PL_EQUIL_WATER_OIL_CONTACT,
PL_EQUIL_GAS_OIL_CONTACT
};
typedef caf::AppEnum<PlotAxisAnnotationType> ExportKeywordEnum;
RimPlotAxisAnnotation();
void setName(const QString& name);
void setValue(double value);
void setEquilibriumData(RimEclipseCase* eclipseCase, int zeroBasedEquilRegionIndex, PlotAxisAnnotationType annotationType);
QString name() const;
double value() const;
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
RigEquil selectedItem() const;
std::vector<RigEquil> equilItems() const;
private:
caf::PdmField<ExportKeywordEnum> m_annotationType;
caf::PdmField<bool> m_isActive;
caf::PdmField<QString> m_name;
caf::PdmField<double> m_value;
caf::PdmPtrField<RimEclipseCase*> m_sourceCase;
caf::PdmField<int> m_equilNum;
};

View File

@ -23,6 +23,7 @@
#include "RigStatisticsCalculator.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimPlotAxisAnnotation.h"
#include "cafPdmUiSliderEditor.h"
@ -95,6 +96,11 @@ RimPlotAxisProperties::RimPlotAxisProperties()
CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale", "", "", "");
CAF_PDM_InitField(&m_isAxisInverted, "AxisInverted", false, "Invert Axis", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", "", "", "", "");
m_annotations.uiCapability()->setUiHidden(true);
// m_annotations.uiCapability()->setUiTreeChildrenHidden(true);
updateOptionSensitivity();
}
// clang-format on
@ -302,6 +308,22 @@ bool RimPlotAxisProperties::isAxisInverted() const
return m_isAxisInverted();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPlotAxisAnnotation*> RimPlotAxisProperties::annotations() const
{
return m_annotations.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisProperties::appendAnnotation(RimPlotAxisAnnotation* annotation)
{
m_annotations.push_back(annotation);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -318,6 +340,22 @@ bool RimPlotAxisProperties::isActive() const
return m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisProperties::setInvertedAxis(bool enable)
{
m_isAxisInverted = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotAxisProperties::showAnnotationObjectsInProjectTree()
{
m_annotations.uiCapability()->setUiTreeChildrenHidden(false);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -30,6 +30,8 @@
#include <QString>
class RimPlotAxisAnnotation;
//==================================================================================================
///
///
@ -70,6 +72,9 @@ public:
bool isAxisInverted() const;
void setAxisInverted(bool inverted);
std::vector<RimPlotAxisAnnotation*> annotations() const;
void appendAnnotation(RimPlotAxisAnnotation* annotation);
caf::PdmField<QString> customTitle;
caf::PdmField<int> titleFontSize;
caf::PdmField<caf::AppEnum<AxisTitlePositionType>> titlePositionEnum;
@ -84,6 +89,9 @@ public:
caf::PdmField<int> valuesFontSize;
bool isActive() const;
void setInvertedAxis(bool enable);
void showAnnotationObjectsInProjectTree();
protected:
void initAfterRead() override;
@ -113,6 +121,8 @@ private:
QwtPlot::Axis m_axis;
bool m_enableTitleTextSettings;
caf::PdmChildArrayField<RimPlotAxisAnnotation*> m_annotations;
};
class QwtPlotCurve;

View File

@ -48,6 +48,7 @@
#include "RimFractureTemplate.h"
#include "RimFractureTemplateCollection.h"
#include "RimGridCrossPlotCollection.h"
#include "RimSaturationPressurePlotCollection.h"
#include "RimValveTemplate.h"
#include "RimValveTemplateCollection.h"
#include "RimGeoMechCase.h"
@ -1246,6 +1247,11 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
{
itemCollection->add(mainPlotCollection->gridCrossPlotCollection());
}
if (mainPlotCollection->saturationPressurePlotCollection())
{
itemCollection->add(mainPlotCollection->saturationPressurePlotCollection());
}
}
}
else

View File

@ -24,6 +24,7 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEquil.h"
#include "RigFormationNames.h"
#include "RigMainGrid.h"
#include "RigResultAccessorFactory.h"
@ -560,6 +561,22 @@ const RigVirtualPerforationTransmissibilities* RigEclipseCaseData::virtualPerfor
return m_virtualPerforationTransmissibilities.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigEquil> RigEclipseCaseData::equilData() const
{
return m_equil;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseCaseData::setEquilData(const std::vector<RigEquil>& equilObjects)
{
m_equil = equilObjects;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -48,6 +48,7 @@ class RigCell;
class RigWellPath;
class RimEclipseCase;
class RigVirtualPerforationTransmissibilities;
class RigEquil;
struct RigWellResultPoint;
@ -118,6 +119,9 @@ public:
void clearWellCellsInGridCache() { m_wellCellsInGrid.clear(); }
std::vector<RigEquil> equilData() const;
void setEquilData(const std::vector<RigEquil>& equilObjects);
private:
void computeActiveCellIJKBBox();
void computeWellCellsPrGrid();
@ -141,5 +145,7 @@ private:
RiaEclipseUnitTools::UnitSystem m_unitsType;
std::vector<RigEquil> m_equil;
mutable std::map<std::tuple<QString, bool, bool>, cvf::Collection<RigWellPath>> m_simWellBranchCache;
};

View File

@ -89,6 +89,32 @@ int RigEquil::initializationTargetAccuracy() const
return this->init_target_accuracy;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEquil RigEquil::defaultObject()
{
double datumDepth = 0.0;
double datuDepthPressure = 0.0;
double waterOilContactDepth = 0.0;
double waterOilContactCapillaryPressure = 0.0;
double gasOilContactDepth = 0.0;
double gasOilContactCapillaryPressure = 0.0;
int liveOilInitConstantRs = -1;
int wetGasInitConstantRv = -1;
int initializationTargetAccuracy = -5;
return RigEquil(datumDepth,
datuDepthPressure,
waterOilContactDepth,
waterOilContactCapillaryPressure,
gasOilContactDepth,
gasOilContactCapillaryPressure,
liveOilInitConstantRs,
wetGasInitConstantRv,
initializationTargetAccuracy);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -49,6 +49,7 @@ public:
bool wetGasInitConstantRv() const;
int initializationTargetAccuracy() const;
static RigEquil defaultObject();
static RigEquil parseString(const QString& keywordData);
private:

View File

@ -17,11 +17,13 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RigStatisticsMath.h"
#include "cvfBase.h"
#include "cvfMath.h"
#include <algorithm>
#include <assert.h>
#include <math.h>
#include "cvfBase.h"
#include "cvfMath.h"
//--------------------------------------------------------------------------------------------------
/// A function to do basic statistical calculations
@ -254,7 +256,12 @@ double RigHistogramCalculator::calculatePercentil(double pVal)
{
double domainValueAtEndOfBin = m_min + (binIdx+1) * binWidth;
double unusedFractionOfLastBin = (double)(accObsCount - pValObservationCount)/binObsCount;
return domainValueAtEndOfBin - unusedFractionOfLastBin*binWidth;
double histogramBasedEstimate = domainValueAtEndOfBin - unusedFractionOfLastBin*binWidth;
// See https://resinsight.org/docs/casegroupsandstatistics/#percentile-methods for details
return histogramBasedEstimate;
}
}
assert(false);

View File

@ -28,6 +28,10 @@
#include "cafSelectionManager.h"
#include "cafTitledOverlayFrame.h"
#include "RimPlotAxisProperties.h"
#include "RimPlotAxisAnnotation.h"
#include "RiuPlotAnnotationTool.h"
#include <QMenu>
#include <QResizeEvent>
@ -36,7 +40,8 @@
//--------------------------------------------------------------------------------------------------
RiuGridCrossQwtPlot::RiuGridCrossQwtPlot(RimViewWindow* ownerViewWindow, QWidget* parent /*= nullptr*/)
: RiuQwtPlot(ownerViewWindow, parent)
{
{
m_annotationTool = std::unique_ptr<RiuPlotAnnotationTool>(new RiuPlotAnnotationTool());
}
//--------------------------------------------------------------------------------------------------
@ -65,7 +70,6 @@ void RiuGridCrossQwtPlot::addOrUpdateCurveSetLegend(RimGridCrossPlotCurveSet* cu
caf::TitledOverlayFrame* overlayItem = curveSet->legendConfig()->titledOverlayFrame();
resizeOverlayItemToFitPlot(overlayItem);
overlayWidget->updateFromOverlayItem(overlayItem);
}
this->updateLegendLayout();
}
@ -121,6 +125,26 @@ void RiuGridCrossQwtPlot::updateLegendSizesToMatchPlot()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuGridCrossQwtPlot::updateAnnotationObjects(RimPlotAxisProperties* axisProperties)
{
std::vector<QString> names;
std::vector<double> positions;
for (auto a : axisProperties->annotations())
{
names.push_back(a->name());
positions.push_back(a->value());
}
if (!names.empty())
{
m_annotationTool->attachWellPicks(this, names, positions);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -163,7 +187,7 @@ void RiuGridCrossQwtPlot::updateLegendLayout()
if (ypos + overlayWidget->height() + spacing > this->canvas()->height())
{
xpos += spacing + maxColumnWidth;
ypos = startMarginY;
ypos = startMarginY;
maxColumnWidth = 0;
}
@ -197,21 +221,20 @@ bool RiuGridCrossQwtPlot::resizeOverlayItemToFitPlot(caf::TitledOverlayFrame* ov
bool sizeAltered = false;
if (plotSize.width() > 0 && (double) legendSize.x() > 0.9 * plotSize.width())
if (plotSize.width() > 0 && (double)legendSize.x() > 0.9 * plotSize.width())
{
legendSize.x() = (plotSize.width() * 9) / 10;
sizeAltered = true;
sizeAltered = true;
}
if (plotSize.height() > 0 && (double) legendSize.y() > 0.9 * plotSize.height())
if (plotSize.height() > 0 && (double)legendSize.y() > 0.9 * plotSize.height())
{
legendSize.y() = (plotSize.height() * 9) / 10;
sizeAltered = true;
sizeAltered = true;
}
overlayItem->setRenderSize(legendSize);
return sizeAltered;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -27,6 +27,8 @@
class RimGridCrossPlotCurveSet;
class RiuCvfOverlayItemWidget;
class RiuPlotAnnotationTool;
class RimPlotAxisProperties;
namespace caf
{
@ -47,12 +49,16 @@ public:
void addOrUpdateCurveSetLegend(RimGridCrossPlotCurveSet* curveSetToShowLegendFor);
void removeCurveSetLegend(RimGridCrossPlotCurveSet* curveSetToShowLegendFor);
void updateLegendSizesToMatchPlot();
void updateAnnotationObjects(RimPlotAxisProperties* axisProperties);
protected:
void updateLayout() override;
void updateLegendLayout();
void resizeEvent(QResizeEvent *e) override;
bool resizeOverlayItemToFitPlot(caf::TitledOverlayFrame* overlayItem);
void contextMenuEvent(QContextMenuEvent*) override;
private:
std::map<caf::PdmPointer<RimGridCrossPlotCurveSet>, QPointer<RiuCvfOverlayItemWidget>> m_legendWidgets;
std::unique_ptr<RiuPlotAnnotationTool> m_annotationTool;
};

View File

@ -0,0 +1,27 @@
@startuml
PdmObject <|-- RimPlotCellFilter
class RimPlotCellFilter
{
void updateCellVisibilityFromFilter(size_t timeStepIndex,
cvf::UByteArray* cellVisibility)
FilterModeType filterMode() const;
}
RimPlotCellFilter <|-- RimPlotCellPropertyFilter
RimPlotCellFilter <|-- RimPlotCellFilterCollection
RimPlotCellFilterCollection -> RimPlotCellFilter
class RimPlotCellFilterCollection
{
std::vector<RimCellFilter*> m_filters
}
RimPlotCellFilter <|-- RimPlotCellRegionFilter_planned
RimPlotCellFilter <|-- RimPlotCellRangeFilter_planned
@enduml