mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#926 Eclipse Input Data : Import custom keyword data
This commit is contained in:
parent
f20a8d7dc8
commit
5dbe2d322d
@ -48,75 +48,6 @@ QString gridKeyword("GRID");
|
|||||||
QString pathsKeyword("PATHS");
|
QString pathsKeyword("PATHS");
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
size_t findOrCreateResult(const QString& newResultName, RigCaseData* reservoir)
|
|
||||||
{
|
|
||||||
size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName);
|
|
||||||
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
|
||||||
{
|
|
||||||
resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
/// Read all double values from input file. To reduce memory footprint, the alternative method
|
|
||||||
/// readDoubleValuesForActiveCells() can be used, and will skip all cell values for inactive cells
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool readDoubleValues(RigCaseData* reservoir, size_t resultIndex, ecl_kw_type* eclKeyWordData)
|
|
||||||
{
|
|
||||||
if (resultIndex == cvf::UNDEFINED_SIZE_T) return false;
|
|
||||||
|
|
||||||
std::vector< std::vector<double> >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
|
||||||
newPropertyData.push_back(std::vector<double>());
|
|
||||||
newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL);
|
|
||||||
ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
bool readDoubleValuesForActiveCells(RigCaseData* reservoir, size_t resultIndex, ecl_kw_type* eclKeyWordData)
|
|
||||||
{
|
|
||||||
if (resultIndex == cvf::UNDEFINED_SIZE_T) return false;
|
|
||||||
|
|
||||||
std::vector< std::vector<double> >& newPropertyData = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
|
||||||
newPropertyData.push_back(std::vector<double>());
|
|
||||||
|
|
||||||
RigActiveCellInfo* activeCellInfo = reservoir->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
|
|
||||||
if (activeCellInfo->reservoirCellCount() > 0 && activeCellInfo->reservoirCellCount() != activeCellInfo->reservoirActiveCellCount())
|
|
||||||
{
|
|
||||||
std::vector<double> valuesAllCells;
|
|
||||||
valuesAllCells.resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL);
|
|
||||||
ecl_kw_get_data_as_double(eclKeyWordData, valuesAllCells.data());
|
|
||||||
|
|
||||||
newPropertyData[0].resize(activeCellInfo->reservoirActiveCellCount(), HUGE_VAL);
|
|
||||||
std::vector<double>& valuesActiveCells = newPropertyData[0];
|
|
||||||
|
|
||||||
for (size_t gcIdx = 0; gcIdx < activeCellInfo->reservoirCellCount(); gcIdx++)
|
|
||||||
{
|
|
||||||
size_t activeCellResultIndex = activeCellInfo->cellResultIndex(gcIdx);
|
|
||||||
if (activeCellResultIndex != cvf::UNDEFINED_SIZE_T)
|
|
||||||
{
|
|
||||||
valuesActiveCells[activeCellResultIndex] = valuesAllCells[gcIdx];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newPropertyData[0].resize(ecl_kw_get_size(eclKeyWordData), HUGE_VAL);
|
|
||||||
ecl_kw_get_data_as_double(eclKeyWordData, newPropertyData[0].data());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Constructor
|
/// Constructor
|
||||||
@ -268,18 +199,11 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName, RigCaseData
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Read known properties from the input file
|
/// Read known properties from the input file
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QString &fileName, RigCaseData* caseData)
|
std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QString& fileName, RigCaseData* caseData)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(caseData);
|
CVF_ASSERT(caseData);
|
||||||
|
|
||||||
std::set<QString> knownKeywordSet;
|
|
||||||
{
|
|
||||||
const std::vector<QString>& knownKeywords = RifEclipseInputFileTools::knownPropertyKeywords();
|
|
||||||
for( size_t fkIt = 0; fkIt < knownKeywords.size(); ++fkIt) knownKeywordSet.insert(knownKeywords[fkIt]);
|
|
||||||
}
|
|
||||||
|
|
||||||
caf::ProgressInfo mainProgress(2, "Reading Eclipse Input properties");
|
caf::ProgressInfo mainProgress(2, "Reading Eclipse Input properties");
|
||||||
caf::ProgressInfo startProgress(knownKeywordSet.size(), "Scanning for known properties");
|
|
||||||
|
|
||||||
std::vector<RifKeywordAndFilePos> fileKeywords;
|
std::vector<RifKeywordAndFilePos> fileKeywords;
|
||||||
RifEclipseInputFileTools::findKeywordsOnFile(fileName, &fileKeywords);
|
RifEclipseInputFileTools::findKeywordsOnFile(fileName, &fileKeywords);
|
||||||
@ -297,25 +221,22 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStri
|
|||||||
std::map<QString, QString> newResults;
|
std::map<QString, QString> newResults;
|
||||||
for (size_t i = 0; i < fileKeywords.size(); ++i)
|
for (size_t i = 0; i < fileKeywords.size(); ++i)
|
||||||
{
|
{
|
||||||
//std::cout << fileKeywords[i].keyword.toLatin1().data() << std::endl;
|
if (!isValidDataKeyword(fileKeywords[i].keyword)) continue;
|
||||||
if (knownKeywordSet.count(fileKeywords[i].keyword))
|
|
||||||
|
fseek(gridFilePointer, fileKeywords[i].filePos, SEEK_SET);
|
||||||
|
|
||||||
|
ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false, ECL_FLOAT_TYPE);
|
||||||
|
if (eclipseKeywordData)
|
||||||
{
|
{
|
||||||
fseek(gridFilePointer, fileKeywords[i].filePos, SEEK_SET);
|
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword);
|
||||||
ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false , ECL_FLOAT_TYPE);
|
if (readDataFromKeyword(eclipseKeywordData, caseData, newResultName))
|
||||||
if (eclipseKeywordData)
|
|
||||||
{
|
{
|
||||||
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword);
|
|
||||||
|
|
||||||
size_t resultIndex = findOrCreateResult(newResultName, caseData);
|
|
||||||
if (resultIndex != cvf::UNDEFINED_SIZE_T)
|
|
||||||
{
|
|
||||||
readDoubleValues(caseData, resultIndex, eclipseKeywordData);
|
|
||||||
}
|
|
||||||
|
|
||||||
ecl_kw_free(eclipseKeywordData);
|
|
||||||
newResults[newResultName] = fileKeywords[i].keyword;
|
newResults[newResultName] = fileKeywords[i].keyword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ecl_kw_free(eclipseKeywordData);
|
||||||
}
|
}
|
||||||
|
|
||||||
progress.setProgress(i);
|
progress.setProgress(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,6 +244,65 @@ std::map<QString, QString> RifEclipseInputFileTools::readProperties(const QStri
|
|||||||
return newResults;
|
return newResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/// Reads the property data requested into the \a reservoir, overwriting any previous
|
||||||
|
/// properties with the same name.
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RifEclipseInputFileTools::readProperty(const QString& fileName, RigCaseData* caseData, const QString& eclipseKeyWord, const QString& resultName)
|
||||||
|
{
|
||||||
|
CVF_ASSERT(caseData);
|
||||||
|
|
||||||
|
if (!isValidDataKeyword(eclipseKeyWord)) return false;
|
||||||
|
|
||||||
|
FILE* filePointer = util_fopen(fileName.toLatin1().data(), "r");
|
||||||
|
if (!filePointer) return false;
|
||||||
|
|
||||||
|
ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_grdecl_dynamic__(filePointer, eclipseKeyWord.toLatin1().data(), false, ECL_FLOAT_TYPE);
|
||||||
|
bool isOk = false;
|
||||||
|
if (eclipseKeywordData)
|
||||||
|
{
|
||||||
|
isOk = readDataFromKeyword(eclipseKeywordData, caseData, resultName);
|
||||||
|
|
||||||
|
ecl_kw_free(eclipseKeywordData);
|
||||||
|
}
|
||||||
|
|
||||||
|
util_fclose(filePointer);
|
||||||
|
|
||||||
|
return isOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordData, RigCaseData* caseData, const QString& resultName)
|
||||||
|
{
|
||||||
|
bool mathingItemCount = false;
|
||||||
|
{
|
||||||
|
int itemCount = ecl_kw_get_size(eclipseKeywordData);
|
||||||
|
if (itemCount == caseData->mainGrid()->cellCount())
|
||||||
|
{
|
||||||
|
mathingItemCount = true;
|
||||||
|
}
|
||||||
|
if (itemCount == caseData->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount())
|
||||||
|
{
|
||||||
|
mathingItemCount = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mathingItemCount) return false;
|
||||||
|
|
||||||
|
size_t resultIndex = RifEclipseInputFileTools::findOrCreateResult(resultName, caseData);
|
||||||
|
if (resultIndex == cvf::UNDEFINED_SIZE_T) return false;
|
||||||
|
|
||||||
|
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
|
||||||
|
newPropertyData.push_back(std::vector<double>());
|
||||||
|
newPropertyData[0].resize(ecl_kw_get_size(eclipseKeywordData), HUGE_VAL);
|
||||||
|
ecl_kw_get_data_as_double(eclipseKeywordData, newPropertyData[0].data());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Read all the keywords from a file
|
/// Read all the keywords from a file
|
||||||
//
|
//
|
||||||
@ -432,36 +412,33 @@ void RifEclipseInputFileTools::parseAndReadPathAliasKeyword(const QString &fileN
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Reads the property data requested into the \a reservoir, overwriting any previous
|
///
|
||||||
/// properties with the same name.
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RifEclipseInputFileTools::readProperty(const QString& fileName, RigCaseData* caseData, const QString& eclipseKeyWord, const QString& resultName)
|
const std::vector<QString>& RifEclipseInputFileTools::invalidPropertyDataKeywords()
|
||||||
{
|
{
|
||||||
CVF_ASSERT(caseData);
|
static std::vector<QString> keywords;
|
||||||
|
static bool isInitialized = false;
|
||||||
FILE* filePointer = util_fopen(fileName.toLatin1().data(), "r");
|
if (!isInitialized)
|
||||||
if (!filePointer) return false;
|
|
||||||
|
|
||||||
ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_grdecl_dynamic__( filePointer , eclipseKeyWord.toLatin1().data() , false , ECL_FLOAT_TYPE);
|
|
||||||
bool isOk = false;
|
|
||||||
if (eclipseKeywordData)
|
|
||||||
{
|
{
|
||||||
size_t resultIndex = findOrCreateResult(resultName, caseData);
|
// Related to geometry
|
||||||
if (resultIndex != cvf::UNDEFINED_SIZE_T)
|
keywords.push_back("COORD");
|
||||||
{
|
keywords.push_back("ZCORN");
|
||||||
isOk = readDoubleValues(caseData, resultIndex, eclipseKeywordData);
|
keywords.push_back("SPECGRID");
|
||||||
}
|
keywords.push_back("MAPAXES");
|
||||||
|
|
||||||
ecl_kw_free(eclipseKeywordData);
|
keywords.push_back(faultsKeyword);
|
||||||
|
|
||||||
|
isInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
util_fclose(filePointer);
|
return keywords;
|
||||||
return isOk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
const std::vector<QString>& RifEclipseInputFileTools::knownPropertyKeywords()
|
const std::vector<QString>& RifEclipseInputFileTools::knownPropertyKeywords()
|
||||||
{
|
{
|
||||||
static std::vector<QString> knownKeywords;
|
static std::vector<QString> knownKeywords;
|
||||||
@ -513,6 +490,7 @@ const std::vector<QString>& RifEclipseInputFileTools::knownPropertyKeywords()
|
|||||||
}
|
}
|
||||||
return knownKeywords;
|
return knownKeywords;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -788,6 +766,37 @@ qint64 RifEclipseInputFileTools::findKeyword(const QString& keyword, QFile& file
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
size_t RifEclipseInputFileTools::findOrCreateResult(const QString& newResultName, RigCaseData* reservoir)
|
||||||
|
{
|
||||||
|
size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName);
|
||||||
|
if (resultIndex == cvf::UNDEFINED_SIZE_T)
|
||||||
|
{
|
||||||
|
resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, newResultName, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RifEclipseInputFileTools::isValidDataKeyword(const QString& keyword)
|
||||||
|
{
|
||||||
|
const std::vector<QString>& keywordsToSkip = RifEclipseInputFileTools::invalidPropertyDataKeywords();
|
||||||
|
for (const QString keywordToSkip : keywordsToSkip)
|
||||||
|
{
|
||||||
|
if (keywordToSkip == keyword.toUpper())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -23,11 +23,15 @@
|
|||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfObject.h"
|
#include "cvfObject.h"
|
||||||
#include "cvfLibCore.h"
|
#include "cvfLibCore.h"
|
||||||
|
|
||||||
|
#include "RifReaderInterface.h"
|
||||||
|
#include "RigFault.h"
|
||||||
|
|
||||||
|
#include "ert/ecl/ecl_kw.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "RifReaderInterface.h"
|
|
||||||
#include "RigFault.h"
|
|
||||||
|
|
||||||
|
|
||||||
class RigCaseData;
|
class RigCaseData;
|
||||||
@ -60,7 +64,7 @@ public:
|
|||||||
// Returns map of assigned resultName and Eclipse Keyword.
|
// Returns map of assigned resultName and Eclipse Keyword.
|
||||||
static std::map<QString, QString> readProperties(const QString& fileName, RigCaseData* eclipseCase);
|
static std::map<QString, QString> readProperties(const QString& fileName, RigCaseData* eclipseCase);
|
||||||
static bool readProperty (const QString& fileName, RigCaseData* eclipseCase, const QString& eclipseKeyWord, const QString& resultName );
|
static bool readProperty (const QString& fileName, RigCaseData* eclipseCase, const QString& eclipseKeyWord, const QString& resultName );
|
||||||
|
|
||||||
static void readFaultsInGridSection(const QString& fileName, cvf::Collection<RigFault>* faults, std::vector<QString>* filenamesWithFaults);
|
static void readFaultsInGridSection(const QString& fileName, cvf::Collection<RigFault>* faults, std::vector<QString>* filenamesWithFaults);
|
||||||
static void readFaults(const QString& fileName, const std::vector< RifKeywordAndFilePos >& fileKeywords, cvf::Collection<RigFault>* faults);
|
static void readFaults(const QString& fileName, const std::vector< RifKeywordAndFilePos >& fileKeywords, cvf::Collection<RigFault>* faults);
|
||||||
static void parseAndReadFaults(const QString& fileName, cvf::Collection<RigFault>* faults);
|
static void parseAndReadFaults(const QString& fileName, cvf::Collection<RigFault>* faults);
|
||||||
@ -70,7 +74,6 @@ public:
|
|||||||
|
|
||||||
static void parseAndReadPathAliasKeyword(const QString &fileName, std::vector< std::pair<QString, QString> >* pathAliasDefinitions);
|
static void parseAndReadPathAliasKeyword(const QString &fileName, std::vector< std::pair<QString, QString> >* pathAliasDefinitions);
|
||||||
|
|
||||||
static const std::vector<QString>& knownPropertyKeywords();
|
|
||||||
|
|
||||||
static bool writePropertyToTextFile(const QString& fileName, RigCaseData* eclipseCase, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord);
|
static bool writePropertyToTextFile(const QString& fileName, RigCaseData* eclipseCase, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord);
|
||||||
static bool writeBinaryResultToTextFile(const QString& fileName, RigCaseData* eclipseCase, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord, const double undefinedValue);
|
static bool writeBinaryResultToTextFile(const QString& fileName, RigCaseData* eclipseCase, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord, const double undefinedValue);
|
||||||
@ -85,10 +88,16 @@ public:
|
|||||||
static cvf::StructGridInterface::FaceEnum faceEnumFromText(const QString& faceString);
|
static cvf::StructGridInterface::FaceEnum faceEnumFromText(const QString& faceString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static bool readDataFromKeyword(ecl_kw_type* eclipseKeywordData, RigCaseData* caseData, const QString& resultName);
|
||||||
static void writeDataToTextFile(QFile* file, const QString& eclipseKeyWord, const std::vector<double>& resultData);
|
static void writeDataToTextFile(QFile* file, const QString& eclipseKeyWord, const std::vector<double>& resultData);
|
||||||
static void findGridKeywordPositions(const std::vector< RifKeywordAndFilePos >& keywords, qint64* coordPos, qint64* zcornPos, qint64* specgridPos, qint64* actnumPos, qint64* mapaxesPos);
|
static void findGridKeywordPositions(const std::vector< RifKeywordAndFilePos >& keywords, qint64* coordPos, qint64* zcornPos, qint64* specgridPos, qint64* actnumPos, qint64* mapaxesPos);
|
||||||
|
|
||||||
static size_t findFaultByName(const cvf::Collection<RigFault>& faults, const QString& name);
|
static size_t findFaultByName(const cvf::Collection<RigFault>& faults, const QString& name);
|
||||||
|
|
||||||
static qint64 findKeyword(const QString& keyword, QFile& file, qint64 startPos);
|
static qint64 findKeyword(const QString& keyword, QFile& file, qint64 startPos);
|
||||||
|
static size_t findOrCreateResult(const QString& newResultName, RigCaseData* reservoir);
|
||||||
|
static bool isValidDataKeyword(const QString& keyword);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const std::vector<QString>& invalidPropertyDataKeywords();
|
||||||
};
|
};
|
||||||
|
@ -243,16 +243,14 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
|
|||||||
std::vector<QString> filenames = m_additionalFileNames;
|
std::vector<QString> filenames = m_additionalFileNames;
|
||||||
filenames.push_back(m_gridFileName);
|
filenames.push_back(m_gridFileName);
|
||||||
|
|
||||||
const std::vector<QString>& knownKeywords = RifEclipseInputFileTools::knownPropertyKeywords();
|
|
||||||
|
|
||||||
size_t inputPropCount = this->m_inputPropertyCollection()->inputProperties.size();
|
size_t inputPropCount = this->m_inputPropertyCollection()->inputProperties.size();
|
||||||
|
|
||||||
caf::ProgressInfo progInfo(static_cast<int>(filenames.size() *( inputPropCount + knownKeywords.size())), "Reading Input properties" );
|
caf::ProgressInfo progInfo(static_cast<int>(filenames.size() * inputPropCount), "Reading Input properties" );
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
|
|
||||||
for_all(filenames, i)
|
for_all(filenames, i)
|
||||||
{
|
{
|
||||||
progress = static_cast<int>(i*( inputPropCount + knownKeywords.size()));
|
progress = static_cast<int>(i*inputPropCount);
|
||||||
// Find all the keywords present on the file
|
// Find all the keywords present on the file
|
||||||
|
|
||||||
progInfo.setProgressDescription(filenames[i]);
|
progInfo.setProgressDescription(filenames[i]);
|
||||||
@ -288,7 +286,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
|
|||||||
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
|
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
|
||||||
if (fileKeywordSet.count(kw))
|
if (fileKeywordSet.count(kw))
|
||||||
{
|
{
|
||||||
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), kw, ipsUsingThisFile[ipIdx]->resultName ))
|
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), kw, ipsUsingThisFile[ipIdx]->resultName ))
|
||||||
{
|
{
|
||||||
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::RESOLVED;
|
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||||
}
|
}
|
||||||
@ -302,25 +300,22 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
|
|||||||
progInfo.setProgress(static_cast<int>(progress + inputPropCount));
|
progInfo.setProgress(static_cast<int>(progress + inputPropCount));
|
||||||
// Check if there are more known property keywords left on file. If it is, read them and create inputProperty objects
|
// Check if there are more known property keywords left on file. If it is, read them and create inputProperty objects
|
||||||
|
|
||||||
if (!fileKeywordSet.empty())
|
for (const QString fileKeyword : fileKeywordSet)
|
||||||
{
|
{
|
||||||
for_all(knownKeywords, fkIt)
|
|
||||||
{
|
{
|
||||||
if (fileKeywordSet.count(knownKeywords[fkIt]))
|
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeyword);
|
||||||
|
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), fileKeyword, resultName))
|
||||||
{
|
{
|
||||||
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(knownKeywords[fkIt]);
|
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
||||||
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), knownKeywords[fkIt], resultName))
|
inputProperty->resultName = resultName;
|
||||||
{
|
inputProperty->eclipseKeyword = fileKeyword;
|
||||||
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
inputProperty->fileName = filenames[i];
|
||||||
inputProperty->resultName = resultName;
|
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||||
inputProperty->eclipseKeyword = knownKeywords[fkIt];
|
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
|
||||||
inputProperty->fileName = filenames[i];
|
|
||||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
|
||||||
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
progInfo.setProgress(static_cast<int>(progress + inputPropCount + fkIt));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progInfo.setProgress(static_cast<int>(progress + inputPropCount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user