mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1776 CVS data parser. Made parsing more generic. Handle error result columns
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "RifEclipseUserDataParserTools.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -168,6 +170,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress(cons
|
||||
int cellJ = -1;
|
||||
int cellK = -1;
|
||||
int aquiferNumber = -1;
|
||||
bool isErrorResult = false;
|
||||
|
||||
switch (category)
|
||||
{
|
||||
@@ -276,10 +279,35 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress(cons
|
||||
cellI,
|
||||
cellJ,
|
||||
cellK,
|
||||
aquiferNumber);
|
||||
aquiferNumber,
|
||||
isErrorResult);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Column header text format: [<ER|ERR|ERROR>:]<VECTOR>:<CATEGORY_VALUE_NAME1>[:<CATEGORY_VALUE_NAME2>][....]
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddressFromObservedData(const std::string& columnHeaderText)
|
||||
{
|
||||
QStringList names = QString().fromStdString(columnHeaderText).split(":");
|
||||
|
||||
int vectorNameIndex = 0;
|
||||
bool isErrorResult = false;
|
||||
|
||||
if (names.size() > 1 && names[0].trimmed().startsWith("ER", Qt::CaseInsensitive))
|
||||
{
|
||||
vectorNameIndex = 1;
|
||||
isErrorResult = true;
|
||||
}
|
||||
|
||||
std::vector<std::string> columnHeaderTexts;
|
||||
for (int i = vectorNameIndex + 1; i < names.size(); i++) columnHeaderTexts.push_back(names[i].trimmed().toStdString());
|
||||
|
||||
RifEclipseSummaryAddress address = makeAndFillAddress(names[vectorNameIndex].trimmed().toStdString(), columnHeaderTexts);
|
||||
if (isErrorResult) address.setAsErrorResult();
|
||||
return address;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user