mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#1691 File Interface : Add support for time step filtering
This commit is contained in:
parent
9223282db4
commit
66c28d8cee
@ -657,9 +657,27 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
|
||||
progInfo.incrementProgress();
|
||||
|
||||
std::vector<int> reportNumbers;
|
||||
|
||||
// Get time steps
|
||||
m_dynamicResultsAccess->timeSteps(&timeSteps, &daysSinceSimulationStart);
|
||||
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
||||
{
|
||||
std::vector<QDateTime> timeStepsOnFile;
|
||||
std::vector<double> daysSinceSimulationStartOnFile;
|
||||
std::vector<int> reportNumbersOnFile;
|
||||
|
||||
m_dynamicResultsAccess->timeSteps(&timeStepsOnFile, &daysSinceSimulationStartOnFile);
|
||||
reportNumbersOnFile = m_dynamicResultsAccess->reportNumbers();
|
||||
|
||||
for (size_t i = 0; i < timeStepsOnFile.size(); i++)
|
||||
{
|
||||
if (this->isTimeStepIncludedByFilter(i))
|
||||
{
|
||||
timeSteps.push_back(timeStepsOnFile[i]);
|
||||
daysSinceSimulationStart.push_back(daysSinceSimulationStartOnFile[i]);
|
||||
reportNumbers.push_back(reportNumbersOnFile[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStringList resultNames;
|
||||
std::vector<size_t> resultNamesDataItemCounts;
|
||||
@ -857,8 +875,10 @@ bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelR
|
||||
|
||||
if (m_dynamicResultsAccess.notNull())
|
||||
{
|
||||
size_t indexOnFile = timeStepIndexOnFile(stepIndex);
|
||||
|
||||
std::vector<double> fileValues;
|
||||
if (!m_dynamicResultsAccess->results(result, stepIndex, m_eclipseCase->mainGrid()->gridCount(), &fileValues))
|
||||
if (!m_dynamicResultsAccess->results(result, indexOnFile, m_eclipseCase->mainGrid()->gridCount(), &fileValues))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ bool RifReaderInterface::isNNCsEnabled()
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix()
|
||||
{
|
||||
if (m_settings.notNull())
|
||||
@ -77,3 +80,43 @@ const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix()
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderInterface::setTimestepIndicesForImport(const std::vector<size_t>& timeStepIndices)
|
||||
{
|
||||
m_includedTimeStepIndices = timeStepIndices;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::isTimeStepIncludedByFilter(size_t timeStepIndex) const
|
||||
{
|
||||
if (m_includedTimeStepIndices.empty()) return true;
|
||||
|
||||
for (auto i : m_includedTimeStepIndices)
|
||||
{
|
||||
if (i == timeStepIndex)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RifReaderInterface::timeStepIndexOnFile(size_t timeStepIndex) const
|
||||
{
|
||||
if (timeStepIndex < m_includedTimeStepIndices.size())
|
||||
{
|
||||
return m_includedTimeStepIndices[timeStepIndex];
|
||||
}
|
||||
|
||||
return timeStepIndex;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,15 @@ public:
|
||||
void setFilenamesWithFaults(const std::vector<QString>& filenames) { m_filenamesWithFaults = filenames; }
|
||||
std::vector<QString> filenamesWithFaults() { return m_filenamesWithFaults; }
|
||||
|
||||
void setTimestepIndicesForImport(const std::vector<size_t>& timeStepIndices);
|
||||
|
||||
protected:
|
||||
bool isTimeStepIncludedByFilter(size_t timeStepIndex) const;
|
||||
size_t timeStepIndexOnFile(size_t timeStepIndex) const;
|
||||
|
||||
private:
|
||||
std::vector<QString> m_filenamesWithFaults;
|
||||
caf::PdmPointer<RifReaderSettings> m_settings;
|
||||
|
||||
std::vector<size_t> m_includedTimeStepIndices;
|
||||
};
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include "RifReaderMockModel.h"
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user