Merge pull request #634 from OPM/geom-sprint-8.2

Merge geom sprint 8.2 into dev
This commit is contained in:
Magne Sjaastad 2015-11-10 09:56:54 +01:00
commit 0beb043804
97 changed files with 2992 additions and 780 deletions

View File

@ -66,6 +66,7 @@
#include "RiuMainWindow.h"
#include "RiuProcessMonitor.h"
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "cafAppEnum.h"
@ -608,6 +609,8 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty)
}
}
RiuSelectionManager::instance()->deleteAllItems();
mainWnd->cleanupGuiBeforeProjectClose();
caf::EffectGenerator::clearEffectCache();

View File

@ -84,12 +84,18 @@ set( USER_INTERFACE_FILES
UserInterface/RiuTreeViewEventFilter.h
UserInterface/RiuWellLogPlot.cpp
UserInterface/RiuWellLogPlot.h
UserInterface/RiuWellLogPlotCurve.cpp
UserInterface/RiuWellLogPlotCurve.h
UserInterface/RiuWellLogTrackPlot.cpp
UserInterface/RiuWellLogTrackPlot.h
UserInterface/RiuLineSegmentQwtPlotCurve.cpp
UserInterface/RiuLineSegmentQwtPlotCurve.h
UserInterface/RiuWellLogTrack.cpp
UserInterface/RiuWellLogTrack.h
UserInterface/RiuProjectPropertyView.h
UserInterface/RiuProjectPropertyView.cpp
UserInterface/RiuTimeHistoryQwtPlot.h
UserInterface/RiuTimeHistoryQwtPlot.cpp
UserInterface/RiuSelectionManager.h
UserInterface/RiuSelectionManager.cpp
UserInterface/RiuSelectionColors.h
UserInterface/RiuSelectionColors.cpp
)
set( SOCKET_INTERFACE_FILES
@ -182,7 +188,7 @@ set ( QT_MOC_HEADERS
UserInterface/RiuViewerCommands.h
UserInterface/RiuTreeViewEventFilter.h
UserInterface/RiuWellLogPlot.h
UserInterface/RiuWellLogTrackPlot.h
UserInterface/RiuWellLogTrack.h
)
qt4_wrap_cpp( MOC_FILES_CPP ${QT_MOC_HEADERS} )

View File

@ -29,7 +29,7 @@
#include "RimViewLinkerCollection.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RimWellPathCollection.h"
#include "cafNotificationCenter.h"
@ -120,7 +120,7 @@ void RicDeleteItemExec::redo()
wellLogPlot->zoomAllDepth();
}
RimWellLogPlotTrack* wellLogPlotTrack;
RimWellLogTrack* wellLogPlotTrack;
parentObj->firstAnchestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack)
{

View File

@ -22,7 +22,7 @@
#include "RicDeleteItemExecData.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "cafCmdExecCommandManager.h"
#include "cafCmdSelectionHelper.h"

View File

@ -19,7 +19,7 @@
#include "RicExportToLasFileFeature.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "RigWellLogFile.h"
#include "RiuMainWindow.h"
@ -46,7 +46,7 @@ bool RicExportToLasFileFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
{
RimWellLogPlotCurve* curve = selectedWellLogPlotCurve();
RimWellLogCurve* curve = selectedWellLogPlotCurve();
if (curve)
{
QString defaultDir = RiaApplication::instance()->defaultFileDialogDirectory("WELL_LOGS_DIR");
@ -77,9 +77,9 @@ void RicExportToLasFileFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCurve* RicExportToLasFileFeature::selectedWellLogPlotCurve() const
RimWellLogCurve* RicExportToLasFileFeature::selectedWellLogPlotCurve() const
{
std::vector<RimWellLogPlotCurve*> selection;
std::vector<RimWellLogCurve*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() > 0)

View File

@ -23,7 +23,7 @@
#include <vector>
class RimWellLogPlotCurve;
class RimWellLogCurve;
//==================================================================================================
///
@ -39,7 +39,7 @@ protected:
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellLogPlotCurve* selectedWellLogPlotCurve() const;
RimWellLogCurve* selectedWellLogPlotCurve() const;
};

View File

@ -25,7 +25,7 @@
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RimWellLogFileCurve.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
@ -37,7 +37,7 @@
#include "RiaApplication.h"
#include "RiuMainWindow.h"
#include "RiuWellLogTrackPlot.h"
#include "RiuWellLogTrack.h"
#include "cafSelectionManager.h"
#include "cafPdmUiTreeView.h"
@ -68,7 +68,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack();
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount()));

View File

@ -19,7 +19,7 @@
#include "RicDeleteWellLogPlotTrackFeature.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RimWellLogPlot.h"
#include "cafSelectionManager.h"
@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteWellLogPlotTrackFeature, "RicDeleteWellLogPlotTrack
//--------------------------------------------------------------------------------------------------
bool RicDeleteWellLogPlotTrackFeature::isCommandEnabled()
{
std::vector<RimWellLogPlotTrack*> selection;
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
if (selection.size() > 0)
@ -55,12 +55,12 @@ bool RicDeleteWellLogPlotTrackFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellLogPlotTrack*> selection;
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
for (size_t i = 0; i < selection.size(); i++)
{
RimWellLogPlotTrack* track = selection[i];
RimWellLogTrack* track = selection[i];
RimWellLogPlot* wellLogPlot = NULL;
track->firstAnchestorOrThisOfType(wellLogPlot);

View File

@ -22,7 +22,7 @@
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@ -54,7 +54,7 @@ bool RicNewWellLogCurveExtractionFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
{
RimWellLogPlotTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
if (wellLogPlotTrack)
{
addCurve(wellLogPlotTrack, NULL, NULL);
@ -64,7 +64,7 @@ void RicNewWellLogCurveExtractionFeature::onActionTriggered(bool isChecked)
RimWellPath* wellPath = selectedWellPath();
if (wellPath)
{
RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogExtractionCurve* plotCurve = addCurve(wellLogPlotTrack, RiaApplication::instance()->activeReservoirView(), wellPath);
plotCurve->updatePlotData();
@ -84,9 +84,9 @@ void RicNewWellLogCurveExtractionFeature::setupActionLook(QAction* actionToSetup
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() const
RimWellLogTrack* RicNewWellLogCurveExtractionFeature::selectedWellLogPlotTrack() const
{
std::vector<RimWellLogPlotTrack*> selection;
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
@ -115,7 +115,7 @@ bool RicNewWellLogCurveExtractionFeature::caseAvailable() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogPlotTrack* plotTrack, RimView* view, RimWellPath* wellPath)
RimWellLogExtractionCurve* RicNewWellLogCurveExtractionFeature::addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath)
{
CVF_ASSERT(plotTrack);

View File

@ -22,7 +22,7 @@
#include "cafCmdFeature.h"
class RimWellLogExtractionCurve;
class RimWellLogPlotTrack;
class RimWellLogTrack;
class RimWellPath;
class RimView;
@ -34,7 +34,7 @@ class RicNewWellLogCurveExtractionFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
public:
static RimWellLogExtractionCurve* addCurve(RimWellLogPlotTrack* plotTrack, RimView* view, RimWellPath* wellPath);
static RimWellLogExtractionCurve* addCurve(RimWellLogTrack* plotTrack, RimView* view, RimWellPath* wellPath);
protected:
@ -44,7 +44,7 @@ protected:
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellLogPlotTrack* selectedWellLogPlotTrack() const;
RimWellLogTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPath() const;
bool caseAvailable() const;
};

View File

@ -23,7 +23,7 @@
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h"
#include "RimWellPath.h"
@ -56,7 +56,7 @@ bool RicNewWellLogFileCurveFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::onActionTriggered(bool isChecked)
{
RimWellLogPlotTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
RimWellLogTrack* wellLogPlotTrack = selectedWellLogPlotTrack();
if (wellLogPlotTrack)
{
addCurve(wellLogPlotTrack);
@ -66,7 +66,7 @@ void RicNewWellLogFileCurveFeature::onActionTriggered(bool isChecked)
RimWellPath* wellPath = selectedWellPathWithLogFile();
if (wellPath)
{
RimWellLogPlotTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogTrack* wellLogPlotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogFileCurve* plotCurve = addCurve(wellLogPlotTrack);
plotCurve->setWellPath(wellPath);
plotCurve->updateConnectedEditors();
@ -85,9 +85,9 @@ void RicNewWellLogFileCurveFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotTrack* RicNewWellLogFileCurveFeature::selectedWellLogPlotTrack() const
RimWellLogTrack* RicNewWellLogFileCurveFeature::selectedWellLogPlotTrack() const
{
std::vector<RimWellLogPlotTrack*> selection;
std::vector<RimWellLogTrack*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
@ -140,7 +140,7 @@ bool RicNewWellLogFileCurveFeature::wellLogFilesAvailable() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack* plotTrack)
RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogTrack* plotTrack)
{
CVF_ASSERT(plotTrack);
@ -162,7 +162,7 @@ RimWellLogFileCurve* RicNewWellLogFileCurveFeature::addCurve(RimWellLogPlotTrack
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogPlotTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels)
void RicNewWellLogFileCurveFeature::addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels)
{
for (size_t cIdx = 0; cIdx < wellLogFileChannels.size(); cIdx++)
{

View File

@ -23,7 +23,7 @@
#include <vector>
class RimWellLogPlotTrack;
class RimWellLogTrack;
class RimWellLogFileCurve;
class RimWellPath;
class RimWellLogFileChannel;
@ -37,9 +37,9 @@ class RicNewWellLogFileCurveFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
public:
static RimWellLogFileCurve* addCurve(RimWellLogPlotTrack* plotTrack);
static RimWellLogFileCurve* addCurve(RimWellLogTrack* plotTrack);
static void addWellLogChannelsToPlotTrack(RimWellLogPlotTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels);
static void addWellLogChannelsToPlotTrack(RimWellLogTrack* plotTrack, const std::vector<RimWellLogFileChannel*>& wellLogFileChannels);
protected:
// Overrides
@ -48,7 +48,7 @@ protected:
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellLogPlotTrack* selectedWellLogPlotTrack() const;
RimWellLogTrack* selectedWellLogPlotTrack() const;
RimWellPath* selectedWellPathWithLogFile() const;
bool wellLogFilesAvailable() const;
};

View File

@ -25,8 +25,8 @@
#include "RimProject.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogCurve.h"
#include "RiaApplication.h"
@ -50,7 +50,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{
RimWellLogPlotTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack();
RicNewWellLogCurveExtractionFeature::addCurve(plotTrack, NULL, NULL);
}

View File

@ -23,7 +23,7 @@
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RiaApplication.h"
@ -83,11 +83,11 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack()
RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack()
{
RimWellLogPlot* plot = createWellLogPlot();
RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack();
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount()));

View File

@ -22,7 +22,7 @@
class RimMainPlotCollection;
class RimWellLogPlotCollection;
class RimWellLogPlot;
class RimWellLogPlotTrack;
class RimWellLogTrack;
//==================================================================================================
///
@ -34,5 +34,5 @@ public:
static RimMainPlotCollection* mainPlotCollection();
static RimWellLogPlotCollection* wellLogPlotCollection();
static RimWellLogPlot* createWellLogPlot();
static RimWellLogPlotTrack* createWellLogPlotTrack();
static RimWellLogTrack* createWellLogPlotTrack();
};

View File

@ -20,7 +20,7 @@
#include "RicNewWellLogPlotTrackFeature.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RiuMainWindow.h"
@ -49,7 +49,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
RimWellLogPlot* wellLogPlot = selectedWellLogPlot();
if (wellLogPlot)
{
RimWellLogPlotTrack* plotTrack = new RimWellLogPlotTrack;
RimWellLogTrack* plotTrack = new RimWellLogTrack;
wellLogPlot->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));

View File

@ -20,8 +20,8 @@
#include "RicWellLogPlotTrackFeatureImpl.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogCurve.h"
#include "RiuMainWindow.h"
@ -30,20 +30,20 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* destTrack,
const std::vector<RimWellLogPlotCurve*>& curves,
RimWellLogPlotCurve* curveToInsertAfter)
void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrack* destTrack,
const std::vector<RimWellLogCurve*>& curves,
RimWellLogCurve* curveToInsertAfter)
{
CVF_ASSERT(destTrack );
std::set<RimWellLogPlotTrack*> srcTracks;
std::set<RimWellLogTrack*> srcTracks;
std::set<RimWellLogPlot*> srcPlots;
for (size_t cIdx = 0; cIdx < curves.size(); cIdx++)
{
RimWellLogPlotCurve* curve = curves[cIdx];
RimWellLogCurve* curve = curves[cIdx];
RimWellLogPlotTrack* wellLogPlotTrack;
RimWellLogTrack* wellLogPlotTrack;
curve->firstAnchestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack)
{
@ -69,7 +69,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot
(*pIt)->calculateAvailableDepthRange();
}
for (std::set<RimWellLogPlotTrack*>::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt)
for (std::set<RimWellLogTrack*>::iterator tIt = srcTracks.begin(); tIt != srcTracks.end(); ++tIt)
{
(*tIt)->zoomAllXAndZoomAllDepthOnOwnerPlot();
}
@ -83,8 +83,8 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogPlot
///
//--------------------------------------------------------------------------------------------------
void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dstWellLogPlot,
const std::vector<RimWellLogPlotTrack*>& tracksToMove,
RimWellLogPlotTrack* trackToInsertAfter)
const std::vector<RimWellLogTrack*>& tracksToMove,
RimWellLogTrack* trackToInsertAfter)
{
CVF_ASSERT(dstWellLogPlot);
@ -92,7 +92,7 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
{
RimWellLogPlotTrack* track = tracksToMove[tIdx];
RimWellLogTrack* track = tracksToMove[tIdx];
RimWellLogPlot* srcPlot;
track->firstAnchestorOrThisOfType(srcPlot);

View File

@ -22,8 +22,8 @@
#include <vector>
class RimWellLogPlot;
class RimWellLogPlotTrack;
class RimWellLogPlotCurve;
class RimWellLogTrack;
class RimWellLogCurve;
//==================================================================================================
///
@ -32,10 +32,10 @@ class RicWellLogPlotTrackFeatureImpl
{
public:
static void moveCurvesToWellLogPlotTrack(RimWellLogPlotTrack* dstTrack,
const std::vector<RimWellLogPlotCurve*>& curves,
RimWellLogPlotCurve* insertAfterCurve);
static void moveCurvesToWellLogPlotTrack(RimWellLogTrack* dstTrack,
const std::vector<RimWellLogCurve*>& curves,
RimWellLogCurve* insertAfterCurve);
static void moveTracksToWellLogPlot(RimWellLogPlot* wellLogPlot,
const std::vector<RimWellLogPlotTrack*>& tracks,
RimWellLogPlotTrack* trackToInsertAfter);
const std::vector<RimWellLogTrack*>& tracks,
RimWellLogTrack* trackToInsertAfter);
};

View File

@ -27,11 +27,15 @@ add_library( ${PROJECT_NAME}
RigFemScalarResultFrames.cpp
RigFemNativeStatCalc.h
RigFemNativeStatCalc.cpp
RigFemNativeVisibleCellsStatCalc.h
RigFemNativeVisibleCellsStatCalc.cpp
RigFemFaceComparator.h
RigFemPartGrid.h
RigFemPartGrid.cpp
RigFemResultAddress.h
RigFemResultPosEnum.h
RigFemTimeHistoryResultAccessor.h
RigFemTimeHistoryResultAccessor.cpp
)
target_link_libraries( ${PROJECT_NAME} LibCore cafTensor ResultStatisticsCache)

View File

@ -38,7 +38,7 @@ RigFemNativeStatCalc::RigFemNativeStatCalc(RigFemPartResultsCollection* femResul
//--------------------------------------------------------------------------------------------------
void RigFemNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
{
for (int pIdx = 0; pIdx < static_cast<int>(m_resultsData->m_femPartResults.size()); ++pIdx)
for (int pIdx = 0; pIdx < m_resultsData->partCount(); ++pIdx)
{
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex);
@ -68,7 +68,7 @@ void RigFemNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double&
//--------------------------------------------------------------------------------------------------
void RigFemNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
{
for (int pIdx = 0; pIdx < static_cast<int>(m_resultsData->m_femPartResults.size()); ++pIdx)
for (int pIdx = 0; pIdx < m_resultsData->partCount(); ++pIdx)
{
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex);
@ -92,53 +92,48 @@ void RigFemNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemNativeStatCalc::valueSumAndSampleCount(double& valueSum, size_t& sampleCount)
{
int timestepCount = (int)(this->timeStepCount());
int partCount = static_cast<int>(m_resultsData->m_femPartResults.size());
for (int pIdx = 0; pIdx < partCount; ++pIdx)
{
for (int tIdx = 0; tIdx < timestepCount; tIdx++)
{
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tIdx);
size_t undefValueCount = 0;
for (size_t cIdx = 0; cIdx < values.size(); ++cIdx)
{
double value = values[cIdx];
if (value == HUGE_VAL || value != value)
{
++undefValueCount;
continue;
}
valueSum += value;
}
sampleCount += values.size();
sampleCount -= undefValueCount;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemNativeStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator)
void RigFemNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount)
{
int timestepCount = (int)(this->timeStepCount());
int partCount = static_cast<int>(m_resultsData->m_femPartResults.size());
int tsIdx = static_cast<int>(timeStepIndex);
int partCount = m_resultsData->partCount();
for (int pIdx = 0; pIdx < partCount; ++pIdx)
{
for (int tIdx = 0; tIdx < timestepCount; tIdx++)
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tsIdx);
size_t undefValueCount = 0;
for (size_t cIdx = 0; cIdx < values.size(); ++cIdx)
{
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tIdx);
double value = values[cIdx];
if (value == HUGE_VAL || value != value)
{
++undefValueCount;
continue;
}
histogramCalculator.addData(values);
valueSum += value;
}
sampleCount += values.size();
sampleCount -= undefValueCount;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator)
{
int partCount = m_resultsData->partCount();
for (int pIdx = 0; pIdx < partCount; ++pIdx)
{
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, static_cast<int>(timeStepIndex));
histogramCalculator.addData(values);
}
}

View File

@ -37,9 +37,11 @@ public:
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator);
virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator);
virtual size_t timeStepCount();
private:

View File

@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigFemNativeVisibleCellsStatCalc.h"
#include "RigFemScalarResultFrames.h"
#include "RigFemPartResultsCollection.h"
#include <math.h>
#include "RigStatisticsMath.h"
#include "RigGeoMechCaseData.h"
#include "RigFemPartCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemNativeVisibleCellsStatCalc::RigFemNativeVisibleCellsStatCalc(RigGeoMechCaseData* femCase,
const RigFemResultAddress& resVarAddr,
const cvf::UByteArray* cellVisibilities)
: m_caseData(femCase), m_resVarAddr(resVarAddr), m_cellVisibilities(cellVisibilities)
{
m_resultsData = femCase->femPartResults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemNativeVisibleCellsStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
{
MinMaxAccumulator acc(min, max);
traverseElementNodes(acc, timeStepIndex);
min = acc.min;
max = acc.max;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemNativeVisibleCellsStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
{
PosNegAccumulator acc(pos, neg);
traverseElementNodes(acc, timeStepIndex);
pos = acc.pos;
neg = acc.neg;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemNativeVisibleCellsStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount)
{
SumCountAccumulator acc(valueSum, sampleCount);
traverseElementNodes(acc, timeStepIndex);
valueSum = acc.valueSum;
sampleCount = acc.sampleCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemNativeVisibleCellsStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator)
{
traverseElementNodes(histogramCalculator, timeStepIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigFemNativeVisibleCellsStatCalc::timeStepCount()
{
return m_resultsData->frameCount();
}

View File

@ -0,0 +1,118 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
//==================================================================================================
///
//==================================================================================================
#include "RigStatisticsCalculator.h"
#include "RigFemResultAddress.h"
#include "cvfArray.h"
class RigGeoMechCaseData;
class RigFemPartResultsCollection;
class RigFemNativeVisibleCellsStatCalc : public RigStatisticsCalculator
{
public:
RigFemNativeVisibleCellsStatCalc(RigGeoMechCaseData* femCase,
const RigFemResultAddress& resVarAddr,
const cvf::UByteArray* cellVisibilities);
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator);
virtual size_t timeStepCount();
private:
RigGeoMechCaseData* m_caseData;
RigFemPartResultsCollection* m_resultsData;
RigFemResultAddress m_resVarAddr;
cvf::cref<cvf::UByteArray> m_cellVisibilities;
template <typename StatisticsAccumulator>
void traverseElementNodes(StatisticsAccumulator& accumulator, size_t timeStepIndex)
{
int partCount = m_caseData->femParts()->partCount();
if (m_resVarAddr.resultPosType == RIG_NODAL)
{
for (int pIdx = 0; pIdx < partCount; ++pIdx)
{
RigFemPart* part = m_caseData->femParts()->part(pIdx);
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex);
size_t nodeCount = values.size();
cvf::UByteArray nodeVisibilities(nodeCount);
nodeVisibilities.setAll(false);
int elmCount = part->elementCount();
for (int elmIdx = 0; elmIdx < elmCount; ++elmIdx)
{
if (!(*m_cellVisibilities)[elmIdx]) continue;
int elmNodeCount = RigFemTypes::elmentNodeCount(part->elementType(elmIdx));
for (int elmLocIdx = 0; elmLocIdx < elmNodeCount; ++elmLocIdx)
{
size_t elmNodeResIdx = part->elementNodeResultIdx(elmIdx, elmLocIdx);
int nodeIdx = part->nodeIdxFromElementNodeResultIdx(elmNodeResIdx);
nodeVisibilities[nodeIdx] = true;
}
}
for (size_t nodeIdx = 0; nodeIdx < nodeCount; ++nodeIdx)
{
if (nodeVisibilities[nodeIdx])
{
accumulator.addValue(values[nodeIdx]);
}
}
}
}
else
{
for (int pIdx = 0; pIdx < partCount; ++pIdx)
{
RigFemPart* part = m_caseData->femParts()->part(pIdx);
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex);
int elmCount = part->elementCount();
for (int elmIdx = 0; elmIdx < elmCount; ++elmIdx)
{
if (!(*m_cellVisibilities)[elmIdx]) continue;
int elmNodeCount = RigFemTypes::elmentNodeCount(part->elementType(elmIdx));
for (int elmLocIdx = 0; elmLocIdx < elmNodeCount; ++elmLocIdx)
{
size_t elmNodeResIdx = part->elementNodeResultIdx(elmIdx, elmLocIdx);
accumulator.addValue(values[elmNodeResIdx]);
}
}
}
}
}
};

View File

@ -781,6 +781,14 @@ void RigFemPartResultsCollection::meanScalarValue(const RigFemResultAddress& res
this->statistics(resVarAddr)->meanCellScalarValues(*meanValue);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemPartResultsCollection::meanScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* meanValue)
{
this->statistics(resVarAddr)->meanCellScalarValues(frameIndex, *meanValue);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -789,6 +797,14 @@ void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress&
this->statistics(resVarAddr)->p10p90CellScalarValues(*p10, *p90);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* p10, double* p90)
{
this->statistics(resVarAddr)->p10p90CellScalarValues(frameIndex, *p10, *p90);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -797,3 +813,19 @@ const std::vector<size_t>& RigFemPartResultsCollection::scalarValuesHistogram(co
return this->statistics(resVarAddr)->cellScalarValuesHistogram();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<size_t>& RigFemPartResultsCollection::scalarValuesHistogram(const RigFemResultAddress& resVarAddr, int frameIndex)
{
return this->statistics(resVarAddr)->cellScalarValuesHistogram(frameIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RigFemPartResultsCollection::partCount() const
{
return m_femParts->partCount();
}

View File

@ -43,17 +43,20 @@ public:
std::vector<std::string> stepNames();
bool assertResultsLoaded(const RigFemResultAddress& resVarAddr);
const std::vector<float>& resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex);
int partCount() const;
int frameCount();
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax);
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero);
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax);
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero);
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero);
void meanScalarValue(const RigFemResultAddress& resVarAddr, double* meanValue);
void meanScalarValue(const RigFemResultAddress& resVarAddr, int frameIndex, double* meanValue);
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90);
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex, double* p10, double* p90);
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr);
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr, int frameIndex);
private:
RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex,
@ -64,7 +67,6 @@ private:
RigFemScalarResultFrames* calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string fieldNameToConvert);
RigFemScalarResultFrames* calculateEnIpPorBarResult(int partIndex, const RigFemResultAddress &convertedResultAddr);
friend class RigFemNativeStatCalc;
cvf::Collection<RigFemPartResults> m_femPartResults;
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
cvf::cref<RigFemPartCollection> m_femParts;

