///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RimWellFlowRateCurve.h" #include "RimWellAllocationPlot.h" #include "RiuLineSegmentQwtPlotCurve.h" #include "qwt_plot.h" #include "RimWellLogPlot.h" //================================================================================================== /// /// //================================================================================================== CAF_PDM_SOURCE_INIT(RimWellFlowRateCurve, "RimWellFlowRateCurve"); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimWellFlowRateCurve::RimWellFlowRateCurve() { CAF_PDM_InitObject("Flow Rate Curve", "", "", ""); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimWellFlowRateCurve::~RimWellFlowRateCurve() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RimWellFlowRateCurve::wellName() const { QString name; RimWellAllocationPlot* wap = wellAllocationPlot(); if (wap) { name = wap->wellName(); } else { name = "Undefined"; } return name; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RimWellFlowRateCurve::wellLogChannelName() const { return "Flow Rate"; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString RimWellFlowRateCurve::createCurveAutoName() { return QString("%1 (%2)").arg(wellLogChannelName()).arg(wellName()); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellFlowRateCurve::onLoadDataAndUpdate() { RimWellLogCurve::updateCurvePresentation(); if (isCurveVisible()) { RimWellLogPlot* wellLogPlot; firstAncestorOrThisOfType(wellLogPlot); CVF_ASSERT(wellLogPlot); m_qwtPlotCurve->setTitle(createCurveAutoName()); RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER; m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast(m_curveData->xPlotValues().size())); m_qwtPlotCurve->setLineSegmentStartStopIndices(m_curveData->polylineStartStopIndices()); updateZoomInParentPlot(); if (m_parentQwtPlot) m_parentQwtPlot->replot(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const { RimWellAllocationPlot* wap = nullptr; this->firstAncestorOrThisOfType(wap); return wap; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellFlowRateCurve::setFlowValues(const std::vector& measuredDepths, const std::vector& flowRates) { m_curveData = new RigWellLogCurveData; m_curveData->setValuesAndMD(flowRates, measuredDepths, RimDefines::UNIT_METER, false); }