2026-02-17 09:34:44 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "RifSummaryReaderInterface.h"
|
2026-08-13 15:29:13 +02:00
|
|
|
#include "RigCaseRealizationParameters.h"
|
2026-02-17 09:34:44 +01:00
|
|
|
#include "RimSummaryCase.h"
|
|
|
|
|
|
|
|
|
|
#include <map>
|
2026-08-13 15:29:13 +02:00
|
|
|
#include <memory>
|
2026-02-17 09:34:44 +01:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
class RimMockSummaryCase : public RimSummaryCase, public RifSummaryReaderInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
void setName( const QString& name ) { m_name = name; }
|
|
|
|
|
|
|
|
|
|
void addVector( const RifEclipseSummaryAddress& address,
|
|
|
|
|
const std::vector<time_t>& timeSteps,
|
|
|
|
|
const std::vector<double>& values,
|
|
|
|
|
const std::string& unit = "" )
|
|
|
|
|
{
|
|
|
|
|
m_data[address] = { timeSteps, values, unit };
|
|
|
|
|
m_allResultAddresses.insert( address );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RimSummaryCase overrides
|
|
|
|
|
void createSummaryReaderInterface() override {}
|
|
|
|
|
RifSummaryReaderInterface* summaryReader() override { return this; }
|
|
|
|
|
QString caseName() const override { return m_name; }
|
|
|
|
|
|
|
|
|
|
// RifSummaryReaderInterface overrides
|
|
|
|
|
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override
|
|
|
|
|
{
|
|
|
|
|
auto it = m_data.find( resultAddress );
|
|
|
|
|
if ( it != m_data.end() ) return it->second.timeSteps;
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::pair<bool, std::vector<double>> values( const RifEclipseSummaryAddress& resultAddress ) const override
|
|
|
|
|
{
|
|
|
|
|
auto it = m_data.find( resultAddress );
|
|
|
|
|
if ( it != m_data.end() ) return { true, it->second.values };
|
|
|
|
|
return { false, {} };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override
|
|
|
|
|
{
|
|
|
|
|
auto it = m_data.find( resultAddress );
|
|
|
|
|
if ( it != m_data.end() ) return it->second.unit;
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RiaDefines::EclipseUnitSystem unitSystem() const override { return RiaDefines::EclipseUnitSystem::UNITS_METRIC; }
|
|
|
|
|
|
|
|
|
|
size_t keywordCount() const override { return m_allResultAddresses.size(); }
|
|
|
|
|
|
2026-08-21 15:31:15 +02:00
|
|
|
void refreshCalculatedAddresses() override { m_refreshCalculatedAddressesCount++; }
|
|
|
|
|
int refreshCalculatedAddressesCount() const { return m_refreshCalculatedAddressesCount; }
|
|
|
|
|
|
2026-02-17 09:34:44 +01:00
|
|
|
private:
|
|
|
|
|
struct VectorData
|
|
|
|
|
{
|
|
|
|
|
std::vector<time_t> timeSteps;
|
|
|
|
|
std::vector<double> values;
|
|
|
|
|
std::string unit;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QString m_name = "MockCase";
|
|
|
|
|
std::map<RifEclipseSummaryAddress, VectorData> m_data;
|
2026-08-21 15:31:15 +02:00
|
|
|
int m_refreshCalculatedAddressesCount = 0;
|
2026-02-17 09:34:44 +01:00
|
|
|
};
|
2026-08-13 15:29:13 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
/// A mock case carrying the realization number a delta ensemble matches its source cases on.
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
inline RimSummaryCase* createMockCase( int realizationNumber )
|
|
|
|
|
{
|
|
|
|
|
auto* summaryCase = new RimMockSummaryCase();
|
|
|
|
|
|
|
|
|
|
auto parameters = std::make_shared<RigCaseRealizationParameters>();
|
|
|
|
|
parameters->setRealizationNumber( realizationNumber );
|
|
|
|
|
summaryCase->setCaseRealizationParameters( parameters );
|
|
|
|
|
|
|
|
|
|
return summaryCase;
|
|
|
|
|
}
|