mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#727) Missing Dynamic parameters not reported for intital time step
This commit is contained in:
parent
a61a3b3e1f
commit
09c711da01
@ -49,6 +49,59 @@ RifEclipseOutputFileTools::~RifEclipseOutputFileTools()
|
||||
{
|
||||
}
|
||||
|
||||
struct KeywordItemCounter
|
||||
{
|
||||
KeywordItemCounter(std::string keyword, size_t aggregatedItemCount)
|
||||
: m_keyword(keyword),
|
||||
m_aggregatedItemCount(aggregatedItemCount),
|
||||
m_reportStepCount(1)
|
||||
{}
|
||||
|
||||
bool operator==(const std::string& rhs) const
|
||||
{
|
||||
return this->m_keyword == rhs;
|
||||
}
|
||||
|
||||
|
||||
std::string m_keyword;
|
||||
size_t m_aggregatedItemCount;
|
||||
size_t m_reportStepCount;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseOutputFileTools::findKeywordsAndItemCount(std::vector<ecl_file_type*> ecl_files, QStringList* resultNames, std::vector<size_t>* resultDataItemCounts)
|
||||
{
|
||||
std::vector<RifRestartReportStep> reportSteps;
|
||||
RifEclipseOutputFileTools::createReportStepsMetaData(ecl_files, &reportSteps);
|
||||
|
||||
std::vector<KeywordItemCounter> foundKeywords;
|
||||
|
||||
for (auto reportStep : reportSteps)
|
||||
{
|
||||
for (auto keywordItemCount : reportStep.m_keywords.keywordsWithAggregatedItemCount())
|
||||
{
|
||||
auto it = std::find(foundKeywords.begin(), foundKeywords.end(), keywordItemCount.first);
|
||||
if (it == foundKeywords.end())
|
||||
{
|
||||
foundKeywords.push_back(KeywordItemCounter(keywordItemCount.first, keywordItemCount.second));
|
||||
}
|
||||
else
|
||||
{
|
||||
it->m_aggregatedItemCount += keywordItemCount.second;
|
||||
it->m_reportStepCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto stdKeyword : foundKeywords)
|
||||
{
|
||||
resultNames->push_back(QString::fromStdString(stdKeyword.m_keyword));
|
||||
resultDataItemCounts->push_back(stdKeyword.m_aggregatedItemCount);
|
||||
}
|
||||
}
|
||||
|
||||
void getDayMonthYear(const ecl_kw_type* intehead_kw, int* day, int* month, int* year)
|
||||
{
|
||||
assert(day && month && year);
|
||||
@ -232,45 +285,6 @@ bool RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(const QString&
|
||||
return baseNameFiles->count() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(ecl_file_type* ecl_file, QStringList* keywords, std::vector<size_t>* keywordDataItemCounts)
|
||||
{
|
||||
if (!ecl_file || !keywords || !keywordDataItemCounts) return;
|
||||
|
||||
int numKeywords = ecl_file_get_num_distinct_kw(ecl_file);
|
||||
|
||||
caf::ProgressInfo info(numKeywords, "Reading Keywords on file");
|
||||
|
||||
for (int i = 0; i < numKeywords; i++)
|
||||
{
|
||||
const char* kw = ecl_file_iget_distinct_kw(ecl_file , i);
|
||||
int numKeywordOccurrences = ecl_file_get_num_named_kw(ecl_file, kw);
|
||||
bool validData = true;
|
||||
size_t fileResultValueCount = 0;
|
||||
for (int j = 0; j < numKeywordOccurrences; j++)
|
||||
{
|
||||
fileResultValueCount += ecl_file_iget_named_size(ecl_file, kw, j);
|
||||
|
||||
ecl_type_enum dataType = ecl_file_iget_named_type(ecl_file, kw, j);
|
||||
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE )
|
||||
{
|
||||
validData = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (validData)
|
||||
{
|
||||
keywords->append(QString(kw));
|
||||
keywordDataItemCounts->push_back(fileResultValueCount);
|
||||
}
|
||||
|
||||
info.setProgress(i);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -323,3 +337,66 @@ int RifEclipseOutputFileTools::readUnitsType(ecl_file_type* ecl_file)
|
||||
|
||||
return unitsType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseOutputFileTools::createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps)
|
||||
{
|
||||
if (!reportSteps) return;
|
||||
|
||||
for (auto ecl_file : ecl_files)
|
||||
{
|
||||
if (!ecl_file) continue;
|
||||
|
||||
int reportStepCount = ecl_file_get_num_named_kw(ecl_file, INTEHEAD_KW);
|
||||
for (int reportStepIndex = 0; reportStepIndex < reportStepCount; reportStepIndex++)
|
||||
{
|
||||
ecl_rsthead_type* restart_header = ecl_rsthead_ialloc(ecl_file, reportStepIndex);
|
||||
if (restart_header)
|
||||
{
|
||||
ecl_file_push_block(ecl_file);
|
||||
|
||||
{
|
||||
ecl_file_select_block(ecl_file, INTEHEAD_KW, reportStepIndex);
|
||||
|
||||
RifRestartReportStep reportStep;
|
||||
|
||||
// Set Date
|
||||
{
|
||||
QDateTime reportDateTime(QDate(restart_header->year, restart_header->month, restart_header->day));
|
||||
CVF_ASSERT(reportDateTime.isValid());
|
||||
|
||||
reportStep.dateTime = reportDateTime;
|
||||
}
|
||||
|
||||
// Find number of keywords withing this report step
|
||||
int numKeywords = ecl_file_get_num_distinct_kw(ecl_file);
|
||||
for (int iKey = 0; iKey < numKeywords; iKey++)
|
||||
{
|
||||
const char* kw = ecl_file_iget_distinct_kw(ecl_file, iKey);
|
||||
|
||||
int namedKeywordCount = ecl_file_get_num_named_kw(ecl_file, kw);
|
||||
for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++)
|
||||
{
|
||||
ecl_type_enum dataType = ecl_file_iget_named_type(ecl_file, kw, iOcc);
|
||||
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int itemCount = ecl_file_iget_named_size(ecl_file, kw, iOcc);
|
||||
reportStep.m_keywords.appendKeyword(kw, itemCount, iOcc);
|
||||
}
|
||||
}
|
||||
|
||||
reportSteps->push_back(reportStep);
|
||||
}
|
||||
|
||||
ecl_file_pop_block(ecl_file);
|
||||
|
||||
ecl_rsthead_free(restart_header);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,12 @@
|
||||
#include "cvfObject.h"
|
||||
#include "cvfLibCore.h"
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
#include "RifEclipseRestartDataAccess.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QDateTime>
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
#include "ecl_util.h"
|
||||
|
||||
@ -45,7 +47,8 @@ public:
|
||||
RifEclipseOutputFileTools();
|
||||
virtual ~RifEclipseOutputFileTools();
|
||||
|
||||
static void findKeywordsAndDataItemCounts(ecl_file_type* ecl_file, QStringList* keywords, std::vector<size_t>* keywordDataItemCounts);
|
||||
static void findKeywordsAndItemCount(std::vector<ecl_file_type*> ecl_files, QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
|
||||
|
||||
static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<double>* values);
|
||||
static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<int>* values);
|
||||
|
||||
@ -59,4 +62,7 @@ public:
|
||||
static void readGridDimensions(const QString& gridFileName, std::vector< std::vector<int> >& gridDimensions);
|
||||
|
||||
static int readUnitsType(ecl_file_type* ecl_file);
|
||||
|
||||
private:
|
||||
static void createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps);
|
||||
};
|
||||
|
@ -33,3 +33,106 @@ RifEclipseRestartDataAccess::RifEclipseRestartDataAccess()
|
||||
RifEclipseRestartDataAccess::~RifEclipseRestartDataAccess()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifRestartReportKeywords::RifRestartReportKeywords()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifRestartReportKeywords::appendKeyword(const std::string& keyword, size_t itemCount, int globalIndex)
|
||||
{
|
||||
m_keywordNameAndItemCount.push_back(RifKeywordLocation(keyword, itemCount, globalIndex));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RifRestartReportKeywords::keywordsWithItemCountFactorOf(const std::vector<size_t>& factorCandidates)
|
||||
{
|
||||
std::vector<std::string> tmp;
|
||||
|
||||
for (auto uni : uniqueKeywords())
|
||||
{
|
||||
size_t sum = 0;
|
||||
for (auto loc : objectsForKeyword(uni))
|
||||
{
|
||||
sum += loc.itemCount();
|
||||
}
|
||||
|
||||
bool foundMatch = false;
|
||||
size_t i = 0;
|
||||
|
||||
while (i < factorCandidates.size() && !foundMatch)
|
||||
{
|
||||
if (sum > 0 && (sum % factorCandidates[i]) == 0)
|
||||
{
|
||||
foundMatch = true;
|
||||
tmp.push_back(uni);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::pair<std::string, size_t> > RifRestartReportKeywords::keywordsWithAggregatedItemCount()
|
||||
{
|
||||
std::vector<std::pair<std::string, size_t> > tmp;
|
||||
|
||||
for (auto uni : uniqueKeywords())
|
||||
{
|
||||
size_t sum = 0;
|
||||
for (auto loc : objectsForKeyword(uni))
|
||||
{
|
||||
sum += loc.itemCount();
|
||||
}
|
||||
|
||||
tmp.push_back(std::make_pair(uni, sum));
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifKeywordLocation> RifRestartReportKeywords::objectsForKeyword(const std::string& keyword)
|
||||
{
|
||||
std::vector<RifKeywordLocation> tmp;
|
||||
|
||||
for (auto a : m_keywordNameAndItemCount)
|
||||
{
|
||||
if (a.keyword() == keyword)
|
||||
{
|
||||
tmp.push_back(a);
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<std::string> RifRestartReportKeywords::uniqueKeywords()
|
||||
{
|
||||
std::set<std::string> unique;
|
||||
|
||||
for (auto a : m_keywordNameAndItemCount)
|
||||
{
|
||||
unique.insert(a.keyword());
|
||||
}
|
||||
|
||||
return unique;
|
||||
}
|
||||
|
@ -33,6 +33,55 @@
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
|
||||
class RifKeywordLocation
|
||||
{
|
||||
public:
|
||||
RifKeywordLocation(std::string keyword, size_t itemCount, int indexWithinReportStep)
|
||||
: m_keyword(keyword),
|
||||
m_itemCount(itemCount),
|
||||
m_indexWithinReportStep(indexWithinReportStep)
|
||||
{
|
||||
}
|
||||
|
||||
std::string keyword() const { return m_keyword; }
|
||||
size_t itemCount() const { return m_itemCount; }
|
||||
int indexWithinReportStep() const { return m_indexWithinReportStep; }
|
||||
|
||||
private:
|
||||
std::string m_keyword;
|
||||
size_t m_itemCount;
|
||||
int m_indexWithinReportStep;
|
||||
};
|
||||
|
||||
class RifRestartReportKeywords
|
||||
{
|
||||
public:
|
||||
RifRestartReportKeywords();
|
||||
|
||||
void appendKeyword(const std::string& keyword, size_t itemCount, int globalIndex);
|
||||
|
||||
std::vector<std::string> keywordsWithItemCountFactorOf(const std::vector<size_t>& factorCandidates);
|
||||
std::vector<std::pair<std::string, size_t> > keywordsWithAggregatedItemCount();
|
||||
|
||||
private:
|
||||
std::vector<RifKeywordLocation> objectsForKeyword(const std::string& keyword);
|
||||
std::set<std::string> uniqueKeywords();
|
||||
|
||||
private:
|
||||
std::vector<RifKeywordLocation> m_keywordNameAndItemCount;
|
||||
};
|
||||
|
||||
|
||||
class RifRestartReportStep
|
||||
{
|
||||
public:
|
||||
//int globalIndex;
|
||||
QDateTime dateTime;
|
||||
|
||||
RifRestartReportKeywords m_keywords;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Abstract class for results access
|
||||
|
@ -155,15 +155,12 @@ void RifEclipseRestartFilesetAccess::resultNames(QStringList* resultNames, std::
|
||||
{
|
||||
CVF_ASSERT(timeStepCount() > 0);
|
||||
|
||||
openTimeStep(0);
|
||||
|
||||
std::vector<size_t> valueCountForOneFile;
|
||||
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_files[0], resultNames, &valueCountForOneFile);
|
||||
|
||||
for (size_t i = 0; i < valueCountForOneFile.size(); i++)
|
||||
for (int i = 0; i < m_fileNames.size(); i++)
|
||||
{
|
||||
resultDataItemCounts->push_back(valueCountForOneFile[i] * timeStepCount());
|
||||
openTimeStep(i);
|
||||
}
|
||||
|
||||
RifEclipseOutputFileTools::findKeywordsAndItemCount(m_ecl_files, resultNames, resultDataItemCounts);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -205,7 +202,6 @@ bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t t
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
void setTimeSteps(const std::vector<QDateTime>& timeSteps);
|
||||
size_t timeStepCount();
|
||||
std::vector<QDateTime> timeSteps();
|
||||
std::vector<QDateTime> timeSteps();
|
||||
std::vector<int> reportNumbers();
|
||||
|
||||
void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
|
||||
@ -55,10 +55,9 @@ public:
|
||||
private:
|
||||
void openTimeStep(size_t timeStep);
|
||||
|
||||
|
||||
private:
|
||||
QStringList m_fileNames;
|
||||
std::vector<QDateTime> m_timeSteps;
|
||||
std::vector<QDateTime> m_timeSteps;
|
||||
|
||||
std::vector< ecl_file_type* > m_ecl_files;
|
||||
};
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <well_conn.h>
|
||||
#include <well_ts.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Constructor
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -105,6 +107,7 @@ std::vector<QDateTime> RifEclipseUnifiedRestartFileAccess::timeSteps()
|
||||
return timeSteps;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get list of result names
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -112,7 +115,10 @@ void RifEclipseUnifiedRestartFileAccess::resultNames(QStringList* resultNames, s
|
||||
{
|
||||
if (openFile())
|
||||
{
|
||||
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_file, resultNames, resultDataItemCounts);
|
||||
std::vector< ecl_file_type* > filesUsedToFindAvailableKeywords;
|
||||
filesUsedToFindAvailableKeywords.push_back(m_ecl_file);
|
||||
|
||||
RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, resultNames, resultDataItemCounts);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,24 +132,27 @@ bool RifEclipseUnifiedRestartFileAccess::results(const QString& resultName, size
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_file, resultName.toAscii().data());
|
||||
ecl_file_push_block(m_ecl_file);
|
||||
|
||||
size_t startIndex = timeStep * gridCount;
|
||||
CVF_ASSERT(startIndex + gridCount <= numOccurrences);
|
||||
|
||||
size_t occurrenceIdx;
|
||||
for (occurrenceIdx = startIndex; occurrenceIdx < startIndex + gridCount; occurrenceIdx++)
|
||||
for (size_t i = 0; i < gridCount; i++)
|
||||
{
|
||||
std::vector<double> partValues;
|
||||
RifEclipseOutputFileTools::keywordData(m_ecl_file, resultName, occurrenceIdx, &partValues);
|
||||
ecl_file_select_block(m_ecl_file, INTEHEAD_KW, static_cast<int>(timeStep * gridCount + i));
|
||||
|
||||
values->insert(values->end(), partValues.begin(), partValues.end());
|
||||
int namedKeywordCount = ecl_file_get_num_named_kw(m_ecl_file, resultName.toAscii().data());
|
||||
for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++)
|
||||
{
|
||||
std::vector<double> partValues;
|
||||
RifEclipseOutputFileTools::keywordData(m_ecl_file, resultName, iOcc, &partValues);
|
||||
|
||||
values->insert(values->end(), partValues.begin(), partValues.end());
|
||||
}
|
||||
}
|
||||
|
||||
ecl_file_pop_block(m_ecl_file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -28,6 +28,8 @@ class RifEclipseOutputFileTools;
|
||||
|
||||
#include "well_info.h"
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Class for access to results from a unified restart file
|
||||
@ -44,7 +46,7 @@ public:
|
||||
void close();
|
||||
|
||||
size_t timeStepCount();
|
||||
std::vector<QDateTime> timeSteps();
|
||||
std::vector<QDateTime> timeSteps();
|
||||
std::vector<int> reportNumbers();
|
||||
|
||||
void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
|
||||
@ -56,7 +58,6 @@ public:
|
||||
private:
|
||||
bool openFile();
|
||||
|
||||
|
||||
private:
|
||||
QString m_filename;
|
||||
ecl_file_type* m_ecl_file;
|
||||
|
@ -710,7 +710,10 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
{
|
||||
QStringList resultNames;
|
||||
std::vector<size_t> resultNamesDataItemCounts;
|
||||
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_init_file, &resultNames, &resultNamesDataItemCounts);
|
||||
std::vector< ecl_file_type* > filesUsedToFindAvailableKeywords;
|
||||
filesUsedToFindAvailableKeywords.push_back(m_ecl_init_file);
|
||||
|
||||
RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, &resultNames, &resultNamesDataItemCounts);
|
||||
|
||||
{
|
||||
QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
|
||||
@ -1592,7 +1595,7 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, boo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts,
|
||||
const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo,
|
||||
PorosityModelResultType matrixOrFracture, size_t timeStepCount) const
|
||||
PorosityModelResultType porosityModel, size_t timeStepCount) const
|
||||
{
|
||||
CVF_ASSERT(activeCellInfo);
|
||||
|
||||
@ -1601,7 +1604,7 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
if (matrixOrFracture == RifReaderInterface::FRACTURE_RESULTS)
|
||||
if (porosityModel == RifReaderInterface::FRACTURE_RESULTS)
|
||||
{
|
||||
if (fractureActiveCellInfo->reservoirActiveCellCount() == 0)
|
||||
{
|
||||
@ -1617,43 +1620,47 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
|
||||
|
||||
if (activeCellInfo->reservoirActiveCellCount() > 0)
|
||||
{
|
||||
size_t timeStepsAllCellsRest = keywordDataItemCounts[i] % activeCellInfo->reservoirCellCount();
|
||||
if (keywordDataItemCounts[i] < activeCellInfo->reservoirActiveCellCount()) continue;
|
||||
|
||||
size_t timeStepsMatrix = keywordDataItemCounts[i] / activeCellInfo->reservoirActiveCellCount();
|
||||
size_t timeStepsAllCellsRest = keywordDataItemCounts[i] % activeCellInfo->reservoirCellCount();
|
||||
size_t timeStepsMatrixRest = keywordDataItemCounts[i] % activeCellInfo->reservoirActiveCellCount();
|
||||
|
||||
size_t timeStepsMatrixAndFracture = keywordDataItemCounts[i] / (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount());
|
||||
size_t timeStepsMatrixAndFractureRest = keywordDataItemCounts[i] % (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount());
|
||||
|
||||
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS)
|
||||
if (timeStepsAllCellsRest == 0)
|
||||
{
|
||||
if (timeStepsMatrixRest == 0 || timeStepsMatrixAndFractureRest == 0)
|
||||
if (keywordDataItemCounts[i] > timeStepCount * activeCellInfo->reservoirCellCount())
|
||||
{
|
||||
if (timeStepCount == timeStepsMatrix || timeStepCount == timeStepsMatrixAndFracture)
|
||||
{
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
}
|
||||
}
|
||||
else if (timeStepsAllCellsRest == 0)
|
||||
{
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
}
|
||||
else
|
||||
else if (porosityModel == RifReaderInterface::MATRIX_RESULTS && timeStepsMatrixRest == 0)
|
||||
{
|
||||
if (timeStepsMatrixAndFractureRest == 0 && timeStepCount == timeStepsMatrixAndFracture)
|
||||
if (keywordDataItemCounts[i] > timeStepCount * activeCellInfo->reservoirActiveCellCount())
|
||||
{
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
continue;
|
||||
}
|
||||
else if (timeStepsAllCellsRest == 0)
|
||||
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
}
|
||||
else if (porosityModel == RifReaderInterface::FRACTURE_RESULTS && timeStepsMatrixAndFractureRest == 0)
|
||||
{
|
||||
if (keywordDataItemCounts[i] > timeStepCount * (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount()))
|
||||
{
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keywordDataItemCounts[i] > activeCellInfo->reservoirCellCount())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,90 @@
|
||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigReservoirTest, BasicTest)
|
||||
{
|
||||
RifEclipseUnifiedRestartFileAccess unrstAccess;
|
||||
|
||||
QStringList filenames;
|
||||
//filenames << "d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST";
|
||||
filenames << "d:/Models/MRST/simple/SIMPLE.UNRST";
|
||||
|
||||
unrstAccess.setRestartFiles(filenames);
|
||||
|
||||
|
||||
QStringList resultNames;
|
||||
std::vector<size_t> dataItemCount;
|
||||
|
||||
unrstAccess.resultNames(&resultNames, &dataItemCount);
|
||||
|
||||
for (size_t i = 0; i < resultNames.size(); i++)
|
||||
{
|
||||
qDebug() << resultNames[i] << "\t" << dataItemCount[i];
|
||||
}
|
||||
|
||||
auto reportNums = unrstAccess.reportNumbers();
|
||||
for (auto reportNum : reportNums)
|
||||
{
|
||||
qDebug() << reportNum;
|
||||
}
|
||||
|
||||
/*
|
||||
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
|
||||
cvf::ref<RigCaseData> reservoir = new RigCaseData;
|
||||
|
||||
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
|
||||
#ifdef WIN32
|
||||
QString filename("TEST10K_FLT_LGR_NNC.EGRID");
|
||||
#else
|
||||
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
|
||||
#endif
|
||||
|
||||
bool result = readerInterfaceEcl->open(filename, reservoir.p());
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
{
|
||||
QStringList staticResults = readerInterfaceEcl->staticResults();
|
||||
EXPECT_EQ(42, staticResults.size());
|
||||
qDebug() << "Static results\n" << staticResults;
|
||||
|
||||
QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
|
||||
EXPECT_EQ(23, dynamicResults.size());
|
||||
qDebug() << "Dynamic results\n" << dynamicResults;
|
||||
|
||||
int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
|
||||
EXPECT_EQ(9, numTimeSteps);
|
||||
|
||||
QStringList timeStepText = readerInterfaceEcl->timeStepText();
|
||||
EXPECT_EQ(numTimeSteps, timeStepText.size());
|
||||
qDebug() << "Time step texts\n" << timeStepText;
|
||||
}
|
||||
|
||||
|
||||
readerInterfaceEcl->close();
|
||||
|
||||
{
|
||||
QStringList staticResults = readerInterfaceEcl->staticResults();
|
||||
EXPECT_EQ(0, staticResults.size());
|
||||
|
||||
QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
|
||||
EXPECT_EQ(0, dynamicResults.size());
|
||||
|
||||
int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
|
||||
EXPECT_EQ(0, numTimeSteps);
|
||||
|
||||
QStringList timeStepText = readerInterfaceEcl->timeStepText();
|
||||
EXPECT_EQ(numTimeSteps, timeStepText.size());
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user