mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #763 from OPM/summary-plot
Merging the new Summary Plot and OPM-Parser integration into dev
This commit is contained in:
commit
2687a794fd
@ -98,6 +98,11 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimGridSummaryCase.h"
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@ -385,6 +390,17 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
|||||||
if (oilField->wellPathCollection) oilField->wellPathCollection->readWellPathFiles();
|
if (oilField->wellPathCollection) oilField->wellPathCollection->readWellPathFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (RimOilField* oilField: m_project->oilFields)
|
||||||
|
{
|
||||||
|
if (oilField == NULL) continue;
|
||||||
|
// Temporary
|
||||||
|
if(!oilField->summaryCaseCollection())
|
||||||
|
{
|
||||||
|
oilField->summaryCaseCollection = new RimSummaryCaseCollection();
|
||||||
|
}
|
||||||
|
oilField->summaryCaseCollection()->createSummaryCasesFromRelevantEclipseResultCases();
|
||||||
|
oilField->summaryCaseCollection()->loadAllSummaryCaseData();
|
||||||
|
}
|
||||||
|
|
||||||
// If load action is specified to recalculate statistics, do it now.
|
// If load action is specified to recalculate statistics, do it now.
|
||||||
// Apparently this needs to be done before the views are loaded, lest the number of time steps for statistics will be clamped
|
// Apparently this needs to be done before the views are loaded, lest the number of time steps for statistics will be clamped
|
||||||
@ -444,17 +460,39 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
RimWellLogPlotCollection* wlpColl = nullptr;
|
||||||
|
RimSummaryPlotCollection* spColl = nullptr;
|
||||||
|
|
||||||
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
|
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
|
||||||
{
|
{
|
||||||
RimWellLogPlotCollection* wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection();
|
wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection();
|
||||||
caf::ProgressInfo plotProgress(wlpColl->wellLogPlots().size(), "Loading Plot Data");
|
}
|
||||||
|
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->summaryPlotCollection())
|
||||||
|
{
|
||||||
|
spColl = m_project->mainPlotCollection()->summaryPlotCollection();
|
||||||
|
}
|
||||||
|
size_t plotCount = 0;
|
||||||
|
plotCount += wlpColl ? wlpColl->wellLogPlots().size(): 0;
|
||||||
|
plotCount += spColl ? spColl->m_summaryPlots().size(): 0;
|
||||||
|
|
||||||
|
caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data");
|
||||||
|
if (wlpColl)
|
||||||
|
{
|
||||||
for (size_t wlpIdx = 0; wlpIdx < wlpColl->wellLogPlots().size(); ++wlpIdx)
|
for (size_t wlpIdx = 0; wlpIdx < wlpColl->wellLogPlots().size(); ++wlpIdx)
|
||||||
{
|
{
|
||||||
wlpColl->wellLogPlots[wlpIdx]->loadDataAndUpdate();
|
wlpColl->wellLogPlots[wlpIdx]->loadDataAndUpdate();
|
||||||
plotProgress.incrementProgress();
|
plotProgress.incrementProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (spColl)
|
||||||
|
{
|
||||||
|
for (size_t wlpIdx = 0; wlpIdx < spColl->m_summaryPlots().size(); ++wlpIdx)
|
||||||
|
{
|
||||||
|
spColl->m_summaryPlots[wlpIdx]->loadDataAndUpdate();
|
||||||
|
plotProgress.incrementProgress();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// NB! This function must be called before executing command objects,
|
// NB! This function must be called before executing command objects,
|
||||||
// because the tree view state is restored from project file and sets
|
// because the tree view state is restored from project file and sets
|
||||||
@ -752,11 +790,21 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
|
|||||||
|
|
||||||
riv->loadDataAndUpdate();
|
riv->loadDataAndUpdate();
|
||||||
|
|
||||||
|
// Add a corresponding summary case if it exists
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* sumCaseColl = m_project->activeOilField() ? m_project->activeOilField()->summaryCaseCollection() : NULL;
|
||||||
|
if(sumCaseColl)
|
||||||
|
{
|
||||||
|
RimGridSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromEclipseResultCase(rimResultReservoir);
|
||||||
|
if(newSumCase) newSumCase->loadCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!riv->cellResult()->hasResult())
|
if (!riv->cellResult()->hasResult())
|
||||||
{
|
{
|
||||||
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||||
}
|
}
|
||||||
|
|
||||||
analysisModels->updateConnectedEditors();
|
analysisModels->updateConnectedEditors();
|
||||||
|
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
||||||
@ -1216,39 +1264,10 @@ int RiaApplication::launchUnitTestsWithConsole()
|
|||||||
// Only one console can be associated with an app, so should fail if a console is already present.
|
// Only one console can be associated with an app, so should fail if a console is already present.
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
|
|
||||||
bool redirStdOut = true;
|
FILE* consoleFilePointer;
|
||||||
bool redirStdErr = true;
|
|
||||||
bool redirStdIn = false;
|
|
||||||
|
|
||||||
if (redirStdOut)
|
freopen_s(&consoleFilePointer, "CONOUT$", "w", stdout);
|
||||||
{
|
freopen_s(&consoleFilePointer, "CONOUT$", "w", stderr);
|
||||||
HANDLE stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
||||||
int fileDescriptor = _open_osfhandle((intptr_t)stdHandle, _O_TEXT);
|
|
||||||
FILE* fp = _fdopen(fileDescriptor, "w");
|
|
||||||
|
|
||||||
*stdout = *fp;
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (redirStdErr)
|
|
||||||
{
|
|
||||||
HANDLE stdHandle = GetStdHandle(STD_ERROR_HANDLE);
|
|
||||||
int fileDescriptor = _open_osfhandle((intptr_t)stdHandle, _O_TEXT);
|
|
||||||
FILE* fp = _fdopen(fileDescriptor, "w");
|
|
||||||
|
|
||||||
*stderr = *fp;
|
|
||||||
setvbuf(stderr, NULL, _IONBF, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (redirStdIn)
|
|
||||||
{
|
|
||||||
HANDLE stdHandle = GetStdHandle(STD_INPUT_HANDLE);
|
|
||||||
int fileDescriptor = _open_osfhandle((intptr_t)stdHandle, _O_TEXT);
|
|
||||||
FILE* fp = _fdopen(fileDescriptor, "r");
|
|
||||||
|
|
||||||
*stdin = *fp;
|
|
||||||
setvbuf(stdin, NULL, _IONBF, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog point to console as well
|
// Make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog point to console as well
|
||||||
std::ios::sync_with_stdio();
|
std::ios::sync_with_stdio();
|
||||||
|
@ -81,8 +81,8 @@ RiaPreferences::RiaPreferences(void)
|
|||||||
CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and show SOIL", "", "", "");
|
CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and show SOIL", "", "", "");
|
||||||
loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||||
|
|
||||||
readerSettings = new RifReaderSettings;
|
|
||||||
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", "");
|
||||||
|
readerSettings = new RifReaderSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -23,6 +23,13 @@ include_directories(
|
|||||||
${CommonCode_SOURCE_DIR}
|
${CommonCode_SOURCE_DIR}
|
||||||
|
|
||||||
${ResInsight_SOURCE_DIR}/ThirdParty
|
${ResInsight_SOURCE_DIR}/ThirdParty
|
||||||
|
${ResInsight_SOURCE_DIR}/ThirdParty/NRLib/nrlib/well
|
||||||
|
${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src
|
||||||
|
${ERT_INCLUDE_DIRS}
|
||||||
|
|
||||||
|
${Boost_INCLUDE_DIRS}
|
||||||
|
${ResInsight_SOURCE_DIR}/ThirdParty/custom-opm-common/opm-common/
|
||||||
|
${custom-opm-parser_SOURCE_DIR}/opm-parser/
|
||||||
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Adm
|
${CMAKE_CURRENT_SOURCE_DIR}/Adm
|
||||||
@ -91,6 +98,8 @@ set( USER_INTERFACE_FILES
|
|||||||
UserInterface/RiuProjectPropertyView.cpp
|
UserInterface/RiuProjectPropertyView.cpp
|
||||||
UserInterface/RiuResultQwtPlot.h
|
UserInterface/RiuResultQwtPlot.h
|
||||||
UserInterface/RiuResultQwtPlot.cpp
|
UserInterface/RiuResultQwtPlot.cpp
|
||||||
|
UserInterface/RiuSummaryQwtPlot.h
|
||||||
|
UserInterface/RiuSummaryQwtPlot.cpp
|
||||||
UserInterface/RiuSelectionManager.h
|
UserInterface/RiuSelectionManager.h
|
||||||
UserInterface/RiuSelectionManager.cpp
|
UserInterface/RiuSelectionManager.cpp
|
||||||
UserInterface/RiuSelectionColors.h
|
UserInterface/RiuSelectionColors.h
|
||||||
@ -133,6 +142,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
|||||||
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
||||||
Commands/ViewLink/CMakeLists_files.cmake
|
Commands/ViewLink/CMakeLists_files.cmake
|
||||||
Commands/WellLogCommands/CMakeLists_files.cmake
|
Commands/WellLogCommands/CMakeLists_files.cmake
|
||||||
|
Commands/SummaryPlotCommands/CMakeLists_files.cmake
|
||||||
Commands/WellPathCommands/CMakeLists_files.cmake
|
Commands/WellPathCommands/CMakeLists_files.cmake
|
||||||
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
||||||
)
|
)
|
||||||
@ -232,60 +242,6 @@ if ( MSVC )
|
|||||||
set( WIN_RESOURCE Resources/ResInsight.rc )
|
set( WIN_RESOURCE Resources/ResInsight.rc )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
# creating PCH's for MSVC and GCC on Linux
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
#set( RAW_SOURCES ${CPP_SOURCES} )
|
|
||||||
#
|
|
||||||
#list( REMOVE_ITEM RAW_SOURCES
|
|
||||||
# RiaStdInclude.cpp
|
|
||||||
#
|
|
||||||
# ${CODE_SOURCE_FILES}
|
|
||||||
#
|
|
||||||
# ModelVisualization/RivCellEdgeEffectGenerator.cpp
|
|
||||||
# ModelVisualization/RivPipeGeometryGenerator.cpp
|
|
||||||
# ModelVisualization/RivWellPipesPartMgr.cpp
|
|
||||||
# ModelVisualization/RivWellHeadPartMgr.cpp
|
|
||||||
#
|
|
||||||
# Application/RiaImageFileCompare.cpp
|
|
||||||
# Application/RiaImageCompareReporter.cpp
|
|
||||||
# Application/RiaRegressionTest.cpp
|
|
||||||
#
|
|
||||||
# SocketInterface/RiaSocketDataTransfer.cpp
|
|
||||||
#
|
|
||||||
# FileInterface/RifEclipseInputFileTools.cpp
|
|
||||||
# FileInterface/RifEclipseOutputFileTools.cpp
|
|
||||||
# FileInterface/RifEclipseRestartFilesetAccess.cpp
|
|
||||||
# FileInterface/RifEclipseRestartDataAccess.cpp
|
|
||||||
# FileInterface/RifEclipseUnifiedRestartFileAccess.cpp
|
|
||||||
# FileInterface/RifReaderEclipseInput.cpp
|
|
||||||
# FileInterface/RifReaderEclipseOutput.cpp
|
|
||||||
#
|
|
||||||
# UserInterface/RiuSimpleHistogramWidget.cpp
|
|
||||||
# UserInterface/RiuMultiCaseImportDialog.cpp
|
|
||||||
# UserInterface/RiuResultTextBuilder.cpp
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
#include( CustomPCH.cmake )
|
|
||||||
#set( ALL_INCLUDES
|
|
||||||
# ${LibCore_SOURCE_DIR}
|
|
||||||
# ${LibGeometry_SOURCE_DIR}
|
|
||||||
# ${LibGuiQt_SOURCE_DIR}
|
|
||||||
# ${LibRender_SOURCE_DIR}
|
|
||||||
# ${LibViewing_SOURCE_DIR}
|
|
||||||
# ${QT_INCLUDES}
|
|
||||||
#)
|
|
||||||
#
|
|
||||||
#set( PCH_NAME RiaStdInclude )
|
|
||||||
#set( GCC_PCH_TARGET gccPCH )
|
|
||||||
#set( PCH_COMPILER_DEFINE EMPTY )
|
|
||||||
#IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
||||||
# set( PCH_COMPILER_DEFINE CVF_LINUX)
|
|
||||||
#ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
||||||
#
|
|
||||||
#precompiled_header( RAW_SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} ${PCH_COMPILER_DEFINE} )
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Create source groups - see also included CMakeLists_files.cmake
|
# Create source groups - see also included CMakeLists_files.cmake
|
||||||
@ -349,49 +305,39 @@ endif ()
|
|||||||
# Set up libraries and dependent projects to link with
|
# Set up libraries and dependent projects to link with
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set (RI_BOOST_LIBRARIES
|
||||||
|
debug ${Boost_SYSTEM_LIBRARY_DEBUG}
|
||||||
|
optimized ${Boost_SYSTEM_LIBRARY_RELEASE}
|
||||||
|
debug ${Boost_FILESYSTEM_LIBRARY_DEBUG}
|
||||||
|
optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE}
|
||||||
|
debug ${Boost_REGEX_LIBRARY_DEBUG}
|
||||||
|
optimized ${Boost_REGEX_LIBRARY_RELEASE}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set (RI_BOOST_LIBRARIES ${Boost_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set( LINK_LIBRARIES
|
set( LINK_LIBRARIES
|
||||||
WellPathImportSsihub
|
WellPathImportSsihub
|
||||||
|
|
||||||
# cafPdmCvf
|
|
||||||
# cafUserInterface
|
|
||||||
# cafProjectDataModel
|
|
||||||
# cafViewer
|
|
||||||
# cafAnimControl
|
|
||||||
# cafTensor
|
|
||||||
# CommonCode
|
|
||||||
|
|
||||||
#cafPdmCore
|
|
||||||
#cafPdmUiCore
|
|
||||||
cafPdmXml
|
|
||||||
#cafProjectDataModel
|
|
||||||
|
|
||||||
cafUserInterface
|
|
||||||
cafViewer
|
|
||||||
cafAnimControl
|
|
||||||
cafCommand
|
|
||||||
cafPdmCvf
|
|
||||||
|
|
||||||
cafTensor
|
|
||||||
CommonCode
|
|
||||||
|
|
||||||
LibGuiQt
|
|
||||||
LibViewing
|
|
||||||
LibRender
|
|
||||||
LibGeometry
|
|
||||||
LibCore
|
|
||||||
|
|
||||||
ResultStatisticsCache
|
ResultStatisticsCache
|
||||||
RigGeoMechDataModel
|
RigGeoMechDataModel
|
||||||
|
|
||||||
ecl
|
${APP_FWK_LIBRARIES}
|
||||||
ert_util
|
${VIZ_FWK_LIBRARIES}
|
||||||
ert_geometry
|
${ERT_LIBRARIES}
|
||||||
ecl_well
|
${ERT_EXTERNAL_LIBRARIES}
|
||||||
|
|
||||||
|
custom-opm-parser
|
||||||
|
|
||||||
NRLib
|
NRLib
|
||||||
|
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
|
|
||||||
|
${RI_BOOST_LIBRARIES}
|
||||||
|
|
||||||
Qwt
|
Qwt
|
||||||
)
|
)
|
||||||
@ -412,6 +358,42 @@ ENDIF()
|
|||||||
|
|
||||||
target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
|
target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# cotire
|
||||||
|
#############################################################################
|
||||||
|
if(RESINSIGHT_ENABLE_COTIRE)
|
||||||
|
|
||||||
|
# forever is used as variable name, and this symbol is defined by Qt and used in precompiled headers
|
||||||
|
set_source_files_properties (${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||||
|
|
||||||
|
# multiple QRC files are not supported
|
||||||
|
set_source_files_properties (qrc_cafAnimControl.cxx PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||||
|
|
||||||
|
# TODO: Revisit why opm-parser is not working
|
||||||
|
set_source_files_properties (UnitTests/opm-parser-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||||
|
|
||||||
|
# variables at global file scope
|
||||||
|
set_source_files_properties (ModelVisualization/RivCrossSectionGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||||
|
set_source_files_properties (ModelVisualization/RivCrossSectionPartMgr.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||||
|
|
||||||
|
# using namespace cvf
|
||||||
|
set_source_files_properties (GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||||
|
set_source_files_properties (UnitTests/cvfGeometryTools-Test.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||||
|
|
||||||
|
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||||
|
|
||||||
|
cotire(ResInsight)
|
||||||
|
|
||||||
|
# make sure the unity target is included in the active builds to trigger rebuild before debug
|
||||||
|
get_target_property(_unityTargetName ResInsight COTIRE_UNITY_TARGET_NAME)
|
||||||
|
set_target_properties(${_unityTargetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD FALSE)
|
||||||
|
set_target_properties(ResInsight PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Copy Dlls on MSVC
|
# Copy Dlls on MSVC
|
||||||
#############################################################################
|
#############################################################################
|
||||||
@ -434,6 +416,12 @@ if ((MSVC) AND (${RESINSIGHT_USE_ODB_API}))
|
|||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
"${RESINSIGHT_ODB_API_DIR}/lib/${aDLL}"
|
"${RESINSIGHT_ODB_API_DIR}/lib/${aDLL}"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||||
|
if (_unityTargetName)
|
||||||
|
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${RESINSIGHT_ODB_API_DIR}/lib/${aDLL}"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
@ -448,6 +436,12 @@ if (MSVC)
|
|||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
"${QT_BINARY_DIR}/${qtlib}4.dll"
|
"${QT_BINARY_DIR}/${qtlib}4.dll"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||||
|
if (_unityTargetName)
|
||||||
|
add_custom_command(TARGET ResInsight POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${QT_BINARY_DIR}/${qtlib}4.dll"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||||
|
endif()
|
||||||
endforeach( qtlib )
|
endforeach( qtlib )
|
||||||
|
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
@ -466,16 +460,24 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
|||||||
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
# tell binary to first attempt to load libraries from its own directory
|
# tell binary to first attempt to load libraries from its own directory
|
||||||
|
set(RESINSIGHT_INSTALL_RPATH "\$ORIGIN")
|
||||||
|
|
||||||
if (${RESINSIGHT_USE_ODB_API})
|
if (${RESINSIGHT_USE_ODB_API})
|
||||||
# This is a "hack" to make ResInsight runtime find the ODB so files used when compiling.
|
# This is a "hack" to make ResInsight runtime find the ODB so files used when compiling.
|
||||||
# statoil wanted it this way, but we should probbly make a different installoptions that does things this way,
|
# statoil wanted it this way, but we should probbly make a different installoptions that does things this way,
|
||||||
# and really do copy them when doing PRIVATE_INSTALL
|
# and really do copy them when doing PRIVATE_INSTALL
|
||||||
set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "\$ORIGIN;${RESINSIGHT_ODB_API_DIR}/lib")
|
set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} ${RESINSIGHT_ODB_API_DIR}/lib)
|
||||||
else()
|
|
||||||
set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "\$ORIGIN")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (EXISTS ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT})
|
||||||
|
# append the external ERT lib root
|
||||||
|
set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} ${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#message("RESINSIGHT_INSTALL_RPATH : " "${RESINSIGHT_INSTALL_RPATH}")
|
||||||
|
|
||||||
|
set_target_properties (ResInsight PROPERTIES INSTALL_RPATH "${RESINSIGHT_INSTALL_RPATH}")
|
||||||
|
|
||||||
# Find Qt libraries and sym links
|
# Find Qt libraries and sym links
|
||||||
file (GLOB RESINSIGHT_FILES
|
file (GLOB RESINSIGHT_FILES
|
||||||
${QT_LIBRARY_DIR}/libQtCore.so*
|
${QT_LIBRARY_DIR}/libQtCore.so*
|
||||||
|
@ -51,7 +51,7 @@ void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
|
|||||||
{
|
{
|
||||||
QString defaultDir = RiaApplication::instance()->defaultFileDialogDirectory("WELL_LOGS_DIR");
|
QString defaultDir = RiaApplication::instance()->defaultFileDialogDirectory("WELL_LOGS_DIR");
|
||||||
|
|
||||||
QString defaultFileName = curve->name().trimmed();
|
QString defaultFileName = curve->curveName().trimmed();
|
||||||
defaultFileName.replace(".", "_");
|
defaultFileName.replace(".", "_");
|
||||||
defaultFileName.replace(",", "_");
|
defaultFileName.replace(",", "_");
|
||||||
defaultFileName.replace(":", "_");
|
defaultFileName.replace(":", "_");
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||||
|
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||||
|
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryPlotFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewSummaryCurveFeature.cpp
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
${SOURCE_GROUP_HEADER_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CODE_SOURCE_FILES
|
||||||
|
${SOURCE_GROUP_SOURCE_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND QT_MOC_HEADERS
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
source_group( "CommandFeature\\SummaryPlot" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
@ -0,0 +1,107 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RicNewSummaryCurveFeature.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RimOilField.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
#include "RimSummaryCurve.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicNewSummaryCurveFeature, "RicNewSummaryCurveFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicNewSummaryCurveFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return (selectedSummaryPlot());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
|
CVF_ASSERT(project);
|
||||||
|
|
||||||
|
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||||
|
CVF_ASSERT(mainPlotColl);
|
||||||
|
|
||||||
|
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
||||||
|
CVF_ASSERT(summaryPlotColl);
|
||||||
|
|
||||||
|
RimSummaryPlot* plot = selectedSummaryPlot();
|
||||||
|
if (plot)
|
||||||
|
{
|
||||||
|
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||||
|
plot->addCurve(newCurve);
|
||||||
|
|
||||||
|
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||||
|
newCurve->setColor(curveColor);
|
||||||
|
|
||||||
|
RimSummaryCase* defaultCase = nullptr;
|
||||||
|
if (project->activeOilField()->summaryCaseCollection()->summaryCaseCount() > 0)
|
||||||
|
{
|
||||||
|
defaultCase = project->activeOilField()->summaryCaseCollection()->summaryCase(0);
|
||||||
|
newCurve->setSummaryCase(defaultCase);
|
||||||
|
newCurve->setVariable("FOPT");
|
||||||
|
newCurve->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
plot->updateConnectedEditors();
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->selectAsCurrentItem(newCurve);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSummaryCurveFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("New Summary Curve");
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot* RicNewSummaryCurveFeature::selectedSummaryPlot() const
|
||||||
|
{
|
||||||
|
std::vector<RimSummaryPlot*> selection;
|
||||||
|
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||||
|
return selection.size() > 0 ? selection[0] : NULL;
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "cafCmdFeature.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class RimSummaryPlot;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicNewSummaryCurveFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered( bool isChecked );
|
||||||
|
virtual void setupActionLook( QAction* actionToSetup );
|
||||||
|
|
||||||
|
private:
|
||||||
|
RimSummaryPlot* selectedSummaryPlot() const;
|
||||||
|
};
|
@ -0,0 +1,75 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RicNewSummaryPlotFeature.h"
|
||||||
|
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
#include "RimMainPlotCollection.h"
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicNewSummaryPlotFeature, "RicNewSummaryPlotFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicNewSummaryPlotFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RimProject* project = RiaApplication::instance()->project();
|
||||||
|
CVF_ASSERT(project);
|
||||||
|
|
||||||
|
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||||
|
CVF_ASSERT(mainPlotColl);
|
||||||
|
|
||||||
|
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
|
||||||
|
CVF_ASSERT(summaryPlotColl);
|
||||||
|
|
||||||
|
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||||
|
summaryPlotColl->m_summaryPlots().push_back(plot);
|
||||||
|
|
||||||
|
plot->setDescription(QString("Well Log Plot %1").arg(summaryPlotColl->m_summaryPlots.size()));
|
||||||
|
|
||||||
|
summaryPlotColl->updateConnectedEditors();
|
||||||
|
plot->loadDataAndUpdate();
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->selectAsCurrentItem(plot);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewSummaryPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
actionToSetup->setText("New Summary Plot");
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "cafCmdFeature.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RicNewSummaryPlotFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overrides
|
||||||
|
virtual bool isCommandEnabled();
|
||||||
|
virtual void onActionTriggered( bool isChecked );
|
||||||
|
virtual void setupActionLook( QAction* actionToSetup );
|
||||||
|
};
|
@ -102,7 +102,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
|||||||
curve->setWellPath(wellPath);
|
curve->setWellPath(wellPath);
|
||||||
curve->setWellLogChannelName(wellLog->name());
|
curve->setWellLogChannelName(wellLog->name());
|
||||||
|
|
||||||
curve->updatePlotData();
|
curve->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
|
|||||||
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
|
||||||
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath);
|
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath);
|
||||||
|
|
||||||
plotCurve->updatePlotData();
|
plotCurve->loadDataAndUpdate();
|
||||||
|
|
||||||
RimWellLogPlot* plot = NULL;
|
RimWellLogPlot* plot = NULL;
|
||||||
wellLogPlotTrack->firstAnchestorOrThisOfType(plot);
|
wellLogPlotTrack->firstAnchestorOrThisOfType(plot);
|
||||||
|
@ -172,7 +172,7 @@ void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogTrac
|
|||||||
{
|
{
|
||||||
plotCurve->setWellPath(wellPath);
|
plotCurve->setWellPath(wellPath);
|
||||||
plotCurve->setWellLogChannelName(wellLogFileChannels[cIdx]->name());
|
plotCurve->setWellLogChannelName(wellLogFileChannels[cIdx]->name());
|
||||||
plotCurve->updatePlotData();
|
plotCurve->loadDataAndUpdate();
|
||||||
plotCurve->updateConnectedEditors();
|
plotCurve->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ ${CEE_CURRENT_LIST_DIR}RifJsonEncodeDecode.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RifReaderInterface.h
|
${CEE_CURRENT_LIST_DIR}RifReaderInterface.h
|
||||||
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.h
|
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.h
|
||||||
${CEE_CURRENT_LIST_DIR}RifReaderSettings.h
|
${CEE_CURRENT_LIST_DIR}RifReaderSettings.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RifEclipseSummaryAddress.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -34,6 +35,7 @@ ${CEE_CURRENT_LIST_DIR}RifJsonEncodeDecode.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RifReaderInterface.cpp
|
${CEE_CURRENT_LIST_DIR}RifReaderInterface.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.cpp
|
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RifReaderSettings.cpp
|
${CEE_CURRENT_LIST_DIR}RifReaderSettings.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RifEclipseSummaryAddress.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
@ -38,10 +38,8 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "ecl_grid.h"
|
#include "ert/ecl/ecl_box.h"
|
||||||
#include "util.h"
|
#include "ert/ecl/ecl_kw.h"
|
||||||
#include "well_state.h"
|
|
||||||
|
|
||||||
|
|
||||||
QString includeKeyword("INCLUDE");
|
QString includeKeyword("INCLUDE");
|
||||||
QString faultsKeyword("FAULTS");
|
QString faultsKeyword("FAULTS");
|
||||||
|
@ -20,11 +20,9 @@
|
|||||||
|
|
||||||
#include "RifEclipseOutputFileTools.h"
|
#include "RifEclipseOutputFileTools.h"
|
||||||
|
|
||||||
#include "util.h"
|
#include "ert/ecl/ecl_file.h"
|
||||||
#include "ecl_file.h"
|
#include "ert/ecl/ecl_grid.h"
|
||||||
#include "ecl_kw_magic.h"
|
#include "ert/ecl/ecl_kw_magic.h"
|
||||||
#include "ecl_grid.h"
|
|
||||||
#include "ecl_rsthead.h"
|
|
||||||
|
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include "RifReaderInterface.h"
|
#include "RifReaderInterface.h"
|
||||||
|
|
||||||
#include "ecl_util.h"
|
#include "ert/ecl/ecl_util.h"
|
||||||
|
|
||||||
typedef struct ecl_file_struct ecl_file_type;
|
typedef struct ecl_file_struct ecl_file_type;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "well_info.h"
|
#include "ert/ecl_well/well_info.h"
|
||||||
|
|
||||||
#include "RifReaderInterface.h"
|
#include "RifReaderInterface.h"
|
||||||
|
|
||||||
|
269
ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp
Normal file
269
ApplicationCode/FileInterface/RifEclipseSummaryAddress.cpp
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 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 "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifEclipseSummaryAddress RifEclipseSummaryAddress::fieldVarAddress(const std::string& fieldVarName)
|
||||||
|
{
|
||||||
|
RifEclipseSummaryAddress fieldAddr;
|
||||||
|
fieldAddr.m_variableCategory = SUMMARY_FIELD;
|
||||||
|
fieldAddr.m_quantityName = fieldVarName;
|
||||||
|
|
||||||
|
return fieldAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::string RifEclipseSummaryAddress::uiText() const
|
||||||
|
{
|
||||||
|
std::string text;
|
||||||
|
text += m_quantityName;
|
||||||
|
switch(this->category())
|
||||||
|
{
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION:
|
||||||
|
{
|
||||||
|
text += ":" + std::to_string(this->regionNumber());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
|
||||||
|
{
|
||||||
|
text += ":" + std::to_string(this->regionNumber());
|
||||||
|
text += "-" + std::to_string(this->regionNumber2());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
|
||||||
|
{
|
||||||
|
text += ":" + this->wellGroupName();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL:
|
||||||
|
{
|
||||||
|
text += ":" + this->wellName();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
|
||||||
|
{
|
||||||
|
text += ":" + this->wellName();
|
||||||
|
text += ":" + std::to_string(this->cellI()) + ", "
|
||||||
|
+ std::to_string(this->cellJ()) + ", "
|
||||||
|
+ std::to_string(this->cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
|
||||||
|
{
|
||||||
|
text += ":" + this->lgrName();
|
||||||
|
text += ":" + this->wellName();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
|
||||||
|
{
|
||||||
|
text += ":" + this->lgrName();
|
||||||
|
text += ":" + this->wellName();
|
||||||
|
text += ":" + std::to_string(this->cellI()) + ", "
|
||||||
|
+ std::to_string(this->cellJ()) + ", "
|
||||||
|
+ std::to_string(this->cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
|
||||||
|
{
|
||||||
|
text += ":" + this->wellName();
|
||||||
|
text += ":" + std::to_string(this->wellSegmentNumber());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK:
|
||||||
|
{
|
||||||
|
text += ":" + std::to_string(this->cellI()) + ", "
|
||||||
|
+ std::to_string(this->cellJ()) + ", "
|
||||||
|
+ std::to_string(this->cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
|
||||||
|
{
|
||||||
|
text += ":" + this->lgrName();
|
||||||
|
text += ":" + std::to_string(this->cellI()) + ", "
|
||||||
|
+ std::to_string(this->cellJ()) + ", "
|
||||||
|
+ std::to_string(this->cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool operator==(const RifEclipseSummaryAddress& first, const RifEclipseSummaryAddress& second)
|
||||||
|
{
|
||||||
|
if(first.category() != second.category()) return false;
|
||||||
|
if(first.quantityName() != second.quantityName()) return false;
|
||||||
|
switch(first.category())
|
||||||
|
{
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION:
|
||||||
|
{
|
||||||
|
if(first.regionNumber() != second.regionNumber()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
|
||||||
|
{
|
||||||
|
if(first.regionNumber() != second.regionNumber()) return false;
|
||||||
|
if(first.regionNumber2() != second.regionNumber2()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
|
||||||
|
{
|
||||||
|
if(first.wellGroupName() != second.wellGroupName()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return false;
|
||||||
|
if(first.cellI() != second.cellI()) return false;
|
||||||
|
if(first.cellJ() != second.cellJ()) return false;
|
||||||
|
if(first.cellK() != second.cellK()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return false;
|
||||||
|
if(first.lgrName() != second.lgrName()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return false;
|
||||||
|
if(first.lgrName() != second.lgrName()) return false;
|
||||||
|
if(first.cellI() != second.cellI()) return false;
|
||||||
|
if(first.cellJ() != second.cellJ()) return false;
|
||||||
|
if(first.cellK() != second.cellK()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return false;
|
||||||
|
if(first.wellSegmentNumber() != second.wellSegmentNumber()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK:
|
||||||
|
{
|
||||||
|
if(first.cellI() != second.cellI()) return false;
|
||||||
|
if(first.cellJ() != second.cellJ()) return false;
|
||||||
|
if(first.cellK() != second.cellK()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
|
||||||
|
{
|
||||||
|
if(first.lgrName() != second.lgrName()) return false;
|
||||||
|
if(first.cellI() != second.cellI()) return false;
|
||||||
|
if(first.cellJ() != second.cellJ()) return false;
|
||||||
|
if(first.cellK() != second.cellK()) return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool operator<(const RifEclipseSummaryAddress& first, const RifEclipseSummaryAddress& second)
|
||||||
|
{
|
||||||
|
if(first.category() != second.category()) return first.category() < second.category();
|
||||||
|
if(first.quantityName() != second.quantityName()) return first.quantityName() < second.quantityName();
|
||||||
|
|
||||||
|
switch(first.category())
|
||||||
|
{
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION:
|
||||||
|
{
|
||||||
|
if(first.regionNumber() != second.regionNumber()) return first.regionNumber() < second.regionNumber();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
|
||||||
|
{
|
||||||
|
if(first.regionNumber() != second.regionNumber()) return first.regionNumber() < second.regionNumber();
|
||||||
|
if(first.regionNumber2() != second.regionNumber2()) return first.regionNumber2() < second.regionNumber2();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
|
||||||
|
{
|
||||||
|
if(first.wellGroupName() != second.wellGroupName()) return first.wellGroupName() < second.wellGroupName();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return (first.wellName() < second.wellName());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return (first.wellName() < second.wellName());
|
||||||
|
if(first.cellI() != second.cellI()) return (first.cellI() < second.cellI());
|
||||||
|
if(first.cellJ() != second.cellJ()) return (first.cellJ() < second.cellJ());
|
||||||
|
if(first.cellK() != second.cellK()) return (first.cellK() < second.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return (first.wellName() < second.wellName());
|
||||||
|
if(first.lgrName() != second.lgrName()) return (first.lgrName() < second.lgrName());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return (first.wellName() < second.wellName());
|
||||||
|
if(first.lgrName() != second.lgrName()) return (first.lgrName() < second.lgrName());
|
||||||
|
if(first.cellI() != second.cellI()) return (first.cellI() < second.cellI());
|
||||||
|
if(first.cellJ() != second.cellJ()) return (first.cellJ() < second.cellJ());
|
||||||
|
if(first.cellK() != second.cellK()) return (first.cellK() < second.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
|
||||||
|
{
|
||||||
|
if(first.wellName() != second.wellName()) return (first.wellName() < second.wellName());
|
||||||
|
if(first.wellSegmentNumber() != second.wellSegmentNumber()) return (first.wellSegmentNumber() < second.wellSegmentNumber());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK:
|
||||||
|
{
|
||||||
|
if(first.cellI() != second.cellI()) return (first.cellI() < second.cellI());
|
||||||
|
if(first.cellJ() != second.cellJ()) return (first.cellJ() < second.cellJ());
|
||||||
|
if(first.cellK() != second.cellK()) return (first.cellK() < second.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
|
||||||
|
{
|
||||||
|
if(first.lgrName() != second.lgrName()) return (first.lgrName() < second.lgrName());
|
||||||
|
if(first.cellI() != second.cellI()) return (first.cellI() < second.cellI());
|
||||||
|
if(first.cellJ() != second.cellJ()) return (first.cellJ() < second.cellJ());
|
||||||
|
if(first.cellK() != second.cellK()) return (first.cellK() < second.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
129
ApplicationCode/FileInterface/RifEclipseSummaryAddress.h
Normal file
129
ApplicationCode/FileInterface/RifEclipseSummaryAddress.h
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 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 <string>
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
class RifEclipseSummaryAddress
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Based on list in ecl_smspec.c and list of types taken from Eclipse Reference Manual ecl_rm_2011.1.pdf
|
||||||
|
enum SummaryVarCategory
|
||||||
|
{
|
||||||
|
SUMMARY_INVALID,
|
||||||
|
SUMMARY_FIELD,
|
||||||
|
SUMMARY_AQUIFER,
|
||||||
|
SUMMARY_NETWORK,
|
||||||
|
SUMMARY_MISC,
|
||||||
|
SUMMARY_REGION,
|
||||||
|
SUMMARY_REGION_2_REGION,
|
||||||
|
SUMMARY_WELL_GROUP,
|
||||||
|
SUMMARY_WELL,
|
||||||
|
SUMMARY_WELL_COMPLETION,
|
||||||
|
SUMMARY_WELL_LGR,
|
||||||
|
SUMMARY_WELL_COMPLETION_LGR,
|
||||||
|
SUMMARY_WELL_SEGMENT,
|
||||||
|
SUMMARY_BLOCK,
|
||||||
|
SUMMARY_BLOCK_LGR,
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
RifEclipseSummaryAddress():
|
||||||
|
m_variableCategory(RifEclipseSummaryAddress::SUMMARY_INVALID),
|
||||||
|
m_regionNumber(-1),
|
||||||
|
m_regionNumber2(-1),
|
||||||
|
m_wellSegmentNumber(-1),
|
||||||
|
m_cellI(-1),
|
||||||
|
m_cellJ(-1),
|
||||||
|
m_cellK(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RifEclipseSummaryAddress(SummaryVarCategory category,
|
||||||
|
const std::string& quantityName,
|
||||||
|
int regionNumber,
|
||||||
|
int regionNumber2,
|
||||||
|
const std::string& wellGroupName,
|
||||||
|
const std::string& wellName,
|
||||||
|
int wellSegmentNumber,
|
||||||
|
const std::string& lgrName,
|
||||||
|
int cellI,
|
||||||
|
int cellJ,
|
||||||
|
int cellK):
|
||||||
|
m_variableCategory(category),
|
||||||
|
m_quantityName(quantityName),
|
||||||
|
m_regionNumber(regionNumber),
|
||||||
|
m_regionNumber2(regionNumber2),
|
||||||
|
m_wellGroupName(wellGroupName),
|
||||||
|
m_wellName(wellName),
|
||||||
|
m_wellSegmentNumber(wellSegmentNumber),
|
||||||
|
m_lgrName(lgrName),
|
||||||
|
m_cellI(cellI),
|
||||||
|
m_cellJ(cellJ),
|
||||||
|
m_cellK(cellK)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static specialized creation methods
|
||||||
|
|
||||||
|
static RifEclipseSummaryAddress fieldVarAddress(const std::string& fieldVarName);
|
||||||
|
|
||||||
|
// Access methods
|
||||||
|
|
||||||
|
SummaryVarCategory category() const { return m_variableCategory; }
|
||||||
|
const std::string& quantityName() const { return m_quantityName; }
|
||||||
|
|
||||||
|
int regionNumber() const { return m_regionNumber; }
|
||||||
|
int regionNumber2() const { return m_regionNumber2; }
|
||||||
|
|
||||||
|
const std::string& wellGroupName() const { return m_wellGroupName; }
|
||||||
|
const std::string& wellName() const { return m_wellName; }
|
||||||
|
int wellSegmentNumber() const { return m_wellSegmentNumber; }
|
||||||
|
const std::string& lgrName() const { return m_lgrName; }
|
||||||
|
int cellI() const { return m_cellI; }
|
||||||
|
int cellJ() const { return m_cellJ; }
|
||||||
|
int cellK() const { return m_cellK; }
|
||||||
|
|
||||||
|
// Derived properties
|
||||||
|
|
||||||
|
std::string uiText() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
SummaryVarCategory m_variableCategory;
|
||||||
|
std::string m_quantityName;
|
||||||
|
int m_regionNumber;
|
||||||
|
int m_regionNumber2;
|
||||||
|
std::string m_wellGroupName;
|
||||||
|
std::string m_wellName;
|
||||||
|
int m_wellSegmentNumber;
|
||||||
|
std::string m_lgrName;
|
||||||
|
int m_cellI;
|
||||||
|
int m_cellJ;
|
||||||
|
int m_cellK;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool operator==(const RifEclipseSummaryAddress& first, const RifEclipseSummaryAddress& second);
|
||||||
|
|
||||||
|
bool operator<(const RifEclipseSummaryAddress& first, const RifEclipseSummaryAddress& second);
|
@ -20,9 +20,10 @@
|
|||||||
|
|
||||||
#include "RifReaderEclipseSummary.h"
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
#include "ecl_util.h"
|
#include "ert/ecl/ecl_util.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "cafAppEnum.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +35,62 @@ void RifEclipseSummaryTools::findSummaryHeaderFile(const std::string& inputFile,
|
|||||||
findSummaryHeaderFileInfo(inputFile, headerFile, NULL, NULL, isFormatted);
|
findSummaryHeaderFileInfo(inputFile, headerFile, NULL, NULL, isFormatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RifEclipseSummaryTools::findSummaryFiles(const std::string& inputFile,
|
||||||
|
std::string* headerFile,
|
||||||
|
std::vector<std::string>* dataFiles)
|
||||||
|
{
|
||||||
|
dataFiles->clear();
|
||||||
|
headerFile->clear();
|
||||||
|
|
||||||
|
char* myPath = NULL;
|
||||||
|
char* myBase = NULL;
|
||||||
|
char* myExtention = NULL;
|
||||||
|
|
||||||
|
util_alloc_file_components(inputFile.data(), &myPath, &myBase, &myExtention);
|
||||||
|
|
||||||
|
std::string path; if(myPath) path = myPath;
|
||||||
|
std::string base; if(myBase) base = myBase;
|
||||||
|
std::string extention; if(myExtention) extention = myExtention;
|
||||||
|
|
||||||
|
if(path.empty() || base.empty()) return ;
|
||||||
|
|
||||||
|
char* myHeaderFile = NULL;
|
||||||
|
stringlist_type* summary_file_list = stringlist_alloc_new();
|
||||||
|
|
||||||
|
ecl_util_alloc_summary_files(path.data(), base.data(), extention.data(), &myHeaderFile, summary_file_list);
|
||||||
|
(*headerFile) = myHeaderFile;
|
||||||
|
util_safe_free(myHeaderFile);
|
||||||
|
|
||||||
|
if(stringlist_get_size(summary_file_list) > 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < stringlist_get_size(summary_file_list); i++)
|
||||||
|
{
|
||||||
|
dataFiles->push_back(stringlist_iget(summary_file_list,i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stringlist_free(summary_file_list);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RifEclipseSummaryTools::hasSummaryFiles(const std::string& gridFileName)
|
||||||
|
{
|
||||||
|
std::string headerFileName;
|
||||||
|
std::vector<std::string> dataFileNames;
|
||||||
|
RifEclipseSummaryTools::findSummaryFiles(gridFileName, &headerFileName, &dataFileNames);
|
||||||
|
if (!headerFileName.empty() && dataFileNames.size()) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -70,33 +127,33 @@ std::vector<std::string> RifEclipseSummaryTools::findSummaryDataFiles(const std:
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RifEclipseSummaryTools::dumpMetaData(RifReaderEclipseSummary* readerEclipseSummary)
|
void RifEclipseSummaryTools::dumpMetaData(RifReaderEclipseSummary* readerEclipseSummary)
|
||||||
{
|
{
|
||||||
std::cout << " -- Well names --" << std::endl;
|
std::vector<RifEclipseSummaryAddress> addresses = readerEclipseSummary->allResultAddresses();
|
||||||
|
|
||||||
|
for (int category = 0; category < RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR; category++)
|
||||||
{
|
{
|
||||||
std::vector<std::string> names = readerEclipseSummary->wellNames();
|
RifEclipseSummaryAddress::SummaryVarCategory categoryEnum = RifEclipseSummaryAddress::SummaryVarCategory(category);
|
||||||
|
|
||||||
for (size_t i = 0; i < names.size(); i++)
|
std::vector<RifEclipseSummaryAddress> catAddresses = addressesForCategory(addresses, categoryEnum);
|
||||||
|
|
||||||
|
if (catAddresses.size() > 0)
|
||||||
{
|
{
|
||||||
std::cout << names[i] << std::endl;
|
std::cout << caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::uiText(categoryEnum).toStdString() << " count : " << catAddresses.size() << std::endl;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << " -- Well variable names --" << std::endl;
|
for (size_t i = 0; i < catAddresses.size(); i++)
|
||||||
{
|
{
|
||||||
std::vector<std::string> names = readerEclipseSummary->wellVariableNames();
|
std::cout << catAddresses[i].quantityName() << " "
|
||||||
|
<< catAddresses[i].regionNumber() << " "
|
||||||
|
<< catAddresses[i].regionNumber2() << " "
|
||||||
|
<< catAddresses[i].wellGroupName() << " "
|
||||||
|
<< catAddresses[i].wellName() << " "
|
||||||
|
<< catAddresses[i].wellSegmentNumber() << " "
|
||||||
|
<< catAddresses[i].lgrName() << " "
|
||||||
|
<< catAddresses[i].cellI() << " "
|
||||||
|
<< catAddresses[i].cellJ() << " "
|
||||||
|
<< catAddresses[i].cellK() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < names.size(); i++)
|
std::cout << std::endl;
|
||||||
{
|
|
||||||
std::cout << names[i] << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << " -- Group names --" << std::endl;
|
|
||||||
{
|
|
||||||
std::vector<std::string> names = readerEclipseSummary->wellGroupNames();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < names.size(); i++)
|
|
||||||
{
|
|
||||||
std::cout << names[i] << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,3 +188,21 @@ void RifEclipseSummaryTools::findSummaryHeaderFileInfo(const std::string& inputF
|
|||||||
util_safe_free(myBase);
|
util_safe_free(myBase);
|
||||||
util_safe_free(myPath);
|
util_safe_free(myPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<RifEclipseSummaryAddress> RifEclipseSummaryTools::addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses, RifEclipseSummaryAddress::SummaryVarCategory category)
|
||||||
|
{
|
||||||
|
std::vector<RifEclipseSummaryAddress> filteredAddresses;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < addresses.size(); i++)
|
||||||
|
{
|
||||||
|
if (addresses[i].category() == category)
|
||||||
|
{
|
||||||
|
filteredAddresses.push_back(addresses[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return filteredAddresses;
|
||||||
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -34,8 +36,11 @@ public:
|
|||||||
static void findSummaryHeaderFile(const std::string& inputFile, std::string* headerFile, bool* isFormatted);
|
static void findSummaryHeaderFile(const std::string& inputFile, std::string* headerFile, bool* isFormatted);
|
||||||
static std::vector<std::string> findSummaryDataFiles(const std::string& caseFile);
|
static std::vector<std::string> findSummaryDataFiles(const std::string& caseFile);
|
||||||
|
|
||||||
|
static void findSummaryFiles(const std::string& inputFile, std::string* headerFile, std::vector<std::string>* dataFiles);
|
||||||
|
static bool hasSummaryFiles(const std::string& gridFileName);
|
||||||
static void dumpMetaData(RifReaderEclipseSummary* readerEclipseSummary);
|
static void dumpMetaData(RifReaderEclipseSummary* readerEclipseSummary);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void findSummaryHeaderFileInfo(const std::string& inputFile, std::string* headerFile, std::string* path, std::string* base, bool* isFormatted);
|
static void findSummaryHeaderFileInfo(const std::string& inputFile, std::string* headerFile, std::string* path, std::string* base, bool* isFormatted);
|
||||||
|
static std::vector<RifEclipseSummaryAddress> addressesForCategory(const std::vector<RifEclipseSummaryAddress>& addresses, RifEclipseSummaryAddress::SummaryVarCategory category);
|
||||||
};
|
};
|
||||||
|
@ -21,11 +21,8 @@
|
|||||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||||
#include "RifEclipseOutputFileTools.h"
|
#include "RifEclipseOutputFileTools.h"
|
||||||
|
|
||||||
#include "ecl_kw_magic.h"
|
#include "ert/ecl/ecl_file.h"
|
||||||
#include <well_state.h>
|
#include "ert/ecl/ecl_kw_magic.h"
|
||||||
#include <well_info.h>
|
|
||||||
#include <well_conn.h>
|
|
||||||
#include <well_ts.h>
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
@ -26,7 +26,7 @@ class RifEclipseOutputFileTools;
|
|||||||
|
|
||||||
//typedef struct ecl_file_struct ecl_file_type;
|
//typedef struct ecl_file_struct ecl_file_type;
|
||||||
|
|
||||||
#include "well_info.h"
|
#include "ert/ecl_well/well_info.h"
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QtScript/QScriptValueIterator>
|
#include <QtScript/QScriptValueIterator>
|
||||||
|
|
||||||
|
namespace ResInsightInternalJson {
|
||||||
|
|
||||||
QMap<QString, QVariant> JsonReader::decodeFile(QString filePath)
|
QMap<QString, QVariant> JsonReader::decodeFile(QString filePath)
|
||||||
{
|
{
|
||||||
@ -141,3 +142,5 @@ QList<QVariant> Json::decodeInnerToList(QScriptValue arrayValue)
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // end ResInsightInternalJson
|
@ -16,6 +16,8 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
// Json parser based on code example found on:
|
// Json parser based on code example found on:
|
||||||
// http://stackoverflow.com/questions/4169988/easiest-way-to-parse-json-in-qt-4-7
|
// http://stackoverflow.com/questions/4169988/easiest-way-to-parse-json-in-qt-4-7
|
||||||
|
|
||||||
@ -34,6 +36,9 @@
|
|||||||
|
|
||||||
class QScriptEngine;
|
class QScriptEngine;
|
||||||
|
|
||||||
|
// Encapsulate the JSON code in a namespace to avoid issues with JSON classes used in opm-parser
|
||||||
|
namespace ResInsightInternalJson {
|
||||||
|
|
||||||
class JsonReader
|
class JsonReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -56,3 +61,6 @@ private:
|
|||||||
QMap<QString, QVariant> decodeInner(QScriptValue object);
|
QMap<QString, QVariant> decodeInner(QScriptValue object);
|
||||||
QList<QVariant> decodeInnerToList(QScriptValue arrayValue);
|
QList<QVariant> decodeInnerToList(QScriptValue arrayValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // end ResInsightInternalJson
|
@ -18,23 +18,10 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "cvfBase.h"
|
|
||||||
|
|
||||||
#include "RigMainGrid.h"
|
|
||||||
#include "RigCaseData.h"
|
|
||||||
#include "RigCaseCellResultsData.h"
|
|
||||||
|
|
||||||
#include "RifReaderEclipseInput.h"
|
#include "RifReaderEclipseInput.h"
|
||||||
#include "RifReaderEclipseOutput.h"
|
|
||||||
|
|
||||||
#include "RifEclipseInputFileTools.h"
|
#include "RifEclipseInputFileTools.h"
|
||||||
|
#include "RigCaseData.h"
|
||||||
#include <iostream>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include "ecl_grid.h"
|
|
||||||
#include "well_state.h"
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
|
@ -32,10 +32,8 @@
|
|||||||
|
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
|
|
||||||
#include "ecl_grid.h"
|
#include "ert/ecl/ecl_nnc_export.h"
|
||||||
#include "well_state.h"
|
#include "ert/ecl/ecl_kw_magic.h"
|
||||||
#include "ecl_kw_magic.h"
|
|
||||||
#include "ecl_nnc_export.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -18,12 +18,13 @@
|
|||||||
|
|
||||||
#include "RifReaderEclipseSummary.h"
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
#include "ecl_sum.h"
|
#include "ert/ecl/ecl_sum.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include "ert/ecl/smspec_node.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -47,7 +48,10 @@ RifReaderEclipseSummary::~RifReaderEclipseSummary()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RifReaderEclipseSummary::open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames)
|
bool RifReaderEclipseSummary::open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames)
|
||||||
{
|
{
|
||||||
assert(ecl_sum == NULL);
|
assert(ecl_sum == NULL);
|
||||||
|
|
||||||
|
if (headerFileName.empty() || dataFileNames.size() == 0) return false;
|
||||||
|
|
||||||
assert(!headerFileName.empty());
|
assert(!headerFileName.empty());
|
||||||
assert(dataFileNames.size() > 0);
|
assert(dataFileNames.size() > 0);
|
||||||
|
|
||||||
@ -64,7 +68,8 @@ bool RifReaderEclipseSummary::open(const std::string& headerFileName, const std:
|
|||||||
|
|
||||||
if (ecl_sum)
|
if (ecl_sum)
|
||||||
{
|
{
|
||||||
assert(ecl_sum_get_smspec(ecl_sum) != NULL);
|
eclSmSpec = ecl_sum_get_smspec(ecl_sum);
|
||||||
|
assert(eclSmSpec != NULL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -84,53 +89,170 @@ void RifReaderEclipseSummary::close()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
RifEclipseSummaryAddress addressFromErtSmSpecNode(const smspec_node_type * ertSumVarNode)
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::string> RifReaderEclipseSummary::variableNames() const
|
|
||||||
{
|
{
|
||||||
assert(ecl_sum != NULL);
|
if (smspec_node_get_var_type(ertSumVarNode) == ECL_SMSPEC_INVALID_VAR) return RifEclipseSummaryAddress();
|
||||||
|
|
||||||
// Get all possible variable names from file
|
RifEclipseSummaryAddress::SummaryVarCategory sumCategory(RifEclipseSummaryAddress::SUMMARY_INVALID);
|
||||||
stringlist_type* keys = ecl_sum_alloc_matching_general_var_list(ecl_sum, NULL);
|
std::string quantityName;
|
||||||
stringlist_sort(keys, NULL);
|
int regionNumber(-1);
|
||||||
|
int regionNumber2(-1);
|
||||||
std::vector<std::string> names;
|
std::string wellGroupName;
|
||||||
RifReaderEclipseSummary::populateVectorFromStringList(keys, &names);
|
std::string wellName;
|
||||||
|
int wellSegmentNumber(-1);
|
||||||
|
std::string lgrName;
|
||||||
|
int cellI(-1);
|
||||||
|
int cellJ(-1);
|
||||||
|
int cellK(-1);
|
||||||
|
|
||||||
stringlist_free(keys);
|
quantityName = smspec_node_get_keyword(ertSumVarNode);
|
||||||
|
|
||||||
return names;
|
switch (smspec_node_get_var_type(ertSumVarNode))
|
||||||
|
{
|
||||||
|
case ECL_SMSPEC_AQUIFER_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_AQUIFER;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_WELL_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL;
|
||||||
|
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_REGION_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_REGION;
|
||||||
|
regionNumber = smspec_node_get_num(ertSumVarNode);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_FIELD_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_FIELD;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_GROUP_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP;
|
||||||
|
wellGroupName = smspec_node_get_wgname(ertSumVarNode);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_BLOCK_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_BLOCK;
|
||||||
|
// Todo: Get IJK values
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_COMPLETION_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION;
|
||||||
|
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||||
|
// Todo: Get IJK values
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_LOCAL_BLOCK_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR;
|
||||||
|
// Todo: GetLGR name
|
||||||
|
// Todo: Get IJK values
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_LOCAL_COMPLETION_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR;
|
||||||
|
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||||
|
// Todo: GetLGR name
|
||||||
|
// Todo: Get IJK values
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_LOCAL_WELL_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_LGR;
|
||||||
|
wellName = smspec_node_get_wgname(ertSumVarNode);
|
||||||
|
// Todo: GetLGR name
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_NETWORK_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_NETWORK;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_REGION_2_REGION_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION;
|
||||||
|
// Todo: Get R1 R2 values
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_SEGMENT_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT;
|
||||||
|
wellSegmentNumber = smspec_node_get_num(ertSumVarNode);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ECL_SMSPEC_MISC_VAR:
|
||||||
|
{
|
||||||
|
sumCategory = RifEclipseSummaryAddress::SUMMARY_MISC;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CVF_ASSERT(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RifEclipseSummaryAddress(sumCategory,
|
||||||
|
quantityName,
|
||||||
|
regionNumber,
|
||||||
|
regionNumber2,
|
||||||
|
wellGroupName,
|
||||||
|
wellName,
|
||||||
|
wellSegmentNumber,
|
||||||
|
lgrName,
|
||||||
|
cellI, cellJ, cellK);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RifReaderEclipseSummary::values(const std::string& variableName, std::vector<double>* values)
|
const std::vector<RifEclipseSummaryAddress>& RifReaderEclipseSummary::allResultAddresses()
|
||||||
|
{
|
||||||
|
if (m_allResultAddresses.size() == 0)
|
||||||
|
{
|
||||||
|
int varCount = ecl_smspec_num_nodes( eclSmSpec);
|
||||||
|
for(int i = 0; i < varCount; i++)
|
||||||
|
{
|
||||||
|
const smspec_node_type * ertSumVarNode = ecl_smspec_iget_node(eclSmSpec, i);
|
||||||
|
|
||||||
|
m_allResultAddresses.push_back(addressFromErtSmSpecNode(ertSumVarNode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_allResultAddresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RifReaderEclipseSummary::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values)
|
||||||
{
|
{
|
||||||
assert(ecl_sum != NULL);
|
assert(ecl_sum != NULL);
|
||||||
|
values->clear();
|
||||||
|
int tsCount = timeStepCount();
|
||||||
|
values->reserve(timeStepCount());
|
||||||
|
|
||||||
int variableIndex = variableIndexFromVariableName(variableName);
|
int variableIndex = indexFromAddress(resultAddress);
|
||||||
if (variableIndex < 0) return false;
|
|
||||||
|
|
||||||
for (int time_index = 0; time_index < timeStepCount(); time_index++)
|
if(variableIndex < 0) return false;
|
||||||
|
|
||||||
|
const smspec_node_type * ertSumVarNode = ecl_smspec_iget_node(eclSmSpec, variableIndex);
|
||||||
|
int paramsIndex = smspec_node_get_params_index(ertSumVarNode);
|
||||||
|
|
||||||
|
for(int time_index = 0; time_index < tsCount; time_index++)
|
||||||
{
|
{
|
||||||
double value = ecl_sum_iget(ecl_sum, time_index, variableIndex);
|
double value = ecl_sum_iget(ecl_sum, time_index, paramsIndex);
|
||||||
|
|
||||||
values->push_back(value);
|
values->push_back(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
int RifReaderEclipseSummary::variableIndexFromVariableName(const std::string& keyword) const
|
|
||||||
{
|
|
||||||
assert(ecl_sum != NULL);
|
|
||||||
|
|
||||||
return ecl_sum_get_general_var_params_index(ecl_sum, keyword.data());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -143,53 +265,6 @@ int RifReaderEclipseSummary::timeStepCount() const
|
|||||||
return ecl_sum_get_data_length(ecl_sum);
|
return ecl_sum_get_data_length(ecl_sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::string> RifReaderEclipseSummary::wellGroupNames() const
|
|
||||||
{
|
|
||||||
assert(ecl_sum != NULL);
|
|
||||||
|
|
||||||
std::vector<std::string> names;
|
|
||||||
stringlist_type* stringList = ecl_sum_alloc_group_list(ecl_sum, NULL);
|
|
||||||
RifReaderEclipseSummary::populateVectorFromStringList(stringList, &names);
|
|
||||||
|
|
||||||
stringlist_free(stringList);
|
|
||||||
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::string> RifReaderEclipseSummary::wellNames() const
|
|
||||||
{
|
|
||||||
assert(ecl_sum != NULL);
|
|
||||||
|
|
||||||
std::vector<std::string> names;
|
|
||||||
stringlist_type* stringList = ecl_sum_alloc_well_list(ecl_sum, NULL);
|
|
||||||
RifReaderEclipseSummary::populateVectorFromStringList(stringList, &names);
|
|
||||||
|
|
||||||
stringlist_free(stringList);
|
|
||||||
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::string> RifReaderEclipseSummary::wellVariableNames() const
|
|
||||||
{
|
|
||||||
assert(ecl_sum != NULL);
|
|
||||||
|
|
||||||
std::vector<std::string> names;
|
|
||||||
stringlist_type* stringList = ecl_sum_alloc_well_var_list(ecl_sum);
|
|
||||||
RifReaderEclipseSummary::populateVectorFromStringList(stringList, &names);
|
|
||||||
stringlist_free(stringList);
|
|
||||||
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -223,6 +298,23 @@ std::vector<QDateTime> RifReaderEclipseSummary::fromTimeT(const std::vector<time
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RifReaderEclipseSummary::indexFromAddress(const RifEclipseSummaryAddress& resultAddress)
|
||||||
|
{
|
||||||
|
// For now, a slow linear search
|
||||||
|
int resIndex = -1;
|
||||||
|
int addrCount = static_cast<int>(this->allResultAddresses().size());
|
||||||
|
for (int idx = 0; idx < addrCount; ++idx)
|
||||||
|
{
|
||||||
|
if (m_allResultAddresses[idx] == resultAddress) return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -236,3 +328,4 @@ void RifReaderEclipseSummary::populateVectorFromStringList(stringlist_type* stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -18,51 +18,51 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "RifEclipseSummaryAddress.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "cvfObject.h"
|
||||||
|
|
||||||
|
|
||||||
class QDateTime;
|
class QDateTime;
|
||||||
|
|
||||||
// Taken from ecl_sum.h
|
|
||||||
typedef struct ecl_sum_struct ecl_sum_type;
|
|
||||||
|
|
||||||
// Taken from stringlist.h
|
|
||||||
typedef struct stringlist_struct stringlist_type;
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RifReaderEclipseSummary
|
class RifReaderEclipseSummary : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RifReaderEclipseSummary();
|
RifReaderEclipseSummary();
|
||||||
~RifReaderEclipseSummary();
|
~RifReaderEclipseSummary();
|
||||||
|
|
||||||
bool open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames);
|
bool open(const std::string& headerFileName, const std::vector<std::string>& dataFileNames);
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
std::vector<std::string> wellNames() const;
|
const std::vector<RifEclipseSummaryAddress>& allResultAddresses();
|
||||||
std::vector<std::string> wellGroupNames() const;
|
std::vector<time_t> timeSteps() const;
|
||||||
|
|
||||||
std::vector<std::string> wellVariableNames() const;
|
|
||||||
std::vector<std::string> variableNames() const;
|
|
||||||
|
|
||||||
std::vector<time_t> timeSteps() const;
|
|
||||||
|
|
||||||
bool values(const std::string& variableName, std::vector<double>* values);
|
|
||||||
|
|
||||||
|
bool values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values);
|
||||||
|
|
||||||
// TODO: Move this to a tools class with static members
|
// TODO: Move this to a tools class with static members
|
||||||
static std::vector<QDateTime> fromTimeT(const std::vector<time_t>& timeSteps);
|
static std::vector<QDateTime> fromTimeT(const std::vector<time_t>& timeSteps);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int variableIndexFromVariableName(const std::string& variableName) const;
|
|
||||||
|
|
||||||
int timeStepCount() const;
|
int timeStepCount() const;
|
||||||
|
int indexFromAddress(const RifEclipseSummaryAddress& resultAddress);
|
||||||
static void populateVectorFromStringList(stringlist_type* stringList, std::vector<std::string>* strings);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ecl_sum_type* ecl_sum;
|
// Taken from ecl_sum.h
|
||||||
|
typedef struct ecl_sum_struct ecl_sum_type;
|
||||||
|
typedef struct ecl_smspec_struct ecl_smspec_type;
|
||||||
|
|
||||||
|
ecl_sum_type* ecl_sum;
|
||||||
|
const ecl_smspec_type * eclSmSpec;
|
||||||
|
|
||||||
|
std::vector<RifEclipseSummaryAddress> m_allResultAddresses;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ if (MSVC)
|
|||||||
add_definitions(-DHKS_NT)
|
add_definitions(-DHKS_NT)
|
||||||
add_definitions(-DABQ_WIN86_64)
|
add_definitions(-DABQ_WIN86_64)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -c -fPIC -w -Wno-deprecated")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -w -Wno-deprecated")
|
||||||
|
|
||||||
add_definitions(-DTYPENAME=typename)
|
add_definitions(-DTYPENAME=typename)
|
||||||
add_definitions(-D_LINUX_SOURCE)
|
add_definitions(-D_LINUX_SOURCE)
|
||||||
|
@ -57,6 +57,7 @@ ${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilter.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilterCollection.h
|
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilterCollection.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.h
|
${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.h
|
${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimViewWindow.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimView.h
|
${CEE_CURRENT_LIST_DIR}RimView.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimCase.h
|
${CEE_CURRENT_LIST_DIR}RimCase.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.h
|
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.h
|
||||||
@ -76,6 +77,15 @@ ${CEE_CURRENT_LIST_DIR}RimCrossSection.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.h
|
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.h
|
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.h
|
||||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.h
|
${CEE_CURRENT_LIST_DIR}RimGridCollection.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCase.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimPlotCurve.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -131,6 +141,7 @@ ${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilter.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilterCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimGeoMechPropertyFilterCollection.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.cpp
|
${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.cpp
|
${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimViewWindow.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimView.cpp
|
${CEE_CURRENT_LIST_DIR}RimView.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimCase.cpp
|
${CEE_CURRENT_LIST_DIR}RimCase.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.cpp
|
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.cpp
|
||||||
@ -150,6 +161,15 @@ ${CEE_CURRENT_LIST_DIR}RimCrossSection.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimCrossSectionCollection.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.cpp
|
${CEE_CURRENT_LIST_DIR}RimContextCommandBuilder.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
|
${CEE_CURRENT_LIST_DIR}RimGridCollection.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlotCollection.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryPlot.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCurve.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCase.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimGridSummaryCase.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimFileSummaryCase.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimSummaryCaseCollection.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RimPlotCurve.cpp
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
@ -40,15 +40,13 @@ public:
|
|||||||
RimCase();
|
RimCase();
|
||||||
virtual ~RimCase();
|
virtual ~RimCase();
|
||||||
|
|
||||||
|
caf::PdmField<int> caseId;
|
||||||
caf::PdmField<QString> caseUserDescription;
|
caf::PdmField<QString> caseUserDescription;
|
||||||
|
|
||||||
caf::PdmField<int> caseId;
|
|
||||||
virtual std::vector<RimView*> views() = 0;
|
virtual std::vector<RimView*> views() = 0;
|
||||||
|
|
||||||
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath) = 0;
|
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath) = 0;
|
||||||
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &caseUserDescription; }
|
|
||||||
|
|
||||||
virtual QStringList timeStepStrings() = 0;
|
virtual QStringList timeStepStrings() = 0;
|
||||||
virtual QString timeStepName(int frameIdx) = 0;
|
virtual QString timeStepName(int frameIdx) = 0;
|
||||||
|
|
||||||
@ -61,6 +59,7 @@ protected:
|
|||||||
static QString relocateFile(const QString& fileName, const QString& newProjectPath, const QString& oldProjectPath,
|
static QString relocateFile(const QString& fileName, const QString& newProjectPath, const QString& oldProjectPath,
|
||||||
bool* foundFile, std::vector<QString>* searchedPaths);
|
bool* foundFile, std::vector<QString>* searchedPaths);
|
||||||
private:
|
private:
|
||||||
|
virtual caf::PdmFieldHandle* userDescriptionField() override { return &caseUserDescription; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
#include "RimGeoMechView.h"
|
#include "RimGeoMechView.h"
|
||||||
#include "RimIdenticalGridCaseGroup.h"
|
#include "RimIdenticalGridCaseGroup.h"
|
||||||
#include "RimScriptCollection.h"
|
#include "RimScriptCollection.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryCurve.h"
|
||||||
#include "RimViewController.h"
|
#include "RimViewController.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RimWellLogCurve.h"
|
#include "RimWellLogCurve.h"
|
||||||
@ -77,6 +80,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
if (uiItems.size() == 0)
|
if (uiItems.size() == 0)
|
||||||
{
|
{
|
||||||
commandIds << "RicNewWellLogPlotFeature";
|
commandIds << "RicNewWellLogPlotFeature";
|
||||||
|
commandIds << "RicNewSummaryPlotFeature";
|
||||||
}
|
}
|
||||||
else if (uiItems.size() > 1)
|
else if (uiItems.size() > 1)
|
||||||
{
|
{
|
||||||
@ -243,6 +247,10 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
{
|
{
|
||||||
commandIds << "RicNewWellLogPlotFeature";
|
commandIds << "RicNewWellLogPlotFeature";
|
||||||
}
|
}
|
||||||
|
else if (dynamic_cast<RimSummaryPlotCollection*>(uiItem))
|
||||||
|
{
|
||||||
|
commandIds << "RicNewSummaryPlotFeature";
|
||||||
|
}
|
||||||
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||||
{
|
{
|
||||||
commandIds << "RicNewWellLogPlotTrackFeature";
|
commandIds << "RicNewWellLogPlotTrackFeature";
|
||||||
@ -259,6 +267,15 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
|||||||
commandIds << "RicExportToLasFileFeature";
|
commandIds << "RicExportToLasFileFeature";
|
||||||
commandIds << "RicDeleteItemFeature";
|
commandIds << "RicDeleteItemFeature";
|
||||||
}
|
}
|
||||||
|
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
|
||||||
|
{
|
||||||
|
commandIds << "RicNewSummaryCurveFeature";
|
||||||
|
commandIds << "RicDeleteItemFeature";
|
||||||
|
}
|
||||||
|
else if (dynamic_cast<RimSummaryCurve*>(uiItem))
|
||||||
|
{
|
||||||
|
commandIds << "RicDeleteItemFeature";
|
||||||
|
}
|
||||||
else if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
else if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
||||||
{
|
{
|
||||||
commandIds << "RicAddWellLogToPlotFeature";
|
commandIds << "RicAddWellLogToPlotFeature";
|
||||||
|
@ -165,7 +165,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
|
|
||||||
if (curve)
|
if (curve)
|
||||||
{
|
{
|
||||||
curve->updatePlotData();
|
curve->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
{
|
{
|
||||||
if (m_viewer)
|
if (m_viewer)
|
||||||
{
|
{
|
||||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget());
|
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||||
|
|
||||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
||||||
delete m_viewer;
|
delete m_viewer;
|
||||||
|
61
ApplicationCode/ProjectDataModel/RimFileSummaryCase.cpp
Normal file
61
ApplicationCode/ProjectDataModel/RimFileSummaryCase.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RimFileSummaryCase.h"
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
CAF_PDM_SOURCE_INIT(RimFileSummaryCase,"FileSummaryCase");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimFileSummaryCase::RimFileSummaryCase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimFileSummaryCase::~RimFileSummaryCase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFileSummaryCase::setSummaryHeaderFilename(const QString& fileName)
|
||||||
|
{
|
||||||
|
m_summaryHeaderFilename = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimFileSummaryCase::summaryHeaderFilename() const
|
||||||
|
{
|
||||||
|
return m_summaryHeaderFilename();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
43
ApplicationCode/ProjectDataModel/RimFileSummaryCase.h
Normal file
43
ApplicationCode/ProjectDataModel/RimFileSummaryCase.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "RimSummaryCase.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
class RimFileSummaryCase: public RimSummaryCase
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimFileSummaryCase();
|
||||||
|
virtual ~RimFileSummaryCase();
|
||||||
|
|
||||||
|
void setSummaryHeaderFilename(const QString& fileName);
|
||||||
|
virtual QString summaryHeaderFilename() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmField<QString> m_summaryHeaderFilename;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -199,7 +199,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
|
|
||||||
if (curve)
|
if (curve)
|
||||||
{
|
{
|
||||||
curve->updatePlotData();
|
curve->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
|
|||||||
{
|
{
|
||||||
if (m_viewer)
|
if (m_viewer)
|
||||||
{
|
{
|
||||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget());
|
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||||
|
|
||||||
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
||||||
delete m_viewer;
|
delete m_viewer;
|
||||||
|
71
ApplicationCode/ProjectDataModel/RimGridSummaryCase.cpp
Normal file
71
ApplicationCode/ProjectDataModel/RimGridSummaryCase.cpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RimGridSummaryCase.h"
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include "RigSummaryCaseData.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimGridSummaryCase,"GridSummaryCase");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGridSummaryCase::RimGridSummaryCase()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_eclipseCase, "Associated3DCase", "Main View", "", "", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGridSummaryCase::~RimGridSummaryCase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimGridSummaryCase::setAssociatedEclipseCase(RimEclipseCase* eclipseCase)
|
||||||
|
{
|
||||||
|
m_eclipseCase = eclipseCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimGridSummaryCase::summaryHeaderFilename() const
|
||||||
|
{
|
||||||
|
if (!m_eclipseCase()) return QString();
|
||||||
|
|
||||||
|
QFileInfo gridFileInfo(m_eclipseCase()->gridFileName());
|
||||||
|
|
||||||
|
QString possibleSumHeaderFileName = gridFileInfo.path() +"/"+ gridFileInfo.completeBaseName() + ".SMSPEC";
|
||||||
|
|
||||||
|
return possibleSumHeaderFileName;
|
||||||
|
}
|
||||||
|
|
44
ApplicationCode/ProjectDataModel/RimGridSummaryCase.h
Normal file
44
ApplicationCode/ProjectDataModel/RimGridSummaryCase.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "RimSummaryCase.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
class RimGridSummaryCase: public RimSummaryCase
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimGridSummaryCase();
|
||||||
|
virtual ~RimGridSummaryCase();
|
||||||
|
|
||||||
|
void setAssociatedEclipseCase(RimEclipseCase* eclipseCase);
|
||||||
|
RimEclipseCase* associatedEclipseCase() { return m_eclipseCase(); }
|
||||||
|
|
||||||
|
virtual QString summaryHeaderFilename() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -19,10 +19,13 @@
|
|||||||
|
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimWellLogPlotCollection.h"
|
#include "RimWellLogPlotCollection.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include "cafPdmUiTreeView.h"
|
#include "cafPdmUiTreeView.h"
|
||||||
|
#include "RiuProjectPropertyView.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimMainPlotCollection, "MainPlotCollection");
|
CAF_PDM_SOURCE_INIT(RimMainPlotCollection, "MainPlotCollection");
|
||||||
|
|
||||||
@ -33,13 +36,20 @@ RimMainPlotCollection::RimMainPlotCollection()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Plots", "", "", "");
|
CAF_PDM_InitObject("Plots", "", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&show, "Show", true, "Show plots", "", "", "");
|
CAF_PDM_InitField(&show, "Show", true, "Show 2D Plot Window", "", "", "");
|
||||||
show.uiCapability()->setUiHidden(true);
|
show.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_wellLogPlotCollection, "WellLogPlotCollection", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_wellLogPlotCollection, "WellLogPlotCollection", "", "", "", "");
|
||||||
m_wellLogPlotCollection.uiCapability()->setUiHidden(true);
|
m_wellLogPlotCollection.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots", "", "", "");
|
||||||
|
m_summaryPlotCollection.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
||||||
|
m_summaryPlotCollection = new RimSummaryPlotCollection();
|
||||||
|
|
||||||
|
//m_plotMainWindow = NULL;
|
||||||
|
//m_plotManagerMainWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -48,6 +58,10 @@ RimMainPlotCollection::RimMainPlotCollection()
|
|||||||
RimMainPlotCollection::~RimMainPlotCollection()
|
RimMainPlotCollection::~RimMainPlotCollection()
|
||||||
{
|
{
|
||||||
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
|
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
|
||||||
|
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
|
||||||
|
|
||||||
|
//m_plotManagerMainWindow->close();
|
||||||
|
//m_plotManagerMainWindow->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -55,8 +69,62 @@ RimMainPlotCollection::~RimMainPlotCollection()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimMainPlotCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimMainPlotCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
if (changedField == &showWindow)
|
||||||
|
{
|
||||||
|
if (showWindow)
|
||||||
|
{
|
||||||
|
showPlotWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hidePlotWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::showPlotWindow()
|
||||||
|
{
|
||||||
|
if (!m_plotManagerMainWindow)
|
||||||
|
{
|
||||||
|
m_plotManagerMainWindow = new QMainWindow;
|
||||||
|
m_plotManagerMainWindow->setDockNestingEnabled(true);
|
||||||
|
|
||||||
|
m_plotMainWindow = new QMainWindow;
|
||||||
|
m_plotMainWindow->setDockNestingEnabled(true);
|
||||||
|
|
||||||
|
// NOTE! setCentralWidget takes ownership of widget
|
||||||
|
m_plotManagerMainWindow->setCentralWidget(m_plotMainWindow);
|
||||||
|
|
||||||
|
{
|
||||||
|
QDockWidget* dockWidget = new QDockWidget("Plots", m_plotManagerMainWindow);
|
||||||
|
dockWidget->setObjectName("dockWidget");
|
||||||
|
|
||||||
|
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||||
|
|
||||||
|
RiuProjectAndPropertyView* projPropView = new RiuProjectAndPropertyView(dockWidget);
|
||||||
|
dockWidget->setWidget(projPropView);
|
||||||
|
|
||||||
|
RimProject* proj = NULL;
|
||||||
|
this->firstAnchestorOrThisOfType(proj);
|
||||||
|
|
||||||
|
projPropView->setPdmItem(this);
|
||||||
|
|
||||||
|
m_plotManagerMainWindow->addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_plotMainWindow->show();
|
||||||
|
|
||||||
|
m_plotManagerMainWindow->showNormal();
|
||||||
|
m_plotManagerMainWindow->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -72,3 +140,124 @@ RimWellLogPlotCollection* RimMainPlotCollection::wellLogPlotCollection()
|
|||||||
{
|
{
|
||||||
return m_wellLogPlotCollection();
|
return m_wellLogPlotCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlotCollection* RimMainPlotCollection::summaryPlotCollection()
|
||||||
|
{
|
||||||
|
return m_summaryPlotCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::createDockWindowsForAllPlots()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_graphPlots.size(); i++)
|
||||||
|
{
|
||||||
|
if (!dockWidgetFromPlot(m_graphPlots[i]))
|
||||||
|
{
|
||||||
|
createPlotDockWidget(m_graphPlots[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QDockWidget* RimMainPlotCollection::dockWidgetFromPlot(RimSummaryPlot* graphPlot)
|
||||||
|
{
|
||||||
|
foreach(QDockWidget* dockW, m_plotViewDockWidgets)
|
||||||
|
{
|
||||||
|
if (dockW && dockW->widget() == graphPlot->widget())
|
||||||
|
{
|
||||||
|
return dockW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::createPlotDockWidget(RimSummaryPlot* graphPlot)
|
||||||
|
{
|
||||||
|
assert(m_plotMainWindow != NULL);
|
||||||
|
|
||||||
|
QDockWidget* dockWidget = new QDockWidget(QString("Plot Widget Tree (%1)").arg(m_plotViewDockWidgets.size() + 1), m_plotMainWindow);
|
||||||
|
dockWidget->setObjectName("dockWidget");
|
||||||
|
// dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||||
|
|
||||||
|
QWidget* widget = graphPlot->createPlotWidget(m_plotMainWindow);
|
||||||
|
|
||||||
|
dockWidget->setWidget(widget);
|
||||||
|
|
||||||
|
m_plotMainWindow->addDockWidget(Qt::RightDockWidgetArea, dockWidget);
|
||||||
|
|
||||||
|
m_plotViewDockWidgets.push_back(dockWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::eraseDockWidget(RimSummaryPlot* graphPlot)
|
||||||
|
{
|
||||||
|
QDockWidget* dockW = dockWidgetFromPlot(graphPlot);
|
||||||
|
if (dockW)
|
||||||
|
{
|
||||||
|
m_plotMainWindow->removeDockWidget(dockW);
|
||||||
|
dockW->setWidget(NULL);
|
||||||
|
dockW->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::redrawAllPlots()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_graphPlots.size(); i++)
|
||||||
|
{
|
||||||
|
m_graphPlots[i]->redrawAllCurves();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QMainWindow* RimMainPlotCollection::windowWithGraphPlots()
|
||||||
|
{
|
||||||
|
return m_plotMainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::initAfterRead()
|
||||||
|
{
|
||||||
|
if (show())
|
||||||
|
{
|
||||||
|
showPlotWindow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hidePlotWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimMainPlotCollection::hidePlotWindow()
|
||||||
|
{
|
||||||
|
if (m_plotManagerMainWindow)
|
||||||
|
{
|
||||||
|
m_plotManagerMainWindow->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -23,7 +23,15 @@
|
|||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmChildField.h"
|
#include "cafPdmChildField.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QDockWidget>
|
||||||
|
|
||||||
|
|
||||||
class RimWellLogPlotCollection;
|
class RimWellLogPlotCollection;
|
||||||
|
class RimSummaryPlotCollection;
|
||||||
|
class RimSummaryPlot;
|
||||||
|
class RifReaderEclipseSummary;
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -38,16 +46,38 @@ public:
|
|||||||
virtual ~RimMainPlotCollection();
|
virtual ~RimMainPlotCollection();
|
||||||
|
|
||||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||||
|
RimSummaryPlotCollection* summaryPlotCollection();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Separate Window stuff
|
||||||
|
void showPlotWindow();
|
||||||
|
void hidePlotWindow();
|
||||||
|
|
||||||
|
void redrawAllPlots();
|
||||||
|
void createDockWindowsForAllPlots();
|
||||||
|
QMainWindow* windowWithGraphPlots();
|
||||||
|
private:
|
||||||
|
|
||||||
|
QDockWidget* dockWidgetFromPlot(RimSummaryPlot* graphPlot);
|
||||||
|
void createPlotDockWidget(RimSummaryPlot* graphPlot);
|
||||||
|
void eraseDockWidget(RimSummaryPlot* graphPlot);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QMainWindow* m_plotManagerMainWindow; // Outer main Window
|
||||||
|
QMainWindow* m_plotMainWindow; // Inner main window
|
||||||
|
|
||||||
|
std::vector<QPointer<QDockWidget> > m_plotViewDockWidgets; // ChildPlotWidgets
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
private:
|
//virtual void initAfterRead();
|
||||||
|
|
||||||
|
|
||||||
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
||||||
|
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
|
||||||
|
|
||||||
caf::PdmField<bool> show;
|
caf::PdmField<bool> show;
|
||||||
};
|
};
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "RimEclipseCaseCollection.h"
|
#include "RimEclipseCaseCollection.h"
|
||||||
#include "RimWellPathCollection.h"
|
#include "RimWellPathCollection.h"
|
||||||
#include "RimGeoMechModels.h"
|
#include "RimGeoMechModels.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField");
|
CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField");
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -35,9 +36,11 @@ RimOilField::RimOilField(void)
|
|||||||
CAF_PDM_InitFieldNoDefault(&analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "");
|
CAF_PDM_InitFieldNoDefault(&analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "");
|
||||||
CAF_PDM_InitFieldNoDefault(&geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "");
|
CAF_PDM_InitFieldNoDefault(&geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "");
|
||||||
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
|
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&summaryCaseCollection,"SummaryCaseCollection","Summary Cases",":/GridModels.png","","");
|
||||||
|
|
||||||
analysisModels = new RimEclipseCaseCollection();
|
analysisModels = new RimEclipseCaseCollection();
|
||||||
wellPathCollection = new RimWellPathCollection();
|
wellPathCollection = new RimWellPathCollection();
|
||||||
|
summaryCaseCollection = new RimSummaryCaseCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -48,5 +51,6 @@ RimOilField::~RimOilField(void)
|
|||||||
if (wellPathCollection()) delete wellPathCollection();
|
if (wellPathCollection()) delete wellPathCollection();
|
||||||
if (geoMechModels()) delete geoMechModels();
|
if (geoMechModels()) delete geoMechModels();
|
||||||
if (analysisModels()) delete analysisModels();
|
if (analysisModels()) delete analysisModels();
|
||||||
|
if (summaryCaseCollection()) delete summaryCaseCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
class RimEclipseCaseCollection;
|
class RimEclipseCaseCollection;
|
||||||
class RimGeoMechModels;
|
class RimGeoMechModels;
|
||||||
class RimWellPathCollection;
|
class RimWellPathCollection;
|
||||||
|
class RimSummaryCaseCollection;
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@ -44,4 +44,5 @@ public:
|
|||||||
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
|
caf::PdmChildField<RimEclipseCaseCollection*> analysisModels;
|
||||||
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
|
caf::PdmChildField<RimGeoMechModels*> geoMechModels;
|
||||||
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
|
caf::PdmChildField<RimWellPathCollection*> wellPathCollection;
|
||||||
|
caf::PdmChildField<RimSummaryCaseCollection*> summaryCaseCollection;
|
||||||
};
|
};
|
||||||
|
372
ApplicationCode/ProjectDataModel/RimPlotCurve.cpp
Normal file
372
ApplicationCode/ProjectDataModel/RimPlotCurve.cpp
Normal file
@ -0,0 +1,372 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RimPlotCurve.h"
|
||||||
|
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include "qwt_symbol.h"
|
||||||
|
#include "qwt_plot.h"
|
||||||
|
|
||||||
|
// NB! Special macro for pure virtual class
|
||||||
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimPlotCurve, "PlotCurve");
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
void caf::AppEnum< RimPlotCurve::LineStyleEnum >::setUp()
|
||||||
|
{
|
||||||
|
addItem(RimPlotCurve::STYLE_NONE, "STYLE_NONE", "None");
|
||||||
|
addItem(RimPlotCurve::STYLE_SOLID, "STYLE_SOLID", "Solid");
|
||||||
|
addItem(RimPlotCurve::STYLE_DASH, "STYLE_DASH", "Dashes");
|
||||||
|
addItem(RimPlotCurve::STYLE_DOT, "STYLE_DOT", "Dots");
|
||||||
|
addItem(RimPlotCurve::STYLE_DASH_DOT, "STYLE_DASH_DOT", "Dashes and Dots");
|
||||||
|
|
||||||
|
setDefault(RimPlotCurve::STYLE_SOLID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void caf::AppEnum< RimPlotCurve::PointSymbolEnum >::setUp()
|
||||||
|
{
|
||||||
|
addItem(RimPlotCurve::SYMBOL_NONE, "SYMBOL_NONE", "None");
|
||||||
|
addItem(RimPlotCurve::SYMBOL_ELLIPSE, "SYMBOL_ELLIPSE", "Ellipse");
|
||||||
|
addItem(RimPlotCurve::SYMBOL_RECT, "SYMBOL_RECT", "Rect");
|
||||||
|
addItem(RimPlotCurve::SYMBOL_DIAMOND, "SYMBOL_DIAMOND", "Diamond");
|
||||||
|
addItem(RimPlotCurve::SYMBOL_TRIANGLE, "SYMBOL_TRIANGLE", "Triangle");
|
||||||
|
addItem(RimPlotCurve::SYMBOL_CROSS, "SYMBOL_CROSS", "Cross");
|
||||||
|
addItem(RimPlotCurve::SYMBOL_XCROSS, "SYMBOL_XCROSS", "X Cross");
|
||||||
|
|
||||||
|
setDefault(RimPlotCurve::SYMBOL_NONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPlotCurve::RimPlotCurve()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Curve", ":/WellLogCurve16x16.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
|
||||||
|
m_showCurve.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_curveName, "CurveName", "Curve Name", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");
|
||||||
|
m_customCurveName.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_curveThickness, "Thickness", 1.0f, "Thickness", "", "", "");
|
||||||
|
m_curveThickness.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
||||||
|
|
||||||
|
caf::AppEnum< RimPlotCurve::LineStyleEnum > lineStyle = STYLE_SOLID;
|
||||||
|
CAF_PDM_InitField(&m_lineStyle, "LineStyle", lineStyle, "Line style", "", "", "");
|
||||||
|
|
||||||
|
caf::AppEnum< RimPlotCurve::PointSymbolEnum > pointSymbol = SYMBOL_NONE;
|
||||||
|
CAF_PDM_InitField(&m_pointSymbol, "PointSymbol", pointSymbol, "Point style", "", "", "");
|
||||||
|
|
||||||
|
m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve;
|
||||||
|
|
||||||
|
m_parentQwtPlot = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimPlotCurve::~RimPlotCurve()
|
||||||
|
{
|
||||||
|
if (m_qwtPlotCurve)
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->detach();
|
||||||
|
delete m_qwtPlotCurve;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (changedField == &m_showCurve)
|
||||||
|
{
|
||||||
|
this->updateCurveVisibility();
|
||||||
|
}
|
||||||
|
else if (changedField == &m_curveName)
|
||||||
|
{
|
||||||
|
m_customCurveName = m_curveName;
|
||||||
|
updateCurveName();
|
||||||
|
}
|
||||||
|
else if (&m_curveColor == changedField
|
||||||
|
|| &m_curveThickness == changedField
|
||||||
|
|| &m_pointSymbol == changedField
|
||||||
|
|| &m_lineStyle == changedField)
|
||||||
|
{
|
||||||
|
updateCurveAppearance();
|
||||||
|
}
|
||||||
|
else if (changedField == &m_isUsingAutoName)
|
||||||
|
{
|
||||||
|
if (!m_isUsingAutoName)
|
||||||
|
{
|
||||||
|
m_customCurveName = createCurveAutoName();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOptionSensitivity();
|
||||||
|
updateCurveName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmFieldHandle* RimPlotCurve::objectToggleField()
|
||||||
|
{
|
||||||
|
return &m_showCurve;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::updateCurveVisibility()
|
||||||
|
{
|
||||||
|
if (m_showCurve() && m_parentQwtPlot)
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->attach(m_parentQwtPlot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
zoomAllParentPlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::updateCurvePresentation()
|
||||||
|
{
|
||||||
|
this->updateCurveVisibility();
|
||||||
|
this->updateCurveName();
|
||||||
|
|
||||||
|
updateCurveAppearance();
|
||||||
|
// Todo: Rest of the curve setup controlled from this class
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::setParentQwtPlot(QwtPlot* plot)
|
||||||
|
{
|
||||||
|
m_parentQwtPlot = plot;
|
||||||
|
if (m_showCurve)
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->attach(m_parentQwtPlot);
|
||||||
|
m_parentQwtPlot->replot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmFieldHandle* RimPlotCurve::userDescriptionField()
|
||||||
|
{
|
||||||
|
return &m_curveName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::setColor(const cvf::Color3f& color)
|
||||||
|
{
|
||||||
|
m_curveColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::detachQwtCurve()
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QwtPlotCurve* RimPlotCurve::qwtPlotCurve() const
|
||||||
|
{
|
||||||
|
return m_qwtPlotCurve;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimPlotCurve::isCurveVisible() const
|
||||||
|
{
|
||||||
|
return m_showCurve;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::initAfterRead()
|
||||||
|
{
|
||||||
|
updateOptionSensitivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::updateCurveName()
|
||||||
|
{
|
||||||
|
if (m_isUsingAutoName)
|
||||||
|
{
|
||||||
|
m_curveName = this->createCurveAutoName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_curveName = m_customCurveName;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_qwtPlotCurve->setTitle(m_curveName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::updateOptionSensitivity()
|
||||||
|
{
|
||||||
|
m_curveName.uiCapability()->setUiReadOnly(m_isUsingAutoName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::updateCurveAppearance()
|
||||||
|
{
|
||||||
|
CVF_ASSERT(m_qwtPlotCurve);
|
||||||
|
|
||||||
|
QColor curveColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
|
||||||
|
|
||||||
|
QwtSymbol* symbol = NULL;
|
||||||
|
|
||||||
|
if (m_pointSymbol() != SYMBOL_NONE)
|
||||||
|
{
|
||||||
|
QwtSymbol::Style style = QwtSymbol::NoSymbol;
|
||||||
|
|
||||||
|
switch (m_pointSymbol())
|
||||||
|
{
|
||||||
|
case SYMBOL_ELLIPSE:
|
||||||
|
style = QwtSymbol::Ellipse;
|
||||||
|
break;
|
||||||
|
case SYMBOL_RECT:
|
||||||
|
style = QwtSymbol::Rect;
|
||||||
|
break;
|
||||||
|
case SYMBOL_DIAMOND:
|
||||||
|
style = QwtSymbol::Diamond;
|
||||||
|
break;
|
||||||
|
case SYMBOL_TRIANGLE:
|
||||||
|
style = QwtSymbol::Triangle;
|
||||||
|
break;
|
||||||
|
case SYMBOL_CROSS:
|
||||||
|
style = QwtSymbol::Cross;
|
||||||
|
break;
|
||||||
|
case SYMBOL_XCROSS:
|
||||||
|
style = QwtSymbol::XCross;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QwtPlotCurve will take ownership of the symbol
|
||||||
|
symbol = new QwtSymbol(style);
|
||||||
|
|
||||||
|
symbol->setSize(6, 6);
|
||||||
|
symbol->setColor(curveColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
QwtPlotCurve::CurveStyle curveStyle = QwtPlotCurve::NoCurve;
|
||||||
|
Qt::PenStyle penStyle = Qt::SolidLine;
|
||||||
|
|
||||||
|
if (m_lineStyle() != STYLE_NONE)
|
||||||
|
{
|
||||||
|
curveStyle = QwtPlotCurve::Lines;
|
||||||
|
|
||||||
|
switch (m_lineStyle())
|
||||||
|
{
|
||||||
|
case STYLE_SOLID:
|
||||||
|
penStyle = Qt::SolidLine;
|
||||||
|
break;
|
||||||
|
case STYLE_DASH:
|
||||||
|
penStyle = Qt::DashLine;
|
||||||
|
break;
|
||||||
|
case STYLE_DOT:
|
||||||
|
penStyle = Qt::DotLine;
|
||||||
|
break;
|
||||||
|
case STYLE_DASH_DOT:
|
||||||
|
penStyle = Qt::DashDotLine;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_qwtPlotCurve->setPen(curveColor, m_curveThickness, penStyle);
|
||||||
|
m_qwtPlotCurve->setStyle(curveStyle);
|
||||||
|
m_qwtPlotCurve->setSymbol(symbol);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QList<caf::PdmOptionItemInfo> RimPlotCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||||
|
{
|
||||||
|
QList<caf::PdmOptionItemInfo> options;
|
||||||
|
|
||||||
|
if (fieldNeedingOptions == &m_curveThickness)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
options.push_back(caf::PdmOptionItemInfo(QString::number(i + 1), QVariant::fromValue(i + 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimPlotCurve::loadDataAndUpdate()
|
||||||
|
{
|
||||||
|
this->onLoadDataAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
110
ApplicationCode/ProjectDataModel/RimPlotCurve.h
Normal file
110
ApplicationCode/ProjectDataModel/RimPlotCurve.h
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "cafPdmField.h"
|
||||||
|
#include "cafPdmFieldCvfColor.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
|
class RiuLineSegmentQwtPlotCurve;
|
||||||
|
|
||||||
|
class QwtPlot;
|
||||||
|
class QwtPlotCurve;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimPlotCurve : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
enum LineStyleEnum
|
||||||
|
{
|
||||||
|
STYLE_NONE,
|
||||||
|
STYLE_SOLID,
|
||||||
|
STYLE_DASH,
|
||||||
|
STYLE_DOT,
|
||||||
|
STYLE_DASH_DOT
|
||||||
|
};
|
||||||
|
|
||||||
|
enum PointSymbolEnum
|
||||||
|
{
|
||||||
|
SYMBOL_NONE,
|
||||||
|
SYMBOL_ELLIPSE,
|
||||||
|
SYMBOL_RECT,
|
||||||
|
SYMBOL_DIAMOND,
|
||||||
|
SYMBOL_TRIANGLE,
|
||||||
|
SYMBOL_CROSS,
|
||||||
|
SYMBOL_XCROSS
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
RimPlotCurve();
|
||||||
|
virtual ~RimPlotCurve();
|
||||||
|
|
||||||
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
|
void setParentQwtPlot(QwtPlot* plot);
|
||||||
|
void detachQwtCurve();
|
||||||
|
QwtPlotCurve* qwtPlotCurve() const;
|
||||||
|
|
||||||
|
void setColor(const cvf::Color3f& color);
|
||||||
|
bool isCurveVisible() const;
|
||||||
|
QString curveName() const { return m_curveName; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual QString createCurveAutoName() = 0;
|
||||||
|
virtual void zoomAllParentPlot() = 0;
|
||||||
|
virtual void onLoadDataAndUpdate() = 0;
|
||||||
|
|
||||||
|
void updateCurvePresentation();
|
||||||
|
void updateCurveName();
|
||||||
|
void updateCurveVisibility();
|
||||||
|
void updateCurveAppearance();
|
||||||
|
|
||||||
|
void updateOptionSensitivity();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Overridden PDM methods
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||||
|
virtual void initAfterRead();
|
||||||
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QPointer<QwtPlot> m_parentQwtPlot;
|
||||||
|
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_showCurve;
|
||||||
|
caf::PdmField<QString> m_curveName;
|
||||||
|
caf::PdmField<QString> m_customCurveName;
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_isUsingAutoName;
|
||||||
|
caf::PdmField<cvf::Color3f> m_curveColor;
|
||||||
|
caf::PdmField<float> m_curveThickness;
|
||||||
|
|
||||||
|
caf::PdmField< caf::AppEnum< PointSymbolEnum > > m_pointSymbol;
|
||||||
|
caf::PdmField< caf::AppEnum< LineStyleEnum > > m_lineStyle;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
|||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimScriptCollection.h"
|
#include "RimScriptCollection.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
#include "RimView.h"
|
#include "RimView.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
#include "RimViewLinkerCollection.h"
|
#include "RimViewLinkerCollection.h"
|
||||||
@ -55,6 +56,8 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include "RimGridSummaryCase.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject");
|
CAF_PDM_SOURCE_INIT(RimProject, "ResInsightProject");
|
||||||
@ -144,6 +147,11 @@ void RimProject::close()
|
|||||||
mainPlotCollection()->wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
mainPlotCollection()->wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mainPlotCollection() && mainPlotCollection()->summaryPlotCollection())
|
||||||
|
{
|
||||||
|
mainPlotCollection()->summaryPlotCollection()->m_summaryPlots.deleteAllChildObjects();
|
||||||
|
}
|
||||||
|
|
||||||
oilFields.deleteAllChildObjects();
|
oilFields.deleteAllChildObjects();
|
||||||
oilFields.push_back(new RimOilField);
|
oilFields.push_back(new RimOilField);
|
||||||
|
|
||||||
@ -465,6 +473,25 @@ void RimProject::allCases(std::vector<RimCase*>& cases)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimProject::allSummaryCases(std::vector<RimSummaryCase*>& sumCases)
|
||||||
|
{
|
||||||
|
for (RimOilField* oilField: oilFields)
|
||||||
|
{
|
||||||
|
if(!oilField) continue;
|
||||||
|
RimSummaryCaseCollection* sumCaseColl = oilField->summaryCaseCollection();
|
||||||
|
if(sumCaseColl)
|
||||||
|
{
|
||||||
|
for (size_t scIdx = 0; scIdx < sumCaseColl->summaryCaseCount(); ++scIdx)
|
||||||
|
{
|
||||||
|
sumCases.push_back(sumCaseColl->summaryCase(scIdx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -728,6 +755,10 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
|||||||
{
|
{
|
||||||
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
|
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
|
||||||
}
|
}
|
||||||
|
if (mainPlotCollection->summaryPlotCollection())
|
||||||
|
{
|
||||||
|
uiTreeOrdering.add(mainPlotCollection->summaryPlotCollection());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uiTreeOrdering.add(scriptCollection());
|
uiTreeOrdering.add(scriptCollection());
|
||||||
|
@ -38,6 +38,7 @@ class RimViewLinkerCollection;
|
|||||||
class RimMainPlotCollection;
|
class RimMainPlotCollection;
|
||||||
class RimOilField;
|
class RimOilField;
|
||||||
class RimScriptCollection;
|
class RimScriptCollection;
|
||||||
|
class RimSummaryCase;
|
||||||
class RimView;
|
class RimView;
|
||||||
class RimWellPathImport;
|
class RimWellPathImport;
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ public:
|
|||||||
void assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup);
|
void assignIdToCaseGroup(RimIdenticalGridCaseGroup* caseGroup);
|
||||||
|
|
||||||
void allCases(std::vector<RimCase*>& cases);
|
void allCases(std::vector<RimCase*>& cases);
|
||||||
|
void allSummaryCases(std::vector<RimSummaryCase*>& sumCases);
|
||||||
void allNotLinkedViews(std::vector<RimView*>& views);
|
void allNotLinkedViews(std::vector<RimView*>& views);
|
||||||
void allVisibleViews(std::vector<RimView*>& views);
|
void allVisibleViews(std::vector<RimView*>& views);
|
||||||
|
|
||||||
|
59
ApplicationCode/ProjectDataModel/RimSummaryCase.cpp
Normal file
59
ApplicationCode/ProjectDataModel/RimSummaryCase.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RimSummaryCase.h"
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
|
#include "RigSummaryCaseData.h"
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
CAF_PDM_ABSTRACT_SOURCE_INIT(RimSummaryCase,"SummaryCase");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCase::RimSummaryCase()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Summary Case",":/Cases16x16.png","","");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCase::~RimSummaryCase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCase::loadCase()
|
||||||
|
{
|
||||||
|
if (m_summaryCaseData.isNull()) m_summaryCaseData = new RigSummaryCaseData(this->summaryHeaderFilename());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimSummaryCase::caseName()
|
||||||
|
{
|
||||||
|
QFileInfo caseFileName(this->summaryHeaderFilename());
|
||||||
|
|
||||||
|
return caseFileName.completeBaseName();
|
||||||
|
}
|
52
ApplicationCode/ProjectDataModel/RimSummaryCase.h
Normal file
52
ApplicationCode/ProjectDataModel/RimSummaryCase.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "cafPdmChildArrayField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cvfObject.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
|
||||||
|
class RimEclipseCase;
|
||||||
|
class RigSummaryCaseData;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
|
class RimSummaryCase : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimSummaryCase();
|
||||||
|
virtual ~RimSummaryCase();
|
||||||
|
|
||||||
|
QString caseName();
|
||||||
|
|
||||||
|
virtual QString summaryHeaderFilename() const = 0;
|
||||||
|
void loadCase();
|
||||||
|
|
||||||
|
RigSummaryCaseData* caseData() { return m_summaryCaseData.p(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
cvf::ref<RigSummaryCaseData> m_summaryCaseData;
|
||||||
|
};
|
136
ApplicationCode/ProjectDataModel/RimSummaryCaseCollection.cpp
Normal file
136
ApplicationCode/ProjectDataModel/RimSummaryCaseCollection.cpp
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RimSummaryCaseCollection.h"
|
||||||
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimOilField.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimGridSummaryCase.h"
|
||||||
|
#include "RifEclipseSummaryTools.h"
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryCaseCollection,"SummaryCaseCollection");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCaseCollection::RimSummaryCaseCollection()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Summary Cases",":/Cases16x16.png","","");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_cases,"SummaryCases","","","","");
|
||||||
|
m_cases.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCaseCollection::~RimSummaryCaseCollection()
|
||||||
|
{
|
||||||
|
m_cases.deleteAllChildObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCaseCollection::createSummaryCasesFromRelevantEclipseResultCases()
|
||||||
|
{
|
||||||
|
RimProject* proj = nullptr;
|
||||||
|
firstAnchestorOrThisOfType(proj);
|
||||||
|
if (proj)
|
||||||
|
{
|
||||||
|
std::vector<RimCase*> all3DCases;
|
||||||
|
proj->allCases(all3DCases);
|
||||||
|
for (RimCase* aCase: all3DCases)
|
||||||
|
{
|
||||||
|
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(aCase);
|
||||||
|
if (eclResCase)
|
||||||
|
{
|
||||||
|
// If we have no summary case corresponding to this eclipse case,
|
||||||
|
// try to create one.
|
||||||
|
bool isFound = false;
|
||||||
|
for (size_t scIdx = 0; scIdx < m_cases.size(); ++scIdx)
|
||||||
|
{
|
||||||
|
RimGridSummaryCase* grdSumCase = dynamic_cast<RimGridSummaryCase*>(m_cases[scIdx]);
|
||||||
|
if (grdSumCase)
|
||||||
|
{
|
||||||
|
if (grdSumCase->associatedEclipseCase() == eclResCase)
|
||||||
|
{
|
||||||
|
isFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isFound)
|
||||||
|
{
|
||||||
|
// Create new GridSummaryCase
|
||||||
|
createAndAddSummaryCaseFromEclipseResultCase(eclResCase);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCase* RimSummaryCaseCollection::summaryCase(size_t idx)
|
||||||
|
{
|
||||||
|
return m_cases[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
size_t RimSummaryCaseCollection::summaryCaseCount()
|
||||||
|
{
|
||||||
|
return m_cases.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCaseCollection::loadAllSummaryCaseData()
|
||||||
|
{
|
||||||
|
for (RimSummaryCase* sumCase: m_cases)
|
||||||
|
{
|
||||||
|
if (sumCase) sumCase->loadCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimGridSummaryCase* RimSummaryCaseCollection::createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase)
|
||||||
|
{
|
||||||
|
QString gridFileName = eclResCase->gridFileName();
|
||||||
|
if(RifEclipseSummaryTools::hasSummaryFiles(QDir::toNativeSeparators(gridFileName).toStdString()))
|
||||||
|
{
|
||||||
|
RimGridSummaryCase* newSumCase = new RimGridSummaryCase();
|
||||||
|
newSumCase->setAssociatedEclipseCase(eclResCase);
|
||||||
|
this->m_cases.push_back(newSumCase);
|
||||||
|
return newSumCase;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
45
ApplicationCode/ProjectDataModel/RimSummaryCaseCollection.h
Normal file
45
ApplicationCode/ProjectDataModel/RimSummaryCaseCollection.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "cafPdmChildArrayField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
class RimSummaryCase;
|
||||||
|
class RimGridSummaryCase;
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
|
||||||
|
class RimSummaryCaseCollection : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimSummaryCaseCollection();
|
||||||
|
virtual ~RimSummaryCaseCollection();
|
||||||
|
|
||||||
|
RimSummaryCase* summaryCase(size_t idx);
|
||||||
|
size_t summaryCaseCount();
|
||||||
|
|
||||||
|
void createSummaryCasesFromRelevantEclipseResultCases();
|
||||||
|
|
||||||
|
RimGridSummaryCase* createAndAddSummaryCaseFromEclipseResultCase(RimEclipseResultCase* eclResCase);
|
||||||
|
|
||||||
|
void loadAllSummaryCaseData();
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmChildArrayField<RimSummaryCase*> m_cases;
|
||||||
|
};
|
677
ApplicationCode/ProjectDataModel/RimSummaryCurve.cpp
Normal file
677
ApplicationCode/ProjectDataModel/RimSummaryCurve.cpp
Normal file
@ -0,0 +1,677 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "RimSummaryCurve.h"
|
||||||
|
|
||||||
|
#include "RiaApplication.h"
|
||||||
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
#include "RimDefines.h"
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
#include "RiuSummaryQwtPlot.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
|
#include "cafPdmUiListEditor.h"
|
||||||
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
|
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||||
|
#include "qwt_date.h"
|
||||||
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RigSummaryCaseData.h"
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryAddress, "SummaryAddress");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryAddress::RimSummaryAddress()
|
||||||
|
{
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_category, "SummaryVarType", "Type", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_quantityName, "SummaryQuantityName", "Quantity", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_regionNumber, "SummaryRegion", "Region", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_regionNumber2, "SummaryRegion2", "Region2", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_wellGroupName, "SummaryWellGroup", "Group", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_wellName, "SummaryWell", "Well", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_wellSegmentNumber, "SummaryWellSegment", "Well Segment", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_lgrName, "SummaryLgr", "Grid", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_cellI, "SummaryCellI", "I", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_cellJ, "SummaryCellJ", "J", "", "", "");
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_cellK, "SummaryCellK", "K", "", "", "");
|
||||||
|
|
||||||
|
m_category = RifEclipseSummaryAddress::SUMMARY_INVALID;
|
||||||
|
m_regionNumber = m_regionNumber2 = m_wellSegmentNumber = m_cellI = m_cellJ = m_cellK = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryAddress::~RimSummaryAddress()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryAddress::setAddress(const RifEclipseSummaryAddress& addr)
|
||||||
|
{
|
||||||
|
m_category = addr.category();
|
||||||
|
m_quantityName = addr.quantityName().c_str();
|
||||||
|
m_regionNumber = addr.regionNumber();
|
||||||
|
m_regionNumber2 = addr.regionNumber2();
|
||||||
|
m_wellGroupName = addr.wellGroupName().c_str();
|
||||||
|
m_wellName = addr.wellName().c_str();
|
||||||
|
m_wellSegmentNumber = addr.wellSegmentNumber();
|
||||||
|
m_lgrName = addr.lgrName().c_str();
|
||||||
|
|
||||||
|
m_cellI = addr.cellI(); m_cellJ = addr.cellJ(); m_cellK = addr.cellK();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifEclipseSummaryAddress RimSummaryAddress::address()
|
||||||
|
{
|
||||||
|
return RifEclipseSummaryAddress( m_category(),
|
||||||
|
m_quantityName().toStdString(),
|
||||||
|
m_regionNumber(),
|
||||||
|
m_regionNumber2(),
|
||||||
|
m_wellGroupName().toStdString(),
|
||||||
|
m_wellName().toStdString(),
|
||||||
|
m_wellSegmentNumber(),
|
||||||
|
m_lgrName().toStdString(),
|
||||||
|
m_cellI(), m_cellJ(), m_cellK());
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>::setUp()
|
||||||
|
{
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_FIELD, "SUMMARY_FIELD", "Field");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_AQUIFER, "SUMMARY_AQUIFER", "Aquifer");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_NETWORK, "SUMMARY_NETWORK", "Network");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_MISC, "SUMMARY_MISC", "Misc");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_REGION, "SUMMARY_REGION", "Region");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION, "SUMMARY_REGION_2_REGION", "Region-Region");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, "SUMMARY_WELL_GROUP", "Group");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_WELL, "SUMMARY_WELL", "Well");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, "SUMMARY_WELL_COMPLETION", "Completion");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, "SUMMARY_WELL_COMPLETION_LGR", "Lgr-Completion");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_LGR, "SUMMARY_WELL_LGR", "Lgr-Well");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT, "SUMMARY_SEGMENT", "Segment");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK, "SUMMARY_BLOCK", "Block");
|
||||||
|
addItem(RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, "SUMMARY_BLOCK_LGR", "Lgr-Block");
|
||||||
|
setDefault(RifEclipseSummaryAddress::SUMMARY_FIELD);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace caf
|
||||||
|
{
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void caf::AppEnum<RimSummaryCurve::SummaryFilterType>::setUp()
|
||||||
|
{
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_VAR_STRING, "SUM_FILTER_VAR_STRING", "Concatenated Variable Text");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_FIELD, "SUM_FILTER_FIELD", "Field");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_WELL, "SUM_FILTER_WELL", "Well");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_WELL_GROUP, "SUM_FILTER_WELL_GROUP", "Group");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_WELL_COMPLETION, "SUM_FILTER_WELL_COMPLETION", "Completion");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_WELL_SEGMENT, "SUM_FILTER_SEGMENT", "Segment");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_BLOCK, "SUM_FILTER_BLOCK", "Block");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_REGION, "SUM_FILTER_REGION", "Region");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_REGION_2_REGION, "SUM_FILTER_REGION_2_REGION", "Region-Region");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_WELL_LGR, "SUM_FILTER_WELL_LGR", "Lgr-Well");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_WELL_COMPLETION_LGR, "SUM_FILTER_WELL_COMPLETION_LGR", "Lgr-Completion");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_BLOCK_LGR, "SUM_FILTER_BLOCK_LGR", "Lgr-Block");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_MISC, "SUM_FILTER_MISC", "Misc");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_AQUIFER, "SUM_FILTER_AQUIFER", "Aquifer");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_NETWORK, "SUM_FILTER_NETWORK", "Network");
|
||||||
|
addItem(RimSummaryCurve::SUM_FILTER_ANY, "SUM_FILTER_ANY", "Any");
|
||||||
|
setDefault(RimSummaryCurve::SUM_FILTER_VAR_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryCurve, "SummaryCurve");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCurve::RimSummaryCurve()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Summary Curve", ":/WellLogCurve16x16.png", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_summaryCase, "SummaryCase", "Case", "", "", "");
|
||||||
|
m_summaryCase.uiCapability()->setUiChildrenHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_selectedVariableDisplayField, "SelectedVariableDisplayVar", "Variable", "", "", "");
|
||||||
|
m_selectedVariableDisplayField.xmlCapability()->setIOWritable(false);
|
||||||
|
m_selectedVariableDisplayField.xmlCapability()->setIOReadable(false);
|
||||||
|
m_selectedVariableDisplayField.uiCapability()->setUiReadOnly(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_filterType,"SummaryFilterType","Filter Type","","","");
|
||||||
|
m_filterType.xmlCapability()->setIOWritable(false);
|
||||||
|
m_filterType.xmlCapability()->setIOReadable(false);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_completeVarStringFilter, "SummaryCompleteVarStringFilter", "Filter", "", "", "");
|
||||||
|
m_completeVarStringFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_completeVarStringFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_filterQuantityName,"SummaryVarQuantityFilter","Quantity","","","");
|
||||||
|
m_filterQuantityName.xmlCapability()->setIOWritable(false);
|
||||||
|
m_filterQuantityName.xmlCapability()->setIOReadable(false);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_regionNumberFilter ,"SummaryRegionNumberFilter","Region","","","");
|
||||||
|
m_regionNumberFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_regionNumberFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_regionNumber2Filter ,"SummaryRegionNumber2Filter","Region 2","","","");
|
||||||
|
m_regionNumber2Filter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_regionNumber2Filter.xmlCapability()->setIOReadable(false);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_wellGroupNameFilter, "SummaryWellGroupNameFilter", "Well Group", "", "", "");
|
||||||
|
m_wellGroupNameFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_wellGroupNameFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_wellNameFilter ,"SummaryWellNameFilter","Well","","","");
|
||||||
|
m_wellNameFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_wellNameFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_wellSegmentNumberFilter ,"SummaryWellSegmentNumberFilter","Segment","","","");
|
||||||
|
m_wellSegmentNumberFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_wellSegmentNumberFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_lgrNameFilter ,"SummaryLgrNameFilter","Lgr","","","");
|
||||||
|
m_lgrNameFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_lgrNameFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_cellIJKFilter ,"SummaryCellIJKFilter","I, J, K","","","");
|
||||||
|
m_cellIJKFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_cellIJKFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_uiFilterResultSelection, "FilterResultSelection", "Filter Result", "", "", "");
|
||||||
|
m_cellIJKFilter.xmlCapability()->setIOWritable(false);
|
||||||
|
m_cellIJKFilter.xmlCapability()->setIOReadable(false);
|
||||||
|
m_uiFilterResultSelection.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||||
|
m_uiFilterResultSelection.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||||
|
m_uiFilterResultSelection.uiCapability()->setAutoAddingOptionFromValue(false);
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_curveVariable, "SummaryAddress", "SummaryAddress", "", "", "");
|
||||||
|
m_curveVariable.uiCapability()->setUiHidden(true);
|
||||||
|
m_curveVariable.uiCapability()->setUiChildrenHidden(true);
|
||||||
|
|
||||||
|
m_curveVariable = new RimSummaryAddress;
|
||||||
|
|
||||||
|
updateOptionSensitivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCurve::~RimSummaryCurve()
|
||||||
|
{
|
||||||
|
delete m_curveVariable();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::setSummaryCase(RimSummaryCase* sumCase)
|
||||||
|
{
|
||||||
|
m_summaryCase = sumCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::setVariable(QString varName)
|
||||||
|
{
|
||||||
|
m_curveVariable->setAddress(RifEclipseSummaryAddress::fieldVarAddress(varName.toStdString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||||
|
{
|
||||||
|
QList<caf::PdmOptionItemInfo> optionList = this->RimPlotCurve::calculateValueOptions(fieldNeedingOptions,useOptionsOnly);
|
||||||
|
if (!optionList.isEmpty()) return optionList;
|
||||||
|
|
||||||
|
|
||||||
|
if (fieldNeedingOptions == &m_summaryCase)
|
||||||
|
{
|
||||||
|
RimProject* proj = RiaApplication::instance()->project();
|
||||||
|
std::vector<RimSummaryCase*> cases;
|
||||||
|
|
||||||
|
proj->allSummaryCases(cases);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < cases.size(); i++)
|
||||||
|
{
|
||||||
|
RimSummaryCase* rimCase = cases[i];
|
||||||
|
|
||||||
|
optionList.push_back(caf::PdmOptionItemInfo(rimCase->caseName(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(rimCase))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optionList.size() > 0)
|
||||||
|
{
|
||||||
|
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(fieldNeedingOptions == &m_uiFilterResultSelection)
|
||||||
|
{
|
||||||
|
if(m_summaryCase)
|
||||||
|
{
|
||||||
|
RifReaderEclipseSummary* reader = summaryReader();
|
||||||
|
int addressCount = 0;
|
||||||
|
if(reader)
|
||||||
|
{
|
||||||
|
const std::vector<RifEclipseSummaryAddress> allAddresses = reader->allResultAddresses();
|
||||||
|
addressCount = static_cast<int>(allAddresses.size());
|
||||||
|
std::map<RifEclipseSummaryAddress, int> addrToIdxMap;
|
||||||
|
for(int i = 0; i <addressCount; i++)
|
||||||
|
{
|
||||||
|
if (!isIncludedByFilter(allAddresses[i] )) continue;
|
||||||
|
addrToIdxMap[allAddresses[i]] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& addrIntPair: addrToIdxMap)
|
||||||
|
{
|
||||||
|
std::string name = addrIntPair.first.uiText();
|
||||||
|
QString s = QString::fromStdString(name);
|
||||||
|
optionList.push_back(caf::PdmOptionItemInfo(s, addrIntPair.second));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), addressCount));
|
||||||
|
|
||||||
|
if(useOptionsOnly) *useOptionsOnly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return optionList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RimSummaryCurve::createCurveAutoName()
|
||||||
|
{
|
||||||
|
return QString::fromStdString( m_curveVariable->address().uiText());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::zoomAllParentPlot()
|
||||||
|
{
|
||||||
|
// Todo
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::onLoadDataAndUpdate()
|
||||||
|
{
|
||||||
|
this->RimPlotCurve::updateCurvePresentation();
|
||||||
|
|
||||||
|
m_selectedVariableDisplayField = QString::fromStdString(m_curveVariable->address().uiText());
|
||||||
|
|
||||||
|
if (isCurveVisible())
|
||||||
|
{
|
||||||
|
std::vector<QDateTime> dateTimes;
|
||||||
|
std::vector<double> values;
|
||||||
|
|
||||||
|
if(this->curveData(&dateTimes, &values))
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->setSamplesFromDateAndValues(dateTimes, values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_qwtPlotCurve->setSamplesFromDateAndValues(std::vector<QDateTime>(), std::vector<double>());
|
||||||
|
}
|
||||||
|
|
||||||
|
zoomAllParentPlot();
|
||||||
|
|
||||||
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Summary Variable");
|
||||||
|
curveDataGroup->add(&m_summaryCase);
|
||||||
|
curveDataGroup->add(&m_selectedVariableDisplayField);
|
||||||
|
|
||||||
|
caf::PdmUiGroup* curveVarSelectionGroup = curveDataGroup->addNewGroup("Variable Selection");
|
||||||
|
curveVarSelectionGroup->add(&m_filterType);
|
||||||
|
|
||||||
|
caf::PdmUiGroup* curveVarFilterGroup = nullptr;
|
||||||
|
|
||||||
|
if (m_filterType() == SUM_FILTER_VAR_STRING)
|
||||||
|
{
|
||||||
|
curveVarSelectionGroup->add(&m_completeVarStringFilter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caf::PdmUiGroup* curveVarFilterGroup = curveVarSelectionGroup->addNewGroup("Filter Settings");
|
||||||
|
|
||||||
|
curveVarFilterGroup->add(&m_filterQuantityName);
|
||||||
|
|
||||||
|
switch (m_filterType())
|
||||||
|
{
|
||||||
|
case SUM_FILTER_ANY:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_wellNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_wellGroupNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_regionNumberFilter);
|
||||||
|
curveVarFilterGroup->add(&m_regionNumber2Filter);
|
||||||
|
curveVarFilterGroup->add(&m_wellSegmentNumberFilter);
|
||||||
|
curveVarFilterGroup->add(&m_lgrNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_cellIJKFilter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_REGION:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_regionNumberFilter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_REGION_2_REGION:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_regionNumberFilter);
|
||||||
|
curveVarFilterGroup->add(&m_regionNumber2Filter);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_WELL_GROUP:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_wellGroupNameFilter);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_WELL:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_wellNameFilter);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_WELL_COMPLETION:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_wellNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_cellIJKFilter);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_WELL_LGR:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_wellNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_lgrNameFilter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_WELL_COMPLETION_LGR:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_wellNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_lgrNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_cellIJKFilter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_WELL_SEGMENT:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_wellNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_wellSegmentNumberFilter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_BLOCK:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_cellIJKFilter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SUM_FILTER_BLOCK_LGR:
|
||||||
|
{
|
||||||
|
curveVarFilterGroup->add(&m_lgrNameFilter);
|
||||||
|
curveVarFilterGroup->add(&m_cellIJKFilter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
curveVarSelectionGroup->add(&m_uiFilterResultSelection);
|
||||||
|
|
||||||
|
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
|
||||||
|
appearanceGroup->add(&m_curveColor);
|
||||||
|
appearanceGroup->add(&m_curveThickness);
|
||||||
|
appearanceGroup->add(&m_pointSymbol);
|
||||||
|
appearanceGroup->add(&m_lineStyle);
|
||||||
|
appearanceGroup->add(&m_curveName);
|
||||||
|
appearanceGroup->add(&m_isUsingAutoName);
|
||||||
|
|
||||||
|
uiOrdering.setForgetRemainingFields(true); // For now.
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isNumberMatch(QString numericalFilterString, int number)
|
||||||
|
{
|
||||||
|
if(numericalFilterString.isEmpty()) return true;
|
||||||
|
|
||||||
|
// Todo: Ranges, and lists
|
||||||
|
int filterNumber = numericalFilterString.toInt();
|
||||||
|
return number == filterNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isStringMatch(QString filterString, std::string value)
|
||||||
|
{
|
||||||
|
if(filterString.isEmpty()) return true;
|
||||||
|
|
||||||
|
QRegExp searcher(filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix);
|
||||||
|
QString qstrValue = QString::fromStdString(value);
|
||||||
|
return searcher.exactMatch(qstrValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isIJKMatch(QString filterString, int cellI, int cellJ, int cellK)
|
||||||
|
{
|
||||||
|
if(filterString.isEmpty()) return true;
|
||||||
|
|
||||||
|
// Todo: Ranges, and lists
|
||||||
|
int filterNumber = filterString.toInt();
|
||||||
|
return cellI == filterNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimSummaryCurve::isIncludedByFilter(const RifEclipseSummaryAddress& addr)
|
||||||
|
{
|
||||||
|
if (!isSumVarTypeMatchingFilterType(m_filterType(), addr.category())) return false;
|
||||||
|
|
||||||
|
if(m_filterType() == SUM_FILTER_VAR_STRING)
|
||||||
|
{
|
||||||
|
return isStringMatch(m_completeVarStringFilter(), addr.uiText());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isStringMatch(m_filterQuantityName(), addr.quantityName())) return false;
|
||||||
|
|
||||||
|
if(m_filterType() == SUM_FILTER_ANY)
|
||||||
|
{
|
||||||
|
return (isNumberMatch(m_regionNumberFilter(), addr.regionNumber())
|
||||||
|
&& isNumberMatch(m_regionNumber2Filter(), addr.regionNumber2())
|
||||||
|
&& isStringMatch(m_wellGroupNameFilter(), addr.wellGroupName())
|
||||||
|
&& isStringMatch(m_wellNameFilter(), addr.wellName())
|
||||||
|
&& isStringMatch(m_lgrNameFilter(), addr.lgrName())
|
||||||
|
&& isNumberMatch(m_wellSegmentNumberFilter(), addr.wellSegmentNumber())
|
||||||
|
&& isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK()));
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (addr.category())
|
||||||
|
{
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION:
|
||||||
|
{
|
||||||
|
return isNumberMatch(m_regionNumberFilter(), addr.regionNumber());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
|
||||||
|
{
|
||||||
|
return isNumberMatch(m_regionNumberFilter(), addr.regionNumber())
|
||||||
|
&& isNumberMatch(m_regionNumber2Filter(), addr.regionNumber2());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
|
||||||
|
{
|
||||||
|
return isStringMatch(m_wellGroupNameFilter(), addr.wellGroupName());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL:
|
||||||
|
{
|
||||||
|
return isStringMatch(m_wellNameFilter(), addr.wellName());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
|
||||||
|
{
|
||||||
|
return isStringMatch(m_wellNameFilter(), addr.wellName())
|
||||||
|
&& isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
|
||||||
|
{
|
||||||
|
return isStringMatch(m_wellNameFilter(), addr.wellName())
|
||||||
|
&& isStringMatch(m_lgrNameFilter(), addr.lgrName());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
|
||||||
|
{
|
||||||
|
return isStringMatch(m_wellNameFilter(), addr.wellName())
|
||||||
|
&& isStringMatch(m_lgrNameFilter(), addr.lgrName())
|
||||||
|
&& isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
|
||||||
|
{
|
||||||
|
return isStringMatch(m_wellNameFilter(), addr.wellName())
|
||||||
|
&& isNumberMatch(m_wellSegmentNumberFilter(), addr.wellSegmentNumber());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK:
|
||||||
|
{
|
||||||
|
return isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
|
||||||
|
{
|
||||||
|
return isStringMatch(m_lgrNameFilter(), addr.lgrName())
|
||||||
|
&& isIJKMatch(m_cellIJKFilter(), addr.cellI(), addr.cellJ(),addr.cellK());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimSummaryCurve::isSumVarTypeMatchingFilterType(SummaryFilterType sumFilterType, RifEclipseSummaryAddress::SummaryVarCategory sumVarType)
|
||||||
|
{
|
||||||
|
if (sumVarType == RifEclipseSummaryAddress::SUMMARY_INVALID) return false;
|
||||||
|
if (sumFilterType == SUM_FILTER_ANY || sumFilterType == SUM_FILTER_VAR_STRING) return true;
|
||||||
|
|
||||||
|
switch(sumVarType)
|
||||||
|
{
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_FIELD: { return (sumFilterType == SUM_FILTER_FIELD); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_AQUIFER: { return (sumFilterType == SUM_FILTER_AQUIFER); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_NETWORK: { return (sumFilterType == SUM_FILTER_NETWORK); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_MISC: { return (sumFilterType == SUM_FILTER_MISC); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION: { return (sumFilterType == SUM_FILTER_REGION); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION: { return (sumFilterType == SUM_FILTER_REGION_2_REGION); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: { return (sumFilterType == SUM_FILTER_WELL_GROUP); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL: { return (sumFilterType == SUM_FILTER_WELL); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION: { return (sumFilterType == SUM_FILTER_WELL_COMPLETION); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR: { return (sumFilterType == SUM_FILTER_WELL_LGR); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR: { return (sumFilterType == SUM_FILTER_FIELD); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT: { return (sumFilterType == SUM_FILTER_WELL_SEGMENT); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK: { return (sumFilterType == SUM_FILTER_BLOCK); } break;
|
||||||
|
case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR: { return (sumFilterType == SUM_FILTER_BLOCK_LGR); } break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
this->RimPlotCurve::fieldChangedByUi(changedField,oldValue,newValue);
|
||||||
|
|
||||||
|
if(changedField = &m_uiFilterResultSelection)
|
||||||
|
{
|
||||||
|
if (0 <= m_uiFilterResultSelection() && m_uiFilterResultSelection() < summaryReader()->allResultAddresses().size())
|
||||||
|
{
|
||||||
|
m_curveVariable->setAddress(summaryReader()->allResultAddresses()[m_uiFilterResultSelection()]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_curveVariable->setAddress(RifEclipseSummaryAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
this->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryCurve::summaryReader()
|
||||||
|
{
|
||||||
|
if (!m_summaryCase()) return nullptr;
|
||||||
|
|
||||||
|
if (!m_summaryCase->caseData()) return nullptr;
|
||||||
|
|
||||||
|
return m_summaryCase()->caseData()->summaryReader();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimSummaryCurve::curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(timeSteps && values);
|
||||||
|
|
||||||
|
RifReaderEclipseSummary* reader = summaryReader();
|
||||||
|
|
||||||
|
if (!reader) return false;
|
||||||
|
|
||||||
|
std::vector<time_t> times = reader->timeSteps();
|
||||||
|
*timeSteps = RifReaderEclipseSummary::fromTimeT(times);
|
||||||
|
|
||||||
|
if (!times.size()) return false;
|
||||||
|
|
||||||
|
RifEclipseSummaryAddress addr = m_curveVariable()->address();
|
||||||
|
return reader->values(addr, values);
|
||||||
|
}
|
138
ApplicationCode/ProjectDataModel/RimSummaryCurve.h
Normal file
138
ApplicationCode/ProjectDataModel/RimSummaryCurve.h
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
#include "cafPdmPtrField.h"
|
||||||
|
#include "cafPdmChildField.h"
|
||||||
|
|
||||||
|
#include "RimPlotCurve.h"
|
||||||
|
#include "RifEclipseSummaryAddress.h"
|
||||||
|
#include "cafAppEnum.h"
|
||||||
|
|
||||||
|
class RimSummaryCase;
|
||||||
|
class RifReaderEclipseSummary;
|
||||||
|
class RiuLineSegmentQwtPlotCurve;
|
||||||
|
|
||||||
|
class RimSummaryAddress: public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimSummaryAddress();;
|
||||||
|
virtual ~RimSummaryAddress();
|
||||||
|
|
||||||
|
void setAddress(const RifEclipseSummaryAddress& addr);
|
||||||
|
RifEclipseSummaryAddress address();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory> >
|
||||||
|
m_category;
|
||||||
|
caf::PdmField<QString> m_quantityName;
|
||||||
|
caf::PdmField<int> m_regionNumber;
|
||||||
|
caf::PdmField<int> m_regionNumber2;
|
||||||
|
caf::PdmField<QString> m_wellGroupName;
|
||||||
|
caf::PdmField<QString> m_wellName;
|
||||||
|
caf::PdmField<int> m_wellSegmentNumber;
|
||||||
|
caf::PdmField<QString> m_lgrName;
|
||||||
|
caf::PdmField<int> m_cellI;
|
||||||
|
caf::PdmField<int> m_cellJ;
|
||||||
|
caf::PdmField<int> m_cellK;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimSummaryCurve : public RimPlotCurve
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimSummaryCurve();
|
||||||
|
virtual ~RimSummaryCurve();
|
||||||
|
|
||||||
|
void setSummaryCase(RimSummaryCase* sumCase);
|
||||||
|
void setVariable(QString varName);
|
||||||
|
|
||||||
|
enum SummaryFilterType
|
||||||
|
{
|
||||||
|
SUM_FILTER_VAR_STRING,
|
||||||
|
SUM_FILTER_ANY,
|
||||||
|
SUM_FILTER_FIELD,
|
||||||
|
SUM_FILTER_AQUIFER,
|
||||||
|
SUM_FILTER_NETWORK,
|
||||||
|
SUM_FILTER_MISC,
|
||||||
|
SUM_FILTER_REGION,
|
||||||
|
SUM_FILTER_REGION_2_REGION,
|
||||||
|
SUM_FILTER_WELL_GROUP,
|
||||||
|
SUM_FILTER_WELL,
|
||||||
|
SUM_FILTER_WELL_COMPLETION,
|
||||||
|
SUM_FILTER_WELL_COMPLETION_LGR,
|
||||||
|
SUM_FILTER_WELL_LGR,
|
||||||
|
SUM_FILTER_WELL_SEGMENT,
|
||||||
|
SUM_FILTER_BLOCK,
|
||||||
|
SUM_FILTER_BLOCK_LGR,
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// RimPlotCurve overrides
|
||||||
|
|
||||||
|
virtual QString createCurveAutoName() override;
|
||||||
|
virtual void zoomAllParentPlot() override;
|
||||||
|
virtual void onLoadDataAndUpdate() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RifReaderEclipseSummary* summaryReader();
|
||||||
|
bool curveData(std::vector<QDateTime>* timeSteps, std::vector<double>* values);
|
||||||
|
|
||||||
|
// Overridden PDM methods
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||||
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||||
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
|
||||||
|
caf::PdmChildField<RimSummaryAddress*> m_curveVariable;
|
||||||
|
caf::PdmField<QString> m_selectedVariableDisplayField;
|
||||||
|
|
||||||
|
// Filter fields
|
||||||
|
bool isIncludedByFilter(const RifEclipseSummaryAddress& addr);
|
||||||
|
bool isSumVarTypeMatchingFilterType(SummaryFilterType sumFilterType, RifEclipseSummaryAddress::SummaryVarCategory sumVarType);
|
||||||
|
|
||||||
|
caf::PdmField<caf::AppEnum<SummaryFilterType> >
|
||||||
|
m_filterType;
|
||||||
|
caf::PdmField<QString> m_completeVarStringFilter;
|
||||||
|
|
||||||
|
caf::PdmField<QString> m_filterQuantityName;
|
||||||
|
caf::PdmField<QString> m_regionNumberFilter;
|
||||||
|
caf::PdmField<QString> m_regionNumber2Filter;
|
||||||
|
caf::PdmField<QString> m_wellGroupNameFilter;
|
||||||
|
caf::PdmField<QString> m_wellNameFilter;
|
||||||
|
caf::PdmField<QString> m_wellSegmentNumberFilter;
|
||||||
|
caf::PdmField<QString> m_lgrNameFilter;
|
||||||
|
caf::PdmField<QString> m_cellIJKFilter;
|
||||||
|
|
||||||
|
caf::PdmField<int> m_uiFilterResultSelection;
|
||||||
|
|
||||||
|
};
|
209
ApplicationCode/ProjectDataModel/RimSummaryPlot.cpp
Normal file
209
ApplicationCode/ProjectDataModel/RimSummaryPlot.cpp
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "RimSummaryPlot.h"
|
||||||
|
|
||||||
|
#include "RimSummaryCurve.h"
|
||||||
|
#include "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "RiuSummaryQwtPlot.h"
|
||||||
|
#include "RiuSelectionColors.h"
|
||||||
|
|
||||||
|
#include "cvfBase.h"
|
||||||
|
#include "cvfColor3.h"
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot::RimSummaryPlot()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Summary Plot", ":/WellLogPlot16x16.png", "", "");
|
||||||
|
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Summary Plot", "", "", "");
|
||||||
|
m_showWindow.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_curves, "SummaryCurves", "", "", "", "");
|
||||||
|
m_curves.uiCapability()->setUiHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot::~RimSummaryPlot()
|
||||||
|
{
|
||||||
|
RiuMainWindow::instance()->removeViewer(m_qwtPlot);
|
||||||
|
|
||||||
|
deletePlotWidget();
|
||||||
|
|
||||||
|
m_curves.deleteAllChildObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::deletePlotWidget()
|
||||||
|
{
|
||||||
|
if (m_qwtPlot)
|
||||||
|
{
|
||||||
|
m_qwtPlot->deleteLater();
|
||||||
|
m_qwtPlot = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::handleViewerDeletion()
|
||||||
|
{
|
||||||
|
m_showWindow = false;
|
||||||
|
|
||||||
|
if (m_qwtPlot)
|
||||||
|
{
|
||||||
|
detachAllCurves();
|
||||||
|
}
|
||||||
|
|
||||||
|
uiCapability()->updateUiIconFromToggleField();
|
||||||
|
updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::addCurve(RimSummaryCurve* curve)
|
||||||
|
{
|
||||||
|
if (curve)
|
||||||
|
{
|
||||||
|
m_curves.push_back(curve);
|
||||||
|
if (m_qwtPlot)
|
||||||
|
{
|
||||||
|
curve->setParentQwtPlot(m_qwtPlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
|
{
|
||||||
|
if (changedField == &m_showWindow)
|
||||||
|
{
|
||||||
|
if (m_showWindow)
|
||||||
|
{
|
||||||
|
loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateViewerWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
uiCapability()->updateUiIconFromToggleField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::setupBeforeSave()
|
||||||
|
{
|
||||||
|
if (m_qwtPlot)
|
||||||
|
{
|
||||||
|
this->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_qwtPlot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::loadDataAndUpdate()
|
||||||
|
{
|
||||||
|
updateViewerWidget();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < m_curves.size(); i++)
|
||||||
|
{
|
||||||
|
RimSummaryCurve* curve = m_curves[i];
|
||||||
|
|
||||||
|
curve->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Todo: Update zoom
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::setDescription(const QString& description)
|
||||||
|
{
|
||||||
|
m_userName = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::updateViewerWidget()
|
||||||
|
{
|
||||||
|
if (m_showWindow())
|
||||||
|
{
|
||||||
|
if (!m_qwtPlot)
|
||||||
|
{
|
||||||
|
m_qwtPlot = new RiuSummaryQwtPlot(this, RiuMainWindow::instance());
|
||||||
|
for (size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||||
|
{
|
||||||
|
m_curves[cIdx]->setParentQwtPlot(m_qwtPlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->addViewer(m_qwtPlot, this->mdiWindowGeometry());
|
||||||
|
RiuMainWindow::instance()->setActiveViewer(m_qwtPlot);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//updateViewerWidgetWindowTitle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_qwtPlot)
|
||||||
|
{
|
||||||
|
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_qwtPlot));
|
||||||
|
|
||||||
|
RiuMainWindow::instance()->removeViewer(m_qwtPlot);
|
||||||
|
detachAllCurves();
|
||||||
|
|
||||||
|
deletePlotWidget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::detachAllCurves()
|
||||||
|
{
|
||||||
|
for (size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx)
|
||||||
|
{
|
||||||
|
m_curves[cIdx]->detachQwtCurve();
|
||||||
|
}
|
||||||
|
}
|
68
ApplicationCode/ProjectDataModel/RimSummaryPlot.h
Normal file
68
ApplicationCode/ProjectDataModel/RimSummaryPlot.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "cafPdmObject.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmChildArrayField.h"
|
||||||
|
#include "cafAppEnum.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
|
#include "RimViewWindow.h"
|
||||||
|
|
||||||
|
class RiuSummaryQwtPlot;
|
||||||
|
class RimSummaryCurve;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimSummaryPlot : public RimViewWindow
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RimSummaryPlot();
|
||||||
|
virtual ~RimSummaryPlot();
|
||||||
|
|
||||||
|
void setDescription(const QString& description);
|
||||||
|
void addCurve(RimSummaryCurve* curve);
|
||||||
|
void loadDataAndUpdate();
|
||||||
|
void handleViewerDeletion();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Overridden PDM methods
|
||||||
|
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||||
|
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
virtual void setupBeforeSave() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateViewerWidget();
|
||||||
|
void detachAllCurves();
|
||||||
|
void deletePlotWidget();
|
||||||
|
|
||||||
|
caf::PdmField<bool> m_showWindow;
|
||||||
|
caf::PdmField<QString> m_userName;
|
||||||
|
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||||
|
|
||||||
|
QPointer<RiuSummaryQwtPlot> m_qwtPlot;
|
||||||
|
};
|
121
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.cpp
Normal file
121
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.cpp
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "RimSummaryPlotCollection.h"
|
||||||
|
|
||||||
|
#include "RifEclipseSummaryTools.h"
|
||||||
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
|
#include "RimEclipseResultCase.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
|
||||||
|
#include "RiuProjectPropertyView.h"
|
||||||
|
|
||||||
|
#include <QDockWidget>
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
CAF_PDM_SOURCE_INIT(RimSummaryPlotCollection, "SummaryPlotCollection");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||||
|
{
|
||||||
|
CAF_PDM_InitObject("Summary Plots", "", "", "");
|
||||||
|
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "");
|
||||||
|
m_summaryPlots.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlotCollection::~RimSummaryPlotCollection()
|
||||||
|
{
|
||||||
|
m_summaryPlots.deleteAllChildObjects();
|
||||||
|
|
||||||
|
for (auto it = m_summaryFileReaders.begin(); it != m_summaryFileReaders.end(); it++)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
m_summaryFileReaders.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryPlotCollection::getOrCreateSummaryFileReader(const QString& eclipseCaseFilePathBasename)
|
||||||
|
{
|
||||||
|
auto it = m_summaryFileReaders.find(eclipseCaseFilePathBasename);
|
||||||
|
if (it != m_summaryFileReaders.end())
|
||||||
|
{
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return createSummaryFileReader(eclipseCaseFilePathBasename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryPlotCollection::getOrCreateSummaryFileReader(const RimEclipseResultCase* eclipseCase)
|
||||||
|
{
|
||||||
|
if (!eclipseCase) return NULL;
|
||||||
|
|
||||||
|
QString caseName = eclipseCase->gridFileName();
|
||||||
|
QString caseNameWithNoExtension = caseName.remove(".egrid", Qt::CaseInsensitive);
|
||||||
|
|
||||||
|
QString caseNameAbsPath = caseNameWithNoExtension.replace("/", "\\");
|
||||||
|
|
||||||
|
return this->getOrCreateSummaryFileReader(caseNameAbsPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RimSummaryPlotCollection::createSummaryFileReader(const QString& eclipseCaseFilePathBasename)
|
||||||
|
{
|
||||||
|
std::string headerFile;
|
||||||
|
bool isFormatted = false;
|
||||||
|
RifEclipseSummaryTools::findSummaryHeaderFile(eclipseCaseFilePathBasename.toStdString(), &headerFile, &isFormatted);
|
||||||
|
|
||||||
|
if (headerFile.empty()) return nullptr;
|
||||||
|
|
||||||
|
std::vector<std::string> dataFiles = RifEclipseSummaryTools::findSummaryDataFiles(eclipseCaseFilePathBasename.toStdString());
|
||||||
|
|
||||||
|
if (!dataFiles.size()) return nullptr;
|
||||||
|
|
||||||
|
RifReaderEclipseSummary* reader = new RifReaderEclipseSummary;
|
||||||
|
if (!reader->open(headerFile, dataFiles))
|
||||||
|
{
|
||||||
|
delete reader;
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_summaryFileReaders.insert(std::make_pair(eclipseCaseFilePathBasename, reader));
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
55
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.h
Normal file
55
ApplicationCode/ProjectDataModel/RimSummaryPlotCollection.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "cafPdmChildArrayField.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QDockWidget>
|
||||||
|
|
||||||
|
class RimSummaryPlot;
|
||||||
|
class RicDropEnabledMainWindow;
|
||||||
|
class RifReaderEclipseSummary;
|
||||||
|
class RimEclipseResultCase;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimSummaryPlotCollection : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimSummaryPlotCollection();
|
||||||
|
virtual ~RimSummaryPlotCollection();
|
||||||
|
|
||||||
|
RifReaderEclipseSummary* getOrCreateSummaryFileReader(const RimEclipseResultCase* eclipseCase);
|
||||||
|
|
||||||
|
caf::PdmChildArrayField<RimSummaryPlot*> m_summaryPlots;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RifReaderEclipseSummary* createSummaryFileReader(const QString& eclipseCaseFilePathBasename);
|
||||||
|
RifReaderEclipseSummary* getOrCreateSummaryFileReader(const QString& eclipseCaseFilePathBasename);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Map from path to case to summary file reader objects
|
||||||
|
std::map<QString, RifReaderEclipseSummary*> m_summaryFileReaders;
|
||||||
|
};
|
@ -109,8 +109,6 @@ RimView::RimView(void)
|
|||||||
|
|
||||||
CAF_PDM_InitField(&m_disableLighting, "DisableLighting", false, "Disable Results Lighting", "", "Disable light model for scalar result colors", "");
|
CAF_PDM_InitField(&m_disableLighting, "DisableLighting", false, "Disable Results Lighting", "", "Disable light model for scalar result colors", "");
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&windowGeometry, "WindowGeometry", "", "", "", "");
|
|
||||||
windowGeometry.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "");
|
||||||
m_rangeFilterCollection.uiCapability()->setUiHidden(true);
|
m_rangeFilterCollection.uiCapability()->setUiHidden(true);
|
||||||
@ -205,7 +203,7 @@ void RimView::updateViewerWidget()
|
|||||||
m_viewer = new RiuViewer(glFormat, NULL);
|
m_viewer = new RiuViewer(glFormat, NULL);
|
||||||
m_viewer->setOwnerReservoirView(this);
|
m_viewer->setOwnerReservoirView(this);
|
||||||
|
|
||||||
RiuMainWindow::instance()->addViewer(m_viewer->layoutWidget(), windowGeometry());
|
RiuMainWindow::instance()->addViewer(m_viewer->layoutWidget(), mdiWindowGeometry());
|
||||||
m_viewer->setMinNearPlaneDistance(10);
|
m_viewer->setMinNearPlaneDistance(10);
|
||||||
|
|
||||||
this->resetLegendsInViewer();
|
this->resetLegendsInViewer();
|
||||||
@ -341,8 +339,8 @@ void RimView::setupBeforeSave()
|
|||||||
hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice...
|
hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice...
|
||||||
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
||||||
|
|
||||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget());
|
setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForViewer(m_viewer->layoutWidget()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "RivCellSetEnum.h"
|
#include "RivCellSetEnum.h"
|
||||||
|
|
||||||
|
#include "RimViewWindow.h"
|
||||||
|
|
||||||
#include "cvfArray.h"
|
#include "cvfArray.h"
|
||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfCollection.h"
|
#include "cvfCollection.h"
|
||||||
@ -36,6 +38,7 @@
|
|||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
|
||||||
class Rim3dOverlayInfoConfig;
|
class Rim3dOverlayInfoConfig;
|
||||||
class RimCase;
|
class RimCase;
|
||||||
class RimCellRangeFilter;
|
class RimCellRangeFilter;
|
||||||
@ -61,7 +64,7 @@ namespace cvf
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimView : public caf::PdmObject
|
class RimView : public RimViewWindow
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
public:
|
public:
|
||||||
@ -90,7 +93,6 @@ public:
|
|||||||
void setOverrideRangeFilterCollection(RimCellRangeFilterCollection* rfc);
|
void setOverrideRangeFilterCollection(RimCellRangeFilterCollection* rfc);
|
||||||
void replaceRangeFilterCollectionWithOverride();
|
void replaceRangeFilterCollectionWithOverride();
|
||||||
|
|
||||||
caf::PdmField< std::vector<int> > windowGeometry;
|
|
||||||
|
|
||||||
caf::PdmChildField<RimCrossSectionCollection*> crossSectionCollection;
|
caf::PdmChildField<RimCrossSectionCollection*> crossSectionCollection;
|
||||||
|
|
||||||
|
68
ApplicationCode/ProjectDataModel/RimViewWindow.cpp
Normal file
68
ApplicationCode/ProjectDataModel/RimViewWindow.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include "RimViewWindow.h"
|
||||||
|
#include "QWidget"
|
||||||
|
|
||||||
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimViewWindow, "ViewWindow"); // Do not use. Abstract class
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimViewWindow::RimViewWindow(void)
|
||||||
|
{
|
||||||
|
CAF_PDM_InitFieldNoDefault(&m_windowGeometry, "WindowGeometry", "", "", "", "");
|
||||||
|
m_windowGeometry.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimViewWindow::~RimViewWindow(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::setViewWidget(QWidget* viewWidget)
|
||||||
|
{
|
||||||
|
m_viewWidget = viewWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimViewWindow::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry)
|
||||||
|
{
|
||||||
|
std::vector<int> geom;
|
||||||
|
geom.clear();
|
||||||
|
if (windowGeometry.isValid())
|
||||||
|
{
|
||||||
|
geom.push_back(windowGeometry.x);
|
||||||
|
geom.push_back(windowGeometry.y);
|
||||||
|
geom.push_back(windowGeometry.width);
|
||||||
|
geom.push_back(windowGeometry.height);
|
||||||
|
geom.push_back(windowGeometry.isMaximized);
|
||||||
|
}
|
||||||
|
m_windowGeometry.setValue(geom);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimMdiWindowGeometry RimViewWindow::mdiWindowGeometry()
|
||||||
|
{
|
||||||
|
|
||||||
|
RimMdiWindowGeometry wg;
|
||||||
|
if (m_windowGeometry.value().size() == 5)
|
||||||
|
{
|
||||||
|
wg.x = m_windowGeometry.value()[0];
|
||||||
|
wg.y = m_windowGeometry.value()[1];
|
||||||
|
wg.width = m_windowGeometry.value()[2];
|
||||||
|
wg.height = m_windowGeometry.value()[3];
|
||||||
|
wg.isMaximized = m_windowGeometry.value()[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
return wg;
|
||||||
|
}
|
||||||
|
|
60
ApplicationCode/ProjectDataModel/RimViewWindow.h
Normal file
60
ApplicationCode/ProjectDataModel/RimViewWindow.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 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 "cafPdmObject.h"
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "QPointer"
|
||||||
|
|
||||||
|
struct RimMdiWindowGeometry
|
||||||
|
{
|
||||||
|
RimMdiWindowGeometry() : x(0), y(0), width(-1), height(-1) {}
|
||||||
|
bool isValid() const { return (width >= 0 && height >= 0);}
|
||||||
|
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
bool isMaximized;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RimViewWindow : public caf::PdmObject
|
||||||
|
{
|
||||||
|
CAF_PDM_HEADER_INIT;
|
||||||
|
public:
|
||||||
|
RimViewWindow(void);
|
||||||
|
virtual ~RimViewWindow(void);
|
||||||
|
|
||||||
|
void setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry);
|
||||||
|
RimMdiWindowGeometry mdiWindowGeometry();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setViewWidget(QWidget* viewWidget);
|
||||||
|
|
||||||
|
// Possible abilities of this class
|
||||||
|
|
||||||
|
//virtual QImage snapshotWindowContent() = 0;
|
||||||
|
//caf::PdmField<QString> name;
|
||||||
|
//caf::PdmField<bool> showWindow;
|
||||||
|
|
||||||
|
private:
|
||||||
|
caf::PdmField< std::vector<int> > m_windowGeometry;
|
||||||
|
QPointer<QWidget> m_viewWidget;
|
||||||
|
};
|
||||||
|
|
@ -35,68 +35,17 @@
|
|||||||
// NB! Special macro for pure virtual class
|
// NB! Special macro for pure virtual class
|
||||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogCurve, "WellLogPlotCurve");
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogCurve, "WellLogPlotCurve");
|
||||||
|
|
||||||
namespace caf
|
|
||||||
{
|
|
||||||
template<>
|
|
||||||
void caf::AppEnum< RimWellLogCurve::LineStyleEnum >::setUp()
|
|
||||||
{
|
|
||||||
addItem(RimWellLogCurve::STYLE_NONE, "STYLE_NONE", "None");
|
|
||||||
addItem(RimWellLogCurve::STYLE_SOLID, "STYLE_SOLID", "Solid");
|
|
||||||
addItem(RimWellLogCurve::STYLE_DASH, "STYLE_DASH", "Dashes");
|
|
||||||
addItem(RimWellLogCurve::STYLE_DOT, "STYLE_DOT", "Dots");
|
|
||||||
addItem(RimWellLogCurve::STYLE_DASH_DOT,"STYLE_DASH_DOT", "Dashes and Dots");
|
|
||||||
|
|
||||||
setDefault(RimWellLogCurve::STYLE_SOLID);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void caf::AppEnum< RimWellLogCurve::PointSymbolEnum >::setUp()
|
|
||||||
{
|
|
||||||
addItem(RimWellLogCurve::SYMBOL_NONE, "SYMBOL_NONE", "None");
|
|
||||||
addItem(RimWellLogCurve::SYMBOL_ELLIPSE, "SYMBOL_ELLIPSE", "Ellipse");
|
|
||||||
addItem(RimWellLogCurve::SYMBOL_RECT, "SYMBOL_RECT", "Rect");
|
|
||||||
addItem(RimWellLogCurve::SYMBOL_DIAMOND, "SYMBOL_DIAMOND", "Diamond");
|
|
||||||
addItem(RimWellLogCurve::SYMBOL_TRIANGLE, "SYMBOL_TRIANGLE", "Triangle");
|
|
||||||
addItem(RimWellLogCurve::SYMBOL_CROSS, "SYMBOL_CROSS", "Cross");
|
|
||||||
addItem(RimWellLogCurve::SYMBOL_XCROSS, "SYMBOL_XCROSS", "X Cross");
|
|
||||||
|
|
||||||
setDefault(RimWellLogCurve::SYMBOL_NONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimWellLogCurve::RimWellLogCurve()
|
RimWellLogCurve::RimWellLogCurve()
|
||||||
{
|
{
|
||||||
CAF_PDM_InitObject("Curve", ":/WellLogCurve16x16.png", "", "");
|
CAF_PDM_InitObject("WellLogCurve", ":/WellLogCurve16x16.png", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
|
|
||||||
m_showCurve.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_curveName, "CurveName", "Curve Name", "", "", "");
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");
|
|
||||||
m_customCurveName.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_autoName, "AutoName", true, "Auto Name", "", "", "");
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
|
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_curveThickness, "Thickness", 1.0f, "Thickness", "", "", "");
|
|
||||||
m_curveThickness.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName());
|
|
||||||
|
|
||||||
caf::AppEnum< RimWellLogCurve::LineStyleEnum > lineStyle = STYLE_SOLID;
|
|
||||||
CAF_PDM_InitField(&m_lineStyle, "LineStyle", lineStyle, "Line style", "", "", "");
|
|
||||||
|
|
||||||
caf::AppEnum< RimWellLogCurve::PointSymbolEnum > pointSymbol = SYMBOL_NONE;
|
|
||||||
CAF_PDM_InitField(&m_pointSymbol, "PointSymbol", pointSymbol, "Point style", "", "", "");
|
|
||||||
|
|
||||||
m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve;
|
|
||||||
m_qwtPlotCurve->setXAxis(QwtPlot::xTop);
|
m_qwtPlotCurve->setXAxis(QwtPlot::xTop);
|
||||||
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
|
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
|
||||||
|
|
||||||
m_ownerQwtTrack = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -106,120 +55,14 @@ RimWellLogCurve::~RimWellLogCurve()
|
|||||||
{
|
{
|
||||||
m_qwtPlotCurve->detach();
|
m_qwtPlotCurve->detach();
|
||||||
delete m_qwtPlotCurve;
|
delete m_qwtPlotCurve;
|
||||||
|
m_qwtPlotCurve = NULL;
|
||||||
|
|
||||||
if (m_ownerQwtTrack)
|
if (m_parentQwtPlot)
|
||||||
{
|
{
|
||||||
m_ownerQwtTrack->replot();
|
m_parentQwtPlot->replot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
||||||
{
|
|
||||||
if (changedField == &m_showCurve)
|
|
||||||
{
|
|
||||||
this->updateCurveVisibility();
|
|
||||||
}
|
|
||||||
else if (changedField == &m_curveName)
|
|
||||||
{
|
|
||||||
m_customCurveName = m_curveName;
|
|
||||||
updatePlotTitle();
|
|
||||||
}
|
|
||||||
else if (&m_curveColor == changedField
|
|
||||||
|| &m_curveThickness == changedField
|
|
||||||
|| &m_pointSymbol == changedField
|
|
||||||
|| &m_lineStyle == changedField)
|
|
||||||
{
|
|
||||||
updateCurveAppearance();
|
|
||||||
}
|
|
||||||
else if (changedField == &m_autoName)
|
|
||||||
{
|
|
||||||
if (!m_autoName)
|
|
||||||
{
|
|
||||||
m_customCurveName = createCurveName();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateOptionSensitivity();
|
|
||||||
updateCurveName();
|
|
||||||
updatePlotTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
caf::PdmFieldHandle* RimWellLogCurve::objectToggleField()
|
|
||||||
{
|
|
||||||
return &m_showCurve;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::updateCurveVisibility()
|
|
||||||
{
|
|
||||||
if (m_showCurve() && m_ownerQwtTrack)
|
|
||||||
{
|
|
||||||
m_qwtPlotCurve->attach(m_ownerQwtTrack);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_qwtPlotCurve->detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
RimWellLogPlot* wellLogPlot;
|
|
||||||
this->firstAnchestorOrThisOfType(wellLogPlot);
|
|
||||||
if (wellLogPlot)
|
|
||||||
{
|
|
||||||
wellLogPlot->calculateAvailableDepthRange();
|
|
||||||
}
|
|
||||||
|
|
||||||
RimWellLogTrack* wellLogPlotTrack;
|
|
||||||
this->firstAnchestorOrThisOfType(wellLogPlotTrack);
|
|
||||||
if (wellLogPlotTrack)
|
|
||||||
{
|
|
||||||
wellLogPlotTrack->zoomAllXAndZoomAllDepthOnOwnerPlot();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::updatePlotConfiguration()
|
|
||||||
{
|
|
||||||
this->updateCurveVisibility();
|
|
||||||
this->updateCurveName();
|
|
||||||
this->updatePlotTitle();
|
|
||||||
|
|
||||||
updateCurveAppearance();
|
|
||||||
// Todo: Rest of the curve setup controlled from this class
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::setQwtTrack(RiuWellLogTrack* plot)
|
|
||||||
{
|
|
||||||
m_ownerQwtTrack = plot;
|
|
||||||
if (m_showCurve)
|
|
||||||
{
|
|
||||||
m_qwtPlotCurve->attach(m_ownerQwtTrack);
|
|
||||||
m_ownerQwtTrack->replot();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
caf::PdmFieldHandle* RimWellLogCurve::userDescriptionField()
|
|
||||||
{
|
|
||||||
return &m_curveName;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -259,58 +102,11 @@ bool RimWellLogCurve::valueRange(double* minimumValue, double* maximumValue) con
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::setColor(const cvf::Color3f& color)
|
|
||||||
{
|
|
||||||
m_curveColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogCurve::detachQwtCurve()
|
void RimWellLogCurve::zoomAllParentPlot()
|
||||||
{
|
|
||||||
m_qwtPlotCurve->detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QwtPlotCurve* RimWellLogCurve::plotCurve() const
|
|
||||||
{
|
|
||||||
return m_qwtPlotCurve;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::updatePlotTitle()
|
|
||||||
{
|
|
||||||
m_qwtPlotCurve->setTitle(m_curveName);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool RimWellLogCurve::isCurveVisible() const
|
|
||||||
{
|
|
||||||
return m_showCurve;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::initAfterRead()
|
|
||||||
{
|
|
||||||
updateOptionSensitivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::zoomAllOwnerTrackAndPlot()
|
|
||||||
{
|
{
|
||||||
RimWellLogPlot* wellLogPlot;
|
RimWellLogPlot* wellLogPlot;
|
||||||
firstAnchestorOrThisOfType(wellLogPlot);
|
firstAnchestorOrThisOfType(wellLogPlot);
|
||||||
@ -328,28 +124,6 @@ void RimWellLogCurve::zoomAllOwnerTrackAndPlot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::updateCurveName()
|
|
||||||
{
|
|
||||||
if (m_autoName)
|
|
||||||
{
|
|
||||||
m_curveName = this->createCurveName();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_curveName = m_customCurveName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::updateOptionSensitivity()
|
|
||||||
{
|
|
||||||
m_curveName.uiCapability()->setUiReadOnly(m_autoName);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -358,101 +132,3 @@ const RigWellLogCurveData* RimWellLogCurve::curveData() const
|
|||||||
{
|
{
|
||||||
return m_curveData.p();
|
return m_curveData.p();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogCurve::updateCurveAppearance()
|
|
||||||
{
|
|
||||||
CVF_ASSERT(m_qwtPlotCurve);
|
|
||||||
|
|
||||||
QColor curveColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte());
|
|
||||||
|
|
||||||
QwtSymbol* symbol = NULL;
|
|
||||||
|
|
||||||
if (m_pointSymbol() != SYMBOL_NONE)
|
|
||||||
{
|
|
||||||
QwtSymbol::Style style = QwtSymbol::NoSymbol;
|
|
||||||
|
|
||||||
switch (m_pointSymbol())
|
|
||||||
{
|
|
||||||
case SYMBOL_ELLIPSE :
|
|
||||||
style = QwtSymbol::Ellipse;
|
|
||||||
break;
|
|
||||||
case SYMBOL_RECT:
|
|
||||||
style = QwtSymbol::Rect;
|
|
||||||
break;
|
|
||||||
case SYMBOL_DIAMOND:
|
|
||||||
style = QwtSymbol::Diamond;
|
|
||||||
break;
|
|
||||||
case SYMBOL_TRIANGLE:
|
|
||||||
style = QwtSymbol::Triangle;
|
|
||||||
break;
|
|
||||||
case SYMBOL_CROSS:
|
|
||||||
style = QwtSymbol::Cross;
|
|
||||||
break;
|
|
||||||
case SYMBOL_XCROSS:
|
|
||||||
style = QwtSymbol::XCross;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QwtPlotCurve will take ownership of the symbol
|
|
||||||
symbol = new QwtSymbol(style);
|
|
||||||
|
|
||||||
symbol->setSize(6, 6);
|
|
||||||
symbol->setColor(curveColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
QwtPlotCurve::CurveStyle curveStyle = QwtPlotCurve::NoCurve;
|
|
||||||
Qt::PenStyle penStyle = Qt::SolidLine;
|
|
||||||
|
|
||||||
if (m_lineStyle() != STYLE_NONE)
|
|
||||||
{
|
|
||||||
curveStyle = QwtPlotCurve::Lines;
|
|
||||||
|
|
||||||
switch (m_lineStyle())
|
|
||||||
{
|
|
||||||
case STYLE_SOLID:
|
|
||||||
penStyle = Qt::SolidLine;
|
|
||||||
break;
|
|
||||||
case STYLE_DASH:
|
|
||||||
penStyle = Qt::DashLine;
|
|
||||||
break;
|
|
||||||
case STYLE_DOT:
|
|
||||||
penStyle = Qt::DotLine;
|
|
||||||
break;
|
|
||||||
case STYLE_DASH_DOT:
|
|
||||||
penStyle = Qt::DashDotLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_qwtPlotCurve->setPen(curveColor, m_curveThickness, penStyle);
|
|
||||||
m_qwtPlotCurve->setStyle(curveStyle);
|
|
||||||
m_qwtPlotCurve->setSymbol(symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QList<caf::PdmOptionItemInfo> RimWellLogCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
|
||||||
{
|
|
||||||
QList<caf::PdmOptionItemInfo> options;
|
|
||||||
|
|
||||||
if (fieldNeedingOptions == &m_curveThickness)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
options.push_back(caf::PdmOptionItemInfo(QString::number(i + 1), QVariant::fromValue(i + 1)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -19,107 +19,35 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafPdmField.h"
|
#include "RimPlotCurve.h"
|
||||||
#include "cafPdmFieldCvfColor.h"
|
|
||||||
#include "cafPdmObject.h"
|
|
||||||
|
|
||||||
#include "RigWellLogCurveData.h"
|
#include "RigWellLogCurveData.h"
|
||||||
|
|
||||||
#include <QPointer>
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class RigWellLogCurveData;
|
class RigWellLogCurveData;
|
||||||
class RiuWellLogTrack;
|
|
||||||
class RiuLineSegmentQwtPlotCurve;
|
|
||||||
|
|
||||||
class QwtPlotCurve;
|
|
||||||
|
|
||||||
class QString;
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimWellLogCurve : public caf::PdmObject
|
class RimWellLogCurve : public RimPlotCurve
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
public:
|
public:
|
||||||
enum LineStyleEnum
|
|
||||||
{
|
|
||||||
STYLE_NONE,
|
|
||||||
STYLE_SOLID,
|
|
||||||
STYLE_DASH,
|
|
||||||
STYLE_DOT,
|
|
||||||
STYLE_DASH_DOT
|
|
||||||
};
|
|
||||||
|
|
||||||
enum PointSymbolEnum
|
|
||||||
{
|
|
||||||
SYMBOL_NONE,
|
|
||||||
SYMBOL_ELLIPSE,
|
|
||||||
SYMBOL_RECT,
|
|
||||||
SYMBOL_DIAMOND,
|
|
||||||
SYMBOL_TRIANGLE,
|
|
||||||
SYMBOL_CROSS,
|
|
||||||
SYMBOL_XCROSS
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RimWellLogCurve();
|
RimWellLogCurve();
|
||||||
virtual ~RimWellLogCurve();
|
virtual ~RimWellLogCurve();
|
||||||
|
|
||||||
void setColor(const cvf::Color3f& color);
|
|
||||||
|
|
||||||
bool depthRange(double* minimumDepth, double* maximumDepth) const;
|
bool depthRange(double* minimumDepth, double* maximumDepth) const;
|
||||||
bool valueRange(double* minimumValue, double* maximumValue) const;
|
bool valueRange(double* minimumValue, double* maximumValue) const;
|
||||||
|
|
||||||
void setQwtTrack(RiuWellLogTrack* plot);
|
|
||||||
void detachQwtCurve();
|
|
||||||
|
|
||||||
bool isCurveVisible() const;
|
|
||||||
|
|
||||||
QwtPlotCurve* plotCurve() const;
|
|
||||||
const RigWellLogCurveData* curveData() const;
|
const RigWellLogCurveData* curveData() const;
|
||||||
|
|
||||||
QString name() const { return m_curveName; }
|
|
||||||
void updateCurveName();
|
|
||||||
void updatePlotTitle();
|
|
||||||
|
|
||||||
virtual QString wellName() const = 0;
|
virtual QString wellName() const = 0;
|
||||||
virtual QString wellLogChannelName() const = 0;
|
virtual QString wellLogChannelName() const = 0;
|
||||||
virtual QString wellDate() const { return ""; };
|
virtual QString wellDate() const { return ""; };
|
||||||
virtual void updatePlotData() = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QString createCurveName() = 0;
|
virtual void zoomAllParentPlot();
|
||||||
|
|
||||||
void updatePlotConfiguration();
|
|
||||||
void updateCurveVisibility();
|
|
||||||
void zoomAllOwnerTrackAndPlot();
|
|
||||||
void updateOptionSensitivity();
|
|
||||||
void updateCurveAppearance();
|
|
||||||
|
|
||||||
// Overridden PDM methods
|
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
|
||||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
|
||||||
virtual void initAfterRead();
|
|
||||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
|
||||||
|
|
||||||
|
|
||||||
QPointer<RiuWellLogTrack> m_ownerQwtTrack;
|
|
||||||
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
|
|
||||||
cvf::ref<RigWellLogCurveData> m_curveData;
|
cvf::ref<RigWellLogCurveData> m_curveData;
|
||||||
|
|
||||||
caf::PdmField<bool> m_showCurve;
|
|
||||||
caf::PdmField<QString> m_curveName;
|
|
||||||
caf::PdmField<QString> m_customCurveName;
|
|
||||||
|
|
||||||
caf::PdmField<bool> m_autoName;
|
|
||||||
caf::PdmField<cvf::Color3f> m_curveColor;
|
|
||||||
caf::PdmField<float> m_curveThickness;
|
|
||||||
|
|
||||||
caf::PdmField< caf::AppEnum< PointSymbolEnum > > m_pointSymbol;
|
|
||||||
caf::PdmField< caf::AppEnum< LineStyleEnum > > m_lineStyle;
|
|
||||||
};
|
};
|
||||||
|
@ -165,15 +165,15 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
|
|||||||
{
|
{
|
||||||
clampTimestep();
|
clampTimestep();
|
||||||
|
|
||||||
this->updatePlotData();
|
this->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
else if (changedField == &m_wellPath)
|
else if (changedField == &m_wellPath)
|
||||||
{
|
{
|
||||||
this->updatePlotData();
|
this->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
else if (changedField == &m_timeStep)
|
else if (changedField == &m_timeStep)
|
||||||
{
|
{
|
||||||
this->updatePlotData();
|
this->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changedField == &m_addCaseNameToCurveName ||
|
if (changedField == &m_addCaseNameToCurveName ||
|
||||||
@ -184,16 +184,15 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
|
|||||||
{
|
{
|
||||||
this->uiCapability()->updateConnectedEditors();
|
this->uiCapability()->updateConnectedEditors();
|
||||||
updateCurveName();
|
updateCurveName();
|
||||||
updatePlotTitle();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogExtractionCurve::updatePlotData()
|
void RimWellLogExtractionCurve::onLoadDataAndUpdate()
|
||||||
{
|
{
|
||||||
RimWellLogCurve::updatePlotConfiguration();
|
RimWellLogCurve::updateCurvePresentation();
|
||||||
|
|
||||||
if (isCurveVisible())
|
if (isCurveVisible())
|
||||||
{
|
{
|
||||||
@ -292,11 +291,11 @@ void RimWellLogExtractionCurve::updatePlotData()
|
|||||||
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
||||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
||||||
|
|
||||||
zoomAllOwnerTrackAndPlot();
|
zoomAllParentPlot();
|
||||||
|
|
||||||
setLogScaleFromSelectedResult();
|
setLogScaleFromSelectedResult();
|
||||||
|
|
||||||
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,8 +402,8 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
|
|||||||
appearanceGroup->add(&m_pointSymbol);
|
appearanceGroup->add(&m_pointSymbol);
|
||||||
appearanceGroup->add(&m_lineStyle);
|
appearanceGroup->add(&m_lineStyle);
|
||||||
appearanceGroup->add(&m_curveName);
|
appearanceGroup->add(&m_curveName);
|
||||||
appearanceGroup->add(&m_autoName);
|
appearanceGroup->add(&m_isUsingAutoName);
|
||||||
if (m_autoName)
|
if (m_isUsingAutoName)
|
||||||
{
|
{
|
||||||
appearanceGroup->add(&m_addWellNameToCurveName);
|
appearanceGroup->add(&m_addWellNameToCurveName);
|
||||||
appearanceGroup->add(&m_addCaseNameToCurveName);
|
appearanceGroup->add(&m_addCaseNameToCurveName);
|
||||||
@ -463,7 +462,7 @@ void RimWellLogExtractionCurve::setLogScaleFromSelectedResult()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimWellLogExtractionCurve::createCurveName()
|
QString RimWellLogExtractionCurve::createCurveAutoName()
|
||||||
{
|
{
|
||||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
|
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
|
||||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
|
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
|
||||||
|
@ -41,7 +41,6 @@ public:
|
|||||||
RimWellLogExtractionCurve();
|
RimWellLogExtractionCurve();
|
||||||
virtual ~RimWellLogExtractionCurve();
|
virtual ~RimWellLogExtractionCurve();
|
||||||
|
|
||||||
virtual void updatePlotData();
|
|
||||||
|
|
||||||
void setWellPath(RimWellPath* wellPath);
|
void setWellPath(RimWellPath* wellPath);
|
||||||
void setPropertiesFromView(RimView* view);
|
void setPropertiesFromView(RimView* view);
|
||||||
@ -51,7 +50,8 @@ public:
|
|||||||
virtual QString wellDate() const;
|
virtual QString wellDate() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QString createCurveName();
|
virtual QString createCurveAutoName();
|
||||||
|
virtual void onLoadDataAndUpdate();
|
||||||
|
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||||
|
@ -68,9 +68,9 @@ RimWellLogFileCurve::~RimWellLogFileCurve()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogFileCurve::updatePlotData()
|
void RimWellLogFileCurve::onLoadDataAndUpdate()
|
||||||
{
|
{
|
||||||
RimWellLogCurve::updatePlotConfiguration();
|
RimWellLogCurve::updateCurvePresentation();
|
||||||
|
|
||||||
if (isCurveVisible())
|
if (isCurveVisible())
|
||||||
{
|
{
|
||||||
@ -107,9 +107,9 @@ void RimWellLogFileCurve::updatePlotData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_autoName)
|
if (m_isUsingAutoName)
|
||||||
{
|
{
|
||||||
m_qwtPlotCurve->setTitle(createCurveName());
|
m_qwtPlotCurve->setTitle(createCurveAutoName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,9 +123,9 @@ void RimWellLogFileCurve::updatePlotData()
|
|||||||
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
|
||||||
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
|
||||||
|
|
||||||
zoomAllOwnerTrackAndPlot();
|
zoomAllParentPlot();
|
||||||
|
|
||||||
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,14 +154,14 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
|||||||
|
|
||||||
if (changedField == &m_wellPath)
|
if (changedField == &m_wellPath)
|
||||||
{
|
{
|
||||||
this->updatePlotData();
|
this->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
else if (changedField == &m_wellLogChannnelName)
|
else if (changedField == &m_wellLogChannnelName)
|
||||||
{
|
{
|
||||||
this->updatePlotData();
|
this->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
|
if (m_parentQwtPlot) m_parentQwtPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -179,7 +179,7 @@ void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
|
|||||||
appearanceGroup->add(&m_pointSymbol);
|
appearanceGroup->add(&m_pointSymbol);
|
||||||
appearanceGroup->add(&m_lineStyle);
|
appearanceGroup->add(&m_lineStyle);
|
||||||
appearanceGroup->add(&m_curveName);
|
appearanceGroup->add(&m_curveName);
|
||||||
appearanceGroup->add(&m_autoName);
|
appearanceGroup->add(&m_isUsingAutoName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -251,7 +251,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions(const c
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimWellLogFileCurve::createCurveName()
|
QString RimWellLogFileCurve::createCurveAutoName()
|
||||||
{
|
{
|
||||||
if (m_wellPath)
|
if (m_wellPath)
|
||||||
{
|
{
|
||||||
|
@ -45,13 +45,13 @@ public:
|
|||||||
void setWellLogChannelName(const QString& name);
|
void setWellLogChannelName(const QString& name);
|
||||||
|
|
||||||
// Overrides from RimWellLogPlotCurve
|
// Overrides from RimWellLogPlotCurve
|
||||||
virtual void updatePlotData();
|
|
||||||
virtual QString wellName() const;
|
virtual QString wellName() const;
|
||||||
virtual QString wellLogChannelName() const;
|
virtual QString wellLogChannelName() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overrides from RimWellLogPlotCurve
|
// Overrides from RimWellLogPlotCurve
|
||||||
virtual QString createCurveName();
|
virtual QString createCurveAutoName();
|
||||||
|
virtual void onLoadDataAndUpdate();
|
||||||
|
|
||||||
// Pdm overrrides
|
// Pdm overrrides
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
@ -76,9 +76,6 @@ RimWellLogPlot::RimWellLogPlot()
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", "");
|
||||||
m_tracks.uiCapability()->setUiHidden(true);
|
m_tracks.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&windowGeometry, "WindowGeometry", "", "", "", "");
|
|
||||||
windowGeometry.uiCapability()->setUiHidden(true);
|
|
||||||
|
|
||||||
m_minAvailableDepth = HUGE_VAL;
|
m_minAvailableDepth = HUGE_VAL;
|
||||||
m_maxAvailableDepth = -HUGE_VAL;
|
m_maxAvailableDepth = -HUGE_VAL;
|
||||||
}
|
}
|
||||||
@ -109,7 +106,7 @@ void RimWellLogPlot::updateViewerWidget()
|
|||||||
|
|
||||||
recreateTrackPlots();
|
recreateTrackPlots();
|
||||||
|
|
||||||
RiuMainWindow::instance()->addViewer(m_viewer, windowGeometry());
|
RiuMainWindow::instance()->addViewer(m_viewer, this->mdiWindowGeometry());
|
||||||
RiuMainWindow::instance()->setActiveViewer(m_viewer);
|
RiuMainWindow::instance()->setActiveViewer(m_viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +116,7 @@ void RimWellLogPlot::updateViewerWidget()
|
|||||||
{
|
{
|
||||||
if (m_viewer)
|
if (m_viewer)
|
||||||
{
|
{
|
||||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer));
|
||||||
|
|
||||||
RiuMainWindow::instance()->removeViewer(m_viewer);
|
RiuMainWindow::instance()->removeViewer(m_viewer);
|
||||||
detachAllCurves();
|
detachAllCurves();
|
||||||
@ -368,7 +365,7 @@ void RimWellLogPlot::setupBeforeSave()
|
|||||||
{
|
{
|
||||||
if (m_viewer)
|
if (m_viewer)
|
||||||
{
|
{
|
||||||
windowGeometry = RiuMainWindow::instance()->windowGeometryForViewer(m_viewer);
|
this->setMdiWindowGeometry( RiuMainWindow::instance()->windowGeometryForViewer(m_viewer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include "RimDefines.h"
|
#include "RimDefines.h"
|
||||||
|
|
||||||
|
#include "RimViewWindow.h"
|
||||||
|
|
||||||
class RiuWellLogPlot;
|
class RiuWellLogPlot;
|
||||||
class RimWellLogTrack;
|
class RimWellLogTrack;
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ class RimWellLogTrack;
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class RimWellLogPlot : public caf::PdmObject
|
class RimWellLogPlot : public RimViewWindow
|
||||||
{
|
{
|
||||||
CAF_PDM_HEADER_INIT;
|
CAF_PDM_HEADER_INIT;
|
||||||
|
|
||||||
@ -59,8 +61,6 @@ public:
|
|||||||
|
|
||||||
QString depthPlotTitle() const;
|
QString depthPlotTitle() const;
|
||||||
|
|
||||||
caf::PdmField< std::vector<int> > windowGeometry;
|
|
||||||
|
|
||||||
void addTrack(RimWellLogTrack* track);
|
void addTrack(RimWellLogTrack* track);
|
||||||
void insertTrack(RimWellLogTrack* track, size_t index);
|
void insertTrack(RimWellLogTrack* track, size_t index);
|
||||||
size_t trackCount() { return m_tracks.size();}
|
size_t trackCount() { return m_tracks.size();}
|
||||||
|
@ -160,7 +160,7 @@ void RimWellLogTrack::addCurve(RimWellLogCurve* curve)
|
|||||||
|
|
||||||
if (m_wellLogTrackPlotWidget)
|
if (m_wellLogTrackPlotWidget)
|
||||||
{
|
{
|
||||||
curve->setQwtTrack(m_wellLogTrackPlotWidget);
|
curve->setParentQwtPlot(m_wellLogTrackPlotWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ void RimWellLogTrack::insertCurve(RimWellLogCurve* curve, size_t index)
|
|||||||
|
|
||||||
if (m_wellLogTrackPlotWidget)
|
if (m_wellLogTrackPlotWidget)
|
||||||
{
|
{
|
||||||
curve->setQwtTrack(m_wellLogTrackPlotWidget);
|
curve->setParentQwtPlot(m_wellLogTrackPlotWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ void RimWellLogTrack::loadDataAndUpdate()
|
|||||||
|
|
||||||
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
||||||
{
|
{
|
||||||
curves[cIdx]->updatePlotData();
|
curves[cIdx]->loadDataAndUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ void RimWellLogTrack::recreateViewer()
|
|||||||
|
|
||||||
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
||||||
{
|
{
|
||||||
curves[cIdx]->setQwtTrack(this->m_wellLogTrackPlotWidget);
|
curves[cIdx]->setParentQwtPlot(this->m_wellLogTrackPlotWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ RimWellLogCurve* RimWellLogTrack::curveDefinitionFromCurve(const QwtPlotCurve* c
|
|||||||
{
|
{
|
||||||
for (size_t idx = 0; idx < curves.size(); idx++)
|
for (size_t idx = 0; idx < curves.size(); idx++)
|
||||||
{
|
{
|
||||||
if (curves[idx]->plotCurve() == curve)
|
if (curves[idx]->qwtPlotCurve() == curve)
|
||||||
{
|
{
|
||||||
return curves[idx];
|
return curves[idx];
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathAsciiFileRe
|
|||||||
void RimWellPath::readJsonWellPathFile()
|
void RimWellPath::readJsonWellPathFile()
|
||||||
{
|
{
|
||||||
RigWellPath* wellPathGeom = new RigWellPath();
|
RigWellPath* wellPathGeom = new RigWellPath();
|
||||||
JsonReader jsonReader;
|
ResInsightInternalJson::JsonReader jsonReader;
|
||||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(filepath);
|
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(filepath);
|
||||||
|
|
||||||
// General well info
|
// General well info
|
||||||
|
@ -39,6 +39,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h
|
|||||||
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h
|
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h
|
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
|
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -73,6 +74,7 @@ ${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp
|
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp
|
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
|
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RigSummaryCaseData.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
60
ApplicationCode/ReservoirDataModel/RigSummaryCaseData.cpp
Normal file
60
ApplicationCode/ReservoirDataModel/RigSummaryCaseData.cpp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RigSummaryCaseData.h"
|
||||||
|
|
||||||
|
#include "RifEclipseSummaryTools.h"
|
||||||
|
#include "RifReaderEclipseSummary.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigSummaryCaseData::RigSummaryCaseData(const QString& summaryHeaderFileName)
|
||||||
|
{
|
||||||
|
std::string headerFileName;
|
||||||
|
std::vector<std::string> dataFileNames;
|
||||||
|
std::string nativeSumHeadFileName = QDir::toNativeSeparators(summaryHeaderFileName).toStdString();
|
||||||
|
RifEclipseSummaryTools::findSummaryFiles(nativeSumHeadFileName, &headerFileName, &dataFileNames);
|
||||||
|
|
||||||
|
m_summaryFileReader = new RifReaderEclipseSummary();
|
||||||
|
if (!m_summaryFileReader->open(headerFileName, dataFileNames))
|
||||||
|
{
|
||||||
|
m_summaryFileReader = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigSummaryCaseData::~RigSummaryCaseData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RifReaderEclipseSummary* RigSummaryCaseData::summaryReader()
|
||||||
|
{
|
||||||
|
return m_summaryFileReader.p();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
39
ApplicationCode/ReservoirDataModel/RigSummaryCaseData.h
Normal file
39
ApplicationCode/ReservoirDataModel/RigSummaryCaseData.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "cvfBase.h"
|
||||||
|
#include "cvfObject.h"
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
class RifReaderEclipseSummary;
|
||||||
|
|
||||||
|
class RigSummaryCaseData: public cvf::Object
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RigSummaryCaseData(const QString& summaryHeaderFileName );
|
||||||
|
~RigSummaryCaseData();
|
||||||
|
|
||||||
|
|
||||||
|
RifReaderEclipseSummary* summaryReader();
|
||||||
|
|
||||||
|
private:
|
||||||
|
cvf::ref<RifReaderEclipseSummary> m_summaryFileReader;
|
||||||
|
|
||||||
|
};
|
@ -17,6 +17,8 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
class RimCase;
|
class RimCase;
|
||||||
class RiaSocketServer;
|
class RiaSocketServer;
|
||||||
class RimEclipseCase;
|
class RimEclipseCase;
|
||||||
|
@ -21,6 +21,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator-Test.cpp
|
|||||||
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper-Test.cpp
|
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper-Test.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}ScalarMapper-Test.cpp
|
${CEE_CURRENT_LIST_DIR}ScalarMapper-Test.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}WellPathAsciiFileReader-Test.cpp
|
${CEE_CURRENT_LIST_DIR}WellPathAsciiFileReader-Test.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}opm-parser-Test.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/*
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#include <int_vector.h>
|
#include <int_vector.h>
|
||||||
#include <ecl_file.h>
|
#include <ecl_file.h>
|
||||||
@ -34,6 +35,7 @@
|
|||||||
#include <well_info.h>
|
#include <well_info.h>
|
||||||
#include <well_conn.h>
|
#include <well_conn.h>
|
||||||
#include <well_ts.h>
|
#include <well_ts.h>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
|
|
||||||
#include "RigCaseData.h"
|
#include "RigCaseData.h"
|
||||||
|
|
||||||
|
#include <ert/ecl/ecl_file.h>
|
||||||
|
|
||||||
#include "RifReaderEclipseOutput.h"
|
#include "RifReaderEclipseOutput.h"
|
||||||
#include "ecl_file.h"
|
|
||||||
#include "RifEclipseOutputFileTools.h"
|
#include "RifEclipseOutputFileTools.h"
|
||||||
#include "RigCaseCellResultsData.h"
|
#include "RigCaseCellResultsData.h"
|
||||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||||
|
@ -21,13 +21,15 @@
|
|||||||
#include "RifReaderEclipseSummary.h"
|
#include "RifReaderEclipseSummary.h"
|
||||||
#include "RifEclipseSummaryTools.h"
|
#include "RifEclipseSummaryTools.h"
|
||||||
|
|
||||||
#include "stringlist.h"
|
//#include "stringlist.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
void printDateAndValues(const std::vector<QDateTime>& dates, const std::vector<double>& values)
|
void printDateAndValues(const std::vector<QDateTime>& dates, const std::vector<double>& values)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(dates.size() == values.size());
|
EXPECT_TRUE(dates.size() == values.size());
|
||||||
@ -40,8 +42,50 @@ void printDateAndValues(const std::vector<QDateTime>& dates, const std::vector<d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
TEST(RifEclipseSummaryTest, SummaryToolsFindSummaryFiles)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
// std::string filename = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010";
|
||||||
|
std::string filename = "g:\\Models\\Statoil\\testcase_juli_2011\\data\\TEST10K_FLT_LGR_NNC";
|
||||||
|
|
||||||
|
{
|
||||||
|
std::string headerFile;
|
||||||
|
bool isFormatted = false;
|
||||||
|
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &headerFile, &isFormatted);
|
||||||
|
|
||||||
|
EXPECT_FALSE(isFormatted);
|
||||||
|
EXPECT_FALSE(headerFile.empty());
|
||||||
|
|
||||||
|
std::vector<std::string> dataFiles = RifEclipseSummaryTools::findSummaryDataFiles(filename);
|
||||||
|
EXPECT_TRUE(dataFiles.size() > 0);
|
||||||
|
|
||||||
|
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new RifReaderEclipseSummary);
|
||||||
|
eclSummary->open(headerFile, dataFiles);
|
||||||
|
|
||||||
|
RifEclipseSummaryTools::dumpMetaData(eclSummary.get());
|
||||||
|
|
||||||
|
// Create a vector of summary addresses based on type, item name and variable name, and compare the resulting
|
||||||
|
// resultAddressString to the original string
|
||||||
|
|
||||||
|
std::vector<RifEclipseSummaryAddress> addresses = eclSummary->allResultAddresses();
|
||||||
|
std::vector<RifEclipseSummaryAddress> myAddresses;
|
||||||
|
for (size_t i = 0; i < addresses.size(); i++)
|
||||||
|
{
|
||||||
|
RifEclipseSummaryAddress adr(addresses[i].category(), addresses[i].simulationItemName(), addresses[i].quantityName());
|
||||||
|
myAddresses.push_back(adr);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < addresses.size(); i++)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(addresses[i].ertSummaryVarId().compare(myAddresses[i].ertSummaryVarId()) == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
163
ApplicationCode/UnitTests/opm-parser-Test.cpp
Normal file
163
ApplicationCode/UnitTests/opm-parser-Test.cpp
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#include "opm/parser/eclipse/Parser/Parser.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace Opm;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
TEST(opm_parser_test, basicConstruction)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Several filenames taken from Models/Statoil folder
|
||||||
|
|
||||||
|
/*
|
||||||
|
std::string filename = "d:/Models/MRST/simple/SIMPLE.DATA";
|
||||||
|
std::string filename = "d:/gitroot/opm-data/spe1/SPE1CASE1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/Brillig/BRILLIG.DATA";
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::string filename = "d:/gitroot-magnesj/opm-parser/testdata/cases_with_issues/testcase_juli_2011/TEST10K_FLT_LGR_NNC.DATA";
|
||||||
|
/*
|
||||||
|
std::string filename = "d:/Models/Statoil/1.2.0_Osesyd_segfault/BASEPRED6.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/1.3.0_fault_assert_binary/BV-R2-11-0.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/Brillig/BRILLIG_FMTOUT.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/ceetron-case.tar/ceetron-case.tar";
|
||||||
|
std::string filename = "d:/Models/Statoil/ceetron-case/.#R5_22X22_H25_C1_SW2_FV1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/ceetron-case/R5_22X22_H25_C1_SW2_FV1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/CO2_well_rst_error/E300_THERMAL_23_RS.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/E300_thermal_option/DualProperty/DUALPERM.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/E300_thermal_option/DualProperty/DUALPORO.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/HD_TEST/HD_TEST.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/HM_10/HM_10.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/LGC_TESTCASE2/LGC_TESTCASE2.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/MAGNE_DUALK2PORO_DPNUMz/DUALK2PORO_DPNUM.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/missingCorner_TP4093/TRAINING_FIXED_MOVE_INJ1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/nnc_faults/TEST10K_FLT_LGR_NNC0P03_FAULTS1P0.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/NNCsDisconnected/TEST10K_FLT_LGR_NNC0P03_LGRNNC0P02_FAULTS0P1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/NNCsDisconnected/TEST10K_FLT_LGR_NNC0P03_NNC0P02_FAULTS0P1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_10K_MultipleTimestepsSameDay/TEST10K_FLT_LGR_NNC_TSTEP.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_10K_SingleTStep/TEST10K_FLT_LGR_NNC_TSTEP.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_DualPerm/DUALPERM.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_DualPoro/DUALPORO.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_Large_FirstLargeCase/R5_22X22_H25_C1_SW2_FV1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_LGC/LGC_TESTCASE2.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_LGR_Amalg/TESTCASE_AMALG_LGR.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/1NotRun/TestCase_Wells_HM_10/HM_10.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/TestCase_10K_Complete/TEST10K_FLT_LGR_NNC.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/RegressionTests/tmp/TestCase_MultiRestartFile_CO2_well_rst_error/E300_THERMAL_23_RS.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/SmbS_ffm/REF161213.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/TEST_RKMFAULTS/TEST_RKMFAULTS.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/TEST10K_FLT_LGR_NNC_TSTEP/TEST10K_FLT_LGR_NNC_TSTEP.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/TestCase_10K_MultipleTimestepsSameDay/TEST10K_FLT_LGR_NNC_TSTEP.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/testcase_amalg_lgr/TESTCASE_AMALG_LGR.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/trainint_fixed_move/TRAINING_FIXED_MOVE_INJ1.DATA";
|
||||||
|
std::string filename = "d:/Models/Statoil/troll_Ref2014/T07-4A-W2014-06.DATA";
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
try
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch (CException* e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
ParseContext parseContext;
|
||||||
|
parseContext.update(InputError::WARN);
|
||||||
|
|
||||||
|
Opm::ParserPtr parser(new Opm::Parser());
|
||||||
|
Opm::DeckConstPtr deck = parser->parseFile(filename, parseContext);
|
||||||
|
|
||||||
|
Opm::EclipseState es(deck, parseContext);
|
||||||
|
auto ep = es.get3DProperties();
|
||||||
|
auto grid = es.getInputGrid();
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Parser parser;
|
||||||
|
const auto deck = parser.newDeckFromFile(filename, Opm::ParseContext());
|
||||||
|
const auto grid = Parser::parseGrid(*deck);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
std::string inline_json = "{\"key\": \"value\"}";
|
||||||
|
Json::JsonObject parser(inline_json);
|
||||||
|
parser.has_item("key");
|
||||||
|
parser.has_item("keyX");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
ParserStringItemPtr itemString(new ParserStringItem(std::string("STRINGITEM1")));
|
||||||
|
ParserRecordPtr record1(new ParserRecord());
|
||||||
|
RawRecord rawRecord(" ' VALUE ' ");
|
||||||
|
ParseContext parseContext;
|
||||||
|
record1->addItem(itemString);
|
||||||
|
//BOOST_CHECK_EQUAL(" VALUE ", deckRecord.getItem(0).get< std::string >(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
const auto* input_deck = "RUNSPEC\n\n"
|
||||||
|
"TITLE\n\n"
|
||||||
|
"DIMENS\n10 10 10/\n"
|
||||||
|
"EQLDIMS\n/\n";
|
||||||
|
|
||||||
|
Parser parser;
|
||||||
|
const auto deck = parser.newDeckFromString(input_deck, ParseContext());
|
||||||
|
//BOOST_CHECK_EQUAL("untitled", deck->getKeyword("TITLE").getStringData().front());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TEST opm- common
|
||||||
|
TEST(opm_parser_test, opm_common_test)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Logger logger;
|
||||||
|
std::ostringstream log_stream;
|
||||||
|
std::shared_ptr<CounterLog> counter = std::make_shared<CounterLog>();
|
||||||
|
std::shared_ptr<StreamLog> streamLog = std::make_shared<StreamLog>(log_stream, Log::MessageType::Warning);
|
||||||
|
logger.hasBackend("NO");
|
||||||
|
|
||||||
|
logger.addBackend("COUNTER", counter);
|
||||||
|
logger.addBackend("STREAM", streamLog);
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
BOOST_CHECK_EQUAL(true, logger.hasBackend("COUNTER"));
|
||||||
|
BOOST_CHECK_EQUAL(true, logger.hasBackend("STREAM"));
|
||||||
|
|
||||||
|
logger.addMessage(Log::MessageType::Error, "Error");
|
||||||
|
logger.addMessage(Log::MessageType::Warning, "Warning");
|
||||||
|
BOOST_CHECK_EQUAL(1U, counter->numMessages(Log::MessageType::Error));
|
||||||
|
BOOST_CHECK_EQUAL(1U, counter->numMessages(Log::MessageType::Warning));
|
||||||
|
BOOST_CHECK_EQUAL(0U, counter->numMessages(Log::MessageType::Info));
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(log_stream.str(), "Warning\n");
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_CHECK_THROW(logger.getBackend<LogBackend>("No"), std::invalid_argument);
|
||||||
|
{
|
||||||
|
auto counter2 = logger.getBackend<CounterLog>("COUNTER");
|
||||||
|
BOOST_CHECK_EQUAL(1U, counter2->numMessages(Log::MessageType::Warning));
|
||||||
|
BOOST_CHECK_EQUAL(1U, counter2->numMessages(Log::MessageType::Error));
|
||||||
|
BOOST_CHECK_EQUAL(0, counter2->numMessages(Log::MessageType::Info));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(false, logger.removeBackend("NO-not-found"));
|
||||||
|
BOOST_CHECK_EQUAL(true, logger.removeBackend("COUNTER"));
|
||||||
|
BOOST_CHECK_EQUAL(false, logger.hasBackend("COUNTER"));
|
||||||
|
*/
|
||||||
|
}
|
@ -20,6 +20,8 @@
|
|||||||
#include "RiuLineSegmentQwtPlotCurve.h"
|
#include "RiuLineSegmentQwtPlotCurve.h"
|
||||||
|
|
||||||
#include "qwt_symbol.h"
|
#include "qwt_symbol.h"
|
||||||
|
#include "RigCurveDataTools.h"
|
||||||
|
#include "qwt_date.h"
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -37,6 +39,44 @@ RiuLineSegmentQwtPlotCurve::~RiuLineSegmentQwtPlotCurve()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuLineSegmentQwtPlotCurve::setSamplesFromDateAndValues(const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(dateTimes.size() == timeHistoryValues.size());
|
||||||
|
|
||||||
|
QPolygonF points;
|
||||||
|
std::vector< std::pair<size_t, size_t> > filteredIntervals;
|
||||||
|
{
|
||||||
|
std::vector<double> filteredTimeHistoryValues;
|
||||||
|
std::vector<QDateTime> filteredDateTimes;
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector< std::pair<size_t, size_t> > intervalsOfValidValues;
|
||||||
|
RigCurveDataTools::calculateIntervalsOfValidValues(timeHistoryValues, &intervalsOfValidValues);
|
||||||
|
|
||||||
|
RigCurveDataTools::getValuesByIntervals(timeHistoryValues, intervalsOfValidValues, &filteredTimeHistoryValues);
|
||||||
|
RigCurveDataTools::getValuesByIntervals(dateTimes, intervalsOfValidValues, &filteredDateTimes);
|
||||||
|
|
||||||
|
RigCurveDataTools::computePolyLineStartStopIndices(intervalsOfValidValues, &filteredIntervals);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (size_t i = 0; i < filteredDateTimes.size(); i++)
|
||||||
|
{
|
||||||
|
double milliSecSinceEpoch = QwtDate::toDouble(filteredDateTimes[i]);
|
||||||
|
points << QPointF(milliSecSinceEpoch, filteredTimeHistoryValues[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RiuLineSegmentQwtPlotCurve* plotCurve = new RiuLineSegmentQwtPlotCurve("Curve 1");
|
||||||
|
|
||||||
|
this->setSamples(points);
|
||||||
|
this->setLineSegmentStartStopIndices(filteredIntervals);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -47,6 +47,8 @@ public:
|
|||||||
explicit RiuLineSegmentQwtPlotCurve(const QString &title = QString::null);
|
explicit RiuLineSegmentQwtPlotCurve(const QString &title = QString::null);
|
||||||
virtual ~RiuLineSegmentQwtPlotCurve();
|
virtual ~RiuLineSegmentQwtPlotCurve();
|
||||||
|
|
||||||
|
void setSamplesFromDateAndValues(const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues);
|
||||||
|
|
||||||
void setLineSegmentStartStopIndices(const std::vector< std::pair<size_t, size_t> >& lineSegmentStartStopIndices);
|
void setLineSegmentStartStopIndices(const std::vector< std::pair<size_t, size_t> >& lineSegmentStartStopIndices);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -49,8 +49,10 @@
|
|||||||
#include "RimReservoirCellResultsStorage.h"
|
#include "RimReservoirCellResultsStorage.h"
|
||||||
#include "RimTools.h"
|
#include "RimTools.h"
|
||||||
#include "RimTreeViewStateSerializer.h"
|
#include "RimTreeViewStateSerializer.h"
|
||||||
|
#include "RimViewWindow.h"
|
||||||
#include "RimWellLogPlot.h"
|
#include "RimWellLogPlot.h"
|
||||||
#include "RimWellLogPlotCollection.h"
|
#include "RimWellLogPlotCollection.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
#include "RimWellPathImport.h"
|
#include "RimWellPathImport.h"
|
||||||
|
|
||||||
#include "RiuDragDrop.h"
|
#include "RiuDragDrop.h"
|
||||||
@ -59,6 +61,7 @@
|
|||||||
#include "RiuProjectPropertyView.h"
|
#include "RiuProjectPropertyView.h"
|
||||||
#include "RiuResultInfoPanel.h"
|
#include "RiuResultInfoPanel.h"
|
||||||
#include "RiuResultQwtPlot.h"
|
#include "RiuResultQwtPlot.h"
|
||||||
|
#include "RiuSummaryQwtPlot.h"
|
||||||
#include "RiuTreeViewEventFilter.h"
|
#include "RiuTreeViewEventFilter.h"
|
||||||
#include "RiuViewer.h"
|
#include "RiuViewer.h"
|
||||||
#include "RiuWellImportWizard.h"
|
#include "RiuWellImportWizard.h"
|
||||||
@ -1216,16 +1219,21 @@ protected:
|
|||||||
QWidget* mainWidget = widget();
|
QWidget* mainWidget = widget();
|
||||||
|
|
||||||
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(mainWidget);
|
RiuWellLogPlot* wellLogPlot = dynamic_cast<RiuWellLogPlot*>(mainWidget);
|
||||||
|
RiuSummaryQwtPlot* summaryPlot = dynamic_cast<RiuSummaryQwtPlot*>(mainWidget);
|
||||||
if (wellLogPlot)
|
if (wellLogPlot)
|
||||||
{
|
{
|
||||||
wellLogPlot->ownerPlotDefinition()->windowGeometry = RiuMainWindow::instance()->windowGeometryForWidget(this);
|
wellLogPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
|
||||||
|
}
|
||||||
|
else if (summaryPlot)
|
||||||
|
{
|
||||||
|
summaryPlot->ownerPlotDefinition()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
|
RiuViewer* viewer = mainWidget->findChild<RiuViewer*>();
|
||||||
if (viewer)
|
if (viewer)
|
||||||
{
|
{
|
||||||
viewer->ownerReservoirView()->windowGeometry = RiuMainWindow::instance()->windowGeometryForWidget(this);
|
viewer->ownerReservoirView()->setMdiWindowGeometry(RiuMainWindow::instance()->windowGeometryForWidget(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1236,7 +1244,7 @@ protected:
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuMainWindow::addViewer(QWidget* viewer, const std::vector<int>& windowsGeometry)
|
void RiuMainWindow::addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry)
|
||||||
{
|
{
|
||||||
RiuMdiSubWindow* subWin = new RiuMdiSubWindow(m_mdiArea);
|
RiuMdiSubWindow* subWin = new RiuMdiSubWindow(m_mdiArea);
|
||||||
subWin->setAttribute(Qt::WA_DeleteOnClose); // Make sure the contained widget is destroyed when the MDI window is closed
|
subWin->setAttribute(Qt::WA_DeleteOnClose); // Make sure the contained widget is destroyed when the MDI window is closed
|
||||||
@ -1246,15 +1254,12 @@ void RiuMainWindow::addViewer(QWidget* viewer, const std::vector<int>& windowsGe
|
|||||||
QPoint subWindowPos(-1, -1);
|
QPoint subWindowPos(-1, -1);
|
||||||
bool initialStateMaximized = false;
|
bool initialStateMaximized = false;
|
||||||
|
|
||||||
if (windowsGeometry.size() == 5)
|
if (windowsGeometry.isValid())
|
||||||
{
|
{
|
||||||
subWindowPos = QPoint(windowsGeometry[0], windowsGeometry[1]);
|
subWindowPos = QPoint(windowsGeometry.x, windowsGeometry.y);
|
||||||
subWindowSize = QSize(windowsGeometry[2], windowsGeometry[3]);
|
subWindowSize = QSize(windowsGeometry.width, windowsGeometry.height);
|
||||||
|
|
||||||
if (windowsGeometry[4] > 0)
|
initialStateMaximized = windowsGeometry.isMaximized;
|
||||||
{
|
|
||||||
initialStateMaximized = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2214,7 +2219,7 @@ void RiuMainWindow::customMenuRequested(const QPoint& pos)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<int> RiuMainWindow::windowGeometryForViewer(QWidget* viewer)
|
RimMdiWindowGeometry RiuMainWindow::windowGeometryForViewer(QWidget* viewer)
|
||||||
{
|
{
|
||||||
QMdiSubWindow* mdiWindow = findMdiSubWindow(viewer);
|
QMdiSubWindow* mdiWindow = findMdiSubWindow(viewer);
|
||||||
if (mdiWindow)
|
if (mdiWindow)
|
||||||
@ -2222,24 +2227,24 @@ std::vector<int> RiuMainWindow::windowGeometryForViewer(QWidget* viewer)
|
|||||||
return windowGeometryForWidget(mdiWindow);
|
return windowGeometryForWidget(mdiWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> geo;
|
RimMdiWindowGeometry geo;
|
||||||
return geo;
|
return geo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<int> RiuMainWindow::windowGeometryForWidget(QWidget* widget)
|
RimMdiWindowGeometry RiuMainWindow::windowGeometryForWidget(QWidget* widget)
|
||||||
{
|
{
|
||||||
std::vector<int> geo;
|
RimMdiWindowGeometry geo;
|
||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
{
|
{
|
||||||
geo.push_back(widget->pos().x());
|
geo.x = widget->pos().x();
|
||||||
geo.push_back(widget->pos().y());
|
geo.y = widget->pos().y();
|
||||||
geo.push_back(widget->size().width());
|
geo.width = widget->size().width();
|
||||||
geo.push_back(widget->size().height());
|
geo.height = widget->size().height();
|
||||||
geo.push_back(widget->isMaximized());
|
geo.isMaximized = widget->isMaximized();
|
||||||
}
|
}
|
||||||
|
|
||||||
return geo;
|
return geo;
|
||||||
|
@ -43,6 +43,7 @@ class RiuResultInfoPanel;
|
|||||||
class RiuViewer;
|
class RiuViewer;
|
||||||
class RiuWellLogPlot;
|
class RiuWellLogPlot;
|
||||||
class RiuResultQwtPlot;
|
class RiuResultQwtPlot;
|
||||||
|
struct RimMdiWindowGeometry;
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
@ -78,7 +79,7 @@ public:
|
|||||||
void cleanupGuiBeforeProjectClose();
|
void cleanupGuiBeforeProjectClose();
|
||||||
|
|
||||||
void removeViewer( QWidget* viewer );
|
void removeViewer( QWidget* viewer );
|
||||||
void addViewer(QWidget* viewer, const std::vector<int>& windowsGeometry);
|
void addViewer(QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry);
|
||||||
void setActiveViewer(QWidget* subWindow);
|
void setActiveViewer(QWidget* subWindow);
|
||||||
|
|
||||||
void setResultInfo(const QString& info) const;
|
void setResultInfo(const QString& info) const;
|
||||||
@ -106,8 +107,8 @@ public:
|
|||||||
void addRecentFiles(const QString& file);
|
void addRecentFiles(const QString& file);
|
||||||
void removeRecentFiles(const QString& file);
|
void removeRecentFiles(const QString& file);
|
||||||
|
|
||||||
std::vector<int> windowGeometryForViewer(QWidget* viewer);
|
RimMdiWindowGeometry windowGeometryForViewer(QWidget* viewer);
|
||||||
std::vector<int> windowGeometryForWidget(QWidget* widget);
|
RimMdiWindowGeometry windowGeometryForWidget(QWidget* widget);
|
||||||
|
|
||||||
void tileWindows();
|
void tileWindows();
|
||||||
bool isAnyMdiSubWindowVisible();
|
bool isAnyMdiSubWindowVisible();
|
||||||
|
@ -64,33 +64,9 @@ RiuResultQwtPlot::~RiuResultQwtPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuResultQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues)
|
void RiuResultQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(dateTimes.size() == timeHistoryValues.size());
|
|
||||||
|
|
||||||
std::vector<double> filteredTimeHistoryValues;
|
|
||||||
std::vector<QDateTime> filteredDateTimes;
|
|
||||||
std::vector< std::pair<size_t, size_t> > filteredIntervals;
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector< std::pair<size_t, size_t> > intervalsOfValidValues;
|
|
||||||
RigCurveDataTools::calculateIntervalsOfValidValues(timeHistoryValues, &intervalsOfValidValues);
|
|
||||||
|
|
||||||
RigCurveDataTools::getValuesByIntervals(timeHistoryValues, intervalsOfValidValues, &filteredTimeHistoryValues);
|
|
||||||
RigCurveDataTools::getValuesByIntervals(dateTimes, intervalsOfValidValues, &filteredDateTimes);
|
|
||||||
|
|
||||||
RigCurveDataTools::computePolyLineStartStopIndices(intervalsOfValidValues, &filteredIntervals);
|
|
||||||
}
|
|
||||||
|
|
||||||
RiuLineSegmentQwtPlotCurve* plotCurve = new RiuLineSegmentQwtPlotCurve("Curve 1");
|
RiuLineSegmentQwtPlotCurve* plotCurve = new RiuLineSegmentQwtPlotCurve("Curve 1");
|
||||||
|
|
||||||
QPolygonF points;
|
plotCurve->setSamplesFromDateAndValues(dateTimes, timeHistoryValues);
|
||||||
for (size_t i = 0; i < filteredDateTimes.size(); i++)
|
|
||||||
{
|
|
||||||
double milliSecSinceEpoch = QwtDate::toDouble(filteredDateTimes[i]);
|
|
||||||
points << QPointF(milliSecSinceEpoch, filteredTimeHistoryValues[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
plotCurve->setSamples(points);
|
|
||||||
plotCurve->setLineSegmentStartStopIndices(filteredIntervals);
|
|
||||||
plotCurve->setTitle(curveName);
|
plotCurve->setTitle(curveName);
|
||||||
|
|
||||||
plotCurve->setPen(QPen(QColor(curveColor.rByte(), curveColor.gByte(), curveColor.bByte())));
|
plotCurve->setPen(QPen(QColor(curveColor.rByte(), curveColor.gByte(), curveColor.bByte())));
|
||||||
|
@ -1,4 +1,27 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2011- Statoil ASA
|
||||||
|
// Copyright (C) 2013- Ceetron Solutions AS
|
||||||
|
// Copyright (C) 2011-2012 Ceetron AS
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QPaintEvent;
|
class QPaintEvent;
|
||||||
class QString;
|
class QString;
|
||||||
class QStringList;
|
class QStringList;
|
||||||
|
126
ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp
Normal file
126
ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "RiuSummaryQwtPlot.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
|
#include "qwt_date_scale_draw.h"
|
||||||
|
#include "qwt_date_scale_engine.h"
|
||||||
|
#include "qwt_legend.h"
|
||||||
|
#include "qwt_plot_curve.h"
|
||||||
|
#include "qwt_plot_grid.h"
|
||||||
|
#include "qwt_plot_layout.h"
|
||||||
|
#include "qwt_scale_engine.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuSummaryQwtPlot::RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* parent) : QwtPlot(parent)
|
||||||
|
{
|
||||||
|
Q_ASSERT(plotDefinition);
|
||||||
|
m_plotDefinition = plotDefinition;
|
||||||
|
|
||||||
|
m_grid = new QwtPlotGrid;
|
||||||
|
m_grid->attach(this);
|
||||||
|
|
||||||
|
setDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuSummaryQwtPlot::~RiuSummaryQwtPlot()
|
||||||
|
{
|
||||||
|
m_grid->detach();
|
||||||
|
delete m_grid;
|
||||||
|
|
||||||
|
if (m_plotDefinition)
|
||||||
|
{
|
||||||
|
m_plotDefinition->handleViewerDeletion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot* RiuSummaryQwtPlot::ownerPlotDefinition()
|
||||||
|
{
|
||||||
|
return m_plotDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuSummaryQwtPlot::setDefaults()
|
||||||
|
{
|
||||||
|
QPalette newPalette(palette());
|
||||||
|
newPalette.setColor(QPalette::Background, Qt::white);
|
||||||
|
setPalette(newPalette);
|
||||||
|
|
||||||
|
setAutoFillBackground(true);
|
||||||
|
setCanvasBackground(Qt::white);
|
||||||
|
|
||||||
|
QFrame* canvasFrame = dynamic_cast<QFrame*>(canvas());
|
||||||
|
if (canvasFrame)
|
||||||
|
{
|
||||||
|
canvasFrame->setFrameShape(QFrame::NoFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas()->setMouseTracking(true);
|
||||||
|
canvas()->installEventFilter(this);
|
||||||
|
|
||||||
|
QPen gridPen(Qt::SolidLine);
|
||||||
|
gridPen.setColor(Qt::lightGray);
|
||||||
|
m_grid->setPen(gridPen);
|
||||||
|
|
||||||
|
enableAxis(QwtPlot::xBottom, true);
|
||||||
|
enableAxis(QwtPlot::yLeft, true);
|
||||||
|
enableAxis(QwtPlot::xTop, false);
|
||||||
|
enableAxis(QwtPlot::yRight, false);
|
||||||
|
|
||||||
|
plotLayout()->setAlignCanvasToScales(true);
|
||||||
|
|
||||||
|
QwtDateScaleDraw* scaleDraw = new QwtDateScaleDraw(Qt::UTC);
|
||||||
|
scaleDraw->setDateFormat(QwtDate::Year, QString("dd-MM-yyyy"));
|
||||||
|
|
||||||
|
QwtDateScaleEngine* scaleEngine = new QwtDateScaleEngine(Qt::UTC);
|
||||||
|
setAxisScaleEngine(QwtPlot::xBottom, scaleEngine);
|
||||||
|
setAxisScaleDraw(QwtPlot::xBottom, scaleDraw);
|
||||||
|
|
||||||
|
QFont xAxisFont = axisFont(QwtPlot::xBottom);
|
||||||
|
xAxisFont.setPixelSize(9);
|
||||||
|
setAxisFont(QwtPlot::xBottom, xAxisFont);
|
||||||
|
|
||||||
|
QFont yAxisFont = axisFont(QwtPlot::yLeft);
|
||||||
|
yAxisFont.setPixelSize(9);
|
||||||
|
setAxisFont(QwtPlot::yLeft, yAxisFont);
|
||||||
|
|
||||||
|
QwtText axisTitleY = axisTitle(QwtPlot::yLeft);
|
||||||
|
QFont yAxisTitleFont = axisTitleY.font();
|
||||||
|
yAxisTitleFont.setPixelSize(9);
|
||||||
|
yAxisTitleFont.setBold(false);
|
||||||
|
axisTitleY.setFont(yAxisTitleFont);
|
||||||
|
axisTitleY.setRenderFlags(Qt::AlignRight);
|
||||||
|
setAxisTitle(QwtPlot::yLeft, axisTitleY);
|
||||||
|
|
||||||
|
|
||||||
|
QwtLegend* legend = new QwtLegend(this);
|
||||||
|
// The legend will be deleted in the destructor of the plot or when
|
||||||
|
// another legend is inserted.
|
||||||
|
this->insertLegend(legend, BottomLegend);
|
||||||
|
}
|
51
ApplicationCode/UserInterface/RiuSummaryQwtPlot.h
Normal file
51
ApplicationCode/UserInterface/RiuSummaryQwtPlot.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016- 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 "qwt_plot.h"
|
||||||
|
#include "cafPdmPointer.h"
|
||||||
|
|
||||||
|
class QwtPlotCurve;
|
||||||
|
class QwtPlotGrid;
|
||||||
|
|
||||||
|
class RimSummaryPlot;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==================================================================================================
|
||||||
|
class RiuSummaryQwtPlot : public QwtPlot
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RiuSummaryQwtPlot(RimSummaryPlot* plotDefinition, QWidget* parent = NULL);
|
||||||
|
virtual ~RiuSummaryQwtPlot();
|
||||||
|
|
||||||
|
RimSummaryPlot* ownerPlotDefinition();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setDefaults();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QwtPlotGrid* m_grid;
|
||||||
|
caf::PdmPointer<RimSummaryPlot> m_plotDefinition;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -354,7 +354,7 @@ void RiuWellImportWizard::updateFieldsModel()
|
|||||||
|
|
||||||
if (QFile::exists(fileName))
|
if (QFile::exists(fileName))
|
||||||
{
|
{
|
||||||
JsonReader jsonReader;
|
ResInsightInternalJson::JsonReader jsonReader;
|
||||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(fileName);
|
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(fileName);
|
||||||
|
|
||||||
QStringList regions;
|
QStringList regions;
|
||||||
@ -581,7 +581,7 @@ void RiuWellImportWizard::parseWellsResponse(RimOilFieldEntry* oilFieldEntry)
|
|||||||
|
|
||||||
if (QFile::exists(oilFieldEntry->wellsFilePath))
|
if (QFile::exists(oilFieldEntry->wellsFilePath))
|
||||||
{
|
{
|
||||||
JsonReader jsonReader;
|
ResInsightInternalJson::JsonReader jsonReader;
|
||||||
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(oilFieldEntry->wellsFilePath);
|
QMap<QString, QVariant> jsonMap = jsonReader.decodeFile(oilFieldEntry->wellsFilePath);
|
||||||
|
|
||||||
QMapIterator<QString, QVariant> it(jsonMap);
|
QMapIterator<QString, QVariant> it(jsonMap);
|
||||||
|
278
CMakeLists.txt
278
CMakeLists.txt
@ -7,6 +7,7 @@ set (VIZ_MODULES_FOLDER_NAME Fwk/VizFwk)
|
|||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "ERT: Build shared libraries")
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Setup the main platform defines
|
# Setup the main platform defines
|
||||||
@ -15,12 +16,12 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||||||
add_definitions(-DCVF_LINUX)
|
add_definitions(-DCVF_LINUX)
|
||||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
add_definitions(-DCVF_OSX)
|
add_definitions(-DCVF_OSX)
|
||||||
else()
|
elseif(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
set(CMAKE_CXX_FLAGS "-DCVF_LINUX -pipe -Wextra -Woverloaded-virtual -Wformat")
|
set(CMAKE_CXX_FLAGS "-DCVF_LINUX -pipe -Wextra -Woverloaded-virtual -Wformat -std=gnu++11")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -g3 -O0 -DDEBUG -D_DEBUG")
|
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -g3 -O0 -DDEBUG -D_DEBUG")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG")
|
||||||
endif()
|
endif()
|
||||||
@ -48,66 +49,166 @@ endif()
|
|||||||
################################################################################
|
################################################################################
|
||||||
include (ResInsightVersion.cmake)
|
include (ResInsightVersion.cmake)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Boost
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# if we are building shared libraries ourselves, then don't include Boost in them
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
|
elseif (DEFINED BUILD_SHARED_LIBS)
|
||||||
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
endif ()
|
||||||
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
ADD_DEFINITIONS("-DBOOST_ALL_NO_LIB")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Requires BOOST filesystem version 3, thus 1.44 is necessary.
|
||||||
|
add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
set(RESINSIGHT_BOOST_ROOT "" CACHE PATH "Path to installed boost directories" )
|
||||||
|
set(RESINSIGHT_BOOST_LIBRARYDIR "" CACHE PATH "Path to boost binary libraries" )
|
||||||
|
set(BOOST_ROOT ${RESINSIGHT_BOOST_ROOT})
|
||||||
|
set(BOOST_LIBRARYDIR ${RESINSIGHT_BOOST_LIBRARYDIR})
|
||||||
|
|
||||||
|
if (RESINSIGHT_BOOST_ROOT AND RESINSIGHT_BOOST_LIBRARYDIR)
|
||||||
|
find_package(Boost 1.44.0 COMPONENTS filesystem date_time system regex REQUIRED)
|
||||||
|
else()
|
||||||
|
message (FATAL_ERROR "You need to set RESINSIGHT_BOOST_ROOT and RESINSIGHT_BOOST_LIBRARYDIR")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
find_package(Boost 1.44.0 COMPONENTS filesystem date_time system regex REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# cotire
|
||||||
|
# Fully automated CMake module for build speedup
|
||||||
|
# https://github.com/sakra/cotire
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
option(RESINSIGHT_ENABLE_COTIRE "Use Cotire to speed up build process" OFF)
|
||||||
|
if(RESINSIGHT_ENABLE_COTIRE)
|
||||||
|
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
include(cotire)
|
||||||
|
|
||||||
|
set(CAF_USE_COTIRE TRUE CACHE INTERNAL "CAF: Use cotire")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# ERT
|
# ERT
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Disable install of ERT libs and headers, as Ert code is compiled and linked directly
|
if (NOT MSVC)
|
||||||
SET(INSTALL_ERT OFF CACHE BOOL "ERT: Install library")
|
# Linux: Optional configuration of externally installed ERT, requires path to libraries and includes
|
||||||
SET(BUILD_PYTHON OFF CACHE BOOL "ERT: Run py_compile on the python wrappers")
|
set(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT "" CACHE PATH "Path to installed ERT libraries")
|
||||||
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "ERT: Build shared libraries")
|
set(RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT "" CACHE PATH "Path to installed ERT includes")
|
||||||
SET(ERT_USE_OPENMP ${OPENMP_FOUND} CACHE BOOL "ERT: Compile using OpenMP")
|
endif()
|
||||||
SET(ERT_BUILD_CXX OFF CACHE BOOL "ERT: Disable build of CXX wrappers")
|
|
||||||
|
|
||||||
option( ERT_EXTERNAL "Build ERT from external source" OFF)
|
set (ERT_BINARY_LIB_NAMES
|
||||||
SET(EXT_ERT_ROOT "" CACHE STRING "Path to ERT CMakeList.txt (source path)")
|
libecl.so
|
||||||
|
libeclxx.so
|
||||||
if (ERT_EXTERNAL)
|
libecl_well.so
|
||||||
if (EXT_ERT_ROOT)
|
libert_geometry.so
|
||||||
set(ERT_SOURCE_PATH "${EXT_ERT_ROOT}")
|
libert_util.so
|
||||||
|
|
||||||
add_subdirectory(${ERT_SOURCE_PATH} ${CMAKE_BINARY_DIR}/ThirdParty/Ert)
|
|
||||||
include_directories(
|
|
||||||
${ERT_SOURCE_PATH}/libecl/include/ert/ecl
|
|
||||||
${ERT_SOURCE_PATH}/libert_util/include/ert/util
|
|
||||||
${ERT_SOURCE_PATH}/libgeometry/include/ert/geometry
|
|
||||||
${ERT_SOURCE_PATH}/libecl_well/include/ert/ecl_well
|
|
||||||
${ERT_SOURCE_PATH}/libecl/include
|
|
||||||
${ERT_SOURCE_PATH}/libert_util/include
|
|
||||||
${ERT_SOURCE_PATH}/libgeometry/include
|
|
||||||
${ERT_SOURCE_PATH}/libecl_well/include
|
|
||||||
${CMAKE_BINARY_DIR}/ThirdParty/Ert/libert_util/include/ert/util
|
|
||||||
${CMAKE_BINARY_DIR}/ThirdParty/Ert/libert_util/include
|
|
||||||
)
|
|
||||||
endif(EXT_ERT_ROOT)
|
|
||||||
|
|
||||||
else (ERT_EXTERNAL)
|
|
||||||
add_subdirectory(ThirdParty/Ert/devel)
|
|
||||||
include_directories(
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include/ert/ecl
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include/ert/geometry
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl/include
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libert_util/include
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libgeometry/include
|
|
||||||
${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel/libecl_well/include
|
|
||||||
|
|
||||||
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util
|
|
||||||
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include/ert/util
|
|
||||||
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include
|
|
||||||
)
|
)
|
||||||
endif (ERT_EXTERNAL)
|
|
||||||
|
|
||||||
set_property(TARGET
|
if (RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT)
|
||||||
ecl
|
if (NOT(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT AND RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT))
|
||||||
ecl_well
|
message(FATAL_ERROR "Both RESINSIGHT_ERT_EXTERNAL_LIB_ROOT and RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT must be defined")
|
||||||
ert_geometry
|
endif()
|
||||||
ert_util
|
|
||||||
PROPERTY FOLDER "ERT"
|
list(APPEND ERT_INCLUDE_DIRS
|
||||||
)
|
${RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT}
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND ERT_EXTERNAL_LIBRARIES
|
||||||
|
${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libecl.so
|
||||||
|
${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libeclxx.so
|
||||||
|
${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libecl_well.so
|
||||||
|
${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libert_geometry.so
|
||||||
|
${RESINSIGHT_ERT_EXTERNAL_LIB_ROOT}/libert_util.so
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
# Disable install of ERT libs and headers, as Ert code is compiled and linked directly
|
||||||
|
SET(INSTALL_ERT OFF CACHE BOOL "ERT: Install library")
|
||||||
|
SET(BUILD_PYTHON OFF CACHE BOOL "ERT: Run py_compile on the python wrappers")
|
||||||
|
SET(ERT_USE_OPENMP ${OPENMP_FOUND} CACHE BOOL "ERT: Compile using OpenMP")
|
||||||
|
SET(ERT_BUILD_CXX ON CACHE BOOL "ERT: Enable build of CXX wrappers" FORCE)
|
||||||
|
|
||||||
|
# Remember original state
|
||||||
|
set(ORIGINAL_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Force static linking on Windows
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
set(ERT_HAVE_UNISTD OFF) #If anyone has mingw installed
|
||||||
|
else ()
|
||||||
|
set(RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT "" CACHE STRING "Path to ERT CMakeList.txt (source path)")
|
||||||
|
|
||||||
|
# Force dynamic linking on other platforms
|
||||||
|
# Copy of libraries into install folder of ResInsight is done a bit further down in this file
|
||||||
|
set(BUILD_SHARED_LIBS ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT)
|
||||||
|
set(ERT_INCLUDE_ROOT "${RESINSIGHT_ERT_EXTERNAL_SOURCE_ROOT}")
|
||||||
|
add_subdirectory(${ERT_SOURCE_PATH} ${CMAKE_BINARY_DIR}/ThirdParty/Ert)
|
||||||
|
else()
|
||||||
|
set(ERT_INCLUDE_ROOT ${CMAKE_SOURCE_DIR}/ThirdParty/Ert/devel)
|
||||||
|
add_subdirectory(ThirdParty/Ert/devel)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
list(APPEND ERT_INCLUDE_DIRS
|
||||||
|
${ERT_INCLUDE_ROOT}/libecl/include/
|
||||||
|
${ERT_INCLUDE_ROOT}/libert_util/include/
|
||||||
|
${ERT_INCLUDE_ROOT}/libgeometry/include/
|
||||||
|
${ERT_INCLUDE_ROOT}/libecl_well/include/
|
||||||
|
${ERT_INCLUDE_ROOT}/libeclxx/include
|
||||||
|
${ERT_INCLUDE_ROOT}/libert_utilxx/include
|
||||||
|
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/libert_util/include
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND ERT_LIBRARIES
|
||||||
|
ecl
|
||||||
|
eclxx
|
||||||
|
ecl_well
|
||||||
|
ert_geometry
|
||||||
|
ert_util
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set_property(TARGET
|
||||||
|
${ERT_LIBRARIES}
|
||||||
|
ecl_lfs
|
||||||
|
PROPERTY FOLDER "ERT"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Restore original state
|
||||||
|
set(BUILD_SHARED_LIBS ${ORIGINAL_BUILD_SHARED_LIBS})
|
||||||
|
|
||||||
|
endif(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT)
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Opm
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
add_subdirectory(ThirdParty/custom-opm-parser)
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -115,7 +216,6 @@ set_property(TARGET
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
add_subdirectory(ThirdParty/NRLib)
|
add_subdirectory(ThirdParty/NRLib)
|
||||||
include_directories(ThirdParty/NRLib/nrlib/well)
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -141,7 +241,6 @@ find_package( OpenGL )
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
add_subdirectory(ThirdParty/Qwt/src)
|
add_subdirectory(ThirdParty/Qwt/src)
|
||||||
include_directories(ThirdParty/Qwt/src)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Vizualization Framework
|
# Vizualization Framework
|
||||||
@ -182,13 +281,17 @@ include_directories(
|
|||||||
${LibGuiQt_SOURCE_DIR}
|
${LibGuiQt_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
list(APPEND VIZ_FWK_LIBRARIES
|
||||||
|
LibGuiQt
|
||||||
|
LibViewing
|
||||||
|
LibRender
|
||||||
|
LibGeometry
|
||||||
|
LibCore
|
||||||
|
)
|
||||||
|
|
||||||
set_property(TARGET
|
set_property(TARGET
|
||||||
LibCore
|
${VIZ_FWK_LIBRARIES}
|
||||||
LibGeometry
|
PROPERTY FOLDER "VizFwk"
|
||||||
LibGuiQt
|
|
||||||
LibRender
|
|
||||||
LibViewing
|
|
||||||
PROPERTY FOLDER "VizFwk"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -213,20 +316,24 @@ add_subdirectory(Fwk/AppFwk/CommonCode)
|
|||||||
|
|
||||||
add_subdirectory(Fwk/AppFwk/cafTensor)
|
add_subdirectory(Fwk/AppFwk/cafTensor)
|
||||||
|
|
||||||
set_property(TARGET
|
list(APPEND APP_FWK_LIBRARIES
|
||||||
cafAnimControl
|
|
||||||
cafViewer
|
|
||||||
|
|
||||||
cafPdmCore
|
cafPdmCore
|
||||||
cafPdmUiCore
|
cafPdmUiCore
|
||||||
cafPdmXml
|
cafPdmXml
|
||||||
cafProjectDataModel
|
cafProjectDataModel
|
||||||
|
|
||||||
|
cafUserInterface
|
||||||
|
cafViewer
|
||||||
|
cafAnimControl
|
||||||
cafCommand
|
cafCommand
|
||||||
cafUserInterface
|
cafPdmCvf
|
||||||
|
|
||||||
cafTensor
|
cafTensor
|
||||||
cafPdmCvf
|
CommonCode
|
||||||
CommonCode
|
)
|
||||||
|
|
||||||
|
set_property(TARGET
|
||||||
|
${APP_FWK_LIBRARIES}
|
||||||
PROPERTY FOLDER "AppFwk"
|
PROPERTY FOLDER "AppFwk"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -248,8 +355,37 @@ option (RESINSIGHT_PRIVATE_INSTALL "Install as an independent bundle including t
|
|||||||
if (RESINSIGHT_PRIVATE_INSTALL)
|
if (RESINSIGHT_PRIVATE_INSTALL)
|
||||||
set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install/)
|
set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install/)
|
||||||
#set (CMAKE_INSTALL_PREFIX /usr/${RESINSIGHT_FINAL_NAME})
|
#set (CMAKE_INSTALL_PREFIX /usr/${RESINSIGHT_FINAL_NAME})
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# ERT shared library files
|
||||||
|
# Install procedure will copy so-files from ERT into same install folder as ResInsight
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
set(ERT_SHARED_LIB_FILES
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libecl.so
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libecl.so.2
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libecl.so.2.0
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libeclxx.so
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libeclxx.so.2
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libeclxx.so.2.0
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libecl_well.so
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libecl_well.so.2
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libecl_well.so.2.0
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libert_geometry.so
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libert_geometry.so.2
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libert_geometry.so.2.0
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libert_util.so
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libert_util.so.2
|
||||||
|
${CMAKE_BINARY_DIR}/ThirdParty/Ert/devel/lib64/libert_util.so.2.0
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES ${ERT_SHARED_LIB_FILES} DESTINATION ${RESINSIGHT_FINAL_NAME} )
|
||||||
|
endif()
|
||||||
|
|
||||||
endif (RESINSIGHT_PRIVATE_INSTALL)
|
endif (RESINSIGHT_PRIVATE_INSTALL)
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Application
|
# Application
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -40,7 +40,9 @@
|
|||||||
#include "cafPdmProxyValueField.h"
|
#include "cafPdmProxyValueField.h"
|
||||||
#include "cafPdmUiColorEditor.h"
|
#include "cafPdmUiColorEditor.h"
|
||||||
|
|
||||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(caf::PdmUiColorEditor, cvf::Color3f);
|
namespace caf {
|
||||||
|
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiColorEditor, cvf::Color3f);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
// If the macro for registering the editor is put as the single statement
|
// If the macro for registering the editor is put as the single statement
|
||||||
|
@ -41,8 +41,10 @@
|
|||||||
#include "cafPdmUiLineEditor.h"
|
#include "cafPdmUiLineEditor.h"
|
||||||
#include "cafPdmUiListEditor.h"
|
#include "cafPdmUiListEditor.h"
|
||||||
|
|
||||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(caf::PdmUiLineEditor, cvf::Vec3d);
|
namespace caf {
|
||||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(caf::PdmUiListEditor, std::vector<cvf::Vec3d>);
|
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, cvf::Vec3d);
|
||||||
|
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<cvf::Vec3d>);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
// If the macro for registering the editor is put as the single statement
|
// If the macro for registering the editor is put as the single statement
|
||||||
|
@ -54,10 +54,10 @@
|
|||||||
#define CAF_FACTORY_CONCATENATE_STRINGS(foo, bar) CAF_FACTORY_CONCATENATE_STRINGS_IMPL_(foo, bar)
|
#define CAF_FACTORY_CONCATENATE_STRINGS(foo, bar) CAF_FACTORY_CONCATENATE_STRINGS_IMPL_(foo, bar)
|
||||||
#define CAF_FACTORY_CONCATENATE_STRINGS_IMPL_(foo, bar) foo ## bar
|
#define CAF_FACTORY_CONCATENATE_STRINGS_IMPL_(foo, bar) foo ## bar
|
||||||
|
|
||||||
#define CAF_UNIQUE_COMPILE_UNIT_VAR_NAME CAF_FACTORY_CONCATENATE_STRINGS(caf_factory_init_, __LINE__)
|
#define CAF_UNIQUE_COMPILE_UNIT_VAR_NAME(foo) CAF_FACTORY_CONCATENATE_STRINGS(foo, __LINE__)
|
||||||
|
|
||||||
#define CAF_FACTORY_REGISTER(BaseType, TypeToCreate, KeyType, key) \
|
#define CAF_FACTORY_REGISTER(BaseType, TypeToCreate, KeyType, key) \
|
||||||
static bool CAF_UNIQUE_COMPILE_UNIT_VAR_NAME = caf::Factory<BaseType, KeyType>::instance()->registerCreator<TypeToCreate>(key)
|
static bool CAF_UNIQUE_COMPILE_UNIT_VAR_NAME(my##TypeToCreate) = caf::Factory<BaseType, KeyType>::instance()->registerCreator<TypeToCreate>(key)
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,8 @@ DataType* PdmChildArrayField<DataType*>::operator[](size_t index) const
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::push_back(DataType* pointer)
|
void PdmChildArrayField<DataType*>::push_back(DataType* pointer)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
m_pointers.push_back(pointer);
|
m_pointers.push_back(pointer);
|
||||||
if (pointer) pointer->setAsParentField(this);
|
if (pointer) pointer->setAsParentField(this);
|
||||||
}
|
}
|
||||||
@ -51,6 +53,8 @@ void PdmChildArrayField<DataType*>::push_back(DataType* pointer)
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::set(size_t index, DataType* pointer)
|
void PdmChildArrayField<DataType*>::set(size_t index, DataType* pointer)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
if (m_pointers[index]) m_pointers[index]->removeAsParentField(this);
|
if (m_pointers[index]) m_pointers[index]->removeAsParentField(this);
|
||||||
m_pointers[index] = pointer;
|
m_pointers[index] = pointer;
|
||||||
if (m_pointers[index]) pointer->setAsParentField(this);
|
if (m_pointers[index]) pointer->setAsParentField(this);
|
||||||
@ -63,6 +67,8 @@ void PdmChildArrayField<DataType*>::set(size_t index, DataType* pointer)
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::insert(size_t index, DataType* pointer)
|
void PdmChildArrayField<DataType*>::insert(size_t index, DataType* pointer)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
m_pointers.insert(m_pointers.begin()+index, pointer);
|
m_pointers.insert(m_pointers.begin()+index, pointer);
|
||||||
|
|
||||||
if (pointer) pointer->setAsParentField(this);
|
if (pointer) pointer->setAsParentField(this);
|
||||||
@ -76,6 +82,8 @@ void PdmChildArrayField<DataType*>::insert(size_t index, DataType* pointer)
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::insert(size_t index, const std::vector<PdmPointer<DataType> >& objects)
|
void PdmChildArrayField<DataType*>::insert(size_t index, const std::vector<PdmPointer<DataType> >& objects)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
m_pointers.insert(m_pointers.begin()+index, objects.begin(), objects.end());
|
m_pointers.insert(m_pointers.begin()+index, objects.begin(), objects.end());
|
||||||
|
|
||||||
typename std::vector< PdmPointer< DataType > >::iterator it;
|
typename std::vector< PdmPointer< DataType > >::iterator it;
|
||||||
@ -114,6 +122,8 @@ size_t PdmChildArrayField<DataType*>::count(const DataType* pointer) const
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::clear()
|
void PdmChildArrayField<DataType*>::clear()
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
this->removeThisAsParentField();
|
this->removeThisAsParentField();
|
||||||
m_pointers.clear();
|
m_pointers.clear();
|
||||||
}
|
}
|
||||||
@ -124,6 +134,8 @@ void PdmChildArrayField<DataType*>::clear()
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::deleteAllChildObjects()
|
void PdmChildArrayField<DataType*>::deleteAllChildObjects()
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
size_t index;
|
size_t index;
|
||||||
for (index = 0; index < m_pointers.size(); ++index)
|
for (index = 0; index < m_pointers.size(); ++index)
|
||||||
{
|
{
|
||||||
@ -141,6 +153,8 @@ void PdmChildArrayField<DataType*>::deleteAllChildObjects()
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::erase(size_t index)
|
void PdmChildArrayField<DataType*>::erase(size_t index)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
if (m_pointers[index].rawPtr())
|
if (m_pointers[index].rawPtr())
|
||||||
{
|
{
|
||||||
m_pointers[index].rawPtr()->removeAsParentField(this);
|
m_pointers[index].rawPtr()->removeAsParentField(this);
|
||||||
@ -174,6 +188,8 @@ size_t PdmChildArrayField<DataType*>::index(DataType* pointer)
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::removeChildObject(PdmObjectHandle* object)
|
void PdmChildArrayField<DataType*>::removeChildObject(PdmObjectHandle* object)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
std::vector< PdmPointer<DataType> > tempPointers;
|
std::vector< PdmPointer<DataType> > tempPointers;
|
||||||
|
|
||||||
tempPointers = m_pointers;
|
tempPointers = m_pointers;
|
||||||
@ -215,6 +231,8 @@ void PdmChildArrayField<DataType*>::childObjects(std::vector<PdmObjectHandle*>*
|
|||||||
template<typename DataType>
|
template<typename DataType>
|
||||||
void PdmChildArrayField<DataType*>::insertAt(int indexAfter, PdmObjectHandle* obj)
|
void PdmChildArrayField<DataType*>::insertAt(int indexAfter, PdmObjectHandle* obj)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
// This method should assert if obj to insert is not castable to the container type, but since this
|
// This method should assert if obj to insert is not castable to the container type, but since this
|
||||||
// is a virtual method, its implementation is always created and that makes a dyn_cast add the need for
|
// is a virtual method, its implementation is always created and that makes a dyn_cast add the need for
|
||||||
// #include of the header file "everywhere"
|
// #include of the header file "everywhere"
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
// Access operators
|
// Access operators
|
||||||
|
|
||||||
/*Conversion*/ operator DataType* () const { return m_fieldValue; }
|
/*Conversion*/ operator DataType* () const { return m_fieldValue; }
|
||||||
DataType* operator->() const { return m_fieldValue; }
|
DataType* operator->() const { return m_fieldValue; }
|
||||||
|
|
||||||
const PdmPointer<DataType>& operator()() const { return m_fieldValue; }
|
const PdmPointer<DataType>& operator()() const { return m_fieldValue; }
|
||||||
const PdmPointer<DataType>& v() const { return m_fieldValue; }
|
const PdmPointer<DataType>& v() const { return m_fieldValue; }
|
||||||
|
@ -67,6 +67,8 @@ caf::PdmChildField<DataType*>::~PdmChildField()
|
|||||||
template<typename DataType >
|
template<typename DataType >
|
||||||
caf::PdmChildField<DataType*>& PdmChildField<DataType*>::operator=(const DataTypePtr & fieldValue)
|
caf::PdmChildField<DataType*>& PdmChildField<DataType*>::operator=(const DataTypePtr & fieldValue)
|
||||||
{
|
{
|
||||||
|
assert(isInitializedByInitFieldMacro());
|
||||||
|
|
||||||
if (m_fieldValue) m_fieldValue->removeAsParentField(this);
|
if (m_fieldValue) m_fieldValue->removeAsParentField(this);
|
||||||
m_fieldValue = fieldValue;
|
m_fieldValue = fieldValue;
|
||||||
if (m_fieldValue != NULL) m_fieldValue->setAsParentField(this);
|
if (m_fieldValue != NULL) m_fieldValue->setAsParentField(this);
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
@ -66,18 +67,18 @@ public:
|
|||||||
|
|
||||||
// Assignment
|
// Assignment
|
||||||
|
|
||||||
PdmDataValueField& operator= (const PdmDataValueField& other) { m_fieldValue = other.m_fieldValue; return *this; }
|
PdmDataValueField& operator= (const PdmDataValueField& other) { assert(isInitializedByInitFieldMacro()); m_fieldValue = other.m_fieldValue; return *this; }
|
||||||
PdmDataValueField& operator= (const DataType& fieldValue) { m_fieldValue = fieldValue; return *this; }
|
PdmDataValueField& operator= (const DataType& fieldValue) { assert(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; return *this; }
|
||||||
|
|
||||||
// Basic access
|
// Basic access
|
||||||
|
|
||||||
DataType value() const { return m_fieldValue; }
|
DataType value() const { return m_fieldValue; }
|
||||||
void setValue(const DataType& fieldValue) { m_fieldValue = fieldValue; }
|
void setValue(const DataType& fieldValue) { assert(isInitializedByInitFieldMacro()); m_fieldValue = fieldValue; }
|
||||||
|
|
||||||
// Implementation of PdmValueField interface
|
// Implementation of PdmValueField interface
|
||||||
|
|
||||||
virtual QVariant toQVariant() const { return PdmValueFieldSpecialization<DataType>::convert(m_fieldValue); }
|
virtual QVariant toQVariant() const { assert(isInitializedByInitFieldMacro()); return PdmValueFieldSpecialization<DataType>::convert(m_fieldValue); }
|
||||||
virtual void setFromQVariant(const QVariant& variant) { PdmValueFieldSpecialization<DataType>::setFromVariant(variant, m_fieldValue); }
|
virtual void setFromQVariant(const QVariant& variant) { assert(isInitializedByInitFieldMacro()); PdmValueFieldSpecialization<DataType>::setFromVariant(variant, m_fieldValue); }
|
||||||
virtual bool isReadOnly() const { return false; }
|
virtual bool isReadOnly() const { return false; }
|
||||||
|
|
||||||
// Access operators
|
// Access operators
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user