View File

@ -0,0 +1,148 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigFemTimeHistoryResultAccessor.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemTypes.h"
#include "RigGeoMechCaseData.h"
#include <cmath> // Needed for HUGE_VAL on Linux
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemTimeHistoryResultAccessor::RigFemTimeHistoryResultAccessor(RigGeoMechCaseData* geomData, RigFemResultAddress femResultAddress,
size_t gridIndex, size_t cellIndex, const cvf::Vec3d& intersectionPoint)
: m_geoMechCaseData(geomData),
m_femResultAddress(femResultAddress),
m_gridIndex(gridIndex),
m_cellIndex(cellIndex),
m_intersectionPoint(intersectionPoint)
{
computeTimeHistoryData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RigFemTimeHistoryResultAccessor::topologyText() const
{
QString text;
if (m_geoMechCaseData)
{
RigFemPart* femPart = m_geoMechCaseData->femParts()->part(m_gridIndex);
int elementId = femPart->elmId(m_cellIndex);
text += QString("Element : Id[%1]").arg(elementId);
size_t i = 0;
size_t j = 0;
size_t k = 0;
if (m_geoMechCaseData->femParts()->part(m_gridIndex)->structGrid()->ijkFromCellIndex(m_cellIndex, &i, &j, &k))
{
// Adjust to 1-based Eclipse indexing
i++;
j++;
k++;
cvf::Vec3d domainCoord = m_intersectionPoint;
text += QString(", ijk[%1, %2, %3]").arg(i).arg(j).arg(k);
QString formattedText;
formattedText.sprintf("Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", domainCoord.x(), domainCoord.y(), -domainCoord.z());
text += formattedText;
}
}
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigFemTimeHistoryResultAccessor::timeHistoryValues() const
{
return m_timeHistoryValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemTimeHistoryResultAccessor::computeTimeHistoryData()
{
m_timeHistoryValues.clear();
size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T;
// Compute scalar result index from geometry
{
RigFemPart* femPart = m_geoMechCaseData->femParts()->part(m_gridIndex);
RigElementType elmType = femPart->elementType(m_cellIndex);
const int* elmentConn = femPart->connectivities(m_cellIndex);
int elmNodeCount = RigFemTypes::elmentNodeCount(elmType);
// Find the closest node
int closestLocalNode = -1;
float minDist = std::numeric_limits<float>::infinity();
for (int lNodeIdx = 0; lNodeIdx < elmNodeCount; ++lNodeIdx)
{
int nodeIdx = elmentConn[lNodeIdx];
cvf::Vec3f nodePos = femPart->nodes().coordinates[nodeIdx];
float dist = (nodePos - cvf::Vec3f(m_intersectionPoint)).lengthSquared();
if (dist < minDist)
{
closestLocalNode = lNodeIdx;
minDist = dist;
}
}
// Create a text showing the results from the closest node
if (closestLocalNode >= 0)
{
int nodeIdx = elmentConn[closestLocalNode];
if (m_femResultAddress.resultPosType == RIG_NODAL)
{
scalarResultIndex = static_cast<size_t>(nodeIdx);
}
else
{
scalarResultIndex = femPart->elementNodeResultIdx(static_cast<int>(m_cellIndex), closestLocalNode);
}
}
}
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) return;
RigFemPartResultsCollection* femPartResultsColl = m_geoMechCaseData->femPartResults();
for (int frameIdx = 0; frameIdx < femPartResultsColl->frameCount(); frameIdx++)
{
const std::vector<float>& scalarResults = m_geoMechCaseData->femPartResults()->resultValues(m_femResultAddress, static_cast<int>(m_gridIndex), frameIdx);
if (scalarResults.size())
{
float scalarValue = scalarResults[scalarResultIndex];
m_timeHistoryValues.push_back(scalarValue);
}
}
}

View File

@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigFemResultAddress.h"
#include "cvfStructGrid.h"
#include "cvfVector3.h"
class RigGeoMechCaseData;
class RigFemTimeHistoryResultAccessor
{
public:
RigFemTimeHistoryResultAccessor(RigGeoMechCaseData* geomData, RigFemResultAddress femResultAddress,
size_t gridIndex, size_t cellIndex, const cvf::Vec3d& intersectionPoint);
QString topologyText() const;
std::vector<double> timeHistoryValues() const;
private:
void computeTimeHistoryData();
private:
RigGeoMechCaseData* m_geoMechCaseData;
RigFemResultAddress m_femResultAddress;
size_t m_gridIndex;
size_t m_cellIndex;
size_t m_scalarResultIndex;
cvf::Vec3d m_intersectionPoint;
std::vector<double> m_timeHistoryValues;
};

View File

@ -32,8 +32,7 @@ ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapperEffectGenerator.h
${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.h
${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.h
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.h
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -62,6 +61,7 @@ ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapperEffectGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivScalarMapperUtils.cpp
${CEE_CURRENT_LIST_DIR}RivCellEdgeGeometryUtils.cpp
${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
)

View File

@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivSingleCellPartGenerator.h"
#include "RigCaseData.h"
#include "cafEffectGenerator.h"
#include "cvfPart.h"
#include "cvfRenderStateDepth.h"
#include "cvfStructGridGeometryGenerator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivSingleCellPartGenerator::RivSingleCellPartGenerator(RigCaseData* rigCaseData, size_t gridIndex, size_t cellIndex)
: m_rigCaseData(rigCaseData),
m_gridIndex(gridIndex),
m_cellIndex(cellIndex)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Part> RivSingleCellPartGenerator::createPart(const cvf::Color3f color)
{
cvf::ref<cvf::Part> part = new cvf::Part;
part->setName("Hightlight part for cell index " + m_cellIndex);
part->setDrawable(createMeshDrawable().p());
cvf::ref<cvf::Effect> eff;
caf::MeshEffectGenerator effGen(color);
eff = effGen.generateUnCachedEffect();
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
depth->enableDepthTest(false);
eff->setRenderState(depth.p());
part->setEffect(eff.p());
return part;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivSingleCellPartGenerator::createMeshDrawable()
{
if (m_rigCaseData &&
m_cellIndex != cvf::UNDEFINED_SIZE_T)
{
return cvf::StructGridGeometryGenerator::createMeshDrawableFromSingleCell(m_rigCaseData->grid(m_gridIndex), m_cellIndex);
}
return NULL;
}

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfDrawableGeo.h"
namespace cvf
{
class Part;
}
class RigCaseData;
//==================================================================================================
///
///
//==================================================================================================
class RivSingleCellPartGenerator
{
public:
RivSingleCellPartGenerator(RigCaseData* rigCaseData, size_t gridIndex, size_t cellIndex);
cvf::ref<cvf::Part> createPart(const cvf::Color3f color);
private:
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
private:
RigCaseData* m_rigCaseData;
size_t m_gridIndex;
size_t m_cellIndex;
};

View File

@ -63,8 +63,8 @@ ${CEE_CURRENT_LIST_DIR}RimViewController.h
${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlot.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlotTrack.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.h
${CEE_CURRENT_LIST_DIR}RimWellLogTrack.h
${CEE_CURRENT_LIST_DIR}RimWellLogCurve.h
${CEE_CURRENT_LIST_DIR}RimViewLinker.h
${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.h
${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.h
@ -132,8 +132,8 @@ ${CEE_CURRENT_LIST_DIR}RimViewController.cpp
${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlotTrack.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogTrack.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogCurve.cpp
${CEE_CURRENT_LIST_DIR}RimViewLinker.cpp
${CEE_CURRENT_LIST_DIR}RimViewLinkerCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurve.cpp

View File

@ -1,6 +1,6 @@
#include "gtest/gtest.h"
#include "RigWellLogCurveData.h"
#include "RigCurveDataTools.h"
#include <cmath> // Needed for HUGE_VAL on Linux
@ -19,7 +19,7 @@ TEST(RimWellLogExtractionCurveImplTest, StripOffInvalidValAtEndsOfVector)
values.push_back(HUGE_VAL);
std::vector< std::pair<size_t, size_t> > valuesIntervals;
RigWellLogCurveDataTestInterface::calculateIntervalsOfValidValues(values, &valuesIntervals);
RigCurveDataTools::calculateIntervalsOfValidValues(values, &valuesIntervals);
EXPECT_EQ(1, static_cast<int>(valuesIntervals.size()));
EXPECT_EQ(2, static_cast<int>(valuesIntervals[0].first));
@ -43,7 +43,7 @@ TEST(RimWellLogExtractionCurveImplTest, StripOffHugeValAtEndsAndInteriorOfVector
values.push_back(HUGE_VAL);
std::vector< std::pair<size_t, size_t> > valuesIntervals;
RigWellLogCurveDataTestInterface::calculateIntervalsOfValidValues(values, &valuesIntervals);
RigCurveDataTools::calculateIntervalsOfValidValues(values, &valuesIntervals);
EXPECT_EQ(2, static_cast<int>(valuesIntervals.size()));
EXPECT_EQ(2, static_cast<int>(valuesIntervals[0].first));

View File

@ -41,7 +41,39 @@
#include "RigFemResultAddress.h"
#include "RigFemPartResultsCollection.h"
#include "RigStatisticsDataCache.h"
#include "RigFemNativeVisibleCellsStatCalc.h"
#include "RigEclipseNativeVisibleCellsStatCalc.h"
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
namespace caf
{
template<>
void caf::AppEnum<Rim3dOverlayInfoConfig::StatisticsTimeRangeType>::setUp()
{
addItem(Rim3dOverlayInfoConfig::ALL_TIMESTEPS, "ALL_TIMESTEPS", "All Time Steps");
addItem(Rim3dOverlayInfoConfig::CURRENT_TIMESTEP, "CURRENT_TIMESTEP", "Current Time Step");
setDefault(Rim3dOverlayInfoConfig::ALL_TIMESTEPS);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
namespace caf
{
template<>
void caf::AppEnum<Rim3dOverlayInfoConfig::StatisticsCellRangeType>::setUp()
{
addItem(Rim3dOverlayInfoConfig::ALL_CELLS, "ALL_CELLS", "All Active Cells");
addItem(Rim3dOverlayInfoConfig::VISIBLE_CELLS, "VISIBLE_CELLS", "Visible Cells");
setDefault(Rim3dOverlayInfoConfig::ALL_CELLS);
}
}
//--------------------------------------------------------------------------------------------------
///
@ -56,6 +88,10 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
CAF_PDM_InitField(&showInfoText, "ShowInfoText", true, "Info Text", "", "", "");
CAF_PDM_InitField(&showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "");
CAF_PDM_InitField(&showHistogram, "ShowHistogram", true, "Histogram", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_statisticsTimeRange, "StatisticsTimeRange", "Statistics Time Range", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_statisticsCellRange, "StatisticsCellRange", "Statistics Cell Range", "", "", "");
//m_statisticsCellRange.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
@ -109,9 +145,11 @@ void Rim3dOverlayInfoConfig::update3DInfo()
m_viewDef->viewer()->showInfoText(showInfoText());
m_viewDef->viewer()->showHistogram(false);
m_viewDef->viewer()->showAnimationProgress(showAnimProgress());
m_isVisCellStatUpToDate = false;
RimEclipseView * reservoirView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
if (reservoirView) updateReservoir3DInfo(reservoirView);
if (reservoirView) updateEclipse3DInfo(reservoirView);
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (geoMechView) updateGeoMech3DInfo(geoMechView);
}
@ -135,8 +173,67 @@ void Rim3dOverlayInfoConfig::setReservoirView(RimView* ownerReservoirView)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirView)
void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * reservoirView)
{
double min = HUGE_VAL, max = HUGE_VAL;
double p10 = HUGE_VAL, p90 = HUGE_VAL;
double mean = HUGE_VAL;
const std::vector<size_t>* histogram = NULL;
bool isResultsInfoRelevant = reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult();
if (showHistogram() || showInfoText())
{
if (isResultsInfoRelevant)
{
size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex();
if (m_statisticsCellRange == ALL_CELLS)
{
if (m_statisticsTimeRange == ALL_TIMESTEPS)
{
reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean);
histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex));
}
else if (m_statisticsTimeRange == CURRENT_TIMESTEP )
{
int timeStepIdx = reservoirView->currentTimeStep();
reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, timeStepIdx, min, max);
reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, timeStepIdx, p10, p90);
reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, timeStepIdx, mean);
histogram = &(reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex, timeStepIdx));
}
else
{
CVF_ASSERT(false);
}
}
else if ( m_statisticsCellRange == VISIBLE_CELLS)
{
updateVisCellStatsIfNeeded();
if (m_statisticsTimeRange == ALL_TIMESTEPS)
{
// TODO: Only valid if we have no dynamic property filter
m_visibleCellStatistics->meanCellScalarValues(mean);
m_visibleCellStatistics->minMaxCellScalarValues(min, max);
m_visibleCellStatistics->p10p90CellScalarValues(p10, p90);
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram());
}
else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
{
int currentTimeStep = reservoirView->currentTimeStep();
m_visibleCellStatistics->meanCellScalarValues(currentTimeStep, mean);
m_visibleCellStatistics->minMaxCellScalarValues(currentTimeStep, min, max);
m_visibleCellStatistics->p10p90CellScalarValues(currentTimeStep, p10, p90);
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep));
}
}
}
}
if (showInfoText())
{
QString caseName;
@ -180,22 +277,17 @@ void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirVie
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
}
if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult())
if (isResultsInfoRelevant)
{
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
// Wait until regression tests confirm new statisticks is ok :
//infoText += QString("<br>Statistics for: ") + m_statisticsTimeRange().uiText() + " and " + m_statisticsCellRange().uiText();
double min, max;
double p10, p90;
double mean;
size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex();
reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean);
//infoText += QString("<blockquote><b>Min:</b> %1 <b>P10:</b> %2 <b>Mean:</b> %3 <b>P90:</b> %4 <b>Max:</b> %5 </blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
//infoText += QString("<blockquote><pre>Min: %1 P10: %2 Mean: %3 \n P90: %4 Max: %5 </pre></blockquote>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
infoText += QString("<table border=0 cellspacing=5 ><tr><td>Min</td><td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
"<tr><td>%1</td><td> %2</td><td> %3</td><td> %4</td><td> %5 </td></tr></table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> <td> %5 </td></tr>"
"</table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
if (reservoirView->faultResultSettings()->hasValidCustomResult())
{
@ -255,19 +347,10 @@ void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirVie
if (showHistogram())
{
if (reservoirView->hasUserRequestedAnimation() && reservoirView->cellResult()->hasResult())
if (isResultsInfoRelevant)
{
double min, max;
double p10, p90;
double mean;
size_t scalarIndex = reservoirView->cellResult()->scalarResultIndex();
reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
reservoirView->currentGridCellResults()->cellResults()->p10p90CellScalarValues(scalarIndex, p10, p90);
reservoirView->currentGridCellResults()->cellResults()->meanCellScalarValues(scalarIndex, mean);
reservoirView->viewer()->showHistogram(true);
reservoirView->viewer()->setHistogram(min, max, reservoirView->currentGridCellResults()->cellResults()->cellScalarValuesHistogram(scalarIndex));
reservoirView->viewer()->setHistogram(min, max, *histogram);
reservoirView->viewer()->setHistogramPercentiles(p10, p90, mean);
}
}
@ -278,12 +361,74 @@ void Rim3dOverlayInfoConfig::updateReservoir3DInfo(RimEclipseView * reservoirVie
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
{
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL;
bool isResultsInfoRelevant = caseData && geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult();
// Retreive result stats if needed
double min = HUGE_VAL, max = HUGE_VAL;
double p10 = HUGE_VAL, p90 = HUGE_VAL;
double mean = HUGE_VAL;
const std::vector<size_t>* histogram = NULL;
if (showInfoText() || showHistogram())
{
if (isResultsInfoRelevant)
{
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
if (m_statisticsCellRange == ALL_CELLS)
{
if (m_statisticsTimeRange == ALL_TIMESTEPS)
{
caseData->femPartResults()->meanScalarValue(resAddress, &mean);
caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max);
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress));
}
else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
{
int timeStepIdx = geoMechView->currentTimeStep();
caseData->femPartResults()->meanScalarValue(resAddress, timeStepIdx, &mean);
caseData->femPartResults()->minMaxScalarValues(resAddress, timeStepIdx, &min, &max);
caseData->femPartResults()->p10p90ScalarValues(resAddress, timeStepIdx, &p10, &p90);
histogram = &(caseData->femPartResults()->scalarValuesHistogram(resAddress, timeStepIdx));
}
}
else if (m_statisticsCellRange == VISIBLE_CELLS)
{
this->updateVisCellStatsIfNeeded();
if (m_statisticsTimeRange == ALL_TIMESTEPS)
{
// TODO: Only valid if we have no dynamic property filter
m_visibleCellStatistics->meanCellScalarValues(mean);
m_visibleCellStatistics->minMaxCellScalarValues(min, max);
m_visibleCellStatistics->p10p90CellScalarValues(p10, p90);
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram());
}
else if (m_statisticsTimeRange == CURRENT_TIMESTEP)
{
int timeStepIdx = geoMechView->currentTimeStep();
m_visibleCellStatistics->meanCellScalarValues(timeStepIdx, mean);
m_visibleCellStatistics->minMaxCellScalarValues(timeStepIdx, min, max);
m_visibleCellStatistics->p10p90CellScalarValues(timeStepIdx, p10, p90);
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(timeStepIdx));
}
}
}
}
// Compose text
if (showInfoText())
{
QString infoText;
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL;
RigFemPartCollection* femParts = caseData ? caseData->femParts() : NULL;
if (femParts)
@ -291,93 +436,100 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
QString caseName = geoMechCase->caseUserDescription();
QString cellCount = QString("%1").arg(femParts->totalElementCount());
QString zScale = QString::number(geoMechView->scaleZ());
infoText = QString(
"<p><b><center>-- %1 --</center></b><p>"
"<b>Cell count:</b> %2 <b>Z-Scale:</b> %3<br>").arg(caseName, cellCount, zScale);
if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult())
infoText = QString(
"<p><b><center>-- %1 --</center></b><p>"
"<b>Cell count:</b> %2 <b>Z-Scale:</b> %3<br>").arg(caseName, cellCount, zScale);
}
if (isResultsInfoRelevant)
{
{
QString resultPos;
QString fieldName = geoMechView->cellResult()->resultFieldUiName();
QString compName = geoMechView->cellResult()->resultComponentUiName();
if (!fieldName.isEmpty())
switch (geoMechView->cellResult()->resultPositionType())
{
switch (geoMechView->cellResult()->resultPositionType())
{
case RIG_NODAL:
resultPos = "Nodal";
break;
case RIG_NODAL:
resultPos = "Nodal";
break;
case RIG_ELEMENT_NODAL:
resultPos = "Element nodal";
break;
case RIG_ELEMENT_NODAL:
resultPos = "Element nodal";
break;
case RIG_INTEGRATION_POINT:
resultPos = "Integration point";
break;
case RIG_INTEGRATION_POINT:
resultPos = "Integration point";
break;
default:
break;
}
infoText += QString(
"<b>Cell result:</b> %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName);
double min = 0, max = 0;
double p10 = 0, p90 = 0;
double mean = 0;
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
caseData->femPartResults()->meanScalarValue(resAddress, &mean);
caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max);
// ToDo: Implement statistics for geomech data
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
infoText += QString("<table border=0 cellspacing=5 ><tr><td>Min</td><td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
"<tr><td>%1</td><td> %2</td><td> %3</td><td> %4</td><td> %5 </td></tr></table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
}
else
{
infoText += QString("<br>");
default:
break;
}
infoText += QString("<b>Cell result:</b> %1, %2, %3").arg(resultPos).arg(fieldName).arg(compName);
}
{
infoText += QString("<table border=0 cellspacing=5 >"
"<tr> <td>Min</td> <td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
"<tr> <td>%1</td> <td> %2</td> <td> %3</td> <td> %4</td> <td> %5</td> </tr>"
"</table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
}
{
int currentTimeStep = geoMechView->currentTimeStep();
QString stepName = QString::fromStdString(caseData->femPartResults()->stepNames()[currentTimeStep]);
infoText += QString("<b>Time Step:</b> %1 <b>Time:</b> %2").arg(currentTimeStep).arg(stepName);
}
}
geoMechView->viewer()->setInfoText(infoText);
}
// Populate histogram
if (showHistogram())
{
if (geoMechView->hasUserRequestedAnimation() && geoMechView->cellResult()->hasResult())
if (isResultsInfoRelevant)
{
geoMechView->viewer()->showHistogram(true);
// ToDo: Implement statistics for geomech data
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RigGeoMechCaseData* caseData = geoMechCase ? geoMechCase->geoMechData() : NULL;
if (caseData)
{
double min = 0, max = 0;
double p10 = 0, p90 = 0;
double mean = 0;
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
caseData->femPartResults()->meanScalarValue(resAddress, &mean);
caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max);
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
geoMechView->viewer()->setHistogram(min, max, caseData->femPartResults()->scalarValuesHistogram(resAddress));
geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean);
}
geoMechView->viewer()->setHistogram(min, max, *histogram);
geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::updateVisCellStatsIfNeeded()
{
RimEclipseView * eclipseView = dynamic_cast<RimEclipseView*>(m_viewDef.p());
RimGeoMechView * geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
if (!m_isVisCellStatUpToDate)
{
cvf::ref<RigStatisticsCalculator> calc;
if (geoMechView)
{
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
calc = new RigFemNativeVisibleCellsStatCalc(geoMechView->geoMechCase()->geoMechData(),
resAddress,
geoMechView->currentTotalCellVisibility().p());
}
else if (eclipseView)
{
size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex();
calc = new RigEclipseNativeVisibleCellsStatCalc(eclipseView->currentGridCellResults()->cellResults(),
scalarIndex,
eclipseView->currentTotalCellVisibility().p());
}
m_visibleCellStatistics = new RigStatisticsDataCache(calc.p());
m_isVisCellStatUpToDate = true;
}
}

View File

@ -24,12 +24,14 @@
#include "cafAppEnum.h"
#include "cvfAssert.h"
#include "cvfObject.h"
#include "cvfVector2.h"
class RimEclipseView;
class RimGeoMechView;
class RimView;
class RigStatisticsDataCache;
//==================================================================================================
///
@ -51,18 +53,37 @@ public:
caf::PdmField<bool> showInfoText;
caf::PdmField<bool> showAnimProgress;
caf::PdmField<bool> showHistogram;
enum StatisticsTimeRangeType
{
ALL_TIMESTEPS,
CURRENT_TIMESTEP
};
enum StatisticsCellRangeType
{
ALL_CELLS,
VISIBLE_CELLS
};
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual caf::PdmFieldHandle* objectToggleField();
private:
void updateReservoir3DInfo(RimEclipseView * reservoirView);
void updateEclipse3DInfo(RimEclipseView * reservoirView);
void updateGeoMech3DInfo(RimGeoMechView * geoMechView);
caf::PdmField<caf::AppEnum<StatisticsTimeRangeType> > m_statisticsTimeRange;
caf::PdmField<caf::AppEnum<StatisticsCellRangeType> > m_statisticsCellRange;
caf::PdmPointer<RimView> m_viewDef;
cvf::Vec2ui m_position;
void updateVisCellStatsIfNeeded();
bool m_isVisCellStatUpToDate;
cvf::ref<RigStatisticsDataCache> m_visibleCellStatistics;
};

