///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2023 Equinor ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cafPdmField.h" #include "cafPdmObject.h" #include "RimSummaryCurve.h" #include "cafAppEnum.h" #include "regression-analysis/src/PowerFitRegression.hpp" #include namespace regression { class LinearRegression; class PolynominalRegression; class PowerFitRegression; } // namespace regression //================================================================================================== /// /// //================================================================================================== class RimSummaryRegressionAnalysisCurve : public RimSummaryCurve { CAF_PDM_HEADER_INIT; public: enum class RegressionType { LINEAR, POLYNOMINAL, POWER_FIT }; RimSummaryRegressionAnalysisCurve(); ~RimSummaryRegressionAnalysisCurve() override; // Y Axis functions std::vector valuesY() const override; std::vector timeStepsY() const override; // X Axis functions std::vector valuesX() const override; std::vector timeStepsX() const override; private: void onLoadDataAndUpdate( bool updateParentPlot ) override; QString createCurveAutoName() override; QString curveExportDescription( const RifEclipseSummaryAddress& address ) const override; // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; std::tuple, std::vector, QString> computeRegressionCurve( const std::vector& timeSteps, const std::vector& values ) const; static QString generateRegressionText( const regression::LinearRegression& reg ); static QString generateRegressionText( const regression::PolynominalRegression& reg ); static QString generateRegressionText( const regression::PowerFitRegression& reg ); static QString formatDouble( double v ); caf::PdmField> m_regressionType; caf::PdmField m_polynominalDegree; caf::PdmField m_expressionText; std::vector m_valuesX; std::vector m_timeStepsX; std::vector m_valuesY; std::vector m_timeStepsY; };