#4404 Derived Ensemble: Fix stepping based on data source

This commit is contained in:
Magne Sjaastad
2019-06-07 14:41:55 +02:00
parent 74718c38fc
commit 8ce19c742e
6 changed files with 92 additions and 61 deletions

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -21,22 +21,30 @@
#include "RimDerivedEnsembleCase.h"
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
const std::vector<time_t> RifDerivedEnsembleReader::EMPTY_TIME_STEPS_VECTOR;
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RifDerivedEnsembleReader::RifDerivedEnsembleReader(RimDerivedEnsembleCase* derivedCase)
RifDerivedEnsembleReader::RifDerivedEnsembleReader(RimDerivedEnsembleCase* derivedCase,
RifSummaryReaderInterface* sourceSummaryReader1)
{
CVF_ASSERT(derivedCase);
m_derivedCase = derivedCase;
if (sourceSummaryReader1)
{
// TODO: This is assuming that the addresses of both reader interfaces are equal
m_allResultAddresses = sourceSummaryReader1->allResultAddresses();
m_allErrorAddresses = sourceSummaryReader1->allErrorAddresses();
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
const std::vector<time_t>& RifDerivedEnsembleReader::timeSteps(const RifEclipseSummaryAddress& resultAddress) const
{
@@ -49,7 +57,7 @@ const std::vector<time_t>& RifDerivedEnsembleReader::timeSteps(const RifEclipseS
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RifDerivedEnsembleReader::values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) const
{
@@ -62,12 +70,13 @@ bool RifDerivedEnsembleReader::values(const RifEclipseSummaryAddress& resultAddr
auto dataValues = m_derivedCase->values(resultAddress);
values->clear();
values->reserve(dataValues.size());
for (auto val : dataValues) values->push_back(val);
for (auto val : dataValues)
values->push_back(val);
return true;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
std::string RifDerivedEnsembleReader::unitName(const RifEclipseSummaryAddress& resultAddress) const
{

View File

@@ -33,7 +33,7 @@ class RifDerivedEnsembleReader : public RifSummaryReaderInterface
static const std::vector<time_t> EMPTY_TIME_STEPS_VECTOR;
public:
RifDerivedEnsembleReader(RimDerivedEnsembleCase* derivedCase);
RifDerivedEnsembleReader(RimDerivedEnsembleCase* derivedCase, RifSummaryReaderInterface* sourceSummaryReader1);
const std::vector<time_t>& timeSteps(const RifEclipseSummaryAddress& resultAddress) const override;
bool values(const RifEclipseSummaryAddress& resultAddress, std::vector<double>* values) const override;

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -22,9 +22,8 @@
#include <QDateTime>
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
const std::set<RifEclipseSummaryAddress>& RifSummaryReaderInterface::allResultAddresses() const
{
@@ -32,7 +31,15 @@ const std::set<RifEclipseSummaryAddress>& RifSummaryReaderInterface::allResultAd
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
const std::set<RifEclipseSummaryAddress>& RifSummaryReaderInterface::allErrorAddresses() const
{
return m_allErrorAddresses;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseSummaryAddress RifSummaryReaderInterface::errorAddress(const RifEclipseSummaryAddress& resultAddress) const
{
@@ -43,7 +50,7 @@ RifEclipseSummaryAddress RifSummaryReaderInterface::errorAddress(const RifEclips
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RifSummaryReaderInterface::hasAddress(const RifEclipseSummaryAddress& resultAddress) const
{

View File

@@ -38,7 +38,10 @@ class RifSummaryReaderInterface : public cvf::Object
{
public:
bool hasAddress(const RifEclipseSummaryAddress& resultAddress) const;
const std::set<RifEclipseSummaryAddress>& allResultAddresses() const;
const std::set<RifEclipseSummaryAddress>& allErrorAddresses() const;
RifEclipseSummaryAddress errorAddress(const RifEclipseSummaryAddress& resultAddress) const;
virtual const std::vector<time_t>& timeSteps(const RifEclipseSummaryAddress& resultAddress) const = 0;