mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fixed segmentation fault for SetGridProperty with selected timestep
See TP#4179 p4#: 22364
This commit is contained in:
@@ -129,6 +129,20 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
class StructGridScalarDataAccessHugeVal : public cvf::StructGridScalarDataAccess
|
||||
{
|
||||
public:
|
||||
virtual double cellScalar(size_t cellIndex) const
|
||||
{
|
||||
return HUGE_VAL;
|
||||
}
|
||||
virtual void setCellScalar(size_t cellIndex, double value)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -152,6 +166,17 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigGridScalarDataAccessFactory::create
|
||||
|
||||
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarSetIndex);
|
||||
|
||||
// A generated result with a generated results for a subset of time steps, will end up with a result container with less entries than time steps
|
||||
// See RiaSetGridProperty command in RiaPropertyDataCommands
|
||||
//
|
||||
// Some functions requires a valid data access object to be present, these might be rewritten to avoid this dummy object always returning HUGE_VAL
|
||||
if (timeStepIndex >= scalarSetResults.size())
|
||||
{
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> object = new StructGridScalarDataAccessHugeVal;
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
std::vector<double>* resultValues = NULL;
|
||||
if (timeStepIndex < scalarSetResults.size())
|
||||
{
|
||||
|
||||
@@ -904,7 +904,7 @@ public:
|
||||
qint64 bytesRead = currentClient->read((char*)(doubleValues.data()), m_bytesPerTimeStepToRead);
|
||||
size_t doubleValueIndex = 0;
|
||||
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> cellCenterDataAccessObject = m_currentReservoir->reservoirData()->dataAccessObject(grid, m_porosityModelEnum, m_currentTimeStepNumberToRead, m_currentScalarIndex);
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> cellCenterDataAccessObject = m_currentReservoir->reservoirData()->dataAccessObject(grid, m_porosityModelEnum, m_requestedTimesteps[m_currentTimeStepNumberToRead], m_currentScalarIndex);
|
||||
if (!cellCenterDataAccessObject.isNull())
|
||||
{
|
||||
for (size_t cellIdx = 0; static_cast<size_t>(cellIdx) < cellCountFromOctave; cellIdx++)
|
||||
|
||||
Reference in New Issue
Block a user