mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5101 clang-format: Adjusted penalties
Use lower absolute values to improve control of behavior
This commit is contained in:
@@ -283,9 +283,9 @@ void RifCaseRealizationRunspecificationReader::parse()
|
||||
}
|
||||
else
|
||||
{
|
||||
errors << QString(
|
||||
"RifCaseRealizationRunspecificationReader: Invalid number format in line %1" )
|
||||
.arg( xml.lineNumber() );
|
||||
errors
|
||||
<< QString( "RifCaseRealizationRunspecificationReader: Invalid number format in line %1" )
|
||||
.arg( xml.lineNumber() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -567,8 +567,8 @@ bool RifCsvUserDataParser::parseLineBasedData()
|
||||
// VALUE
|
||||
{
|
||||
bool parseOk = true;
|
||||
double value = QLocale::c().toDouble( dataItems[colIndexes[(size_t)CsvLineBasedColumnType::VALUE]],
|
||||
&parseOk );
|
||||
double value =
|
||||
QLocale::c().toDouble( dataItems[colIndexes[(size_t)CsvLineBasedColumnType::VALUE]], &parseOk );
|
||||
|
||||
if ( !parseOk )
|
||||
{
|
||||
|
||||
@@ -152,11 +152,11 @@ bool RifEclipseInputFileTools::openGridFile( const QString& fileName,
|
||||
bool allKwReadOk = true;
|
||||
|
||||
fseek( gridFilePointer, specgridPos, SEEK_SET );
|
||||
allKwReadOk = allKwReadOk &&
|
||||
nullptr !=
|
||||
( specGridKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer,
|
||||
false,
|
||||
ecl_type_create_from_type( ECL_INT_TYPE ) ) );
|
||||
allKwReadOk =
|
||||
allKwReadOk &&
|
||||
nullptr != ( specGridKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer,
|
||||
false,
|
||||
ecl_type_create_from_type( ECL_INT_TYPE ) ) );
|
||||
progress.setProgress( 1 );
|
||||
|
||||
fseek( gridFilePointer, zcornPos, SEEK_SET );
|
||||
@@ -179,11 +179,11 @@ bool RifEclipseInputFileTools::openGridFile( const QString& fileName,
|
||||
if ( actnumPos >= 0 )
|
||||
{
|
||||
fseek( gridFilePointer, actnumPos, SEEK_SET );
|
||||
allKwReadOk = allKwReadOk &&
|
||||
nullptr !=
|
||||
( actNumKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer,
|
||||
false,
|
||||
ecl_type_create_from_type( ECL_INT_TYPE ) ) );
|
||||
allKwReadOk =
|
||||
allKwReadOk &&
|
||||
nullptr != ( actNumKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer,
|
||||
false,
|
||||
ecl_type_create_from_type( ECL_INT_TYPE ) ) );
|
||||
progress.setProgress( 4 );
|
||||
}
|
||||
|
||||
@@ -191,9 +191,8 @@ bool RifEclipseInputFileTools::openGridFile( const QString& fileName,
|
||||
if ( mapaxesPos >= 0 )
|
||||
{
|
||||
fseek( gridFilePointer, mapaxesPos, SEEK_SET );
|
||||
mapAxesKw = ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer,
|
||||
false,
|
||||
ecl_type_create_from_type( ECL_FLOAT_TYPE ) );
|
||||
mapAxesKw =
|
||||
ecl_kw_fscanf_alloc_current_grdecl__( gridFilePointer, false, ecl_type_create_from_type( ECL_FLOAT_TYPE ) );
|
||||
}
|
||||
|
||||
if ( !allKwReadOk )
|
||||
@@ -508,10 +507,8 @@ bool RifEclipseInputFileTools::exportKeywords( const QString& resul
|
||||
{
|
||||
resultValuesInt.push_back( static_cast<int>( val ) );
|
||||
}
|
||||
ecl_kw = ecl_kw_alloc_new( keyword.toLatin1().data(),
|
||||
(int)resultValuesInt.size(),
|
||||
ECL_INT,
|
||||
resultValuesInt.data() );
|
||||
ecl_kw =
|
||||
ecl_kw_alloc_new( keyword.toLatin1().data(), (int)resultValuesInt.size(), ECL_INT, resultValuesInt.data() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -683,8 +680,7 @@ void RifEclipseInputFileTools::saveFault( QTextStream&
|
||||
}
|
||||
else
|
||||
{
|
||||
faultCellAndFaces.push_back(
|
||||
std::make_tuple( shifted_i, shifted_j, shifted_k, faultCellAndFace.m_nativeFace ) );
|
||||
faultCellAndFaces.push_back( std::make_tuple( shifted_i, shifted_j, shifted_k, faultCellAndFace.m_nativeFace ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,8 +753,7 @@ void RifEclipseInputFileTools::saveFaults( QTextStream& stream,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Read known properties from the input file
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<QString, QString> RifEclipseInputFileTools::readProperties( const QString& fileName,
|
||||
RigEclipseCaseData* caseData )
|
||||
std::map<QString, QString> RifEclipseInputFileTools::readProperties( const QString& fileName, RigEclipseCaseData* caseData )
|
||||
{
|
||||
CVF_ASSERT( caseData );
|
||||
|
||||
@@ -1018,7 +1013,8 @@ void RifEclipseInputFileTools::parseAndReadPathAliasKeyword( const QString&
|
||||
// Replace tab with space to be able to split the string using space as splitter
|
||||
line.replace( "\t", " " );
|
||||
|
||||
// Remove character ' used to mark start and end of fault name, possibly also around face definition; 'I+'
|
||||
// Remove character ' used to mark start and end of fault name, possibly also around face
|
||||
// definition; 'I+'
|
||||
line.remove( "'" );
|
||||
|
||||
QStringList entries = line.split( " ", QString::SkipEmptyParts );
|
||||
|
||||
@@ -56,10 +56,8 @@ public:
|
||||
RifEclipseInputFileTools();
|
||||
~RifEclipseInputFileTools() override;
|
||||
|
||||
static bool openGridFile( const QString& fileName,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
bool readFaultData,
|
||||
QString* errorMessages );
|
||||
static bool
|
||||
openGridFile( const QString& fileName, RigEclipseCaseData* eclipseCase, bool readFaultData, QString* errorMessages );
|
||||
|
||||
static bool exportGrid( const QString& gridFileName,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
@@ -121,14 +119,14 @@ public:
|
||||
static void parseAndReadPathAliasKeyword( const QString& fileName,
|
||||
std::vector<std::pair<QString, QString>>* pathAliasDefinitions );
|
||||
|
||||
static bool readFaultsAndParseIncludeStatementsRecursively(
|
||||
QFile& file,
|
||||
qint64 startPos,
|
||||
const std::vector<std::pair<QString, QString>>& pathAliasDefinitions,
|
||||
cvf::Collection<RigFault>* faults,
|
||||
std::vector<QString>* filenamesWithFaults,
|
||||
bool* isEditKeywordDetected,
|
||||
const QString& faultIncludeFileAbsolutePathPrefix );
|
||||
static bool
|
||||
readFaultsAndParseIncludeStatementsRecursively( QFile& file,
|
||||
qint64 startPos,
|
||||
const std::vector<std::pair<QString, QString>>& pathAliasDefinitions,
|
||||
cvf::Collection<RigFault>* faults,
|
||||
std::vector<QString>* filenamesWithFaults,
|
||||
bool* isEditKeywordDetected,
|
||||
const QString& faultIncludeFileAbsolutePathPrefix );
|
||||
|
||||
static bool readKeywordAndParseIncludeStatementsRecursively(
|
||||
const QString& keyword,
|
||||
@@ -139,11 +137,11 @@ public:
|
||||
QStringList* keywordDataContent,
|
||||
std::vector<QString>* filenamesContainingKeyword,
|
||||
bool* isEditKeywordDetected,
|
||||
const QString& faultIncludeFileAbsolutePathPrefix // rename to includeStatementAbsolutePathPrefix
|
||||
const QString& faultIncludeFileAbsolutePathPrefix // rename to
|
||||
// includeStatementAbsolutePathPrefix
|
||||
);
|
||||
|
||||
static void
|
||||
readKeywordDataContent( QFile& data, qint64 filePos, QStringList* textContent, bool* isEditKeywordDetected );
|
||||
static void readKeywordDataContent( QFile& data, qint64 filePos, QStringList* textContent, bool* isEditKeywordDetected );
|
||||
static RiaEclipseUnitTools::UnitSystem readUnitSystem( QFile& file, qint64 gridunitPos );
|
||||
|
||||
static cvf::StructGridInterface::FaceEnum faceEnumFromText( const QString& faceString );
|
||||
|
||||
@@ -38,10 +38,9 @@
|
||||
/// Loads input property data from the gridFile and additional files
|
||||
/// Creates new InputProperties if necessary, and flags the unused ones as obsolete
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties(
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection,
|
||||
RigEclipseCaseData* eclipseCaseData,
|
||||
const std::vector<QString>& filenames )
|
||||
void RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
||||
RigEclipseCaseData* eclipseCaseData,
|
||||
const std::vector<QString>& filenames )
|
||||
{
|
||||
CVF_ASSERT( inputPropertyCollection );
|
||||
CVF_ASSERT( eclipseCaseData );
|
||||
@@ -92,8 +91,8 @@ bool RifEclipseInputPropertyLoader::readInputPropertiesFromFiles( RimEclipseInpu
|
||||
{
|
||||
for ( const QString& propertyFileName : filenames )
|
||||
{
|
||||
std::map<QString, QString> readProperties = RifEclipseInputFileTools::readProperties( propertyFileName,
|
||||
eclipseCaseData );
|
||||
std::map<QString, QString> readProperties =
|
||||
RifEclipseInputFileTools::readProperties( propertyFileName, eclipseCaseData );
|
||||
|
||||
std::map<QString, QString>::iterator it;
|
||||
for ( it = readProperties.begin(); it != readProperties.end(); ++it )
|
||||
@@ -205,11 +204,10 @@ void RifEclipseInputPropertyLoader::readDataForEachInputProperty( RimEclipseInpu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseInputPropertyLoader::readInputPropertiesForRemainingKeywords(
|
||||
RimEclipseInputPropertyCollection* inputPropertyCollection,
|
||||
RigEclipseCaseData* eclipseCaseData,
|
||||
const QString& filename,
|
||||
std::set<QString>* fileKeywordSet )
|
||||
void RifEclipseInputPropertyLoader::readInputPropertiesForRemainingKeywords( RimEclipseInputPropertyCollection* inputPropertyCollection,
|
||||
RigEclipseCaseData* eclipseCaseData,
|
||||
const QString& filename,
|
||||
std::set<QString>* fileKeywordSet )
|
||||
{
|
||||
for ( const QString& fileKeyword : *fileKeywordSet )
|
||||
{
|
||||
|
||||
@@ -418,17 +418,18 @@ bool RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName( const QString&
|
||||
void RifEclipseOutputFileTools::readGridDimensions( const QString& gridFileName,
|
||||
std::vector<std::vector<int>>& gridDimensions )
|
||||
{
|
||||
ecl_grid_type* grid = ecl_grid_alloc(
|
||||
RiaStringEncodingTools::toNativeEncoded( gridFileName ).data() ); // bootstrap ecl_grid instance
|
||||
ecl_grid_type* grid = ecl_grid_alloc( RiaStringEncodingTools::toNativeEncoded( gridFileName ).data() ); // bootstrap
|
||||
// ecl_grid
|
||||
// instance
|
||||
stringlist_type* lgr_names = ecl_grid_alloc_lgr_name_list( grid ); // get a list of all the lgr names.
|
||||
|
||||
// printf("grid:%s has %d a total of %d lgr's \n", grid_filename , stringlist_get_size( lgr_names ));
|
||||
for ( int lgr_nr = 0; lgr_nr < stringlist_get_size( lgr_names ); lgr_nr++ )
|
||||
{
|
||||
ecl_grid_type* lgr_grid =
|
||||
ecl_grid_get_lgr( grid,
|
||||
stringlist_iget( lgr_names,
|
||||
lgr_nr ) ); // get the ecl_grid instance of the lgr - by name.
|
||||
ecl_grid_type* lgr_grid = ecl_grid_get_lgr( grid,
|
||||
stringlist_iget( lgr_names,
|
||||
lgr_nr ) ); // get the ecl_grid instance of the lgr
|
||||
// - by name.
|
||||
|
||||
int nx, ny, nz, active_size;
|
||||
ecl_grid_get_dims( lgr_grid, &nx, &ny, &nz, &active_size ); // get some size info from this lgr.
|
||||
@@ -480,8 +481,8 @@ cvf::ref<RifEclipseRestartDataAccess> RifEclipseOutputFileTools::createDynamicRe
|
||||
cvf::ref<RifEclipseRestartDataAccess> resultsAccess;
|
||||
|
||||
// Look for unified restart file
|
||||
QString unrstFileName = RifEclipseOutputFileTools::firstFileNameOfType( filesWithSameBaseName,
|
||||
ECL_UNIFIED_RESTART_FILE );
|
||||
QString unrstFileName =
|
||||
RifEclipseOutputFileTools::firstFileNameOfType( filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE );
|
||||
if ( unrstFileName.size() > 0 )
|
||||
{
|
||||
resultsAccess = new RifEclipseUnifiedRestartFileAccess();
|
||||
@@ -490,8 +491,8 @@ cvf::ref<RifEclipseRestartDataAccess> RifEclipseOutputFileTools::createDynamicRe
|
||||
else
|
||||
{
|
||||
// Look for set of restart files (one file per time step)
|
||||
QStringList restartFiles = RifEclipseOutputFileTools::filterFileNamesOfType( filesWithSameBaseName,
|
||||
ECL_RESTART_FILE );
|
||||
QStringList restartFiles =
|
||||
RifEclipseOutputFileTools::filterFileNamesOfType( filesWithSameBaseName, ECL_RESTART_FILE );
|
||||
if ( restartFiles.size() > 0 )
|
||||
{
|
||||
resultsAccess = new RifEclipseRestartFilesetAccess();
|
||||
|
||||
@@ -84,7 +84,8 @@ void RifEclipseRestartFilesetAccess::setRestartFiles( const QStringList& fileSet
|
||||
m_ecl_files.clear();
|
||||
|
||||
m_fileNames = fileSet;
|
||||
m_fileNames.sort(); // To make sure they are sorted in increasing *.X000N order. Hack. Should probably be actual time stored on file.
|
||||
m_fileNames.sort(); // To make sure they are sorted in increasing *.X000N order. Hack. Should probably be actual
|
||||
// time stored on file.
|
||||
|
||||
for ( int i = 0; i < m_fileNames.size(); i++ )
|
||||
{
|
||||
@@ -275,9 +276,9 @@ void RifEclipseRestartFilesetAccess::openTimeStep( size_t timeStep )
|
||||
|
||||
if ( m_ecl_files[timeStep] == nullptr )
|
||||
{
|
||||
int index = static_cast<int>( timeStep );
|
||||
ecl_file_type* ecl_file = ecl_file_open( RiaStringEncodingTools::toNativeEncoded( m_fileNames[index] ).data(),
|
||||
ECL_FILE_CLOSE_STREAM );
|
||||
int index = static_cast<int>( timeStep );
|
||||
ecl_file_type* ecl_file =
|
||||
ecl_file_open( RiaStringEncodingTools::toNativeEncoded( m_fileNames[index] ).data(), ECL_FILE_CLOSE_STREAM );
|
||||
|
||||
m_ecl_files[timeStep] = ecl_file;
|
||||
|
||||
|
||||
@@ -363,9 +363,8 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::regionAddress( const std::str
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::regionToRegionAddress( const std::string& quantityName,
|
||||
int regionNumber,
|
||||
int region2Number )
|
||||
RifEclipseSummaryAddress
|
||||
RifEclipseSummaryAddress::regionToRegionAddress( const std::string& quantityName, int regionNumber, int region2Number )
|
||||
{
|
||||
RifEclipseSummaryAddress addr;
|
||||
addr.m_variableCategory = SUMMARY_REGION_2_REGION;
|
||||
@@ -391,8 +390,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellGroupAddress( const std::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::wellAddress( const std::string& quantityName,
|
||||
const std::string& wellName )
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::wellAddress( const std::string& quantityName, const std::string& wellName )
|
||||
{
|
||||
RifEclipseSummaryAddress addr;
|
||||
addr.m_variableCategory = SUMMARY_WELL;
|
||||
@@ -488,11 +486,8 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::blockAddress( const std::stri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress RifEclipseSummaryAddress::blockLgrAddress( const std::string& quantityName,
|
||||
const std::string& lgrName,
|
||||
int i,
|
||||
int j,
|
||||
int k )
|
||||
RifEclipseSummaryAddress
|
||||
RifEclipseSummaryAddress::blockLgrAddress( const std::string& quantityName, const std::string& lgrName, int i, int j, int k )
|
||||
{
|
||||
RifEclipseSummaryAddress addr;
|
||||
addr.m_variableCategory = SUMMARY_BLOCK_LGR;
|
||||
|
||||
@@ -53,10 +53,7 @@ void RifEclipseSummaryTools::findSummaryFiles( const QString& inputFile, QString
|
||||
char* myBase = nullptr;
|
||||
char* myExtention = nullptr;
|
||||
|
||||
util_alloc_file_components( RiaStringEncodingTools::toNativeEncoded( inputFile ).data(),
|
||||
&myPath,
|
||||
&myBase,
|
||||
&myExtention );
|
||||
util_alloc_file_components( RiaStringEncodingTools::toNativeEncoded( inputFile ).data(), &myPath, &myBase, &myExtention );
|
||||
|
||||
QString path;
|
||||
if ( myPath ) path = RiaStringEncodingTools::fromNativeEncoded( myPath );
|
||||
@@ -103,8 +100,7 @@ QString RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( const QSt
|
||||
char* myPath = nullptr;
|
||||
char* myBase = nullptr;
|
||||
|
||||
util_alloc_file_components( RiaStringEncodingTools::toNativeEncoded( QDir::toNativeSeparators( summaryHeaderFile ) )
|
||||
.data(),
|
||||
util_alloc_file_components( RiaStringEncodingTools::toNativeEncoded( QDir::toNativeSeparators( summaryHeaderFile ) ).data(),
|
||||
&myPath,
|
||||
&myBase,
|
||||
nullptr );
|
||||
@@ -135,11 +131,11 @@ void RifEclipseSummaryTools::dumpMetaData( RifSummaryReaderInterface* readerEcli
|
||||
|
||||
for ( int category = 0; category < RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR; category++ )
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory categoryEnum = RifEclipseSummaryAddress::SummaryVarCategory(
|
||||
category );
|
||||
RifEclipseSummaryAddress::SummaryVarCategory categoryEnum =
|
||||
RifEclipseSummaryAddress::SummaryVarCategory( category );
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> catAddresses = RiaSummaryCurveAnalyzer::addressesForCategory( addresses,
|
||||
categoryEnum );
|
||||
std::vector<RifEclipseSummaryAddress> catAddresses =
|
||||
RiaSummaryCurveAnalyzer::addressesForCategory( addresses, categoryEnum );
|
||||
|
||||
if ( catAddresses.size() > 0 )
|
||||
{
|
||||
|
||||
@@ -102,8 +102,8 @@ bool RifEclipseUnifiedRestartFileAccess::openFile()
|
||||
|
||||
if ( !m_ecl_file )
|
||||
{
|
||||
m_ecl_file = ecl_file_open( RiaStringEncodingTools::toNativeEncoded( m_filename ).data(),
|
||||
ECL_FILE_CLOSE_STREAM );
|
||||
m_ecl_file =
|
||||
ecl_file_open( RiaStringEncodingTools::toNativeEncoded( m_filename ).data(), ECL_FILE_CLOSE_STREAM );
|
||||
if ( !m_ecl_file )
|
||||
{
|
||||
RiaLogging::error( QString( "Failed to open file %1" ).arg( m_filename ) );
|
||||
|
||||
@@ -161,9 +161,8 @@ bool RifEclipseUserDataKeywordTools::isYearX( const std::string& identifier )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseSummaryAddress
|
||||
RifEclipseUserDataKeywordTools::makeAndFillAddress( const std::string quantityName,
|
||||
const std::vector<std::string>& columnHeaderText )
|
||||
RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( const std::string quantityName,
|
||||
const std::vector<std::string>& columnHeaderText )
|
||||
{
|
||||
RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::identifyCategory( quantityName );
|
||||
|
||||
|
||||
@@ -544,8 +544,8 @@ std::vector<std::string> RifEclipseUserDataParserTools::findValidHeaderLines( st
|
||||
|
||||
columnCount = words.size();
|
||||
|
||||
minimunRequiredExtraHeaderLines = RifEclipseUserDataKeywordTools::computeRequiredHeaderLineCount(
|
||||
words );
|
||||
minimunRequiredExtraHeaderLines =
|
||||
RifEclipseUserDataKeywordTools::computeRequiredHeaderLineCount( words );
|
||||
|
||||
headerLines.push_back( line );
|
||||
}
|
||||
|
||||
@@ -45,8 +45,7 @@ RifElementPropertyReader::~RifElementPropertyReader()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifElementPropertyReader::addFile( const std::string& fileName )
|
||||
{
|
||||
RifElementPropertyMetadata metaData = RifElementPropertyTableReader::readMetadata(
|
||||
QString::fromStdString( fileName ) );
|
||||
RifElementPropertyMetadata metaData = RifElementPropertyTableReader::readMetadata( QString::fromStdString( fileName ) );
|
||||
for ( QString field : metaData.dataColumns )
|
||||
{
|
||||
m_fieldsMetaData[field.toStdString()] = metaData;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RifFileParseTools::splitLineAndTrim( const QString& line, const QString& separator, bool skipEmptyParts )
|
||||
{
|
||||
QStringList cols = line.trimmed().split( separator,
|
||||
skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts );
|
||||
QStringList cols =
|
||||
line.trimmed().split( separator, skipEmptyParts ? QString::SkipEmptyParts : QString::KeepEmptyParts );
|
||||
for ( QString& col : cols )
|
||||
{
|
||||
col = col.trimmed();
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
/// May reduce constructor content upon discussion of overlying framework.
|
||||
///
|
||||
/// std::string dateString = getStringAttribute(file, "/KaseStudy/TransientSections", "initial_date");
|
||||
/// QDateTime initalDateTime = sourSimDateTimeToQDateTime(dateString); // may rearrange/change to be a call in timeSteps()
|
||||
/// QDateTime initalDateTime = sourSimDateTimeToQDateTime(dateString); // may rearrange/change to be a call in
|
||||
/// timeSteps()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifHdf5Reader::RifHdf5Reader( const QString& fileName )
|
||||
: m_fileName( fileName )
|
||||
@@ -81,9 +82,8 @@ bool RifHdf5Reader::dynamicResult( const QString& result, size_t stepIndex, std:
|
||||
|
||||
QStringList::iterator it = std::find( props.begin(), props.end(), result );
|
||||
|
||||
int propIdx = ( it != props.end() )
|
||||
? it - props.begin()
|
||||
: 0; // index to 'result' in QStringList props (usually size_t but int gave no warning)
|
||||
int propIdx = ( it != props.end() ) ? it - props.begin() : 0; // index to 'result' in QStringList props (usually
|
||||
// size_t but int gave no warning)
|
||||
|
||||
H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately
|
||||
|
||||
|
||||
@@ -34,9 +34,7 @@ public:
|
||||
// Virtual interface implementation
|
||||
bool open( const QString& fileName, RigEclipseCaseData* eclipseCase ) override;
|
||||
|
||||
bool staticResult( const QString& result,
|
||||
RiaDefines::PorosityModelType matrixOrFracture,
|
||||
std::vector<double>* values ) override
|
||||
bool staticResult( const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector<double>* values ) override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -179,12 +179,7 @@ bool transferGridCellData( RigMainGrid* mainGrid,
|
||||
for ( cIdx = 0; cIdx < 8; ++cIdx )
|
||||
{
|
||||
double* point = mainGrid->nodes()[nodeStartIndex + gridLocalCellIndex * 8 + cellMappingECLRi[cIdx]].ptr();
|
||||
ecl_grid_get_cell_corner_xyz1( localEclGrid,
|
||||
gridLocalCellIndex,
|
||||
cIdx,
|
||||
&( point[0] ),
|
||||
&( point[1] ),
|
||||
&( point[2] ) );
|
||||
ecl_grid_get_cell_corner_xyz1( localEclGrid, gridLocalCellIndex, cIdx, &( point[0] ), &( point[1] ), &( point[2] ) );
|
||||
point[2] = -point[2]; // Flipping Z making depth become negative z values
|
||||
cell.cornerIndices()[cIdx] = nodeStartIndex + gridLocalCellIndex * 8 + cIdx;
|
||||
}
|
||||
@@ -594,9 +589,8 @@ void RifReaderEclipseOutput::setHdf5FileName( const QString& fileName )
|
||||
}
|
||||
}
|
||||
|
||||
timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos( sourSimTimeSteps,
|
||||
reportNumbers,
|
||||
daysSinceSimulationStart );
|
||||
timeStepInfos =
|
||||
RigEclipseTimeStepInfo::createTimeStepInfos( sourSimTimeSteps, reportNumbers, daysSinceSimulationStart );
|
||||
}
|
||||
|
||||
QStringList resultNames = hdf5ReaderInterface->propertyNames();
|
||||
@@ -654,8 +648,7 @@ void RifReaderEclipseOutput::importFaults( const QStringList& fileSet, cvf::Coll
|
||||
faultIncludeFileAbsolutePathPrefix() );
|
||||
|
||||
std::sort( filenamesWithFaults.begin(), filenamesWithFaults.end() );
|
||||
std::vector<QString>::iterator last = std::unique( filenamesWithFaults.begin(),
|
||||
filenamesWithFaults.end() );
|
||||
std::vector<QString>::iterator last = std::unique( filenamesWithFaults.begin(), filenamesWithFaults.end() );
|
||||
filenamesWithFaults.erase( last, filenamesWithFaults.end() );
|
||||
|
||||
this->setFilenamesWithFaults( filenamesWithFaults );
|
||||
@@ -718,9 +711,8 @@ void RifReaderEclipseOutput::transferStaticNNCData( const ecl_grid_type* mainEcl
|
||||
ecl_nnc_geometry_type* nnc_geo = ecl_nnc_geometry_alloc( mainEclGrid );
|
||||
if ( nnc_geo )
|
||||
{
|
||||
ecl_nnc_data_type* tran_data = ecl_nnc_data_alloc_tran( mainEclGrid,
|
||||
nnc_geo,
|
||||
ecl_file_get_global_view( init_file ) );
|
||||
ecl_nnc_data_type* tran_data =
|
||||
ecl_nnc_data_alloc_tran( mainEclGrid, nnc_geo, ecl_file_get_global_view( init_file ) );
|
||||
if ( tran_data )
|
||||
{
|
||||
int numNNC = ecl_nnc_data_get_size( tran_data );
|
||||
@@ -752,8 +744,8 @@ void RifReaderEclipseOutput::transferStaticNNCData( const ecl_grid_type* mainEcl
|
||||
|
||||
mainGrid->nncData()->setConnections( nncConnections );
|
||||
|
||||
std::vector<double>& transmissibilityValues = mainGrid->nncData()->makeStaticConnectionScalarResult(
|
||||
RiaDefines::propertyNameCombTrans() );
|
||||
std::vector<double>& transmissibilityValues =
|
||||
mainGrid->nncData()->makeStaticConnectionScalarResult( RiaDefines::propertyNameCombTrans() );
|
||||
transmissibilityValues = transmissibilityValuesTemp;
|
||||
}
|
||||
|
||||
@@ -846,8 +838,8 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
|
||||
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType( m_filesWithSameBaseName, ECL_INIT_FILE );
|
||||
if ( initFileName.size() > 0 )
|
||||
{
|
||||
ecl_file_type* ecl_file = ecl_file_open( RiaStringEncodingTools::toNativeEncoded( initFileName ).data(),
|
||||
ECL_FILE_CLOSE_STREAM );
|
||||
ecl_file_type* ecl_file =
|
||||
ecl_file_open( RiaStringEncodingTools::toNativeEncoded( initFileName ).data(), ECL_FILE_CLOSE_STREAM );
|
||||
if ( ecl_file )
|
||||
{
|
||||
bool isDualPorosity = m_eclipseCase->mainGrid()->isDualPorosity();
|
||||
@@ -863,8 +855,8 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
|
||||
QString egridFileName = RifEclipseOutputFileTools::firstFileNameOfType( m_filesWithSameBaseName, ECL_EGRID_FILE );
|
||||
if ( egridFileName.size() > 0 )
|
||||
{
|
||||
ecl_file_type* ecl_file = ecl_file_open( RiaStringEncodingTools::toNativeEncoded( egridFileName ).data(),
|
||||
ECL_FILE_CLOSE_STREAM );
|
||||
ecl_file_type* ecl_file =
|
||||
ecl_file_open( RiaStringEncodingTools::toNativeEncoded( egridFileName ).data(), ECL_FILE_CLOSE_STREAM );
|
||||
if ( ecl_file )
|
||||
{
|
||||
actnumValuesPerGrid = RifActiveCellsReader::activeCellsFromActnumKeyword( ecl_file );
|
||||
@@ -1207,10 +1199,7 @@ bool RifReaderEclipseOutput::dynamicResult( const QString& result
|
||||
size_t indexOnFile = timeStepIndexOnFile( stepIndex );
|
||||
|
||||
std::vector<double> fileValues;
|
||||
if ( !m_dynamicResultsAccess->results( result,
|
||||
indexOnFile,
|
||||
m_eclipseCase->mainGrid()->gridCountOnFile(),
|
||||
&fileValues ) )
|
||||
if ( !m_dynamicResultsAccess->results( result, indexOnFile, m_eclipseCase->mainGrid()->gridCountOnFile(), &fileValues ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1350,8 +1339,8 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint( const RigGridB
|
||||
resultPoint.m_oilRate = oilRate;
|
||||
resultPoint.m_waterRate = waterRate;
|
||||
|
||||
resultPoint.m_gasRate = RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( m_eclipseCase->unitsType(),
|
||||
gasRate );
|
||||
resultPoint.m_gasRate =
|
||||
RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( m_eclipseCase->unitsType(), gasRate );
|
||||
|
||||
resultPoint.m_connectionFactor = connectionFactor;
|
||||
}
|
||||
@@ -1514,15 +1503,14 @@ public:
|
||||
const well_conn_type* ert_wellhead = well_state_iget_wellhead( ert_well_state, static_cast<int>( gridNr ) );
|
||||
if ( ert_wellhead )
|
||||
{
|
||||
size_t localGridCellidx = localGridCellIndexFromErtConnection( m_mainGrid->gridByIndex( gridNr ),
|
||||
ert_wellhead,
|
||||
nullptr );
|
||||
size_t localGridCellidx =
|
||||
localGridCellIndexFromErtConnection( m_mainGrid->gridByIndex( gridNr ), ert_wellhead, nullptr );
|
||||
this->insertTheParentCells( gridNr, localGridCellidx );
|
||||
}
|
||||
|
||||
std::string gridname = gridNr == 0 ? ECL_GRID_GLOBAL_GRID : m_mainGrid->gridByIndex( gridNr )->gridName();
|
||||
const well_conn_collection_type* connections = well_state_get_grid_connections( ert_well_state,
|
||||
gridname.data() );
|
||||
const well_conn_collection_type* connections =
|
||||
well_state_get_grid_connections( ert_well_state, gridname.data() );
|
||||
|
||||
if ( connections )
|
||||
{
|
||||
@@ -1578,8 +1566,8 @@ private:
|
||||
gridIndex = lgrHost->parentGrid()->gridIndex();
|
||||
gridCellIndex = connectionCell.parentCellIndex();
|
||||
|
||||
size_t parentReservoirCellIdx = m_mainGrid->reservoirCellIndexByGridAndGridLocalCellIndex( gridIndex,
|
||||
gridCellIndex );
|
||||
size_t parentReservoirCellIdx =
|
||||
m_mainGrid->reservoirCellIndexByGridAndGridLocalCellIndex( gridIndex, gridCellIndex );
|
||||
m_gridCellsWithSubCellWellConnections.insert( parentReservoirCellIdx );
|
||||
}
|
||||
}
|
||||
@@ -1709,8 +1697,8 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo
|
||||
// If several grids have a wellhead definition for this well, we use the last one.
|
||||
// (Possibly the innermost LGR)
|
||||
|
||||
const well_conn_type* ert_wellhead = well_state_iget_wellhead( ert_well_state,
|
||||
static_cast<int>( gridNr ) );
|
||||
const well_conn_type* ert_wellhead =
|
||||
well_state_iget_wellhead( ert_well_state, static_cast<int>( gridNr ) );
|
||||
if ( ert_wellhead )
|
||||
{
|
||||
wellResFrame.m_wellHead = createWellResultPoint( grids[gridNr], ert_wellhead, -1, -1, wellName );
|
||||
@@ -1798,8 +1786,7 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo
|
||||
lastConnectionCellSize = ( lastConnectionPos - cellVxes[0] ).length();
|
||||
|
||||
lastConnectionSegmentId = well_segment_get_id( segment );
|
||||
accLengthFromLastConnection = well_segment_get_length( segment ) /
|
||||
( connectionCount + 1 );
|
||||
accLengthFromLastConnection = well_segment_get_length( segment ) / ( connectionCount + 1 );
|
||||
if ( !segmentBelowHasConnections )
|
||||
upperSegmentIdsOfUnpositionedSegementGroup.push_back( segmentIdBelow );
|
||||
|
||||
@@ -1866,8 +1853,8 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo
|
||||
int connectionCount = well_conn_collection_get_size( connections );
|
||||
|
||||
// Select the deepest connection
|
||||
well_conn_type* ert_connection = well_conn_collection_iget( connections,
|
||||
connectionCount - 1 );
|
||||
well_conn_type* ert_connection =
|
||||
well_conn_collection_iget( connections, connectionCount - 1 );
|
||||
wellResultBranch.m_branchResultPoints.push_back(
|
||||
createWellResultPoint( grids[gridNr],
|
||||
ert_connection,
|
||||
@@ -2089,8 +2076,8 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo
|
||||
int lastGridNr = static_cast<int>( grids.size() ) - 1;
|
||||
for ( int gridNr = 0; gridNr <= lastGridNr; ++gridNr )
|
||||
{
|
||||
const well_conn_type* ert_wellhead = well_state_iget_wellhead( ert_well_state,
|
||||
static_cast<int>( gridNr ) );
|
||||
const well_conn_type* ert_wellhead =
|
||||
well_state_iget_wellhead( ert_well_state, static_cast<int>( gridNr ) );
|
||||
if ( ert_wellhead )
|
||||
{
|
||||
RigWellResultPoint wellHeadRp =
|
||||
@@ -2393,8 +2380,7 @@ void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel( RiaDefines
|
||||
{
|
||||
destinationResultValues->insert( destinationResultValues->end(),
|
||||
sourceResultValues.begin() + sourceStartPosition,
|
||||
sourceResultValues.begin() + sourceStartPosition +
|
||||
matrixActiveCellCount );
|
||||
sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2428,8 +2414,8 @@ void RifReaderEclipseOutput::openInitFile()
|
||||
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType( m_filesWithSameBaseName, ECL_INIT_FILE );
|
||||
if ( initFileName.size() > 0 )
|
||||
{
|
||||
m_ecl_init_file = ecl_file_open( RiaStringEncodingTools::toNativeEncoded( initFileName ).data(),
|
||||
ECL_FILE_CLOSE_STREAM );
|
||||
m_ecl_init_file =
|
||||
ecl_file_open( RiaStringEncodingTools::toNativeEncoded( initFileName ).data(), ECL_FILE_CLOSE_STREAM );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -320,8 +320,7 @@ std::set<QDateTime> RifReaderEclipseRft::availableTimeSteps( const QString& well
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseRftAddress::RftWellLogChannelType>
|
||||
RifReaderEclipseRft::availableWellLogChannels( const QString& wellName )
|
||||
std::set<RifEclipseRftAddress::RftWellLogChannelType> RifReaderEclipseRft::availableWellLogChannels( const QString& wellName )
|
||||
{
|
||||
if ( !m_ecl_rft_file )
|
||||
{
|
||||
|
||||
@@ -164,8 +164,7 @@ bool RifReaderEclipseSummary::open( const QString& headerFileName, bool includeR
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RifRestartFileInfo> RifReaderEclipseSummary::getRestartFiles( const QString& headerFileName,
|
||||
bool* hasWarnings )
|
||||
std::vector<RifRestartFileInfo> RifReaderEclipseSummary::getRestartFiles( const QString& headerFileName, bool* hasWarnings )
|
||||
{
|
||||
CVF_ASSERT( hasWarnings );
|
||||
|
||||
@@ -523,11 +522,10 @@ RifRestartFileInfo RifReaderEclipseSummary::getRestartFile( const QString& heade
|
||||
{
|
||||
ecl_sum_type* ecl_sum = openEclSum( headerFileName, true );
|
||||
|
||||
const ecl_smspec_type* smspec = ecl_sum ? ecl_sum_get_smspec( ecl_sum ) : nullptr;
|
||||
const char* rstCase = smspec ? ecl_smspec_get_restart_case( smspec ) : nullptr;
|
||||
QString restartCase = rstCase
|
||||
? RiaFilePathTools::canonicalPath( RiaStringEncodingTools::fromNativeEncoded( rstCase ) )
|
||||
: "";
|
||||
const ecl_smspec_type* smspec = ecl_sum ? ecl_sum_get_smspec( ecl_sum ) : nullptr;
|
||||
const char* rstCase = smspec ? ecl_smspec_get_restart_case( smspec ) : nullptr;
|
||||
QString restartCase =
|
||||
rstCase ? RiaFilePathTools::canonicalPath( RiaStringEncodingTools::fromNativeEncoded( rstCase ) ) : "";
|
||||
closeEclSum( ecl_sum );
|
||||
|
||||
if ( !restartCase.isEmpty() )
|
||||
@@ -535,13 +533,13 @@ RifRestartFileInfo RifReaderEclipseSummary::getRestartFile( const QString& heade
|
||||
QString path = QFileInfo( restartCase ).dir().path();
|
||||
QString restartBase = QDir( restartCase ).dirName();
|
||||
|
||||
char* smspec_header = ecl_util_alloc_exfilename( path.toStdString().data(),
|
||||
char* smspec_header = ecl_util_alloc_exfilename( path.toStdString().data(),
|
||||
restartBase.toStdString().data(),
|
||||
ECL_SUMMARY_HEADER_FILE,
|
||||
false /*unformatted*/,
|
||||
0 );
|
||||
QString restartFileName = RiaFilePathTools::toInternalSeparator(
|
||||
RiaStringEncodingTools::fromNativeEncoded( smspec_header ) );
|
||||
QString restartFileName =
|
||||
RiaFilePathTools::toInternalSeparator( RiaStringEncodingTools::fromNativeEncoded( smspec_header ) );
|
||||
free( smspec_header );
|
||||
|
||||
return getFileInfo( restartFileName );
|
||||
|
||||
@@ -113,9 +113,9 @@ std::set<QDateTime> RifReaderEnsembleStatisticsRft::availableTimeSteps( const QS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QDateTime> RifReaderEnsembleStatisticsRft::availableTimeSteps(
|
||||
const QString& wellName,
|
||||
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName )
|
||||
std::set<QDateTime>
|
||||
RifReaderEnsembleStatisticsRft::availableTimeSteps( const QString& wellName,
|
||||
const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName )
|
||||
{
|
||||
std::set<QDateTime> allTimeSteps;
|
||||
for ( auto summaryCase : m_summaryCaseCollection->allSummaryCases() )
|
||||
|
||||
@@ -163,9 +163,8 @@ void RifSummaryCaseRestartSelector::determineFilesToImport( const std::vector<Ri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifSummaryCaseRestartSelector::determineFilesToImportByAskingUser(
|
||||
const std::vector<RifSummaryCaseFileImportInfo>& initialFiles,
|
||||
bool enableApplyToAllField )
|
||||
void RifSummaryCaseRestartSelector::determineFilesToImportByAskingUser( const std::vector<RifSummaryCaseFileImportInfo>& initialFiles,
|
||||
bool enableApplyToAllField )
|
||||
{
|
||||
RicSummaryCaseRestartDialogResult lastResult;
|
||||
|
||||
@@ -246,8 +245,7 @@ void RifSummaryCaseRestartSelector::determineFilesToImportByAskingUser(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifSummaryCaseRestartSelector::determineFilesToImportUsingPrefs(
|
||||
const std::vector<RifSummaryCaseFileImportInfo>& initialFiles )
|
||||
void RifSummaryCaseRestartSelector::determineFilesToImportUsingPrefs( const std::vector<RifSummaryCaseFileImportInfo>& initialFiles )
|
||||
{
|
||||
RicSummaryCaseRestartDialogResult lastResult;
|
||||
|
||||
@@ -290,8 +288,8 @@ void RifSummaryCaseRestartSelector::determineFilesToImportUsingPrefs(
|
||||
m_summaryFileInfos.push_back( RifSummaryCaseFileResultInfo( initialSummaryFile, false ) );
|
||||
bool hasWarnings = false;
|
||||
RifReaderEclipseSummary reader;
|
||||
std::vector<RifRestartFileInfo> restartFileInfos = reader.getRestartFiles( initialSummaryFile,
|
||||
&hasWarnings );
|
||||
std::vector<RifRestartFileInfo> restartFileInfos =
|
||||
reader.getRestartFiles( initialSummaryFile, &hasWarnings );
|
||||
for ( const auto& rfi : restartFileInfos )
|
||||
{
|
||||
RifSummaryCaseFileResultInfo resultFileInfo( RiaFilePathTools::toInternalSeparator( rfi.fileName ),
|
||||
@@ -312,9 +310,9 @@ void RifSummaryCaseRestartSelector::determineFilesToImportUsingPrefs(
|
||||
if ( defaultGridImportMode == RicSummaryCaseRestartDialog::SEPARATE_CASES )
|
||||
{
|
||||
RifReaderEclipseSummary reader;
|
||||
bool hasWarnings = false;
|
||||
std::vector<RifRestartFileInfo> restartFileInfos = reader.getRestartFiles( initialSummaryFile,
|
||||
&hasWarnings );
|
||||
bool hasWarnings = false;
|
||||
std::vector<RifRestartFileInfo> restartFileInfos =
|
||||
reader.getRestartFiles( initialSummaryFile, &hasWarnings );
|
||||
for ( const auto& rfi : restartFileInfos )
|
||||
{
|
||||
QString gridFileName = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile( rfi.fileName );
|
||||
|
||||
@@ -156,10 +156,7 @@ double RifWellMeasurementReader::parseDouble( const QString& token,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RifWellMeasurementReader::parseInt( const QString& token,
|
||||
const QString& propertyName,
|
||||
int lineNumber,
|
||||
const QString& filePath )
|
||||
int RifWellMeasurementReader::parseInt( const QString& token, const QString& propertyName, int lineNumber, const QString& filePath )
|
||||
{
|
||||
bool isOk = false;
|
||||
int value = token.toInt( &isOk );
|
||||
@@ -200,10 +197,8 @@ void RifWellMeasurementReader::verifyNonEmptyTokens( const QStringList& tokens,
|
||||
{
|
||||
if ( tokens[i].isEmpty() )
|
||||
{
|
||||
throw FileParseException( QString( "Unexpected empty '%1' on line %2: %3" )
|
||||
.arg( nameOfNonEmptyTokens[i] )
|
||||
.arg( lineNumber )
|
||||
.arg( filePath ) );
|
||||
throw FileParseException(
|
||||
QString( "Unexpected empty '%1' on line %2: %3" ).arg( nameOfNonEmptyTokens[i] ).arg( lineNumber ).arg( filePath ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,10 +120,9 @@ std::map<QString, cvf::ref<RigWellPathFormations>>
|
||||
|
||||
for ( const std::pair<QString, std::vector<RigWellPathFormation>>& formation : formations )
|
||||
{
|
||||
cvf::ref<RigWellPathFormations> wellPathFormations = new RigWellPathFormations( formation.second,
|
||||
filePath,
|
||||
formation.first );
|
||||
result[formation.first] = wellPathFormations;
|
||||
cvf::ref<RigWellPathFormations> wellPathFormations =
|
||||
new RigWellPathFormations( formation.second, filePath, formation.first );
|
||||
result[formation.first] = wellPathFormations;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -40,8 +40,8 @@ cvf::ref<RigWellPathFormations> RifWellPathFormationsImporter::readWellPathForma
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigWellPathFormations> RifWellPathFormationsImporter::reloadWellPathFormations( const QString& formationFilePath,
|
||||
const QString& wellName )
|
||||
cvf::ref<RigWellPathFormations>
|
||||
RifWellPathFormationsImporter::reloadWellPathFormations( const QString& formationFilePath, const QString& wellName )
|
||||
{
|
||||
m_fileNameToWellPathFormationMap.erase( formationFilePath );
|
||||
|
||||
|
||||
@@ -45,6 +45,5 @@ public:
|
||||
private:
|
||||
void readAllWellPathFormations( const QString& filePath );
|
||||
|
||||
std::map<QString /*filename*/, std::map<QString /*wellName*/, cvf::ref<RigWellPathFormations>>>
|
||||
m_fileNameToWellPathFormationMap;
|
||||
std::map<QString /*filename*/, std::map<QString /*wellName*/, cvf::ref<RigWellPathFormations>>> m_fileNameToWellPathFormationMap;
|
||||
};
|
||||
|
||||
@@ -95,8 +95,8 @@ size_t RifWellPathImporter::wellDataCount( const QString& filePath )
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>>::iterator it = m_fileNameToWellDataGroupMap.find(
|
||||
filePath );
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>>::iterator it =
|
||||
m_fileNameToWellDataGroupMap.find( filePath );
|
||||
|
||||
// If we have the file in the map, assume it is already read.
|
||||
if ( it != m_fileNameToWellDataGroupMap.end() )
|
||||
@@ -149,9 +149,9 @@ RifWellPathImporter::WellMetaData RifWellPathImporter::readJsonWellMetaData( con
|
||||
// Convert updateDate from the following format:
|
||||
// "Number of milliseconds elapsed since midnight Coordinated Universal Time (UTC)
|
||||
// of January 1, 1970, not counting leap seconds"
|
||||
QString updateDateStr = jsonMap["updateDate"].toString().trimmed();
|
||||
uint updateDateUint = updateDateStr.toULongLong() /
|
||||
1000; // Should be within 32 bit, maximum number is 4294967295 which corresponds to year 2106
|
||||
QString updateDateStr = jsonMap["updateDate"].toString().trimmed();
|
||||
uint updateDateUint = updateDateStr.toULongLong() / 1000; // Should be within 32 bit, maximum number is 4294967295
|
||||
// which corresponds to year 2106
|
||||
metadata.m_updateDate.setTime_t( updateDateUint );
|
||||
|
||||
return metadata;
|
||||
@@ -190,8 +190,8 @@ RifWellPathImporter::WellData RifWellPathImporter::readJsonWellData( const QStri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifWellPathImporter::readAllAsciiWellData( const QString& filePath )
|
||||
{
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>>::iterator it = m_fileNameToWellDataGroupMap.find(
|
||||
filePath );
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>>::iterator it =
|
||||
m_fileNameToWellDataGroupMap.find( filePath );
|
||||
|
||||
// If we have the file in the map, assume it is already read.
|
||||
if ( it != m_fileNameToWellDataGroupMap.end() )
|
||||
@@ -278,10 +278,9 @@ void RifWellPathImporter::readAllAsciiWellData( const QString& filePath )
|
||||
// name <WellNameA>
|
||||
// wellname: <WellNameA>
|
||||
std::string lineLowerCase = line;
|
||||
transform( lineLowerCase.begin(),
|
||||
lineLowerCase.end(),
|
||||
lineLowerCase.begin(),
|
||||
[]( const char c ) -> char { return (char)::tolower( c ); } );
|
||||
transform( lineLowerCase.begin(), lineLowerCase.end(), lineLowerCase.begin(), []( const char c ) -> char {
|
||||
return (char)::tolower( c );
|
||||
} );
|
||||
|
||||
std::string tokenName = "name";
|
||||
std::size_t foundNameIdx = lineLowerCase.find( tokenName );
|
||||
@@ -343,8 +342,8 @@ RifWellPathImporter::WellData RifWellPathImporter::readAsciiWellData( const QStr
|
||||
{
|
||||
readAllAsciiWellData( filePath );
|
||||
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>>::iterator it = m_fileNameToWellDataGroupMap.find(
|
||||
filePath );
|
||||
std::map<QString, std::vector<RifWellPathImporter::WellData>>::iterator it =
|
||||
m_fileNameToWellDataGroupMap.find( filePath );
|
||||
|
||||
CVF_ASSERT( it != m_fileNameToWellDataGroupMap.end() );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user