mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added time history plot for geo mech models
This commit is contained in:
@@ -51,9 +51,9 @@ RiuTimeHistoryQwtPlot::~RiuTimeHistoryQwtPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector<QDateTime>& dateTimes, const std::vector<double>& yValues)
|
||||
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues)
|
||||
{
|
||||
CVF_ASSERT(dateTimes.size() == yValues.size());
|
||||
CVF_ASSERT(dateTimes.size() == timeHistoryValues.size());
|
||||
|
||||
QwtPlotCurve* plotCurve = new QwtPlotCurve("Curve 1");
|
||||
|
||||
@@ -61,7 +61,7 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector
|
||||
for (int i = 0; i < dateTimes.size(); i++)
|
||||
{
|
||||
double milliSecSinceEpoch = QwtDate::toDouble(dateTimes[i]);
|
||||
points << QPointF(milliSecSinceEpoch, yValues[i]);
|
||||
points << QPointF(milliSecSinceEpoch, timeHistoryValues[i]);
|
||||
}
|
||||
|
||||
plotCurve->setSamples(points);
|
||||
@@ -78,6 +78,21 @@ void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, const std::vector
|
||||
this->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuTimeHistoryQwtPlot::addCurve(const QString& curveName, 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, dateTimes, timeHistoryValues);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -34,7 +34,9 @@ public:
|
||||
RiuTimeHistoryQwtPlot(QWidget* parent = NULL);
|
||||
virtual ~RiuTimeHistoryQwtPlot();
|
||||
|
||||
void addCurve(const QString& curveName, const std::vector<QDateTime>& dateTimes, const std::vector<double>& yValues);
|
||||
void addCurve(const QString& curveName, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues);
|
||||
void addCurve(const QString& curveName, const std::vector<double>& frameTimes, const std::vector<double>& timeHistoryValues);
|
||||
|
||||
void deleteAllCurves();
|
||||
|
||||
private:
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
#include "RigFemTimeHistoryResultAccessor.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -513,6 +514,12 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
|
||||
resultInfo = textBuilder.mainResultText();
|
||||
|
||||
pickInfo = textBuilder.topologyText(", ");
|
||||
|
||||
if (geomView->cellResult() &&
|
||||
geomView->cellResult()->hasResult())
|
||||
{
|
||||
addTimeHistoryCurve(geomView, gridIndex, cellIndex, localIntersectionPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -540,7 +547,6 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t
|
||||
std::vector<QDateTime> timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(eclipseView->cellResult()->scalarResultIndex());
|
||||
|
||||
RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(), gridIndex, cellIndex, eclipseView->cellResult()->scalarResultIndex(), porosityModel);
|
||||
timeHistResultAccessor.computeTimeHistoryData();
|
||||
|
||||
QString curveName = eclipseView->eclipseCase()->caseUserDescription();
|
||||
curveName += " - Result : ";
|
||||
@@ -548,13 +554,48 @@ void RiuViewerCommands::addTimeHistoryCurve(RimEclipseView* eclipseView, size_t
|
||||
curveName += " - ";
|
||||
curveName += timeHistResultAccessor.topologyText();
|
||||
|
||||
std::vector<double> yValues = timeHistResultAccessor.timeHistoryValues();
|
||||
std::vector<double> timeHistoryValues = timeHistResultAccessor.timeHistoryValues();
|
||||
|
||||
CVF_ASSERT(timeStepDates.size() == yValues.size());
|
||||
CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size());
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, yValues);
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, timeStepDates, timeHistoryValues);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint)
|
||||
{
|
||||
if (geoMechView &&
|
||||
geoMechView->cellResult() &&
|
||||
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());
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
mainWnd->timeHistoryPlot()->addCurve(curveName, frameTimes, timeHistoryValues);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -64,6 +64,7 @@ private:
|
||||
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);
|
||||
void addTimeHistoryCurve(RimGeoMechView* geoMechView, size_t gridIndex, size_t cellIndex, const cvf::Vec3d& localIntersectionPoint);
|
||||
|
||||
size_t m_currentGridIdx;
|
||||
size_t m_currentCellIndex;
|
||||
|
||||
Reference in New Issue
Block a user