View File

@ -31,7 +31,7 @@
#include "RimReservoirCellResultsStorage.h"
#include "RimView.h"
#include "RimViewLinker.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "cafPdmUiListEditor.h"
@ -128,7 +128,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
RimEclipsePropertyFilter* propFilter = dynamic_cast<RimEclipsePropertyFilter*>(this->parentField()->ownerObject());
RimView* view = NULL;
this->firstAnchestorOrThisOfType(view);
RimWellLogPlotCurve* curve = NULL;
RimWellLogCurve* curve = NULL;
this->firstAnchestorOrThisOfType(curve);
if (&m_resultVariableUiField == changedField)
@ -194,7 +194,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{
QList<caf::PdmOptionItemInfo> optionItems = calculateValueOptionsForSpecifiedDerivedListPosition(false, fieldNeedingOptions, useOptionsOnly);
RimWellLogPlotCurve* curve = NULL;
RimWellLogCurve* curve = NULL;
this->firstAnchestorOrThisOfType(curve);
RimEclipsePropertyFilter* propFilter = dynamic_cast<RimEclipsePropertyFilter*>(this->parentField()->ownerObject());

View File

@ -22,33 +22,42 @@
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RigCaseCellResultsData.h"
#include "RigCaseData.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RimEclipseCase.h"
#include "RimCellEdgeColors.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimCellRangeFilterCollection.h"
#include "RimFaultCollection.h"
#include "RimEclipseFaultColors.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimTernaryLegendConfig.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimTernaryLegendConfig.h"
#include "RimViewController.h"
#include "RimViewLinker.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h"
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "RivReservoirPipesPartMgr.h"
#include "RivSingleCellPartGenerator.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathCollectionPartMgr.h"
#include "cafCadNavigation.h"
#include "cafCeetronPlusNavigation.h"
#include "cafFrameAnimationControl.h"
#include "cafPdmUiTreeOrdering.h"
#include "cvfDrawable.h"
#include "cvfModelBasicList.h"
@ -61,9 +70,6 @@
#include <QMessageBox>
#include <limits.h>
#include "RimViewLinker.h"
#include "RimViewController.h"
#include "cafPdmUiTreeOrdering.h"
@ -644,20 +650,8 @@ void RimEclipseView::updateCurrentTimeStep()
// Well pipes
// ----------
cvf::String wellPipeModelName = "WellPipeModel";
std::vector<cvf::Model*> wellPipeModels;
for (cvf::uint i = 0; i < frameScene->modelCount(); i++)
{
if (frameScene->model(i)->name() == wellPipeModelName)
{
wellPipeModels.push_back(frameScene->model(i));
}
}
for (size_t i = 0; i < wellPipeModels.size(); i++)
{
//printf("updateCurrentTimeStep: Remove WellPipeModel %i from frameScene, for frame %i\n", i, m_currentTimeStep.v());
frameScene->removeModel(wellPipeModels[i]);
}
this->removeModelByName(frameScene, wellPipeModelName);
cvf::ref<cvf::ModelBasicList> wellPipeModelBasicList = new cvf::ModelBasicList;
wellPipeModelBasicList->setName(wellPipeModelName);
@ -680,6 +674,51 @@ void RimEclipseView::updateCurrentTimeStep()
mainGrid->characteristicIJCellSize(),
currentActiveCellInfo()->geometryBoundingBox(),
m_reservoirGridPartManager->scaleTransform());
{
// Actions related to highlight items in scene
//
// Removed highlight model by name
// Create new highlight model with name
// Create and add selected parts
// Modify with scaletransform()
// Add parts to model
// Add model to scene
cvf::String highlightModelName = "HighLightModel";
this->removeModelByName(frameScene, highlightModelName);
cvf::ref<cvf::ModelBasicList> highlightModelBasicList = new cvf::ModelBasicList;
highlightModelBasicList->setName(highlightModelName);
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
std::vector<RiuSelectionItem*> items;
riuSelManager->selectedItems(items);
for (size_t i = 0; i < items.size(); i++)
{
RiuEclipseSelectionItem* eclipseSelItem = dynamic_cast<RiuEclipseSelectionItem*>(items[i]);
if (eclipseSelItem &&
eclipseSelItem->m_view)
{
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase());
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->reservoirData());
RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->reservoirData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_cellIndex);
cvf::ref<cvf::Part> part = partGen.createPart(eclipseSelItem->m_color);
part->setTransform(this->scaleTransform());
part->setPriority(10000);
highlightModelBasicList->addPart(part.p());
}
}
highlightModelBasicList->updateBoundingBoxesRecursive();
frameScene->addModel(highlightModelBasicList.p());
}
}
}
@ -1565,19 +1604,7 @@ void RimEclipseView::addWellPathsToScene(cvf::Scene* scene,
CVF_ASSERT(scaleTransform);
cvf::String wellPathModelName = "WellPathModel";
std::vector<cvf::Model*> wellPathModels;
for (cvf::uint i = 0; i < scene->modelCount(); i++)
{
if (scene->model(i)->name() == wellPathModelName)
{
wellPathModels.push_back(scene->model(i));
}
}
for (size_t i = 0; i < wellPathModels.size(); i++)
{
scene->removeModel(wellPathModels[i]);
}
this->removeModelByName(scene, wellPathModelName);
// Append static Well Paths to model
cvf::ref<cvf::ModelBasicList> wellPathModelBasicList = new cvf::ModelBasicList;

View File

@ -31,7 +31,7 @@
#include "RimGeoMechPropertyFilter.h"
#include "RimGeoMechView.h"
#include "RimViewLinker.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "cafPdmUiListEditor.h"
@ -150,7 +150,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
RimGeoMechPropertyFilter* propFilter = dynamic_cast<RimGeoMechPropertyFilter*>(this->parentField()->ownerObject());
RimView* view = NULL;
this->firstAnchestorOrThisOfType(view);
RimWellLogPlotCurve* curve = NULL;
RimWellLogCurve* curve = NULL;
this->firstAnchestorOrThisOfType(curve);

View File

@ -625,8 +625,8 @@ void RimProject::computeUtmAreaOfInterest()
#include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogCurve.h"
#include "RimWellLogFileChannel.h"
#include <QMenu>
@ -814,13 +814,13 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
commandIds << "RicNewWellLogPlotTrackFeature";
commandIds << "RicDeleteItemFeature";
}
else if (dynamic_cast<RimWellLogPlotTrack*>(uiItem))
else if (dynamic_cast<RimWellLogTrack*>(uiItem))
{
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewWellLogFileCurveFeature";
commandIds << "RicDeleteWellLogPlotTrackFeature";
}
else if (dynamic_cast<RimWellLogPlotCurve*>(uiItem))
else if (dynamic_cast<RimWellLogCurve*>(uiItem))
{
commandIds << "RicExportToLasFileFeature";
commandIds << "RicDeleteItemFeature";

View File

@ -746,3 +746,23 @@ void RimView::replaceRangeFilterCollectionWithOverride()
this->uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName)
{
std::vector<cvf::Model*> modelsToBeRemoved;
for (cvf::uint i = 0; i < scene->modelCount(); i++)
{
if (scene->model(i)->name() == modelName)
{
modelsToBeRemoved.push_back(scene->model(i));
}
}
for (size_t i = 0; i < modelsToBeRemoved.size(); i++)
{
scene->removeModel(modelsToBeRemoved[i]);
}
}

View File

@ -33,7 +33,6 @@
#include "cvfBase.h"
#include "cvfObject.h"
#include <QPointer>
class Rim3dOverlayInfoConfig;
@ -49,6 +48,7 @@ namespace cvf
class BoundingBox;
class ModelBasicList;
class Scene;
class String;
class Transform;
}
@ -151,6 +151,8 @@ protected:
const cvf::BoundingBox& wellPathClipBoundingBox,
cvf::Transform* scaleTransform);
static void removeModelByName(cvf::Scene* scene, const cvf::String& modelName);
virtual void createDisplayModel() = 0;
virtual void updateDisplayModelVisibility() = 0;
virtual void clampCurrentTimestep() = 0;

View File

