mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#1356 Do not check active cell count when reading result names
This commit is contained in:
parent
c4cd1972c4
commit
34d9b1358e
@ -54,8 +54,7 @@ bool RifHdf5Reader::dynamicResult(const QString& result, size_t stepIndex, std::
|
||||
{
|
||||
H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately
|
||||
|
||||
std::string fileName = m_fileName.toStdString(); // her ligger trøbbel mht Unicode or det smalt i H5File med direkte bruk av c_str()
|
||||
|
||||
std::string fileName = m_fileName.toStdString(); // her ligger tr<74>bbel mht Unicode or det smalt i H5File med direkte bruk av c_str(
|
||||
H5::H5File file(fileName.c_str(), H5F_ACC_RDONLY);
|
||||
|
||||
std::string groupName = "/Timestep_00001/GridFunctions/GridPart_00000/GridFunction_00002";
|
||||
@ -98,7 +97,7 @@ QStringList RifHdf5Reader::propertyNames() const
|
||||
{
|
||||
QStringList propNames;
|
||||
|
||||
std::string str = m_fileName.toStdString(); // her ligger trøbbel mht Unicode or det smalt i H5File med direkte bruk av c_str()
|
||||
std::string str = m_fileName.toStdString(); // her ligger tr<EFBFBD>bbel mht Unicode or det smalt i H5File med direkte bruk av c_str()
|
||||
|
||||
H5::H5File file(str.c_str(), H5F_ACC_RDONLY);
|
||||
|
||||
@ -114,18 +113,6 @@ QStringList RifHdf5Reader::propertyNames() const
|
||||
return propNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifHdf5Reader::resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts)
|
||||
{
|
||||
*resultNames = propertyNames();
|
||||
|
||||
for (size_t i = 0; i < propertyNames().size(); i++)
|
||||
{
|
||||
resultDataItemCounts->push_back(16336);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -35,17 +35,9 @@ public:
|
||||
explicit RifHdf5Reader(const QString& fileName);
|
||||
virtual ~RifHdf5Reader();
|
||||
|
||||
bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) const;
|
||||
|
||||
|
||||
std::vector<QDateTime> timeSteps() const;
|
||||
|
||||
|
||||
virtual QStringList propertyNames() const override;
|
||||
|
||||
|
||||
virtual void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts) override;
|
||||
|
||||
std::vector<QDateTime> timeSteps() const override;
|
||||
virtual QStringList propertyNames() const override;
|
||||
bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) const override;
|
||||
|
||||
private:
|
||||
int getIntAttribute(H5::H5File file, std::string groupName, std::string attributeName) const;
|
||||
@ -56,7 +48,6 @@ private:
|
||||
std::vector<std::string> getResultNames(H5::H5File file, std::string baseGroupName) const;
|
||||
void getElementResultValues(H5::H5File file, std::string groupName, std::vector<double>* resultValues) const;
|
||||
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
};
|
||||
|
@ -34,6 +34,5 @@ class RifHdf5ReaderInterface
|
||||
public:
|
||||
virtual std::vector<QDateTime> timeSteps() const = 0;
|
||||
virtual QStringList propertyNames() const = 0;
|
||||
virtual void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts) = 0;
|
||||
virtual bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) const = 0;
|
||||
};
|
||||
|
@ -491,31 +491,20 @@ void RifReaderEclipseOutput::setHdf5FileName(const QString& fileName)
|
||||
{
|
||||
reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
||||
}
|
||||
|
||||
QStringList resultNames;
|
||||
std::vector<size_t> resultNamesDataItemCounts;
|
||||
myReader->resultNames(&resultNames, &resultNamesDataItemCounts);
|
||||
if (resultNames.size() != static_cast<int>(resultNamesDataItemCounts.size()))
|
||||
else
|
||||
{
|
||||
RiaLogging::error("HDF: Result name vectors and result name data item count does not match");
|
||||
|
||||
return;
|
||||
for (size_t i = 0; i < m_timeSteps.size(); i++)
|
||||
{
|
||||
reportNumbers.push_back(static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
|
||||
size_t activeCellCount = 0;
|
||||
matrixModelResults->activeCellInfo()->gridActiveCellCounts(0, activeCellCount);
|
||||
QStringList resultNames = myReader->propertyNames();
|
||||
|
||||
for (int i = 0; i < resultNames.size(); ++i)
|
||||
{
|
||||
if (activeCellCount != resultNamesDataItemCounts[i])
|
||||
{
|
||||
RiaLogging::error("HDF: Number of active cells does not match");
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false);
|
||||
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers);
|
||||
}
|
||||
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, resultNames[i], false);
|
||||
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers);
|
||||
}
|
||||
|
||||
m_hdfReaderInterface = std::move(myReader);
|
||||
@ -941,10 +930,33 @@ bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelR
|
||||
#ifdef USE_HDF5
|
||||
if (m_hdfReaderInterface)
|
||||
{
|
||||
if (m_hdfReaderInterface->dynamicResult(result, stepIndex, values))
|
||||
if (m_eclipseCase->mainGrid()->gridCount() == 0)
|
||||
{
|
||||
return true;
|
||||
RiaLogging::error("No grids available");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t activeCellCount = cvf::UNDEFINED_SIZE_T;
|
||||
{
|
||||
RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
|
||||
fracActCellInfo->gridActiveCellCounts(0, activeCellCount);
|
||||
}
|
||||
|
||||
bool readCellResultOk = m_hdfReaderInterface->dynamicResult(result, stepIndex, values);
|
||||
|
||||
if (activeCellCount != values->size())
|
||||
{
|
||||
for (size_t i=0; i < values->size(); i++)
|
||||
{
|
||||
values->at(i) = HUGE_VAL;
|
||||
}
|
||||
|
||||
RiaLogging::error("No grids available");
|
||||
return false;
|
||||
}
|
||||
|
||||
return readCellResultOk;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -472,7 +472,7 @@ TEST(RigReservoirTest, WellTest)
|
||||
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
|
||||
#ifdef WIN32
|
||||
QString filename("d:/Models/Statoil/soursim/PKMUNK_NOV_TEST_SS.GRID");
|
||||
QString sourSim("d:/Models/Statoil/soursim/result.sourres");
|
||||
QString sourSim("d:/Models/Statoil/soursim/result.sourres.00001");
|
||||
#else
|
||||
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
|
||||
QString sourSim("d:/Models/Statoil/soursim/result.sourres");
|
||||
@ -482,4 +482,4 @@ TEST(RigReservoirTest, WellTest)
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
readerInterfaceEcl->setHdf5FileName(sourSim);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user