2017-10-12 00:30:37 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "cafPdmChildArrayField.h"
|
2017-10-13 05:22:35 -05:00
|
|
|
#include "cafPdmObject.h"
|
|
|
|
#include "cafPdmField.h"
|
2017-10-12 00:30:37 -05:00
|
|
|
|
2017-10-23 07:42:38 -05:00
|
|
|
class RimSummaryCalculationVariable;
|
2017-10-12 00:30:37 -05:00
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
///
|
|
|
|
///
|
|
|
|
//==================================================================================================
|
2017-10-23 07:27:04 -05:00
|
|
|
class RimSummaryCalculation : public caf::PdmObject
|
2017-10-12 00:30:37 -05:00
|
|
|
{
|
|
|
|
CAF_PDM_HEADER_INIT;
|
|
|
|
|
|
|
|
public:
|
2017-10-23 07:27:04 -05:00
|
|
|
RimSummaryCalculation();
|
2017-10-12 00:30:37 -05:00
|
|
|
|
2017-10-13 07:33:26 -05:00
|
|
|
void setDescription(const QString& description);
|
|
|
|
QString description() const;
|
2017-10-13 05:22:35 -05:00
|
|
|
|
2017-10-12 00:30:37 -05:00
|
|
|
caf::PdmChildArrayFieldHandle* variables();
|
2017-10-23 14:25:58 -05:00
|
|
|
RimSummaryCalculationVariable* addVariable();
|
2017-10-23 07:42:38 -05:00
|
|
|
void deleteVariable(RimSummaryCalculationVariable* calcVariable);
|
2017-10-12 00:30:37 -05:00
|
|
|
|
|
|
|
const std::vector<double>& values() const;
|
2017-10-18 01:20:21 -05:00
|
|
|
const std::vector<time_t>& timeSteps() const;
|
2017-10-13 05:22:35 -05:00
|
|
|
|
|
|
|
bool parseExpression();
|
|
|
|
bool calculate();
|
2017-10-20 03:20:53 -05:00
|
|
|
void updateDependentCurvesAndPlots();
|
2017-10-13 05:22:35 -05:00
|
|
|
|
|
|
|
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
|
|
|
|
|
|
|
static QString findLeftHandSide(const QString& expresion);
|
2017-10-23 06:11:38 -05:00
|
|
|
|
|
|
|
private:
|
2017-10-23 14:25:58 -05:00
|
|
|
RimSummaryCalculationVariable* findByName(const QString& name) const;
|
2017-10-12 00:30:37 -05:00
|
|
|
|
2017-10-13 07:33:26 -05:00
|
|
|
QString buildCalculationName() const;
|
|
|
|
|
2017-10-12 00:30:37 -05:00
|
|
|
private:
|
2017-10-13 05:22:35 -05:00
|
|
|
caf::PdmField<QString> m_description;
|
2017-10-12 00:30:37 -05:00
|
|
|
caf::PdmField<QString> m_expression;
|
2017-10-23 14:25:58 -05:00
|
|
|
|
|
|
|
caf::PdmChildArrayField<RimSummaryCalculationVariable*> m_variables;
|
2017-10-12 00:30:37 -05:00
|
|
|
|
|
|
|
caf::PdmField<std::vector<double>> m_calculatedValues;
|
2017-10-18 01:20:21 -05:00
|
|
|
caf::PdmField<std::vector<time_t>> m_timesteps;
|
2017-10-12 00:30:37 -05:00
|
|
|
};
|