@ -17,24 +17,24 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RiuWellLogPlotCurve.h"
#include "RiuWellLogTrackPlot.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuWellLogTrack.h"
#include "cvfAssert.h"
// NB! Special macro for pure virtual class
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogPlotCurve, "WellLogPlotCurve");
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimWellLogCurve, "WellLogPlotCurve");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCurve::RimWellLogPlotCurve()
RimWellLogCurve::RimWellLogCurve()
{
CAF_PDM_InitObject("Curve", ":/WellLogCurve16x16.png", "", "");
@ -49,7 +49,7 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
m_qwtPlotCurve = new RiuWellLogPlotCurve;
m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve;
m_qwtPlotCurve->setXAxis(QwtPlot::xTop);
m_qwtPlotCurve->setYAxis(QwtPlot::yLeft);
@ -59,7 +59,7 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCurve::~RimWellLogPlotCurve()
RimWellLogCurve::~RimWellLogCurve()
{
m_qwtPlotCurve->detach();
delete m_qwtPlotCurve;
@ -73,7 +73,7 @@ RimWellLogPlotCurve::~RimWellLogPlotCurve()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimWellLogCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_showCurve)
{
@ -106,7 +106,7 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField()
caf::PdmFieldHandle* RimWellLogCurve::objectToggleField()
{
return &m_showCurve;
}
@ -114,7 +114,7 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateCurveVisibility()
void RimWellLogCurve::updateCurveVisibility()
{
if (m_showCurve() && m_ownerQwtTrack)
{
@ -132,7 +132,7 @@ void RimWellLogPlotCurve::updateCurveVisibility()
wellLogPlot->calculateAvailableDepthRange();
}
RimWellLogPlotTrack* wellLogPlotTrack;
RimWellLogTrack* wellLogPlotTrack;
this->firstAnchestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack)
{
@ -144,7 +144,7 @@ void RimWellLogPlotCurve::updateCurveVisibility()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updatePlotConfiguration()
void RimWellLogCurve::updatePlotConfiguration()
{
this->updateCurveVisibility();
this->updateCurveName();
@ -157,7 +157,7 @@ void RimWellLogPlotCurve::updatePlotConfiguration()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrackPlot* plot)
void RimWellLogCurve::setQwtTrack(RiuWellLogTrack* plot)
{
m_ownerQwtTrack = plot;
if (m_showCurve)
@ -170,7 +170,7 @@ void RimWellLogPlotCurve::setQwtTrack(RiuWellLogTrackPlot* plot)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField()
caf::PdmFieldHandle* RimWellLogCurve::userDescriptionField()
{
return &m_curveName;
}
@ -178,7 +178,7 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth) const
bool RimWellLogCurve::depthRange(double* minimumDepth, double* maximumDepth) const
{
CVF_ASSERT(minimumDepth && maximumDepth);
CVF_ASSERT(m_qwtPlotCurve);
@ -197,7 +197,7 @@ bool RimWellLogPlotCurve::depthRange(double* minimumDepth, double* maximumDepth)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue) const
bool RimWellLogCurve::valueRange(double* minimumValue, double* maximumValue) const
{
CVF_ASSERT(minimumValue && maximumValue);
CVF_ASSERT(m_qwtPlotCurve);
@ -216,7 +216,7 @@ bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::setColor(const cvf::Color3f& color)
void RimWellLogCurve::setColor(const cvf::Color3f& color)
{
m_curveColor = color;
}
@ -224,7 +224,7 @@ void RimWellLogPlotCurve::setColor(const cvf::Color3f& color)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::detachQwtCurve()
void RimWellLogCurve::detachQwtCurve()
{
m_qwtPlotCurve->detach();
}
@ -232,7 +232,7 @@ void RimWellLogPlotCurve::detachQwtCurve()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
QwtPlotCurve* RimWellLogCurve::plotCurve() const
{
return m_qwtPlotCurve;
}
@ -240,7 +240,7 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updatePlotTitle()
void RimWellLogCurve::updatePlotTitle()
{
m_qwtPlotCurve->setTitle(m_curveName);
}
@ -248,7 +248,7 @@ void RimWellLogPlotCurve::updatePlotTitle()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotCurve::isCurveVisible() const
bool RimWellLogCurve::isCurveVisible() const
{
return m_showCurve;
}
@ -256,7 +256,7 @@ bool RimWellLogPlotCurve::isCurveVisible() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::initAfterRead()
void RimWellLogCurve::initAfterRead()
{
updateOptionSensitivity();
}
@ -264,7 +264,7 @@ void RimWellLogPlotCurve::initAfterRead()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::zoomAllOwnerTrackAndPlot()
void RimWellLogCurve::zoomAllOwnerTrackAndPlot()
{
RimWellLogPlot* wellLogPlot;
firstAnchestorOrThisOfType(wellLogPlot);
@ -274,7 +274,7 @@ void RimWellLogPlotCurve::zoomAllOwnerTrackAndPlot()
wellLogPlot->zoomAllDepth();
}
RimWellLogPlotTrack* plotTrack;
RimWellLogTrack* plotTrack;
firstAnchestorOrThisOfType(plotTrack);
if (plotTrack)
{
@ -285,7 +285,7 @@ void RimWellLogPlotCurve::zoomAllOwnerTrackAndPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateCurveName()
void RimWellLogCurve::updateCurveName()
{
if (m_autoName)
{
@ -300,7 +300,7 @@ void RimWellLogPlotCurve::updateCurveName()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updateOptionSensitivity()
void RimWellLogCurve::updateOptionSensitivity()
{
m_curveName.uiCapability()->setUiReadOnly(m_autoName);
}
@ -308,7 +308,7 @@ void RimWellLogPlotCurve::updateOptionSensitivity()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigWellLogCurveData* RimWellLogPlotCurve::curveData() const
const RigWellLogCurveData* RimWellLogCurve::curveData() const
{
return m_curveData.p();
}

View File

@ -28,8 +28,8 @@
#include <vector>
class RigWellLogCurveData;
class RiuWellLogTrackPlot;
class RiuWellLogPlotCurve;
class RiuWellLogTrack;
class RiuLineSegmentQwtPlotCurve;
class QwtPlotCurve;
class QString;
@ -37,19 +37,19 @@ class QString;
///
///
//==================================================================================================
class RimWellLogPlotCurve : public caf::PdmObject
class RimWellLogCurve : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlotCurve();
virtual ~RimWellLogPlotCurve();
RimWellLogCurve();
virtual ~RimWellLogCurve();
void setColor(const cvf::Color3f& color);
bool depthRange(double* minimumDepth, double* maximumDepth) const;
bool valueRange(double* minimumValue, double* maximumValue) const;
void setQwtTrack(RiuWellLogTrackPlot* plot);
void setQwtTrack(RiuWellLogTrack* plot);
void detachQwtCurve();
bool isCurveVisible() const;
@ -81,8 +81,8 @@ protected:
virtual void initAfterRead();
QPointer<RiuWellLogTrackPlot> m_ownerQwtTrack;
RiuWellLogPlotCurve* m_qwtPlotCurve;
QPointer<RiuWellLogTrack> m_ownerQwtTrack;
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
cvf::ref<RigWellLogCurveData> m_curveData;
caf::PdmField<bool> m_showCurve;

View File

@ -37,8 +37,8 @@
#include "RimProject.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimEclipseView.h"
@ -46,8 +46,8 @@
#include "RimGeoMechView.h"
#include "RimGeoMechCellColors.h"
#include "RiuWellLogPlotCurve.h"
#include "RiuWellLogTrackPlot.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuWellLogTrack.h"
#include "cafPdmUiTreeOrdering.h"
@ -145,7 +145,7 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view)
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
RimWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_case)
{
@ -177,7 +177,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::updatePlotData()
{
RimWellLogPlotCurve::updatePlotConfiguration();
RimWellLogCurve::updatePlotConfiguration();
if (isCurveVisible())
{
@ -255,7 +255,9 @@ void RimWellLogExtractionCurve::updatePlotData()
}
}
m_qwtPlotCurve->setCurveData(m_curveData.p());
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues().data(), static_cast<int>(m_curveData->xPlotValues().size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
zoomAllOwnerTrackAndPlot();
if (m_ownerQwtTrack) m_ownerQwtTrack->replot();
@ -378,7 +380,7 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::initAfterRead()
{
RimWellLogPlotCurve::initAfterRead();
RimWellLogCurve::initAfterRead();
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());

View File

@ -19,7 +19,7 @@
#pragma once
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "cafPdmPtrField.h"
#include "cafPdmChildField.h"
@ -34,7 +34,7 @@ class RimView;
///
///
//==================================================================================================
class RimWellLogExtractionCurve : public RimWellLogPlotCurve
class RimWellLogExtractionCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;
public:

View File

@ -25,11 +25,11 @@
#include "RimWellPath.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RimWellLogPlot.h"
#include "RiuWellLogTrackPlot.h"
#include "RiuWellLogPlotCurve.h"
#include "RiuWellLogTrack.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
@ -70,7 +70,7 @@ RimWellLogFileCurve::~RimWellLogFileCurve()
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::updatePlotData()
{
RimWellLogPlotCurve::updatePlotConfiguration();
RimWellLogCurve::updatePlotConfiguration();
if (isCurveVisible())
{
@ -114,7 +114,8 @@ void RimWellLogFileCurve::updatePlotData()
}
}
m_qwtPlotCurve->setCurveData(m_curveData.p());
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->depthPlotValues().data(), static_cast<int>(m_curveData->xPlotValues().size()));
m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices());
zoomAllOwnerTrackAndPlot();
@ -143,7 +144,7 @@ void RimWellLogFileCurve::setWellLogChannelName(const QString& name)
//--------------------------------------------------------------------------------------------------
void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
RimWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_wellPath)
{

View File

@ -19,7 +19,7 @@
#pragma once
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "cafPdmPtrField.h"
#include "cafPdmField.h"
@ -33,7 +33,7 @@ class RimWellLogFileChannel;
///
///
//==================================================================================================
class RimWellLogFileCurve : public RimWellLogPlotCurve
class RimWellLogFileCurve : public RimWellLogCurve
{
CAF_PDM_HEADER_INIT;

View File

@ -19,10 +19,10 @@
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RiuWellLogPlot.h"
#include "RiuWellLogTrackPlot.h"
#include "RiuWellLogTrack.h"
#include "RiuMainWindow.h"
#include "cafPdmUiTreeView.h"
@ -167,7 +167,7 @@ caf::PdmFieldHandle* RimWellLogPlot::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::addTrack(RimWellLogPlotTrack* track)
void RimWellLogPlot::addTrack(RimWellLogTrack* track)
{
m_tracks.push_back(track);
if (m_viewer)
@ -182,7 +182,7 @@ void RimWellLogPlot::addTrack(RimWellLogPlotTrack* track)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::insertTrack(RimWellLogPlotTrack* track, size_t index)
void RimWellLogPlot::insertTrack(RimWellLogTrack* track, size_t index)
{
m_tracks.insert(index, track);
@ -198,7 +198,7 @@ void RimWellLogPlot::insertTrack(RimWellLogPlotTrack* track, size_t index)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::removeTrack(RimWellLogPlotTrack* track)
void RimWellLogPlot::removeTrack(RimWellLogTrack* track)
{
if (track)
{
@ -210,11 +210,11 @@ void RimWellLogPlot::removeTrack(RimWellLogPlotTrack* track)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracksToMove)
void RimWellLogPlot::moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove)
{
for (size_t tIdx = 0; tIdx < tracksToMove.size(); tIdx++)
{
RimWellLogPlotTrack* track = tracksToMove[tIdx];
RimWellLogTrack* track = tracksToMove[tIdx];
RimWellLogPlot* wellLogPlot;
track->firstAnchestorOrThisOfType(wellLogPlot);
@ -534,7 +534,7 @@ QString RimWellLogPlot::depthPlotTitle() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimWellLogPlot::trackIndex(RimWellLogPlotTrack* track)
size_t RimWellLogPlot::trackIndex(RimWellLogTrack* track)
{
return m_tracks.index(track);
}

View File

@ -27,7 +27,7 @@
#include <QPointer>
class RiuWellLogPlot;
class RimWellLogPlotTrack;
class RimWellLogTrack;
//==================================================================================================
@ -56,12 +56,12 @@ public:
caf::PdmField< std::vector<int> > windowGeometry;
void addTrack(RimWellLogPlotTrack* track);
void insertTrack(RimWellLogPlotTrack* track, size_t index);
void addTrack(RimWellLogTrack* track);
void insertTrack(RimWellLogTrack* track, size_t index);
size_t trackCount() { return m_tracks.size();}
void removeTrack(RimWellLogPlotTrack* track);
size_t trackIndex(RimWellLogPlotTrack* track);
void moveTracks(RimWellLogPlotTrack* insertAfterTrack, const std::vector<RimWellLogPlotTrack*>& tracksToMove);
void removeTrack(RimWellLogTrack* track);
size_t trackIndex(RimWellLogTrack* track);
void moveTracks(RimWellLogTrack* insertAfterTrack, const std::vector<RimWellLogTrack*>& tracksToMove);
void loadDataAndUpdate();
void updateTracks();
@ -101,7 +101,7 @@ private:
caf::PdmField<bool> m_showWindow;
caf::PdmField<QString> m_userName;
caf::PdmField< caf::AppEnum< DepthTypeEnum > > m_depthType;
caf::PdmChildArrayField<RimWellLogPlotTrack*> m_tracks;
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;
caf::PdmField<double> m_minVisibleDepth;
caf::PdmField<double> m_maxVisibleDepth;

View File

@ -17,12 +17,12 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "RiuWellLogTrackPlot.h"
#include "RiuWellLogTrack.h"
#include "RiuWellLogPlot.h"
#include "RiuMainWindow.h"
@ -35,12 +35,12 @@
#define RI_LOGPLOTTRACK_MAXX_DEFAULT 100.0
CAF_PDM_SOURCE_INIT(RimWellLogPlotTrack, "WellLogPlotTrack");
CAF_PDM_SOURCE_INIT(RimWellLogTrack, "WellLogPlotTrack");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotTrack::RimWellLogPlotTrack()
RimWellLogTrack::RimWellLogTrack()
{
CAF_PDM_InitObject("Track", ":/WellLogTrack16x16.png", "", "");
@ -60,7 +60,7 @@ RimWellLogPlotTrack::RimWellLogPlotTrack()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotTrack::~RimWellLogPlotTrack()
RimWellLogTrack::~RimWellLogTrack()
{
delete m_wellLogTrackPlotWidget;
}
@ -68,7 +68,7 @@ RimWellLogPlotTrack::~RimWellLogPlotTrack()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::setDescription(const QString& description)
void RimWellLogTrack::setDescription(const QString& description)
{
m_userName = description;
}
@ -76,7 +76,7 @@ void RimWellLogPlotTrack::setDescription(const QString& description)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_show)
{
@ -104,7 +104,7 @@ void RimWellLogPlotTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogPlotTrack::objectToggleField()
caf::PdmFieldHandle* RimWellLogTrack::objectToggleField()
{
return &m_show;
}
@ -112,7 +112,7 @@ caf::PdmFieldHandle* RimWellLogPlotTrack::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogPlotTrack::userDescriptionField()
caf::PdmFieldHandle* RimWellLogTrack::userDescriptionField()
{
return &m_userName;
}
@ -120,7 +120,7 @@ caf::PdmFieldHandle* RimWellLogPlotTrack::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::addCurve(RimWellLogPlotCurve* curve)
void RimWellLogTrack::addCurve(RimWellLogCurve* curve)
{
curves.push_back(curve);
@ -133,7 +133,7 @@ void RimWellLogPlotTrack::addCurve(RimWellLogPlotCurve* curve)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index)
void RimWellLogTrack::insertCurve(RimWellLogCurve* curve, size_t index)
{
curves.insert(index, curve);
// Todo: Mark curve data to use either TVD or MD
@ -147,7 +147,7 @@ void RimWellLogPlotTrack::insertCurve(RimWellLogPlotCurve* curve, size_t index)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::removeCurve(RimWellLogPlotCurve* curve)
void RimWellLogTrack::removeCurve(RimWellLogCurve* curve)
{
size_t index = curves.index(curve);
if ( index < curves.size())
@ -161,7 +161,7 @@ void RimWellLogPlotTrack::removeCurve(RimWellLogPlotCurve* curve)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellLogTrackPlot* RimWellLogPlotTrack::viewer()
RiuWellLogTrack* RimWellLogTrack::viewer()
{
return m_wellLogTrackPlotWidget;
}
@ -169,7 +169,7 @@ RiuWellLogTrackPlot* RimWellLogPlotTrack::viewer()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::availableDepthRange(double* minimumDepth, double* maximumDepth)
void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumDepth)
{
double minDepth = HUGE_VAL;
double maxDepth = -HUGE_VAL;
@ -202,7 +202,7 @@ void RimWellLogPlotTrack::availableDepthRange(double* minimumDepth, double* maxi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::loadDataAndUpdate()
void RimWellLogTrack::loadDataAndUpdate()
{
CVF_ASSERT(m_wellLogTrackPlotWidget);
@ -222,11 +222,11 @@ void RimWellLogPlotTrack::loadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::recreateViewer()
void RimWellLogTrack::recreateViewer()
{
if (m_wellLogTrackPlotWidget == NULL)
{
m_wellLogTrackPlotWidget = new RiuWellLogTrackPlot(this);
m_wellLogTrackPlotWidget = new RiuWellLogTrack(this);
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
{
@ -238,7 +238,7 @@ void RimWellLogPlotTrack::recreateViewer()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::detachAllCurves()
void RimWellLogTrack::detachAllCurves()
{
for (size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
{
@ -249,7 +249,7 @@ void RimWellLogPlotTrack::detachAllCurves()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::zoomAllXAndZoomAllDepthOnOwnerPlot()
void RimWellLogTrack::zoomAllXAndZoomAllDepthOnOwnerPlot()
{
if (m_wellLogTrackPlotWidget)
{
@ -269,7 +269,7 @@ void RimWellLogPlotTrack::zoomAllXAndZoomAllDepthOnOwnerPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::alignDepthZoomToPlotAndZoomAllX()
void RimWellLogTrack::alignDepthZoomToPlotAndZoomAllX()
{
if (m_wellLogTrackPlotWidget)
{
@ -292,7 +292,7 @@ void RimWellLogPlotTrack::alignDepthZoomToPlotAndZoomAllX()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::zoomAllXAxis()
void RimWellLogTrack::zoomAllXAxis()
{
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
@ -333,7 +333,7 @@ void RimWellLogPlotTrack::zoomAllXAxis()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCurve* RimWellLogPlotTrack::curveDefinitionFromCurve(const QwtPlotCurve* curve) const
RimWellLogCurve* RimWellLogTrack::curveDefinitionFromCurve(const QwtPlotCurve* curve) const
{
for (size_t idx = 0; idx < curves.size(); idx++)
{
@ -349,7 +349,7 @@ RimWellLogPlotCurve* RimWellLogPlotTrack::curveDefinitionFromCurve(const QwtPlot
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_userName);
@ -361,7 +361,7 @@ void RimWellLogPlotTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimWellLogPlotTrack::curveIndex(RimWellLogPlotCurve* curve)
size_t RimWellLogTrack::curveIndex(RimWellLogCurve* curve)
{
return curves.index(curve);
}
@ -369,7 +369,7 @@ size_t RimWellLogPlotTrack::curveIndex(RimWellLogPlotCurve* curve)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlotTrack::isVisible()
bool RimWellLogTrack::isVisible()
{
return m_show;
}

View File

@ -27,8 +27,8 @@
#include <vector>
class RimWellLogPlotCurve;
class RiuWellLogTrackPlot;
class RimWellLogCurve;
class RiuWellLogTrack;
class QwtPlotCurve;
@ -36,19 +36,19 @@ class QwtPlotCurve;
///
///
//==================================================================================================
class RimWellLogPlotTrack : public caf::PdmObject
class RimWellLogTrack : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlotTrack();
virtual ~RimWellLogPlotTrack();
RimWellLogTrack();
virtual ~RimWellLogTrack();
void setDescription(const QString& description);
bool isVisible();
void addCurve(RimWellLogPlotCurve* curve);
void insertCurve(RimWellLogPlotCurve* curve, size_t index);
void removeCurve(RimWellLogPlotCurve* curve);
size_t curveIndex(RimWellLogPlotCurve* curve);
void addCurve(RimWellLogCurve* curve);
void insertCurve(RimWellLogCurve* curve, size_t index);
void removeCurve(RimWellLogCurve* curve);
size_t curveIndex(RimWellLogCurve* curve);
size_t curveCount() { return curves.size(); }
void recreateViewer();
@ -61,9 +61,9 @@ public:
void alignDepthZoomToPlotAndZoomAllX();
void zoomAllXAxis();
RiuWellLogTrackPlot* viewer();
RiuWellLogTrack* viewer();
RimWellLogPlotCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const;
RimWellLogCurve* curveDefinitionFromCurve(const QwtPlotCurve* curve) const;
protected:
@ -77,9 +77,9 @@ private:
private:
caf::PdmField<bool> m_show;
caf::PdmField<QString> m_userName;
caf::PdmChildArrayField<RimWellLogPlotCurve*> curves;
caf::PdmChildArrayField<RimWellLogCurve*> curves;
caf::PdmField<double> m_visibleXRangeMin;
caf::PdmField<double> m_visibleXRangeMax;
QPointer<RiuWellLogTrackPlot> m_wellLogTrackPlotWidget;
QPointer<RiuWellLogTrack> m_wellLogTrackPlotWidget;
};

View File

@ -34,9 +34,12 @@ ${CEE_CURRENT_LIST_DIR}cvfGeometryTools.inl
${CEE_CURRENT_LIST_DIR}RigPipeInCellEvaluator.h
${CEE_CURRENT_LIST_DIR}RigResultAccessor2d.h
${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.h
${CEE_CURRENT_LIST_DIR}RigNativeStatCalc.h
${CEE_CURRENT_LIST_DIR}RigMultipleDatasetStatCalc.h
${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.h
${CEE_CURRENT_LIST_DIR}RigEclipseNativeVisibleCellsStatCalc.h
${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.h
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.h
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -65,9 +68,12 @@ ${CEE_CURRENT_LIST_DIR}RigFault.cpp
${CEE_CURRENT_LIST_DIR}RigNNCData.cpp
${CEE_CURRENT_LIST_DIR}cvfGeometryTools.cpp
${CEE_CURRENT_LIST_DIR}RigTernaryResultAccessor2d.cpp
${CEE_CURRENT_LIST_DIR}RigNativeStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigMultipleDatasetStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigEclipseNativeStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigEclipseNativeVisibleCellsStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigEclipseMultiPropertyStatCalc.cpp
${CEE_CURRENT_LIST_DIR}RigWellLogCurveData.cpp
${CEE_CURRENT_LIST_DIR}RigTimeHistoryResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCurveDataTools.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -23,8 +23,8 @@
#include "RigMainGrid.h"
#include "RigStatisticsDataCache.h"
#include "RigStatisticsMath.h"
#include "RigMultipleDatasetStatCalc.h"
#include "RigNativeStatCalc.h"
#include "RigEclipseMultiPropertyStatCalc.h"
#include "RigEclipseNativeStatCalc.h"
#include <QDateTime>
#include <math.h>
@ -87,6 +87,14 @@ const std::vector<size_t>& RigCaseCellResultsData::cellScalarValuesHistogram(siz
return m_statisticsDataCache[scalarResultIndex]->cellScalarValuesHistogram();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<size_t>& RigCaseCellResultsData::cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex)
{
return m_statisticsDataCache[scalarResultIndex]->cellScalarValuesHistogram(timeStepIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -95,6 +103,14 @@ void RigCaseCellResultsData::p10p90CellScalarValues(size_t scalarResultIndex, do
m_statisticsDataCache[scalarResultIndex]->p10p90CellScalarValues(p10, p90);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90)
{
m_statisticsDataCache[scalarResultIndex]->p10p90CellScalarValues(timeStepIndex, p10, p90);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -103,6 +119,14 @@ void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, doub
m_statisticsDataCache[scalarResultIndex]->meanCellScalarValues(meanValue);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue)
{
m_statisticsDataCache[scalarResultIndex]->meanCellScalarValues(timeStepIndex, meanValue);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -225,7 +249,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
if (resultName == RimDefines::combinedTransmissibilityResultName())
{
cvf::ref<RigMultipleDatasetStatCalc> calc = new RigMultipleDatasetStatCalc();
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "TRANX"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "TRANY"));
@ -235,7 +259,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
}
else if (resultName == RimDefines::combinedMultResultName())
{
cvf::ref<RigMultipleDatasetStatCalc> calc = new RigMultipleDatasetStatCalc();
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "MULTX"));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, "MULTX-"));
@ -248,7 +272,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
}
else if (resultName == RimDefines::combinedRiTranResultName())
{
cvf::ref<RigMultipleDatasetStatCalc> calc = new RigMultipleDatasetStatCalc();
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTranXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTranYResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riTranZResultName()));
@ -256,7 +280,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
}
else if (resultName == RimDefines::combinedRiMultResultName())
{
cvf::ref<RigMultipleDatasetStatCalc> calc = new RigMultipleDatasetStatCalc();
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultYResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riMultZResultName()));
@ -264,7 +288,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
}
else if (resultName == RimDefines::combinedRiAreaNormTranResultName())
{
cvf::ref<RigMultipleDatasetStatCalc> calc = new RigMultipleDatasetStatCalc();
cvf::ref<RigEclipseMultiPropertyStatCalc> calc = new RigEclipseMultiPropertyStatCalc();
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTranXResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTranYResultName()));
calc->addNativeStatisticsCalculator(this, findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::riAreaNormTranZResultName()));
@ -272,7 +296,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RimDefines::ResultCatType ty
}
else
{
statisticsCalculator = new RigNativeStatCalc(this, scalarResultIndex);
statisticsCalculator = new RigEclipseNativeStatCalc(this, scalarResultIndex);
}
cvf::ref<RigStatisticsDataCache> dataCache = new RigStatisticsDataCache(statisticsCalculator.p());

View File

@ -54,8 +54,11 @@ public:
void posNegClosestToZero(size_t scalarResultIndex, double& pos, double& neg);
void posNegClosestToZero(size_t scalarResultIndex, size_t timeStepIndex, double& pos, double& neg);
const std::vector<size_t>& cellScalarValuesHistogram(size_t scalarResultIndex);
const std::vector<size_t>& cellScalarValuesHistogram(size_t scalarResultIndex, size_t timeStepIndex);
void p10p90CellScalarValues(size_t scalarResultIndex, double& p10, double& p90);
void p10p90CellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& p10, double& p90);
void meanCellScalarValues(size_t scalarResultIndex, double& meanValue);
void meanCellScalarValues(size_t scalarResultIndex, size_t timeStepIndex, double& meanValue);
// Access meta-information about the results
size_t resultCount() const;

View File

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigCurveDataTools.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCurveDataTools::calculateIntervalsOfValidValues(const std::vector<double>& values, std::vector< std::pair<size_t, size_t> >* intervals)
{
CVF_ASSERT(intervals);
int startIdx = -1;
size_t vIdx = 0;
size_t valueCount = values.size();
while (vIdx < valueCount)
{
double value = values[vIdx];
if (value == HUGE_VAL || value == -HUGE_VAL || value != value)
{
if (startIdx >= 0)
{
intervals->push_back(std::make_pair(startIdx, vIdx - 1));
startIdx = -1;
}
}
else if (startIdx < 0)
{
startIdx = (int)vIdx;
}
vIdx++;
}
if (startIdx >= 0 && startIdx < ((int)valueCount))
{
intervals->push_back(std::make_pair(startIdx, valueCount - 1));
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCurveDataTools::computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* fltrIntervals)
{
CVF_ASSERT(fltrIntervals);
const size_t intervalCount = intervals.size();
if (intervalCount < 1) return;
size_t index = 0;
for (size_t intIdx = 0; intIdx < intervalCount; intIdx++)
{
size_t intervalSize = intervals[intIdx].second - intervals[intIdx].first + 1;
fltrIntervals->push_back(std::make_pair(index, index + intervalSize - 1));
index += intervalSize;
}
}

View File

@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfAssert.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RigCurveDataTools
{
public:
static void calculateIntervalsOfValidValues(const std::vector<double>& values,
std::vector< std::pair<size_t, size_t> >* intervals);
template <typename T>
static void getValuesByIntervals(const std::vector<T>& values,
const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector<T>* filteredValues)
{
CVF_ASSERT(filteredValues);
for (size_t intIdx = 0; intIdx < intervals.size(); intIdx++)
{
for (size_t vIdx = intervals[intIdx].first; vIdx <= intervals[intIdx].second; vIdx++)
{
filteredValues->push_back(values[vIdx]);
}
}
}
static void computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* filteredIntervals);
};

View File

@ -17,21 +17,21 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigMultipleDatasetStatCalc.h"
#include "RigNativeStatCalc.h"
#include "RigEclipseMultiPropertyStatCalc.h"
#include "RigEclipseNativeStatCalc.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigMultipleDatasetStatCalc::RigMultipleDatasetStatCalc()
RigEclipseMultiPropertyStatCalc::RigEclipseMultiPropertyStatCalc()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMultipleDatasetStatCalc::addStatisticsCalculator(RigStatisticsCalculator* statisticsCalculator)
void RigEclipseMultiPropertyStatCalc::addStatisticsCalculator(RigStatisticsCalculator* statisticsCalculator)
{
if (statisticsCalculator)
{
@ -42,7 +42,7 @@ void RigMultipleDatasetStatCalc::addStatisticsCalculator(RigStatisticsCalculator
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMultipleDatasetStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
void RigEclipseMultiPropertyStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
{
for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++)
{
@ -56,7 +56,7 @@ void RigMultipleDatasetStatCalc::minMaxCellScalarValues(size_t timeStepIndex, do
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMultipleDatasetStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
void RigEclipseMultiPropertyStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
{
for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++)
{
@ -67,16 +67,32 @@ void RigMultipleDatasetStatCalc::posNegClosestToZero(size_t timeStepIndex, doubl
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMultipleDatasetStatCalc::valueSumAndSampleCount(double& valueSum, size_t& sampleCount)
void RigEclipseMultiPropertyStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount)
{
for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++)
{
if (m_nativeStatisticsCalculators.at(i))
{
m_nativeStatisticsCalculators.at(i)->valueSumAndSampleCount(valueSum, sampleCount);
m_nativeStatisticsCalculators.at(i)->valueSumAndSampleCount(timeStepIndex, valueSum, sampleCount);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseMultiPropertyStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator)
{
for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++)
{
if (m_nativeStatisticsCalculators.at(i))
{
m_nativeStatisticsCalculators.at(i)->addDataToHistogramCalculator(timeStepIndex, histogramCalculator);
}
}
}
@ -84,21 +100,7 @@ void RigMultipleDatasetStatCalc::valueSumAndSampleCount(double& valueSum, size_t
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMultipleDatasetStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator)
{
for (size_t i = 0; i < m_nativeStatisticsCalculators.size(); i++)
{
if (m_nativeStatisticsCalculators.at(i))
{
m_nativeStatisticsCalculators.at(i)->addDataToHistogramCalculator(histogramCalculator);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigMultipleDatasetStatCalc::timeStepCount()
size_t RigEclipseMultiPropertyStatCalc::timeStepCount()
{
if (m_nativeStatisticsCalculators.size() > 0)
{
@ -111,11 +113,11 @@ size_t RigMultipleDatasetStatCalc::timeStepCount()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMultipleDatasetStatCalc::addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex)
void RigEclipseMultiPropertyStatCalc::addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex)
{
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
this->addStatisticsCalculator(new RigNativeStatCalc(cellResultsData, scalarResultIndex));
this->addStatisticsCalculator(new RigEclipseNativeStatCalc(cellResultsData, scalarResultIndex));
}
}

View File

@ -34,18 +34,19 @@ class RigCaseCellResultsData;
//==================================================================================================
///
//==================================================================================================
class RigMultipleDatasetStatCalc : public RigStatisticsCalculator
class RigEclipseMultiPropertyStatCalc : public RigStatisticsCalculator
{
public:
RigMultipleDatasetStatCalc();
RigEclipseMultiPropertyStatCalc();
void addStatisticsCalculator(RigStatisticsCalculator* statisticsCalculator);
void addNativeStatisticsCalculator(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndices);
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator);
virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator);
virtual size_t timeStepCount();

View File

@ -17,7 +17,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigNativeStatCalc.h"
#include "RigEclipseNativeStatCalc.h"
#include "RigStatisticsMath.h"
#include "RigCaseCellResultsData.h"
@ -29,7 +29,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigNativeStatCalc::RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex)
RigEclipseNativeStatCalc::RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex)
: m_resultsData(cellResultsData),
m_scalarResultIndex(scalarResultIndex)
{
@ -39,7 +39,7 @@ RigNativeStatCalc::RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, si
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
void RigEclipseNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
{
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
@ -66,7 +66,7 @@ void RigNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
void RigEclipseNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
{
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
@ -94,46 +94,42 @@ void RigNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, d
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNativeStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator)
void RigEclipseNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator)
{
for (size_t tIdx = 0; tIdx < m_resultsData->timeStepCount(m_scalarResultIndex); tIdx++)
{
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, tIdx);
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
histogramCalculator.addData(values);
}
histogramCalculator.addData(values);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNativeStatCalc::valueSumAndSampleCount(double& valueSum, size_t& sampleCount)
void RigEclipseNativeStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount)
{
for (size_t tIdx = 0; tIdx < m_resultsData->timeStepCount(m_scalarResultIndex); tIdx++)
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
size_t undefValueCount = 0;
for (size_t cIdx = 0; cIdx < values.size(); ++cIdx)
{
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, tIdx);
size_t undefValueCount = 0;
for (size_t cIdx = 0; cIdx < values.size(); ++cIdx)
double value = values[cIdx];
if (value == HUGE_VAL || value != value)
{
double value = values[cIdx];
if (value == HUGE_VAL || value != value)
{
++undefValueCount;
continue;
}
valueSum += value;
++undefValueCount;
continue;
}
sampleCount += values.size();
sampleCount -= undefValueCount;
valueSum += value;
}
sampleCount += values.size();
sampleCount -= undefValueCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigNativeStatCalc::timeStepCount()
size_t RigEclipseNativeStatCalc::timeStepCount()
{
return m_resultsData->timeStepCount(m_scalarResultIndex);
}

View File

@ -31,16 +31,18 @@ class RigCaseCellResultsData;
//==================================================================================================
///
//==================================================================================================
class RigNativeStatCalc : public RigStatisticsCalculator
class RigEclipseNativeStatCalc : public RigStatisticsCalculator
{
public:
RigNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex);
RigEclipseNativeStatCalc(RigCaseCellResultsData* cellResultsData, size_t scalarResultIndex);
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator);
virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator);
virtual size_t timeStepCount();
private:

View File

@ -0,0 +1,91 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigEclipseNativeVisibleCellsStatCalc.h"
#include <math.h>
#include "RigStatisticsMath.h"
#include "RigCaseCellResultsData.h"
#include "RigActiveCellInfo.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseNativeVisibleCellsStatCalc::RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData,
size_t scalarResultIndex,
const cvf::UByteArray* cellVisibilities)
: m_caseData(cellResultsData),
m_scalarResultIndex(scalarResultIndex),
m_cellVisibilities(cellVisibilities)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseNativeVisibleCellsStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
{
MinMaxAccumulator acc(min, max);
traverseCells(acc, timeStepIndex);
min = acc.min;
max = acc.max;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseNativeVisibleCellsStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
{
PosNegAccumulator acc(pos, neg);
traverseCells(acc, timeStepIndex);
pos = acc.pos;
neg = acc.neg;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseNativeVisibleCellsStatCalc::valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount)
{
SumCountAccumulator acc(valueSum, sampleCount);
traverseCells(acc, timeStepIndex);
valueSum = acc.valueSum;
sampleCount = acc.sampleCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigEclipseNativeVisibleCellsStatCalc::addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator)
{
traverseCells(histogramCalculator, timeStepIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigEclipseNativeVisibleCellsStatCalc::timeStepCount()
{
return m_caseData->timeStepCount(m_scalarResultIndex);
}

View File

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
//==================================================================================================
///
//==================================================================================================
#include "RigStatisticsCalculator.h"
#include "cvfArray.h"
class RigCaseCellResultsData;
class RigEclipseNativeVisibleCellsStatCalc : public RigStatisticsCalculator
{
public:
RigEclipseNativeVisibleCellsStatCalc(RigCaseCellResultsData* cellResultsData,
size_t scalarResultIndex,
const cvf::UByteArray* cellVisibilities);
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount);
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator);
virtual size_t timeStepCount();
private:
RigCaseCellResultsData* m_caseData;
size_t m_scalarResultIndex;
cvf::cref<cvf::UByteArray> m_cellVisibilities;
template <typename StatisticsAccumulator>
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
{
std::vector<double>& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo();
size_t cellCount = actCellInfo->reservoirCellCount();
CVF_TIGHT_ASSERT(cellCount == m_cellVisibilities->size());
for (size_t cIdx = 0; cIdx < cellCount; ++cIdx)
{
if (!(*m_cellVisibilities)[cIdx]) continue;
size_t cellResultIndex = actCellInfo->cellResultIndex(cIdx);
if (cellResultIndex != cvf::UNDEFINED_SIZE_T) accumulator.addValue(values[cellResultIndex]);
}
}
};

View File

@ -0,0 +1,113 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigTimeHistoryResultAccessor.h"
#include <cmath> // Needed for HUGE_VAL on Linux
#include "RigCaseData.h"
#include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h"
#include "RigCaseCellResultsData.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigTimeHistoryResultAccessor::RigTimeHistoryResultAccessor(RigCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex, size_t scalarResultIndex, RifReaderInterface::PorosityModelResultType porosityModel)
: m_eclipseCaseData(eclipseCaseData),
m_gridIndex(gridIndex),
m_cellIndex(cellIndex),
m_scalarResultIndex(scalarResultIndex),
m_porosityModel(porosityModel)
{
m_face = cvf::StructGridInterface::NO_FACE;
computeTimeHistoryData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigTimeHistoryResultAccessor::setFace(cvf::StructGridInterface::FaceType face)
{
m_face = face;
computeTimeHistoryData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigTimeHistoryResultAccessor::timeHistoryValues() const
{
return m_timeHistoryValues;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RigTimeHistoryResultAccessor::topologyText() const
{
QString text;
if (m_eclipseCaseData)
{
if (m_cellIndex != cvf::UNDEFINED_SIZE_T)
{
size_t i = 0;
size_t j = 0;
size_t k = 0;
if (m_eclipseCaseData->grid(m_gridIndex)->ijkFromCellIndex(m_cellIndex, &i, &j, &k))
{
// Adjust to 1-based Eclipse indexing
i++;
j++;
k++;
cvf::StructGridInterface::FaceEnum faceEnum(m_face);
text += QString("Cell : [%1, %2, %3]").arg(i).arg(j).arg(k);
}
}
}
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigTimeHistoryResultAccessor::computeTimeHistoryData()
{
m_timeHistoryValues.clear();
if (m_eclipseCaseData)
{
size_t timeStepCount = m_eclipseCaseData->results(m_porosityModel)->timeStepCount(m_scalarResultIndex);
for (size_t i = 0; i < timeStepCount; i++)
{
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(m_eclipseCaseData, m_gridIndex, m_porosityModel, i, m_scalarResultIndex);
m_timeHistoryValues.push_back(resultAccessor->cellScalar(m_cellIndex));
}
}
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfStructGrid.h"
#include "RifReaderInterface.h"
class RigCaseData;
class RigTimeHistoryResultAccessor
{
public:
RigTimeHistoryResultAccessor(RigCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex, size_t scalarResultIndex, RifReaderInterface::PorosityModelResultType porosityModel);
void setFace(cvf::StructGridInterface::FaceType face);
QString topologyText() const;
std::vector<double> timeHistoryValues() const;
private:
void computeTimeHistoryData();
private:
RigCaseData* m_eclipseCaseData;
size_t m_gridIndex;
size_t m_cellIndex;
size_t m_scalarResultIndex;
cvf::StructGridInterface::FaceType m_face;
RifReaderInterface::PorosityModelResultType m_porosityModel;
std::vector<double> m_timeHistoryValues;
};

View File

@ -19,6 +19,8 @@
#include "RigWellLogCurveData.h"
#include "RigCurveDataTools.h"
#include "cvfMath.h"
#include "cvfAssert.h"
@ -101,7 +103,7 @@ const std::vector<double>& RigWellLogCurveData::measuredDepths() const
std::vector<double> RigWellLogCurveData::xPlotValues() const
{
std::vector<double> filteredValues;
getValuesByIntervals(m_xValues, m_intervalsOfContinousValidValues, &filteredValues);
RigCurveDataTools::getValuesByIntervals(m_xValues, m_intervalsOfContinousValidValues, &filteredValues);
return filteredValues;
}
@ -114,11 +116,11 @@ std::vector<double> RigWellLogCurveData::depthPlotValues() const
std::vector<double> filteredValues;
if (m_tvDepths.size())
{
getValuesByIntervals(m_tvDepths, m_intervalsOfContinousValidValues, &filteredValues);
RigCurveDataTools::getValuesByIntervals(m_tvDepths, m_intervalsOfContinousValidValues, &filteredValues);
}
else
{
getValuesByIntervals(m_measuredDepths, m_intervalsOfContinousValidValues, &filteredValues);
RigCurveDataTools::getValuesByIntervals(m_measuredDepths, m_intervalsOfContinousValidValues, &filteredValues);
}
return filteredValues;
@ -130,7 +132,7 @@ std::vector<double> RigWellLogCurveData::depthPlotValues() const
std::vector< std::pair<size_t, size_t> > RigWellLogCurveData::polylineStartStopIndices() const
{
std::vector< std::pair<size_t, size_t> > lineStartStopIndices;
computePolyLineStartStopIndices(m_intervalsOfContinousValidValues, &lineStartStopIndices);
RigCurveDataTools::computePolyLineStartStopIndices(m_intervalsOfContinousValidValues, &lineStartStopIndices);
return lineStartStopIndices;
}
@ -142,7 +144,7 @@ std::vector< std::pair<size_t, size_t> > RigWellLogCurveData::polylineStartStopI
void RigWellLogCurveData::calculateIntervalsOfContinousValidValues()
{
std::vector< std::pair<size_t, size_t> > intervalsOfValidValues;
calculateIntervalsOfValidValues(m_xValues, &intervalsOfValidValues);
RigCurveDataTools::calculateIntervalsOfValidValues(m_xValues, &intervalsOfValidValues);
m_intervalsOfContinousValidValues.clear();
@ -168,42 +170,6 @@ void RigWellLogCurveData::calculateIntervalsOfContinousValidValues()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::calculateIntervalsOfValidValues(const std::vector<double>& values, std::vector< std::pair<size_t, size_t> >* intervals)
{
CVF_ASSERT(intervals);
int startIdx = -1;
size_t vIdx = 0;
size_t valueCount = values.size();
while (vIdx < valueCount)
{
double value = values[vIdx];
if (value == HUGE_VAL || value == -HUGE_VAL || value != value)
{
if (startIdx >= 0)
{
intervals->push_back(std::make_pair(startIdx, vIdx - 1));
startIdx = -1;
}
}
else if (startIdx < 0)
{
startIdx = (int)vIdx;
}
vIdx++;
}
if (startIdx >= 0 && startIdx < ((int)valueCount))
{
intervals->push_back(std::make_pair(startIdx, valueCount - 1));
}
}
//--------------------------------------------------------------------------------------------------
/// Splits the start stop interval between cells that are not close enough.
/// The depth values are expected to contain pair of depths: Depth at cell enter, and cell leave
@ -242,46 +208,6 @@ void RigWellLogCurveData::splitIntervalAtEmptySpace(const std::vector<double>& d
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::getValuesByIntervals(const std::vector<double>& values,
const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector<double>* filteredValues)
{
CVF_ASSERT(filteredValues);
for (size_t intIdx = 0; intIdx < intervals.size(); intIdx++)
{
for (size_t vIdx = intervals[intIdx].first; vIdx <= intervals[intIdx].second; vIdx++)
{
filteredValues->push_back(values[vIdx]);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* fltrIntervals)
{
CVF_ASSERT(fltrIntervals);
const size_t intervalCount = intervals.size();
if (intervalCount < 1) return;
size_t index = 0;
for (size_t intIdx = 0; intIdx < intervalCount; intIdx++)
{
size_t intervalSize = intervals[intIdx].second - intervals[intIdx].first + 1;
fltrIntervals->push_back(std::make_pair(index, index + intervalSize - 1));
index += intervalSize;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -53,18 +53,9 @@ public:
private:
void calculateIntervalsOfContinousValidValues();
static void calculateIntervalsOfValidValues(const std::vector<double>& values,
std::vector< std::pair<size_t, size_t> >* intervals);
static void splitIntervalAtEmptySpace(const std::vector<double>& depthValues,
size_t startIdx, size_t stopIdx,
std::vector< std::pair<size_t, size_t> >* intervals);
static void getValuesByIntervals(const std::vector<double>& values,
const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector<double>* filteredValues);
static void computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* filteredIntervals);
private:
std::vector<double> m_xValues;
std::vector<double> m_measuredDepths;
@ -72,18 +63,5 @@ private:
bool m_isExtractionCurve;
std::vector< std::pair<size_t, size_t> > m_intervalsOfContinousValidValues;
friend class RigWellLogCurveDataTestInterface;
};
//==================================================================================================
///
//==================================================================================================
class RigWellLogCurveDataTestInterface
{
public:
static void calculateIntervalsOfValidValues(const std::vector<double>& values, std::vector< std::pair<size_t, size_t> >* intervals)
{
RigWellLogCurveData::calculateIntervalsOfValidValues(values, intervals);
}
};

View File

@ -19,7 +19,7 @@
#include "RigWellLogFile.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogCurve.h"
#include "well.hpp"
#include "laswell.hpp"
@ -245,7 +245,7 @@ QString RigWellLogFile::wellLogChannelUnit(const QString& wellLogChannelName) co
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigWellLogFile::exportToLasFile(const RimWellLogPlotCurve* curve, const QString& fileName)
bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString& fileName)
{
CVF_ASSERT(curve);

View File

@ -30,7 +30,7 @@ namespace NRLib
class Well;
}
class RimWellLogPlotCurve;
class RimWellLogCurve;
//==================================================================================================
///
@ -52,7 +52,7 @@ public:
QString depthUnit() const;
QString wellLogChannelUnit(const QString& wellLogChannelName) const;
static bool exportToLasFile(const RimWellLogPlotCurve* curve, const QString& fileName);
static bool exportToLasFile(const RimWellLogCurve* curve, const QString& fileName);
private:
void close();

View File

@ -42,3 +42,48 @@ void RigStatisticsCalculator::meanCellScalarValue(double& meanValue)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsCalculator::meanCellScalarValue(size_t timeStepIndex, double& meanValue)
{
double valueSum = 0.0;
size_t sampleCount = 0;
this->valueSumAndSampleCount(timeStepIndex, valueSum, sampleCount);
if (sampleCount == 0)
{
meanValue = HUGE_VAL;
}
else
{
meanValue = valueSum / sampleCount;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsCalculator::valueSumAndSampleCount(double& valueSum, size_t& sampleCount)
{
size_t tsCount = this->timeStepCount();
for (size_t tIdx = 0; tIdx < tsCount; tIdx++)
{
this->valueSumAndSampleCount(tIdx, valueSum, sampleCount);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsCalculator::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator)
{
size_t tsCount = this->timeStepCount();
for (size_t tIdx = 0; tIdx < tsCount; tIdx++)
{
this->addDataToHistogramCalculator(tIdx, histogramCalculator);
}
}

View File

@ -37,8 +37,13 @@ public:
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg) = 0;
void meanCellScalarValue(double& meanValue);
virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount) = 0;
virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator) = 0;
void meanCellScalarValue(size_t timeStepIndex, double& meanValue);
void valueSumAndSampleCount(double& valueSum, size_t& sampleCount);
virtual void valueSumAndSampleCount(size_t timeStepIndex, double& valueSum, size_t& sampleCount) = 0;
void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator);
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) = 0;
virtual size_t timeStepCount() = 0;
};

View File

@ -31,6 +31,8 @@
RigStatisticsDataCache::RigStatisticsDataCache(RigStatisticsCalculator* statisticsCalculator)
: m_statisticsCalculator(statisticsCalculator)
{
CVF_ASSERT(m_statisticsCalculator.notNull());
clearAllStatistics();
}
@ -39,20 +41,8 @@ RigStatisticsDataCache::RigStatisticsDataCache(RigStatisticsCalculator* statisti
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::clearAllStatistics()
{
m_minValue = HUGE_VAL;
m_maxValue = -HUGE_VAL;
m_isMaxMinCalculated = false;
m_posClosestToZero = HUGE_VAL;
m_negClosestToZero = -HUGE_VAL;
m_isClosestToZeroCalculated = false;
m_p10 = HUGE_VAL;
m_p90 = HUGE_VAL;
m_meanValue = HUGE_VAL;
m_isMeanCalculated = false;
m_histogram.clear();
m_maxMinValuesPrTs.clear();
m_posNegClosestToZeroPrTs.clear();
m_statsAllTimesteps = StatisticsValues();
m_statsPrTs.clear();
}
//--------------------------------------------------------------------------------------------------
@ -60,7 +50,7 @@ void RigStatisticsDataCache::clearAllStatistics()
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max)
{
if (!m_isMaxMinCalculated)
if (!m_statsAllTimesteps.m_isMaxMinCalculated)
{
min = HUGE_VAL;
max = -HUGE_VAL;
@ -74,13 +64,13 @@ void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max)
if (tsmax > max) max = tsmax;
}
m_minValue = min;
m_maxValue = max;
m_isMaxMinCalculated = true;
m_statsAllTimesteps.m_minValue = min;
m_statsAllTimesteps.m_maxValue = max;
m_statsAllTimesteps.m_isMaxMinCalculated = true;
}
min = m_minValue;
max = m_maxValue;
min = m_statsAllTimesteps.m_minValue;
max = m_statsAllTimesteps.m_maxValue;
}
//--------------------------------------------------------------------------------------------------
@ -88,27 +78,26 @@ void RigStatisticsDataCache::minMaxCellScalarValues(double& min, double& max)
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
{
if (timeStepIndex >= m_maxMinValuesPrTs.size())
if (timeStepIndex >= m_statsPrTs.size())
{
m_maxMinValuesPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
m_isMaxMinPrTsCalculated.resize(timeStepIndex + 1, false);
m_statsPrTs.resize(timeStepIndex + 1);
}
if (!m_isMaxMinPrTsCalculated[timeStepIndex])
if (!m_statsPrTs[timeStepIndex].m_isMaxMinCalculated)
{
double tsMin = HUGE_VAL;
double tsMax = -HUGE_VAL;
m_statisticsCalculator->minMaxCellScalarValues(timeStepIndex, tsMin, tsMax);
m_maxMinValuesPrTs[timeStepIndex].first = tsMin;
m_maxMinValuesPrTs[timeStepIndex].second = tsMax;
m_statsPrTs[timeStepIndex].m_minValue = tsMin;
m_statsPrTs[timeStepIndex].m_maxValue = tsMax;
m_isMaxMinPrTsCalculated[timeStepIndex] = true;
m_statsPrTs[timeStepIndex].m_isMaxMinCalculated = true;
}
min = m_maxMinValuesPrTs[timeStepIndex].first;
max = m_maxMinValuesPrTs[timeStepIndex].second;
min = m_statsPrTs[timeStepIndex].m_minValue;
max = m_statsPrTs[timeStepIndex].m_maxValue;
}
//--------------------------------------------------------------------------------------------------
@ -116,7 +105,7 @@ void RigStatisticsDataCache::minMaxCellScalarValues(size_t timeStepIndex, double
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg)
{
if (!m_isClosestToZeroCalculated)
if (!m_statsAllTimesteps.m_isClosestToZeroCalculated)
{
pos = HUGE_VAL;
neg = -HUGE_VAL;
@ -130,13 +119,13 @@ void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg)
if (tsPos < pos && tsPos > 0) pos = tsPos;
}
m_posClosestToZero = pos;
m_negClosestToZero = neg;
m_isClosestToZeroCalculated = true;
m_statsAllTimesteps.m_posClosestToZero = pos;
m_statsAllTimesteps.m_negClosestToZero = neg;
m_statsAllTimesteps.m_isClosestToZeroCalculated = true;
}
pos = m_posClosestToZero;
neg = m_negClosestToZero;
pos = m_statsAllTimesteps.m_posClosestToZero;
neg = m_statsAllTimesteps.m_negClosestToZero;
}
//--------------------------------------------------------------------------------------------------
@ -144,13 +133,12 @@ void RigStatisticsDataCache::posNegClosestToZero(double& pos, double& neg)
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& posNearZero, double& negNearZero)
{
if (timeStepIndex >= m_posNegClosestToZeroPrTs.size())
if (timeStepIndex >= m_statsPrTs.size())
{
m_posNegClosestToZeroPrTs.resize(timeStepIndex + 1, std::make_pair(HUGE_VAL, -HUGE_VAL));
m_isClosestToZeroPrTsCalculated.resize(timeStepIndex + 1, false);
m_statsPrTs.resize(timeStepIndex + 1);
}
if (!m_isClosestToZeroPrTsCalculated[timeStepIndex])
if (!m_statsPrTs[timeStepIndex].m_isClosestToZeroCalculated)
{
double pos = HUGE_VAL;
@ -158,24 +146,68 @@ void RigStatisticsDataCache::posNegClosestToZero(size_t timeStepIndex, double& p
m_statisticsCalculator->posNegClosestToZero(timeStepIndex, pos, neg);
m_posNegClosestToZeroPrTs[timeStepIndex].first = pos;
m_posNegClosestToZeroPrTs[timeStepIndex].second = neg;
m_statsPrTs[timeStepIndex].m_posClosestToZero = pos;
m_statsPrTs[timeStepIndex].m_negClosestToZero = neg;
m_isClosestToZeroPrTsCalculated[timeStepIndex] = true;
m_statsPrTs[timeStepIndex].m_isClosestToZeroCalculated = true;
}
posNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].first;
negNearZero = m_posNegClosestToZeroPrTs[timeStepIndex].second;
posNearZero = m_statsPrTs[timeStepIndex].m_posClosestToZero;
negNearZero = m_statsPrTs[timeStepIndex].m_negClosestToZero;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::meanCellScalarValues(double& meanValue)
{
if (!m_statsAllTimesteps.m_isMeanCalculated)
{
m_statisticsCalculator->meanCellScalarValue(m_statsAllTimesteps.m_meanValue);
m_statsAllTimesteps.m_isMeanCalculated = true;
}
meanValue = m_statsAllTimesteps.m_meanValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::meanCellScalarValues(size_t timeStepIndex, double& meanValue)
{
if (timeStepIndex >= m_statsPrTs.size())
{
m_statsPrTs.resize(timeStepIndex + 1);
}
if (!m_statsPrTs[timeStepIndex].m_isMeanCalculated)
{
m_statisticsCalculator->meanCellScalarValue(timeStepIndex, m_statsPrTs[timeStepIndex].m_meanValue);
m_statsPrTs[timeStepIndex].m_isMeanCalculated = true;
}
meanValue = m_statsPrTs[timeStepIndex].m_meanValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram()
{
computeStatisticsIfNeeded();
computeHistogramStatisticsIfNeeded();
return m_histogram;
return m_statsAllTimesteps.m_histogram;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram(size_t timeStepIndex)
{
computeHistogramStatisticsIfNeeded(timeStepIndex);
return m_statsPrTs[timeStepIndex].m_histogram;
}
//--------------------------------------------------------------------------------------------------
@ -183,45 +215,62 @@ const std::vector<size_t>& RigStatisticsDataCache::cellScalarValuesHistogram()
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::p10p90CellScalarValues(double& p10, double& p90)
{
// First make sure they are calculated
computeStatisticsIfNeeded();
computeHistogramStatisticsIfNeeded();
p10 = m_p10;
p90 = m_p90;
p10 = m_statsAllTimesteps.m_p10;
p90 = m_statsAllTimesteps.m_p90;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::meanCellScalarValues(double& meanValue)
void RigStatisticsDataCache::p10p90CellScalarValues(size_t timeStepIndex, double& p10, double& p90)
{
if (!m_isMeanCalculated)
{
m_statisticsCalculator->meanCellScalarValue(m_meanValue);
m_isMeanCalculated = true;
}
computeHistogramStatisticsIfNeeded(timeStepIndex);
meanValue = m_meanValue;
p10 = m_statsPrTs[timeStepIndex].m_p10;
p90 = m_statsPrTs[timeStepIndex].m_p90;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::computeStatisticsIfNeeded()
void RigStatisticsDataCache::computeHistogramStatisticsIfNeeded()
{
if (m_histogram.size() == 0)
if (m_statsAllTimesteps.m_histogram.size() == 0)
{
double min;
double max;
size_t nBins = 100;
this->minMaxCellScalarValues(min, max);
RigHistogramCalculator histCalc(min, max, nBins, &m_histogram);
RigHistogramCalculator histCalc(min, max, nBins, &m_statsAllTimesteps.m_histogram);
m_statisticsCalculator->addDataToHistogramCalculator(histCalc);
m_p10 = histCalc.calculatePercentil(0.1);
m_p90 = histCalc.calculatePercentil(0.9);
m_statsAllTimesteps.m_p10 = histCalc.calculatePercentil(0.1);
m_statsAllTimesteps.m_p90 = histCalc.calculatePercentil(0.9);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStatisticsDataCache::computeHistogramStatisticsIfNeeded(size_t timeStepIndex)
{
if (m_statsPrTs[timeStepIndex].m_histogram.size() == 0)
{
double min;
double max;
size_t nBins = 100;
this->minMaxCellScalarValues(timeStepIndex, min, max);
RigHistogramCalculator histCalc(min, max, nBins, &m_statsPrTs[timeStepIndex].m_histogram);
m_statisticsCalculator->addDataToHistogramCalculator(timeStepIndex, histCalc);
m_statsPrTs[timeStepIndex].m_p10 = histCalc.calculatePercentil(0.1);
m_statsPrTs[timeStepIndex].m_p90 = histCalc.calculatePercentil(0.9);
}
}

View File

@ -39,37 +39,60 @@ public:
void minMaxCellScalarValues(double& min, double& max);
void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
void posNegClosestToZero(double& pos, double& neg);
void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
void p10p90CellScalarValues(double& p10, double& p90);
void p10p90CellScalarValues(size_t timeStepIndex, double& p10, double& p90);
void meanCellScalarValues(double& meanValue);
void meanCellScalarValues(size_t timeStepIndex, double& meanValue);
const std::vector<size_t>& cellScalarValuesHistogram();
const std::vector<size_t>& cellScalarValuesHistogram(size_t timeStepIndex);
private:
void computeStatisticsIfNeeded();
void computeHistogramStatisticsIfNeeded();
void computeHistogramStatisticsIfNeeded(size_t timeStepIndex);
private:
double m_minValue;
double m_maxValue;
bool m_isMaxMinCalculated;
struct StatisticsValues
{
StatisticsValues()
{
m_minValue = HUGE_VAL;
m_maxValue = -HUGE_VAL;
m_isMaxMinCalculated = false;
m_meanValue = HUGE_VAL;
m_isMeanCalculated = false;
m_posClosestToZero = HUGE_VAL;
m_negClosestToZero = -HUGE_VAL;
m_isClosestToZeroCalculated = false;
m_p10 = HUGE_VAL;
m_p90 = HUGE_VAL;
}
double m_posClosestToZero;
double m_negClosestToZero;
bool m_isClosestToZeroCalculated;
double m_minValue;
double m_maxValue;
bool m_isMaxMinCalculated;
double m_meanValue;
bool m_isMeanCalculated;
double m_p10;
double m_p90;
double m_meanValue;
bool m_isMeanCalculated;
double m_posClosestToZero;
double m_negClosestToZero;
bool m_isClosestToZeroCalculated;
double m_p10;
double m_p90;
std::vector<size_t> m_histogram;
std::vector<size_t> m_histogram;
};
std::vector<std::pair<double, double> > m_maxMinValuesPrTs; ///< Max min values for each time step
std::vector<bool> m_isMaxMinPrTsCalculated;
std::vector<std::pair<double, double> > m_posNegClosestToZeroPrTs; ///< PosNeg values for each time step
std::vector<bool> m_isClosestToZeroPrTsCalculated;
StatisticsValues m_statsAllTimesteps;
std::vector<StatisticsValues> m_statsPrTs;
cvf::ref<RigStatisticsCalculator> m_statisticsCalculator;
cvf::ref<RigStatisticsCalculator> m_statisticsCalculator;
};

View File

@ -186,7 +186,28 @@ RigHistogramCalculator::RigHistogramCalculator(double min, double max, size_t nB
for (size_t i = 0; i < m_histogram->size(); ++i) (*m_histogram)[i] = 0;
m_range = max - min;
maxIndex = nBins-1;
m_maxIndex = nBins-1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigHistogramCalculator::addValue(double value)
{
if (value == HUGE_VAL || value != value)
{
return;
}
size_t index = 0;
if (m_maxIndex > 0) index = (size_t)(m_maxIndex*(value - m_min)/m_range);
if (index < m_histogram->size()) // Just clip to the max min range (-index will overflow to positive )
{
(*m_histogram)[index]++;
m_observationCount++;
}
}
//--------------------------------------------------------------------------------------------------
@ -197,20 +218,7 @@ void RigHistogramCalculator::addData(const std::vector<double>& data)
assert(m_histogram);
for (size_t i = 0; i < data.size(); ++i)
{
if (data[i] == HUGE_VAL)
{
continue;
}
size_t index = 0;
if (maxIndex > 0) index = (size_t)(maxIndex*(data[i] - m_min)/m_range);
if(index < m_histogram->size()) // Just clip to the max min range (-index will overflow to positive )
{
(*m_histogram)[index]++;
m_observationCount++;
}
addValue(data[i]);
}
}
@ -222,20 +230,7 @@ void RigHistogramCalculator::addData(const std::vector<float>& data)
assert(m_histogram);
for (size_t i = 0; i < data.size(); ++i)
{
if (data[i] == HUGE_VAL)
{
continue;
}
size_t index = 0;
if (maxIndex > 0) index = (size_t)(maxIndex*(data[i] - m_min)/m_range);
if(index < m_histogram->size()) // Just clip to the max min range (-index will overflow to positive )
{
(*m_histogram)[index]++;
m_observationCount++;
}
addValue(data[i]);
}
}

View File

@ -41,6 +41,8 @@ public:
void addData(const std::vector<double>& data);
void addData(const std::vector<float>& data);
void addValue(double value);
/// Calculates the estimated percentile from the histogram.
/// the percentile is the domain value at which pVal of the observations are below it.
/// Will only consider observed values between min and max, as all other values are discarded from the histogram
@ -48,9 +50,84 @@ public:
double calculatePercentil(double pVal);
private:
size_t maxIndex;
size_t m_maxIndex;
double m_range;
double m_min;
size_t m_observationCount;
std::vector<size_t>* m_histogram;
};
class MinMaxAccumulator
{
public:
MinMaxAccumulator(double initMin, double initMax): max(initMax), min(initMin) {}
void addValue(double value)
{
if (value == HUGE_VAL) // TODO
{
return;
}
if (value < min)
{
min = value;
}
if (value > max)
{
max = value;
}
}
double max;
double min;
};
class PosNegAccumulator
{
public:
PosNegAccumulator(double initPos, double initNeg): pos(initPos), neg(initNeg) {}
void addValue(double value)
{
if (value == HUGE_VAL)
{
return;
}
if (value < pos && value > 0)
{
pos = value;
}
if (value > neg && value < 0)
{
neg = value;
}
}
double pos;
double neg;
};
class SumCountAccumulator
{
public:
SumCountAccumulator(double initSum, size_t initCount): valueSum(initSum), sampleCount(initCount) {}
void addValue(double value)
{
if (value == HUGE_VAL || value != value)
{
return;
}
valueSum += value;
++sampleCount;
}
double valueSum;
size_t sampleCount;
};

View File

@ -30,11 +30,11 @@
#include "RimIdenticalGridCaseGroup.h"
#include "RimMimeData.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "RiuMainWindow.h"
#include "cafPdmUiTreeView.h"
@ -148,9 +148,9 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex(index);
if (dynamic_cast<RimEclipseCase*>(uiItem) ||
dynamic_cast<RimWellLogPlotCurve*>(uiItem) ||
dynamic_cast<RimWellLogCurve*>(uiItem) ||
dynamic_cast<RimWellLogFileChannel*>(uiItem) ||
dynamic_cast<RimWellLogPlotTrack*>(uiItem))
dynamic_cast<RimWellLogTrack*>(uiItem))
{
// TODO: Remember to handle reservoir holding the main grid
itemflags |= Qt::ItemIsDragEnabled;
@ -167,25 +167,25 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
{
if (dynamic_cast<RimWellLogPlot*>(uiItem))
{
if (RiuTypedPdmObjects<RimWellLogPlotTrack>::containsTypedObjects(m_dragItems))
if (RiuTypedPdmObjects<RimWellLogTrack>::containsTypedObjects(m_dragItems))
{
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if (dynamic_cast<RimWellLogPlotTrack*>(uiItem))
else if (dynamic_cast<RimWellLogTrack*>(uiItem))
{
if (RiuTypedPdmObjects<RimWellLogPlotCurve>::containsTypedObjects(m_dragItems))
if (RiuTypedPdmObjects<RimWellLogCurve>::containsTypedObjects(m_dragItems))
{
itemflags |= Qt::ItemIsDropEnabled;
}
else if (RiuTypedPdmObjects<RimWellLogPlotTrack>::containsTypedObjects(m_dragItems))
else if (RiuTypedPdmObjects<RimWellLogTrack>::containsTypedObjects(m_dragItems))
{
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if (dynamic_cast<RimWellLogPlotCurve*>(uiItem))
else if (dynamic_cast<RimWellLogCurve*>(uiItem))
{
if (RiuTypedPdmObjects<RimWellLogPlotCurve>::containsTypedObjects(m_dragItems))
if (RiuTypedPdmObjects<RimWellLogCurve>::containsTypedObjects(m_dragItems))
{
itemflags |= Qt::ItemIsDropEnabled;
}
@ -193,14 +193,14 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
}
else if (m_proposedDropAction == Qt::CopyAction)
{
if (dynamic_cast<RimWellLogPlotTrack*>(uiItem))
if (dynamic_cast<RimWellLogTrack*>(uiItem))
{
if (RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects(m_dragItems))
{
itemflags |= Qt::ItemIsDropEnabled;
}
}
else if (dynamic_cast<RimWellLogPlotCurve*>(uiItem))
else if (dynamic_cast<RimWellLogCurve*>(uiItem))
{
if (RiuTypedPdmObjects<RimWellLogFileChannel>::containsTypedObjects(m_dragItems))
{
@ -241,14 +241,14 @@ bool RiuDragDrop::dropMimeData(const QMimeData *data, Qt::DropAction action, int
return handleGridCaseGroupDrop(action, draggedObjects, gridCaseGroup);
}
RimWellLogPlotCurve* wellLogPlotCurve;
RimWellLogCurve* wellLogPlotCurve;
dropTarget->firstAnchestorOrThisOfType(wellLogPlotCurve);
if (wellLogPlotCurve)
{
return handleWellLogPlotCurveDrop(action, draggedObjects, wellLogPlotCurve);
}
RimWellLogPlotTrack* wellLogPlotTrack;
RimWellLogTrack* wellLogPlotTrack;
dropTarget->firstAnchestorOrThisOfType(wellLogPlotTrack);
if (wellLogPlotTrack)
{
@ -333,7 +333,7 @@ bool RiuDragDrop::handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectG
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlotTrack* trackTarget)
bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogTrack* trackTarget)
{
std::vector<RimWellLogFileChannel*> wellLogFileChannels = RiuTypedPdmObjects<RimWellLogFileChannel>::typedObjectsFromGroup(draggedObjects);
if (wellLogFileChannels.size() > 0)
@ -345,7 +345,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
}
}
std::vector<RimWellLogPlotCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogPlotCurve>::typedObjectsFromGroup(draggedObjects);
std::vector<RimWellLogCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup(draggedObjects);
if (wellLogPlotCurves.size() > 0)
{
if (action == Qt::MoveAction)
@ -355,7 +355,7 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
}
}
std::vector<RimWellLogPlotTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogPlotTrack>::typedObjectsFromGroup(draggedObjects);
std::vector<RimWellLogTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup(draggedObjects);
if (wellLogPlotTracks.size() > 0)
{
if (action == Qt::MoveAction)
@ -373,14 +373,14 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlotCurve* curveDropTarget)
bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogCurve* curveDropTarget)
{
std::vector<RimWellLogPlotCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogPlotCurve>::typedObjectsFromGroup(draggedObjects);
std::vector<RimWellLogCurve*> wellLogPlotCurves = RiuTypedPdmObjects<RimWellLogCurve>::typedObjectsFromGroup(draggedObjects);
if (wellLogPlotCurves.size() > 0)
{
if (action == Qt::MoveAction)
{
RimWellLogPlotTrack* wellLogPlotTrack;
RimWellLogTrack* wellLogPlotTrack;
curveDropTarget->firstAnchestorOrThisOfType(wellLogPlotTrack);
RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(wellLogPlotTrack, wellLogPlotCurves, curveDropTarget);
@ -396,7 +396,7 @@ bool RiuDragDrop::handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObje
//--------------------------------------------------------------------------------------------------
bool RiuDragDrop::handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& draggedObjects, RimWellLogPlot* wellLogPlotTarget)
{
std::vector<RimWellLogPlotTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogPlotTrack>::typedObjectsFromGroup(draggedObjects);
std::vector<RimWellLogTrack*> wellLogPlotTracks = RiuTypedPdmObjects<RimWellLogTrack>::typedObjectsFromGroup(draggedObjects);
if (wellLogPlotTracks.size() > 0)
{
if (action == Qt::MoveAction)

View File

@ -32,8 +32,8 @@ namespace caf
class RimIdenticalGridCaseGroup;
class RimWellLogPlot;
class RimWellLogPlotTrack;
class RimWellLogPlotCurve;
class RimWellLogTrack;
class RimWellLogCurve;
//--------------------------------------------------------------------------------------------------
///
@ -57,9 +57,9 @@ protected:
private:
void moveCasesToGridGroup(caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
bool handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotTrack* wellLogPlotTrack);
bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogTrack* wellLogPlotTrack);
bool handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot);
bool handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotCurve* wellLogPlotCurve);
bool handleWellLogPlotCurveDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogCurve* wellLogPlotCurve);
static void objectGroupFromModelIndexes(caf::PdmObjectGroup* objectGroup, const QModelIndexList &indexes);
static std::vector<caf::PdmPointer<caf::PdmObjectHandle> > objectHandlesFromSelection();

View File

@ -17,29 +17,30 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuWellLogPlotCurve.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RigWellLogCurveData.h"
#include "qwt_symbol.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellLogPlotCurve::RiuWellLogPlotCurve()
RiuLineSegmentQwtPlotCurve::RiuLineSegmentQwtPlotCurve(const QString &title)
: QwtPlotCurve(title)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellLogPlotCurve::~RiuWellLogPlotCurve()
RiuLineSegmentQwtPlotCurve::~RiuLineSegmentQwtPlotCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlotCurve::drawCurve(QPainter* p, int style,
void RiuLineSegmentQwtPlotCurve::drawCurve(QPainter* p, int style,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to) const
{
@ -48,22 +49,32 @@ void RiuWellLogPlotCurve::drawCurve(QPainter* p, int style,
{
for (size_t intIdx = 0; intIdx < intervalCount; intIdx++)
{
QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, (int) m_polyLineStartStopIndices[intIdx].first, (int) m_polyLineStartStopIndices[intIdx].second);
if (m_polyLineStartStopIndices[intIdx].first == m_polyLineStartStopIndices[intIdx].second)
{
// Use a symbol to draw a single value, as a single value will not be visible
// when using QwtPlotCurve::drawCurve without symbols activated
QwtSymbol symbol(QwtSymbol::XCross);
symbol.setSize(10, 10);
QwtPlotCurve::drawSymbols(p, symbol, xMap, yMap, canvasRect, (int) m_polyLineStartStopIndices[intIdx].first, (int) m_polyLineStartStopIndices[intIdx].second);
}
else
{
QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, (int) m_polyLineStartStopIndices[intIdx].first, (int) m_polyLineStartStopIndices[intIdx].second);
}
}
}
else QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, from, to);
else
{
QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, from, to);
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlotCurve::setCurveData(const RigWellLogCurveData* curveData)
void RiuLineSegmentQwtPlotCurve::setLineSegmentStartStopIndices(const std::vector< std::pair<size_t, size_t> >& lineSegmentStartStopIndices)
{
CVF_ASSERT(curveData);
std::vector<double> validXValues = curveData->xPlotValues();
std::vector<double> validYValues = curveData->depthPlotValues();
setSamples(validXValues.data(), validYValues.data(), (int) validXValues.size());
m_polyLineStartStopIndices = curveData->polylineStartStopIndices();
m_polyLineStartStopIndices = lineSegmentStartStopIndices;
}

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "qwt_plot_curve.h"
//==================================================================================================
//
// If infinite data is present in the curve data, Qwt is not able to draw a nice curve.
// This class assumes that inf data is removed, and segments to be draw are indicated by start/stop indices into curve data.
//
// Single values in the curve are drawn using a CrossX symbol
//
// Here you can see the curve segments visualized. Curve segments are drawn between vector indices.
//
// 0 - 1
// 5 - 7
// 9 -10
//
// / ^
// / / \
// Curve / / \ ----- X
//
// Values 1.0|2.0|inf|inf|inf|1.0|2.0|1.0|inf|1.0|1.0|inf|1.0|inf
// Vec index 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13
//==================================================================================================
class RiuLineSegmentQwtPlotCurve : public QwtPlotCurve
{
public:
explicit RiuLineSegmentQwtPlotCurve(const QString &title = QString::null);
virtual ~RiuLineSegmentQwtPlotCurve();
void setLineSegmentStartStopIndices(const std::vector< std::pair<size_t, size_t> >& lineSegmentStartStopIndices);
protected:
virtual void drawCurve(QPainter* p, int style,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to) const;
private:
std::vector< std::pair<size_t, size_t> > m_polyLineStartStopIndices;
};

View File

@ -58,6 +58,7 @@
#include "RiuProcessMonitor.h"
#include "RiuProjectPropertyView.h"
#include "RiuResultInfoPanel.h"
#include "RiuTimeHistoryQwtPlot.h"
#include "RiuTreeViewEventFilter.h"
#include "RiuViewer.h"
#include "RiuWellImportWizard.h"
@ -180,6 +181,8 @@ void RiuMainWindow::cleanupGuiBeforeProjectClose()
setPdmRoot(NULL);
setResultInfo("");
m_timeHistoryQwtPlot->deleteAllCurves();
if (m_pdmUiPropertyView)
{
@ -661,19 +664,15 @@ void RiuMainWindow::createDockPanels()
addDockWidget(Qt::BottomDockWidgetArea, dockPanel);
}
// Test - create well log viewer in a dock widget
// TODO: remove after making MDI widgets for well log viewers
// {
// QDockWidget* dockPanel = new QDockWidget("TEST - Well Log Viewer", this);
// dockPanel->setObjectName("dockWellLogViewer");
// dockPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
//
// RiuWellLogViewer* wellLogViewer = new RiuWellLogViewer(dockPanel);
// dockPanel->setWidget(wellLogViewer);
//
// addDockWidget(Qt::BottomDockWidgetArea, dockPanel);
// }
{
QDockWidget* dockPanel = new QDockWidget("Time History Plot", this);
dockPanel->setObjectName("dockTimeHistoryPanel");
dockPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
m_timeHistoryQwtPlot = new RiuTimeHistoryQwtPlot(dockPanel);
dockPanel->setWidget(m_timeHistoryQwtPlot);
addDockWidget(Qt::RightDockWidgetArea, dockPanel);
}
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
@ -1168,6 +1167,14 @@ QMdiSubWindow* RiuMainWindow::findMdiSubWindow(QWidget* viewer)
return NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuTimeHistoryQwtPlot* RiuMainWindow::timeHistoryPlot()
{
return m_timeHistoryQwtPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -42,6 +42,7 @@ class RiuProcessMonitor;
class RiuResultInfoPanel;
class RiuViewer;
class RiuWellLogPlot;
class RiuTimeHistoryQwtPlot;
namespace caf
{
@ -112,6 +113,8 @@ public:
bool isAnyMdiSubWindowVisible();
QMdiSubWindow* findMdiSubWindow(QWidget* viewer);
RiuTimeHistoryQwtPlot* timeHistoryPlot();
protected:
virtual void closeEvent(QCloseEvent* event);
@ -198,6 +201,8 @@ private:
RiuResultInfoPanel* m_resultInfoPanel;
RiuProcessMonitor* m_processMonitor;
RiuTimeHistoryQwtPlot* m_timeHistoryQwtPlot;
QMenu* m_windowMenu;

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuSelectionColors.h"
#include <QColor>
static const int RI_SELECTION_COLOR_COUNT = 7;
static const int RI_SELECTION_COLOR[] =
{
Qt::magenta,
Qt::cyan,
Qt::blue,
Qt::red,
Qt::green,
Qt::yellow,
Qt::gray
};
static int riuSelectionColorIndex = 0;
//--------------------------------------------------------------------------------------------------
/// Pick default curve color from an index based palette
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiuSelectionColors::curveColorFromTable()
{
QColor color = QColor(Qt::GlobalColor(RI_SELECTION_COLOR[riuSelectionColorIndex % RI_SELECTION_COLOR_COUNT]));
++riuSelectionColorIndex;
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
return cvfColor;
}
//--------------------------------------------------------------------------------------------------
/// Color rarely present in result value colors
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiuSelectionColors::singleCurveColor()
{
riuSelectionColorIndex = 0;
return curveColorFromTable();
}

View File

@ -19,31 +19,15 @@
#pragma once
#include "qwt_plot_curve.h"
#include <vector>
class RigWellLogCurveData;
#include "cvfBase.h"
#include "cvfColor3.h"
//==================================================================================================
///
///
///
//==================================================================================================
class RiuWellLogPlotCurve : public QwtPlotCurve
class RiuSelectionColors
{
public:
RiuWellLogPlotCurve();
virtual ~RiuWellLogPlotCurve();
void setCurveData(const RigWellLogCurveData* curveData);
protected:
virtual void drawCurve(QPainter* p, int style,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to) const;
private:
std::vector< std::pair<size_t, size_t> > m_polyLineStartStopIndices;
static cvf::Color3f curveColorFromTable();
static cvf::Color3f singleCurveColor();
};

View File

@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuSelectionManager.h"
#include "RimEclipseView.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSelectionManager* RiuSelectionManager::instance()
{
static RiuSelectionManager* singleton = new RiuSelectionManager;
return singleton;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSelectionManager::selectedItems(std::vector<RiuSelectionItem*>& items) const
{
items = m_selection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSelectionManager::setSelectedItems(const std::vector<RiuSelectionItem*>& items)
{
CVF_ASSERT(m_selection.size() == 0);
m_selection = items;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSelectionManager::appendItemToSelection(RiuSelectionItem* item)
{
m_selection.push_back(item);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSelectionManager::deleteAllItems()
{
for (size_t i = 0; i < m_selection.size(); i++)
{
delete m_selection[i];
}
m_selection.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuSelectionManager::isEmpty() const
{
return m_selection.size() == 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuEclipseSelectionItem::RiuEclipseSelectionItem(RimEclipseView* view, size_t gridIndex, size_t cellIndex, cvf::Color3f color)
: m_view(view),
m_gridIndex(gridIndex),
m_cellIndex(cellIndex),
m_color(color)
{
}

View File

@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmPointer.h"
#include "cvfBase.h"
#include "cvfColor3.h"
#include <vector>
class RimEclipseView;
class RiuSelectionItem;
//==================================================================================================
//
//
//
//==================================================================================================
class RiuSelectionManager
{
public:
static RiuSelectionManager* instance();
// Returns selected items
// Selection manager owns the selection items and is responsible for delete
void selectedItems(std::vector<RiuSelectionItem*>& items) const;
// Set vector of items as selected items in SelectionManager
// SelectionManager takes ownership of the selection items
void setSelectedItems(const std::vector<RiuSelectionItem*>& items);
// Append item to selected items in SelectionManager
// SelectionManager takes ownership of the item
void appendItemToSelection(RiuSelectionItem* item);
// Deletes all items in the SelectionManager
void deleteAllItems();
bool isEmpty() const;
private:
std::vector < RiuSelectionItem* > m_selection;
};
//==================================================================================================
//
//
//
//==================================================================================================
class RiuSelectionItem
{
public:
enum RiuSelectionType
{
ECLIPSE_SELECTION_OBJECT,
GEOMECH_SELECTION_OBJECT
};
public:
RiuSelectionItem() {}
virtual ~RiuSelectionItem() {};
virtual RiuSelectionType type() = 0;
};
//==================================================================================================
//
//
//
//==================================================================================================
class RiuEclipseSelectionItem : public RiuSelectionItem
{
public:
explicit RiuEclipseSelectionItem(RimEclipseView* view, size_t gridIndex, size_t cellIndex, cvf::Color3f color);
virtual ~RiuEclipseSelectionItem() {};
virtual RiuSelectionType type()
{
return ECLIPSE_SELECTION_OBJECT;
}
public:
caf::PdmPointer<RimEclipseView> m_view;
size_t m_gridIndex;
size_t m_cellIndex;
cvf::Color3f m_color;
};

View File

@ -105,3 +105,38 @@ void RiuSimpleHistogramWidget::setHistogramData(double min, double max, const st
if (m_maxHistogramCount < m_histogramData[colIdx]) m_maxHistogramCount = m_histogramData[colIdx] ;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSimpleHistogramWidget::setPercentiles(double pmin, double pmax)
{
m_minPercentile = pmin;
m_maxPercentile = pmax;
}
#define xBorder 1
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuSimpleHistogramWidget::xPosFromColIdx(size_t colIdx)
{
return (int)(m_x + xBorder + (m_width - 2*xBorder) * colIdx/m_histogramData.size());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuSimpleHistogramWidget::xPosFromDomainValue(double value)
{
double range = m_max - m_min;
return (range == 0.0) ? (int)(m_x + xBorder) : (int)(m_x + xBorder + (m_width - 2*xBorder) * (value - m_min)/(m_max - m_min));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuSimpleHistogramWidget::yPosFromCount(size_t colHeight)
{
return (int)(m_y + m_height - 1 - (m_height - 3) * colHeight/m_maxHistogramCount);
}

View File

@ -10,7 +10,7 @@ public:
RiuSimpleHistogramWidget( QWidget * parent = 0, Qt::WindowFlags f = 0);
void setHistogramData(double min, double max, const std::vector<size_t>& histogram);
void setPercentiles(double pmin, double pmax) {m_minPercentile = pmin; m_maxPercentile = pmax;}
void setPercentiles(double pmin, double pmax);
void setMean(double mean) {m_mean = mean;}
protected:
@ -19,10 +19,10 @@ protected:
private:
void draw(QPainter *painter,int x, int y, int width, int height );
int xPosFromColIdx(size_t colIdx) { return (int)(m_x + 1 + (m_width - 2 ) * colIdx/m_histogramData.size());}
int yPosFromCount(size_t colHeight) { return (int)(m_y + m_height - 1 - (m_height - 3 ) * colHeight/m_maxHistogramCount);}
int xPosFromColIdx(size_t colIdx);
int yPosFromCount(size_t colHeight);
int xPosFromDomainValue(double value) { double range = m_max - m_min; return (range == 0.0) ? (int)(m_x + 1) : (int)(m_x + 1 + (m_width - 2 ) * (value - m_min)/(m_max - m_min));}
int xPosFromDomainValue(double value);
std::vector<size_t> m_histogramData;
double m_max;

View File

@ -0,0 +1,211 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuTimeHistoryQwtPlot.h"
#include "RigCurveDataTools.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "cvfBase.h"
#include "cvfAssert.h"
#include "cvfColor3.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"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuTimeHistoryQwtPlot::RiuTimeHistoryQwtPlot(QWidget* parent)
: QwtPlot(parent)
{
m_grid = new QwtPlotGrid;
m_grid->attach(this);
setDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot()
{
deleteAllCurves();
m_grid->detach();
delete m_grid;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuTimeHistoryQwtPlot::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");
QPolygonF points;
for (int 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->setPen(QPen(QColor(curveColor.rByte(), curveColor.gByte(), curveColor.bByte())));
plotCurve->attach(this);
m_plotCurves.push_back(plotCurve);
this->setAxisScale( QwtPlot::xTop, QwtDate::toDouble(dateTimes.front()), QwtDate::toDouble(dateTimes.back()));
this->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<double>& frameTimes, const std::vector<double>& timeHistoryValues)
{
std::vector<QDateTime> dateTimes;
for (size_t i = 0; i < frameTimes.size(); i++)
{
dateTimes.push_back(QwtDate::toDateTime(frameTimes[i]));
}
addCurve(curveName, curveColor, dateTimes, timeHistoryValues);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuTimeHistoryQwtPlot::deleteAllCurves()
{
for (size_t i = 0; i < m_plotCurves.size(); i++)
{
m_plotCurves[i]->detach();
delete m_plotCurves[i];
}
m_plotCurves.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuTimeHistoryQwtPlot::sizeHint() const
{
return QSize(0, 0);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuTimeHistoryQwtPlot::minimumSizeHint() const
{
return QSize(0, 0);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuTimeHistoryQwtPlot::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);
}

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "qwt_plot.h"
class QwtPlotCurve;
class QwtPlotGrid;
namespace cvf
{
class Color3f;
}
//==================================================================================================
//
//
//
//==================================================================================================
class RiuTimeHistoryQwtPlot : public QwtPlot
{
public:
RiuTimeHistoryQwtPlot(QWidget* parent = NULL);
virtual ~RiuTimeHistoryQwtPlot();
void addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues);
void addCurve(const QString& curveName, const cvf::Color3f& curveColor, const std::vector<double>& frameTimes, const std::vector<double>& timeHistoryValues);
void deleteAllCurves();
protected:
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
private:
void setDefaults();
private:
std::vector<QwtPlotCurve*> m_plotCurves;
QwtPlotGrid* m_grid;
};

View File

@ -225,7 +225,7 @@ void RiuViewer::mouseReleaseEvent(QMouseEvent* event)
if (event->button() == Qt::LeftButton)
{
m_viewerCommands->handlePickAction(event->x(), event->y());
m_viewerCommands->handlePickAction(event->x(), event->y(), event->modifiers());
return;
}
else if (event->button() == Qt::RightButton)

View File

@ -25,11 +25,14 @@
#include "Commands/WellLogCommands/RicNewWellLogFileCurveFeature.h"
#include "Commands/WellLogCommands/RicNewWellLogCurveExtractionFeature.h"
#include "RigCaseCellResultsData.h"
#include "RigCaseData.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
#include "RigGeoMechCaseData.h"
#include "RigTimeHistoryResultAccessor.h"
#include "RigFemTimeHistoryResultAccessor.h"
#include "RimCellRangeFilter.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipseCase.h"
@ -48,13 +51,16 @@
#include "RimProject.h"
#include "RimView.h"
#include "RimViewController.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellLogFile.h"
#include "RiuFemResultTextBuilder.h"
#include "RiuMainWindow.h"
#include "RiuResultTextBuilder.h"
#include "RiuSelectionColors.h"
#include "RiuSelectionManager.h"
#include "RiuTimeHistoryQwtPlot.h"
#include "RiuViewer.h"
#include "RivFemPartGeometryGenerator.h"
@ -400,9 +406,8 @@ void RiuViewerCommands::slotAddGeoMechPropertyFilter()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers)
{
size_t gridIndex = cvf::UNDEFINED_SIZE_T;
size_t cellIndex = cvf::UNDEFINED_SIZE_T;
size_t nncIndex = cvf::UNDEFINED_SIZE_T;
@ -469,6 +474,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
}
}
// Compose a info text regarding the hit
QString pickInfo = "No hits";
@ -489,6 +496,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
resultInfo = textBuilder.mainResultText();
pickInfo = textBuilder.topologyText(", ");
addTimeHistoryCurve(eclipseView, gridIndex, cellIndex, keyboardModifiers);
}
else if (geomView)
{
@ -500,23 +509,155 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
resultInfo = textBuilder.mainResultText();
pickInfo = textBuilder.topologyText(", ");
addTimeHistoryCurve(geomView, gridIndex, cellIndex, localIntersectionPoint, keyboardModifiers);
}
}
if (wellPath)
{
pickInfo = QString("Well path hit: %1").arg(wellPath->name());
}
// Display the text
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!mainWnd) return;
if (cellIndex == cvf::UNDEFINED_SIZE_T &&
!(keyboardModifiers & Qt::ControlModifier))
{
if (mainWnd->timeHistoryPlot()->isVisible())
{
// Delete all curves if no cell is hit
mainWnd->timeHistoryPlot()->deleteAllCurves();
std::vector<RiuSelectionItem*> items;
RiuSelectionManager::instance()->deleteAllItems();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
mainWnd->statusBar()->showMessage(pickInfo);
mainWnd->setResultInfo(resultInfo);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex, Qt::KeyboardModifiers keyboardModifiers)
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!mainWnd->timeHistoryPlot()->isVisible()) return;
if (eclipseView->cellResult()->hasDynamicResult() &&
eclipseView->eclipseCase() &&
eclipseView->eclipseCase()->reservoirData())
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(eclipseView->cellResult()->porosityModel());
size_t scalarIndexWithMaxTimeStepCount = cvf::UNDEFINED_SIZE_T;
eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount);
std::vector<QDateTime> timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(scalarIndexWithMaxTimeStepCount);
RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel);
QString curveName = eclipseView->eclipseCase()->caseUserDescription();
curveName += ", ";
curveName += eclipseView->cellResult()->resultVariable();
curveName += ", ";
curveName += QString("Grid index %1").arg(gridIndex);
curveName += ", ";
curveName += timeHistResultAccessor.topologyText();
std::vector<double> timeHistoryValues = timeHistResultAccessor.timeHistoryValues();
CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size());
std::vector<RiuSelectionItem*> items;
RiuSelectionManager::instance()->selectedItems(items);
bool isItemPartOfSelection = false;
for (size_t i = 0; i < items.size(); i++)
{
RiuEclipseSelectionItem* eclSelItem = dynamic_cast<RiuEclipseSelectionItem*>(items[i]);
if (eclSelItem &&
eclSelItem->m_view == eclipseView &&
eclSelItem->m_gridIndex == gridIndex &&
eclSelItem->m_cellIndex == cellIndex)
{
isItemPartOfSelection = true;
}
}
if (!isItemPartOfSelection)
{
if (!(keyboardModifiers & Qt::ControlModifier))
{
mainWnd->timeHistoryPlot()->deleteAllCurves();
RiuSelectionManager::instance()->deleteAllItems();
}
cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable();
if (RiuSelectionManager::instance()->isEmpty())
{
curveColor = RiuSelectionColors::singleCurveColor();
}
RiuSelectionManager::instance()->appendItemToSelection(new RiuEclipseSelectionItem(eclipseView, gridIndex, cellIndex, curveColor));
mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, timeStepDates, timeHistoryValues);
eclipseView->scheduleCreateDisplayModelAndRedraw();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint, Qt::KeyboardModifiers keyboardModifiers)
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!mainWnd->timeHistoryPlot()->isVisible()) return;
if (geoMechView &&
geoMechView->cellResult() &&
geoMechView->cellResult()->hasResult() &&
geoMechView->geoMechCase() &&
geoMechView->geoMechCase()->geoMechData())
{
RigFemTimeHistoryResultAccessor timeHistResultAccessor(geoMechView->geoMechCase()->geoMechData(), geoMechView->cellResult->resultAddress(), gridIndex, cellIndex, localIntersectionPoint);
QString curveName;
curveName.append(geoMechView->geoMechCase()->caseUserDescription() + ", ");
caf::AppEnum<RigFemResultPosEnum> resPosAppEnum = geoMechView->cellResult()->resultPositionType();
curveName.append(resPosAppEnum.uiText() + ", ");
curveName.append(geoMechView->cellResult()->resultFieldUiName()+ ", ") ;
curveName.append(geoMechView->cellResult()->resultComponentUiName() + ":\n");
curveName.append(timeHistResultAccessor.topologyText());
std::vector<double> timeHistoryValues = timeHistResultAccessor.timeHistoryValues();
std::vector<double> frameTimes;
for (size_t i = 0; i < timeHistoryValues.size(); i++)
{
frameTimes.push_back(i);
}
CVF_ASSERT(frameTimes.size() == timeHistoryValues.size());
cvf::Color3f curveColor = RiuSelectionColors::curveColorFromTable();
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!(keyboardModifiers & Qt::ControlModifier))
{
mainWnd->timeHistoryPlot()->deleteAllCurves();
RiuSelectionManager::instance()->deleteAllItems();
}
mainWnd->timeHistoryPlot()->addCurve(curveName, curveColor, frameTimes, timeHistoryValues);
}
}
//--------------------------------------------------------------------------------------------------
/// Perform picking and return the index of the face that was hit, if a drawable geo was hit
//--------------------------------------------------------------------------------------------------

View File

@ -47,7 +47,8 @@ public:
void setOwnerView(RimView * owner);
void displayContextMenu(QMouseEvent* event);
void handlePickAction(int winPosX, int winPosY);
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
private slots:
void slotRangeFilterI();
@ -62,6 +63,8 @@ private:
void createSliceRangeFilter(int ijOrk);
void extractIntersectionData(const cvf::HitItemCollection& hitItems, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit);
void updateSelectionFromPickedPart(cvf::Part* part);
void addTimeHistoryCurve(RimEclipseView* eclipseView, size_t gridIndex, size_t cellIndex, Qt::KeyboardModifiers keyboardModifiers);
void addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint, Qt::KeyboardModifiers keyboardModifiers);
size_t m_currentGridIdx;
size_t m_currentCellIndex;

View File

@ -19,11 +19,11 @@
#include "RiuWellLogPlot.h"
#include "RiuWellLogTrackPlot.h"
#include "RiuWellLogTrack.h"
#include "RiuMainWindow.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogTrack.h"
#include "cafPdmUiTreeView.h"
#include "cvfAssert.h"
@ -73,7 +73,7 @@ RiuWellLogPlot::~RiuWellLogPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::addTrackPlot(RiuWellLogTrackPlot* trackPlot)
void RiuWellLogPlot::addTrackPlot(RiuWellLogTrack* trackPlot)
{
// Insert the plot to the left of the scroll bar
insertTrackPlot(trackPlot, m_trackPlots.size());
@ -82,7 +82,7 @@ void RiuWellLogPlot::addTrackPlot(RiuWellLogTrackPlot* trackPlot)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t index)
void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index)
{
trackPlot->setParent(this);
@ -113,7 +113,7 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t inde
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrackPlot* trackPlot)
void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrack* trackPlot)
{
if (!trackPlot) return;

View File

@ -24,7 +24,7 @@
#include "cafPdmPointer.h"
class RimWellLogPlot;
class RiuWellLogTrackPlot;
class RiuWellLogTrack;
class QHBoxLayout;
class QScrollBar;
@ -46,9 +46,9 @@ public:
RimWellLogPlot* ownerPlotDefinition();
void addTrackPlot(RiuWellLogTrackPlot* trackPlot);
void insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t index);
void removeTrackPlot(RiuWellLogTrackPlot* trackPlot);
void addTrackPlot(RiuWellLogTrack* trackPlot);
void insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index);
void removeTrackPlot(RiuWellLogTrack* trackPlot);
void setDepthZoomAndReplot(double minDepth, double maxDepth);
@ -73,7 +73,7 @@ private:
QHBoxLayout* m_layout;
QScrollBar* m_scrollBar;
QList<QwtLegend*> m_legends;
QList<RiuWellLogTrackPlot*> m_trackPlots;
QList<RiuWellLogTrack*> m_trackPlots;
caf::PdmPointer<RimWellLogPlot> m_plotDefinition;
QTimer* m_scheduleUpdateChildrenLayoutTimer;
};

View File

@ -17,11 +17,11 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuWellLogTrackPlot.h"
#include "RiuWellLogTrack.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrack.h"
#include "RimWellLogPlotCurve.h"
#include "RimWellLogTrack.h"
#include "RimWellLogCurve.h"
#include "RiuMainWindow.h"
@ -48,7 +48,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellLogTrackPlot::RiuWellLogTrackPlot(RimWellLogPlotTrack* plotTrackDefinition, QWidget* parent)
RiuWellLogTrack::RiuWellLogTrack(RimWellLogTrack* plotTrackDefinition, QWidget* parent)
: QwtPlot(parent)
{
Q_ASSERT(plotTrackDefinition);
@ -64,7 +64,7 @@ RiuWellLogTrackPlot::RiuWellLogTrackPlot(RimWellLogPlotTrack* plotTrackDefinitio
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellLogTrackPlot::~RiuWellLogTrackPlot()
RiuWellLogTrack::~RiuWellLogTrack()
{
m_grid->detach();
delete m_grid;
@ -73,7 +73,7 @@ RiuWellLogTrackPlot::~RiuWellLogTrackPlot()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrackPlot::setDefaults()
void RiuWellLogTrack::setDefaults()
{
QPalette newPalette(palette());
newPalette.setColor(QPalette::Background, Qt::white);
@ -130,7 +130,7 @@ void RiuWellLogTrackPlot::setDefaults()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrackPlot::setDepthZoom(double minDepth, double maxDepth)
void RiuWellLogTrack::setDepthZoom(double minDepth, double maxDepth)
{
// Note: Y-axis is inverted
setAxisScale(QwtPlot::yLeft, maxDepth, minDepth);
@ -139,7 +139,7 @@ void RiuWellLogTrackPlot::setDepthZoom(double minDepth, double maxDepth)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrackPlot::setXRange(double min, double max)
void RiuWellLogTrack::setXRange(double min, double max)
{
setAxisScale(QwtPlot::xTop, min, max);
setAxisScale(QwtPlot::xBottom, min, max);
@ -148,7 +148,7 @@ void RiuWellLogTrackPlot::setXRange(double min, double max)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrackPlot::setDepthTitle(const QString& title)
void RiuWellLogTrack::setDepthTitle(const QString& title)
{
QwtText axisTitleY = axisTitle(QwtPlot::yLeft);
axisTitleY.setText(title);
@ -158,7 +158,7 @@ void RiuWellLogTrackPlot::setDepthTitle(const QString& title)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogTrackPlot::eventFilter(QObject* watched, QEvent* event)
bool RiuWellLogTrack::eventFilter(QObject* watched, QEvent* event)
{
if (watched == canvas())
{
@ -218,7 +218,7 @@ bool RiuWellLogTrackPlot::eventFilter(QObject* watched, QEvent* event)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrackPlot::focusInEvent(QFocusEvent* event)
void RiuWellLogTrack::focusInEvent(QFocusEvent* event)
{
if (m_plotTrackDefinition)
{
@ -230,7 +230,7 @@ void RiuWellLogTrackPlot::focusInEvent(QFocusEvent* event)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogTrackPlot::selectClosestCurve(const QPoint& pos)
void RiuWellLogTrack::selectClosestCurve(const QPoint& pos)
{
QwtPlotCurve* closestCurve = NULL;
double distMin = DBL_MAX;
@ -253,7 +253,7 @@ void RiuWellLogTrackPlot::selectClosestCurve(const QPoint& pos)
if (closestCurve && distMin < 20)
{
RimWellLogPlotCurve* selectedCurve = m_plotTrackDefinition->curveDefinitionFromCurve(closestCurve);
RimWellLogCurve* selectedCurve = m_plotTrackDefinition->curveDefinitionFromCurve(closestCurve);
if (selectedCurve)
{
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(selectedCurve);
@ -264,7 +264,7 @@ void RiuWellLogTrackPlot::selectClosestCurve(const QPoint& pos)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellLogTrackPlot::sizeHint() const
QSize RiuWellLogTrack::sizeHint() const
{
return QSize(0, 0);
}
@ -272,7 +272,7 @@ QSize RiuWellLogTrackPlot::sizeHint() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellLogTrackPlot::minimumSizeHint() const
QSize RiuWellLogTrack::minimumSizeHint() const
{
return QSize(0, 0);
}
@ -280,7 +280,7 @@ QSize RiuWellLogTrackPlot::minimumSizeHint() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogTrackPlot::isRimTrackVisible()
bool RiuWellLogTrack::isRimTrackVisible()
{
if (m_plotTrackDefinition)
{

View File

@ -22,7 +22,7 @@
#include "qwt_plot.h"
#include "cafPdmPointer.h"
class RimWellLogPlotTrack;
class RimWellLogTrack;
class QwtPlotGrid;
class QwtLegend;
@ -33,13 +33,13 @@ class QEvent;
//
//
//==================================================================================================
class RiuWellLogTrackPlot : public QwtPlot
class RiuWellLogTrack : public QwtPlot
{
Q_OBJECT
public:
RiuWellLogTrackPlot(RimWellLogPlotTrack* plotTrackDefinition, QWidget* parent = NULL);
virtual ~RiuWellLogTrackPlot();
RiuWellLogTrack(RimWellLogTrack* plotTrackDefinition, QWidget* parent = NULL);
virtual ~RiuWellLogTrack();
void setDepthZoom(double minDepth, double maxDepth);
void setDepthTitle(const QString& title);
@ -59,7 +59,7 @@ private:
void selectClosestCurve(const QPoint& pos);
private:
caf::PdmPointer<RimWellLogPlotTrack> m_plotTrackDefinition;
caf::PdmPointer<RimWellLogTrack> m_plotTrackDefinition;
QwtPlotGrid* m_grid;
};

View File

@ -252,6 +252,46 @@ ref<DrawableGeo> StructGridGeometryGenerator::createOutlineMeshDrawable(double c
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
ref<DrawableGeo> StructGridGeometryGenerator::createMeshDrawableFromSingleCell(const StructGridInterface* grid, size_t cellIndex)
{
cvf::Vec3d cornerVerts[8];
grid->cellCornerVertices(cellIndex, cornerVerts);
std::vector<Vec3f> vertices;
for (int enumInt = cvf::StructGridInterface::POS_I; enumInt < cvf::StructGridInterface::NO_FACE; enumInt++)
{
cvf::StructGridInterface::FaceType face = static_cast<cvf::StructGridInterface::FaceType>(enumInt);
ubyte faceConn[4];
grid->cellFaceVertexIndices(face, faceConn);
int n;
for (n = 0; n < 4; n++)
{
vertices.push_back(cvf::Vec3f(cornerVerts[faceConn[n]] - grid->displayModelOffset()));
}
}
cvf::ref<cvf::Vec3fArray> cvfVertices = new cvf::Vec3fArray;
cvfVertices->assign(vertices);
if (!(cvfVertices.notNull() && cvfVertices->size() != 0)) return NULL;
ref<DrawableGeo> geo = new DrawableGeo;
geo->setVertexArray(cvfVertices.p());
ref<UIntArray> indices = lineIndicesFromQuadVertexArray(cvfVertices.p());
ref<PrimitiveSetIndexedUInt> prim = new PrimitiveSetIndexedUInt(PT_LINES);
prim->setIndices(indices.p());
geo->addPrimitiveSet(prim.p());
return geo;
}
//--------------------------------------------------------------------------------------------------
///
///

View File

@ -187,6 +187,8 @@ public:
ref<DrawableGeo> createMeshDrawable();
ref<DrawableGeo> createOutlineMeshDrawable(double creaseAngle);
static ref<DrawableGeo> createMeshDrawableFromSingleCell(const StructGridInterface* grid, size_t cellIndex);
private:
static ref<UIntArray>
lineIndicesFromQuadVertexArray(const Vec3fArray* vertexArray);

View File

@ -1,9 +1,9 @@
set(CMAKE_MAJOR_VERSION 1)
set(CMAKE_MINOR_VERSION 5)
set(CMAKE_PATCH_VERSION 0)
# set(DEV_VERSION "-dev")
# set(DEV_VERSION "-RC")
set(CMAKE_PATCH_VERSION 100)
set(DEV_VERSION "-dev")
# https://github.com/CRAVA/crava/tree/master/libs/nrlib
set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")