Added reading of fracture model active index

Lots of renaming
p4#: 20302
This commit is contained in:
Magne Sjaastad 2013-01-30 14:13:50 +01:00
parent 4275e67a82
commit ce95f13c10
32 changed files with 343 additions and 255 deletions

View File

@ -114,6 +114,6 @@ TEST(RigReservoirTest, ElipseInputGridFile)
bool result = inputReader.open("TEST10K_FLT_LGR_NNC.grdecl", &res); bool result = inputReader.open("TEST10K_FLT_LGR_NNC.grdecl", &res);
EXPECT_TRUE(result); EXPECT_TRUE(result);
EXPECT_EQ(size_t(1), res.mainGrid()->cells().size()); EXPECT_EQ(size_t(1), res.mainGrid()->cells().size());
EXPECT_EQ(size_t(1), res.mainGrid()->globalMatrixActiveCellCount()); EXPECT_EQ(size_t(1), res.mainGrid()->globalMatrixModelActiveCellCount());
} }

View File

@ -25,12 +25,16 @@
#include <QFileInfo> #include <QFileInfo>
#include "cafProgressInfo.h" #include "cafProgressInfo.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Constructor /// Constructor
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEclipseOutputFileTools::RifEclipseOutputFileTools() RifEclipseOutputFileTools::RifEclipseOutputFileTools()
{ {
m_file = NULL; m_file = NULL;
m_globalMatrixActiveCellCounts = 0;;
m_globalFractureActiveCellCounts = 0;
} }
@ -46,7 +50,7 @@ RifEclipseOutputFileTools::~RifEclipseOutputFileTools()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Open file given by name /// Open file given by name
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseOutputFileTools::open(const QString& fileName) bool RifEclipseOutputFileTools::open(const QString& fileName, const std::vector<size_t>& matrixActiveCellCounts, const std::vector<size_t>& fractureActiveCellCounts)
{ {
// Close current file if any // Close current file if any
close(); close();
@ -54,6 +58,15 @@ bool RifEclipseOutputFileTools::open(const QString& fileName)
m_file = ecl_file_open(fileName.toAscii().data()); m_file = ecl_file_open(fileName.toAscii().data());
if (!m_file) return false; if (!m_file) return false;
m_numMatrixActiveCellCounts = matrixActiveCellCounts;
m_numFractureActiveCellCount = fractureActiveCellCounts;
for (size_t i = 0; i < matrixActiveCellCounts.size(); i++)
{
m_globalMatrixActiveCellCounts += matrixActiveCellCounts[i];
m_globalFractureActiveCellCounts += fractureActiveCellCounts[i];
}
return true; return true;
} }
@ -81,69 +94,6 @@ int RifEclipseOutputFileTools::numOccurrences(const QString& keyword)
} }
//--------------------------------------------------------------------------------------------------
/// Get keywords found on file given by name.
/// If numDataItems != cvf::UNDEFINED_SIZE_T, get keywords with that exact number of data items only.
//--------------------------------------------------------------------------------------------------
bool RifEclipseOutputFileTools::keywordsWithGivenResultValueCount(QStringList* keywords, size_t expectedResultValueCount, size_t numSteps)
{
CVF_ASSERT(m_file);
CVF_ASSERT(keywords);
keywords->clear();
int numKeywords = ecl_file_get_num_distinct_kw(m_file);
caf::ProgressInfo info(numKeywords, "Reading Keywords on file");
for (int i = 0; i < numKeywords; i++)
{
const char* kw = ecl_file_iget_distinct_kw(m_file , i);
int numKeywordOccurrences = ecl_file_get_num_named_kw(m_file, kw);
if (expectedResultValueCount != cvf::UNDEFINED_SIZE_T)
{
bool dataTypeSupported = true;
int fileResultValueCount = 0;
int j;
for (j = 0; j < numKeywordOccurrences; j++)
{
fileResultValueCount += ecl_file_iget_named_size(m_file, kw, j);
// Check the data type - only float and double are supported
ecl_type_enum dataType = ecl_file_iget_named_type(m_file, kw, j);
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE )
{
dataTypeSupported = false;
break;
}
}
if (dataTypeSupported)
{
if (numSteps != cvf::UNDEFINED_SIZE_T && numSteps > 0)
{
fileResultValueCount /= static_cast<int>(numSteps);
}
// Append keyword to the list if it has the given number of values in total
if (fileResultValueCount == static_cast<int>(expectedResultValueCount))
{
keywords->append(QString(kw));
}
}
}
else
{
keywords->append(QString(kw));
}
info.setProgress(i);
}
return true;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get list of time step texts (dates) /// Get list of time step texts (dates)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -232,21 +182,44 @@ bool RifEclipseOutputFileTools::timeSteps(QList<QDateTime>* timeSteps)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get first occurrence of file of given type in given list of filenames, as filename or NULL if not found /// Get first occurrence of file of given type in given list of filenames, as filename or NULL if not found
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseOutputFileTools::keywordData(const QString& keyword, size_t index, std::vector<double>* values) bool RifEclipseOutputFileTools::keywordData(const QString& keyword, size_t fileKeywordOccurrence,
RifReaderInterface::PorosityModelResultType matrixOrFracture,
std::vector<double>* values)
{ {
CVF_ASSERT(m_file); CVF_ASSERT(m_file);
CVF_ASSERT(values); CVF_ASSERT(values);
ecl_kw_type* kwData = ecl_file_iget_named_kw(m_file, keyword.toAscii().data(), static_cast<int>(index)); size_t gridIndex = fileKeywordOccurrence % m_numMatrixActiveCellCounts.size();
if (kwData)
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS)
{ {
size_t numValues = ecl_kw_get_size(kwData); ecl_kw_type* kwData = ecl_file_iget_named_kw(m_file, keyword.toAscii().data(), static_cast<int>(fileKeywordOccurrence));
if (kwData)
{
size_t numValues = ecl_kw_get_size(kwData);
std::vector<double> doubleData; std::vector<double> doubleData;
doubleData.resize(numValues); doubleData.resize(numValues);
ecl_kw_get_data_as_double(kwData, doubleData.data()); ecl_kw_get_data_as_double(kwData, doubleData.data());
values->insert(values->end(), doubleData.begin(), doubleData.end()); values->insert(values->end(), doubleData.begin(), doubleData.begin() + m_numMatrixActiveCellCounts[gridIndex]);
}
}
else
{
ecl_kw_type* kwData = ecl_file_iget_named_kw(m_file, keyword.toAscii().data(), static_cast<int>(fileKeywordOccurrence));
if (kwData)
{
size_t numValues = ecl_kw_get_size(kwData);
CVF_ASSERT(numValues == m_numMatrixActiveCellCounts[gridIndex] + m_numFractureActiveCellCount[gridIndex]);
std::vector<double> doubleData;
doubleData.resize(numValues);
ecl_kw_get_data_as_double(kwData, doubleData.data());
values->insert(values->end(), doubleData.begin() + m_numMatrixActiveCellCounts[gridIndex], doubleData.end());
}
} }
return true; return true;
@ -328,3 +301,65 @@ ecl_file_type* RifEclipseOutputFileTools::filePointer()
{ {
return m_file; return m_file;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifEclipseOutputFileTools::validKeywords(QStringList* keywords, RifReaderInterface::PorosityModelResultType matrixOrFracture)
{
if (m_globalMatrixActiveCellCounts == 0) return true;
CVF_ASSERT(m_file);
CVF_ASSERT(keywords);
if (!keywords) return false;
keywords->clear();
int numKeywords = ecl_file_get_num_distinct_kw(m_file);
caf::ProgressInfo info(numKeywords, "Reading Keywords on file");
for (int i = 0; i < numKeywords; i++)
{
const char* kw = ecl_file_iget_distinct_kw(m_file , i);
int numKeywordOccurrences = ecl_file_get_num_named_kw(m_file, kw);
bool validData = true;
size_t fileResultValueCount = 0;
for (int j = 0; j < numKeywordOccurrences; j++)
{
fileResultValueCount += ecl_file_iget_named_size(m_file, kw, j);
ecl_type_enum dataType = ecl_file_iget_named_type(m_file, kw, j);
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE )
{
validData = false;
break;
}
}
if (validData)
{
// Only report valid fracture results when total result value count equals matrix and fracture
if (matrixOrFracture == RifReaderInterface::FRACTURE_RESULTS)
{
size_t rest = fileResultValueCount % (m_globalMatrixActiveCellCounts + m_globalFractureActiveCellCounts);
if (rest == 0)
{
keywords->append(QString(kw));
}
}
else
{
size_t rest = fileResultValueCount % (m_globalMatrixActiveCellCounts);
if (rest == 0)
{
keywords->append(QString(kw));
}
}
}
info.setProgress(i);
}
return true;
}

View File

@ -28,6 +28,8 @@
#include "ecl_file.h" #include "ecl_file.h"
#include "RifReaderInterface.h"
//================================================================================================== //==================================================================================================
// //
// Class for access to Eclipse "keyword" files using libecl // Class for access to Eclipse "keyword" files using libecl
@ -39,16 +41,19 @@ public:
RifEclipseOutputFileTools(); RifEclipseOutputFileTools();
virtual ~RifEclipseOutputFileTools(); virtual ~RifEclipseOutputFileTools();
bool open(const QString& fileName); bool open(const QString& fileName, const std::vector<size_t>& matrixActiveCellCounts, const std::vector<size_t>& fractureActiveCellCounts);
void close(); void close();
int numOccurrences(const QString& keyword); int numOccurrences(const QString& keyword);
bool keywordsWithGivenResultValueCount(QStringList* keywords, size_t expectedResultValueCount = cvf::UNDEFINED_SIZE_T, size_t numSteps = cvf::UNDEFINED_SIZE_T);
bool validKeywords(QStringList* keywords, RifReaderInterface::PorosityModelResultType matrixOrFracture);
bool timeStepsText(QStringList* timeSteps); bool timeStepsText(QStringList* timeSteps);
bool timeSteps(QList<QDateTime>* timeSteps); bool timeSteps(QList<QDateTime>* timeSteps);
bool keywordData(const QString& keyword, size_t index, std::vector<double>* values); bool keywordData(const QString& keyword, size_t fileKeywordOccurrence,
RifReaderInterface::PorosityModelResultType matrixOrFracture,
std::vector<double>* values);
ecl_file_type* filePointer(); ecl_file_type* filePointer();
@ -60,4 +65,11 @@ public:
protected: protected:
ecl_file_type* m_file; ecl_file_type* m_file;
private:
std::vector<size_t> m_numMatrixActiveCellCounts;
std::vector<size_t> m_numFractureActiveCellCount;
size_t m_globalMatrixActiveCellCounts;
size_t m_globalFractureActiveCellCounts;
}; };

View File

@ -22,10 +22,8 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Constructor /// Constructor
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEclipseRestartDataAccess::RifEclipseRestartDataAccess(size_t numGrids, size_t numActiveCells) RifEclipseRestartDataAccess::RifEclipseRestartDataAccess()
{ {
m_numGrids = numGrids;
m_numActiveCells = numActiveCells;
} }

View File

@ -29,6 +29,8 @@
#include "well_info.h" #include "well_info.h"
#include "RifReaderInterface.h"
//================================================================================================== //==================================================================================================
// //
// Abstract class for results access // Abstract class for results access
@ -37,10 +39,10 @@
class RifEclipseRestartDataAccess : public cvf::Object class RifEclipseRestartDataAccess : public cvf::Object
{ {
public: public:
RifEclipseRestartDataAccess(size_t numGrids, size_t numActiveCells); RifEclipseRestartDataAccess();
virtual ~RifEclipseRestartDataAccess(); virtual ~RifEclipseRestartDataAccess();
virtual bool open(const QStringList& fileSet) = 0; virtual bool open(const QStringList& fileSet, const std::vector<size_t>& matrixModelActiveCellCounts, const std::vector<size_t>& fractureModelActiveCellCounts) = 0;
virtual void close() = 0; virtual void close() = 0;
virtual size_t numTimeSteps() = 0; virtual size_t numTimeSteps() = 0;
@ -48,11 +50,7 @@ public:
virtual QList<QDateTime> timeSteps() = 0; virtual QList<QDateTime> timeSteps() = 0;
virtual QStringList resultNames() = 0; virtual QStringList resultNames() = 0;
virtual bool results(const QString& resultName, size_t timeStep, std::vector<double>* values) = 0; virtual bool results(const QString& resultName, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t timeStep, std::vector<double>* values) = 0;
virtual void readWellData(well_info_type * well_info) = 0; virtual void readWellData(well_info_type * well_info) = 0;
protected:
size_t m_numGrids;
size_t m_numActiveCells;
}; };

View File

@ -23,8 +23,8 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Constructor /// Constructor
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEclipseRestartFilesetAccess::RifEclipseRestartFilesetAccess(size_t numGrids, size_t numActiveCells) RifEclipseRestartFilesetAccess::RifEclipseRestartFilesetAccess()
: RifEclipseRestartDataAccess(numGrids, numActiveCells) : RifEclipseRestartDataAccess()
{ {
} }
@ -39,7 +39,7 @@ RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Open files /// Open files
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet) bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet, const std::vector<size_t>& matrixActiveCellCounts, const std::vector<size_t>& fractureActiveCellCounts)
{ {
close(); close();
@ -48,7 +48,7 @@ bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet)
for (i = 0; i < numFiles; i++) for (i = 0; i < numFiles; i++)
{ {
cvf::ref<RifEclipseOutputFileTools> fileAccess = new RifEclipseOutputFileTools; cvf::ref<RifEclipseOutputFileTools> fileAccess = new RifEclipseOutputFileTools;
if (!fileAccess->open(fileSet[i])) if (!fileAccess->open(fileSet[i], matrixActiveCellCounts, fractureActiveCellCounts))
{ {
close(); close();
return false; return false;
@ -57,6 +57,8 @@ bool RifEclipseRestartFilesetAccess::open(const QStringList& fileSet)
m_files.push_back(fileAccess); m_files.push_back(fileAccess);
} }
m_gridCount = matrixActiveCellCounts.size();
return true; return true;
} }
@ -131,7 +133,7 @@ QStringList RifEclipseRestartFilesetAccess::resultNames()
// Get the results found on the first file // Get the results found on the first file
QStringList resultsList; QStringList resultsList;
m_files[0]->keywordsWithGivenResultValueCount(&resultsList, m_numActiveCells, 1); m_files[0]->validKeywords(&resultsList, RifReaderInterface::MATRIX_RESULTS);
return resultsList; return resultsList;
} }
@ -139,15 +141,15 @@ QStringList RifEclipseRestartFilesetAccess::resultNames()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get result values for given time step /// Get result values for given time step
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t timeStep, std::vector<double>* values) bool RifEclipseRestartFilesetAccess::results(const QString& resultName, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t timeStep, std::vector<double>* values)
{ {
size_t numOccurrences = m_files[timeStep]->numOccurrences(resultName); size_t numOccurrences = m_files[timeStep]->numOccurrences(resultName);
// No results for this result variable for current time step found // No results for this result variable for current time step found
if (numOccurrences == 0) return true; if (numOccurrences == 0) return true;
// Result handling depends on presens of result values for all grids // Result handling depends on presents of result values for all grids
if (m_numGrids != numOccurrences) if (m_gridCount != numOccurrences)
{ {
return false; return false;
} }
@ -156,7 +158,7 @@ bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t t
for (i = 0; i < numOccurrences; i++) for (i = 0; i < numOccurrences; i++)
{ {
std::vector<double> partValues; std::vector<double> partValues;
if (!m_files[timeStep]->keywordData(resultName, i, &partValues)) // !! don't need to append afterwards if (!m_files[timeStep]->keywordData(resultName, i, matrixOrFracture, &partValues)) // !! don't need to append afterwards
{ {
return false; return false;
} }

View File

@ -32,10 +32,10 @@ class RifEclipseOutputFileTools;
class RifEclipseRestartFilesetAccess : public RifEclipseRestartDataAccess class RifEclipseRestartFilesetAccess : public RifEclipseRestartDataAccess
{ {
public: public:
RifEclipseRestartFilesetAccess(size_t numGrids, size_t numActiveCells); RifEclipseRestartFilesetAccess();
virtual ~RifEclipseRestartFilesetAccess(); virtual ~RifEclipseRestartFilesetAccess();
bool open(const QStringList& fileSet); bool open(const QStringList& fileSet, const std::vector<size_t>& matrixActiveCellCounts, const std::vector<size_t>& fractureActiveCellCounts);
void close(); void close();
size_t numTimeSteps(); size_t numTimeSteps();
@ -43,10 +43,12 @@ public:
QList<QDateTime> timeSteps(); QList<QDateTime> timeSteps();
QStringList resultNames(); QStringList resultNames();
bool results(const QString& resultName, size_t timeStep, std::vector<double>* values); bool results(const QString& resultName, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t timeStep, std::vector<double>* values);
virtual void readWellData(well_info_type* well_info); virtual void readWellData(well_info_type* well_info);
private: private:
std::vector< cvf::ref<RifEclipseOutputFileTools> > m_files; std::vector< cvf::ref<RifEclipseOutputFileTools> > m_files;
size_t m_gridCount;
}; };

View File

@ -27,9 +27,10 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Constructor /// Constructor
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEclipseUnifiedRestartFileAccess::RifEclipseUnifiedRestartFileAccess(size_t numGrids, size_t numActiveCells) RifEclipseUnifiedRestartFileAccess::RifEclipseUnifiedRestartFileAccess()
: RifEclipseRestartDataAccess(numGrids, numActiveCells) : RifEclipseRestartDataAccess()
{ {
m_gridCount = 0;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -43,18 +44,20 @@ RifEclipseUnifiedRestartFileAccess::~RifEclipseUnifiedRestartFileAccess()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Open file /// Open file
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseUnifiedRestartFileAccess::open(const QStringList& fileSet) bool RifEclipseUnifiedRestartFileAccess::open(const QStringList& fileSet, const std::vector<size_t>& matrixModelActiveCellCounts, const std::vector<size_t>& fractureModelActiveCellCounts)
{ {
QString fileName = fileSet[0]; QString fileName = fileSet[0];
cvf::ref<RifEclipseOutputFileTools> fileAccess = new RifEclipseOutputFileTools; cvf::ref<RifEclipseOutputFileTools> fileAccess = new RifEclipseOutputFileTools;
if (!fileAccess->open(fileName)) if (!fileAccess->open(fileName, matrixModelActiveCellCounts, fractureModelActiveCellCounts))
{ {
return false; return false;
} }
m_file = fileAccess; m_file = fileAccess;
m_gridCount = matrixModelActiveCellCounts.size();
return true; return true;
} }
@ -114,7 +117,7 @@ QStringList RifEclipseUnifiedRestartFileAccess::resultNames()
{ {
// Get the results found on the UNRST file // Get the results found on the UNRST file
QStringList resultsList; QStringList resultsList;
m_file->keywordsWithGivenResultValueCount(&resultsList, m_numActiveCells, numTimeSteps()); m_file->validKeywords(&resultsList, RifReaderInterface::MATRIX_RESULTS);
return resultsList; return resultsList;
} }
@ -122,17 +125,17 @@ QStringList RifEclipseUnifiedRestartFileAccess::resultNames()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get result values for given time step /// Get result values for given time step
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifEclipseUnifiedRestartFileAccess::results(const QString& resultName, size_t timeStep, std::vector<double>* values) bool RifEclipseUnifiedRestartFileAccess::results(const QString& resultName, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t timeStep, std::vector<double>* values)
{ {
size_t numOccurrences = m_file->numOccurrences(resultName); size_t numOccurrences = m_file->numOccurrences(resultName);
size_t startIndex = timeStep*m_numGrids; size_t startIndex = timeStep * m_gridCount;
CVF_ASSERT(startIndex + m_numGrids <= numOccurrences); CVF_ASSERT(startIndex + m_gridCount <= numOccurrences);
size_t i; size_t occurrenceIdx;
for (i = startIndex; i < startIndex + m_numGrids; i++) for (occurrenceIdx = startIndex; occurrenceIdx < startIndex + m_gridCount; occurrenceIdx++)
{ {
std::vector<double> partValues; std::vector<double> partValues;
if (!m_file->keywordData(resultName, i, &partValues)) // !! don't need to append afterwards if (!m_file->keywordData(resultName, occurrenceIdx, matrixOrFracture, &partValues)) // !! don't need to append afterwards
{ {
return false; return false;
} }

View File

@ -32,10 +32,10 @@ class RifEclipseOutputFileTools;
class RifEclipseUnifiedRestartFileAccess : public RifEclipseRestartDataAccess class RifEclipseUnifiedRestartFileAccess : public RifEclipseRestartDataAccess
{ {
public: public:
RifEclipseUnifiedRestartFileAccess(size_t numGrids, size_t numActiveCells); RifEclipseUnifiedRestartFileAccess();
virtual ~RifEclipseUnifiedRestartFileAccess(); virtual ~RifEclipseUnifiedRestartFileAccess();
bool open(const QStringList& fileSet); bool open(const QStringList& fileSet, const std::vector<size_t>& matrixModelActiveCellCounts, const std::vector<size_t>& fractureModelActiveCellCounts);
void close(); void close();
size_t numTimeSteps(); size_t numTimeSteps();
@ -43,10 +43,12 @@ public:
QList<QDateTime> timeSteps(); QList<QDateTime> timeSteps();
QStringList resultNames(); QStringList resultNames();
bool results(const QString& resultName, size_t timeStep, std::vector<double>* values); bool results(const QString& resultName, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t timeStep, std::vector<double>* values);
virtual void readWellData(well_info_type * well_info); virtual void readWellData(well_info_type * well_info);
private: private:
cvf::ref<RifEclipseOutputFileTools> m_file; cvf::ref<RifEclipseOutputFileTools> m_file;
size_t m_gridCount;
}; };

View File

@ -91,3 +91,4 @@ bool RifReaderEclipseInput::open(const QString& fileName, RigReservoir* reservoi
return isOk; return isOk;
} }

View File

@ -38,7 +38,6 @@ public:
virtual void close() {} virtual void close() {}
virtual bool staticResult(const QString& result, std::vector<double>* values) { return false; } virtual bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector<double>* values ) { return false; }
virtual bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) { return false; } virtual bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values ) { return false; }
}; };

View File

@ -111,11 +111,11 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
int matrixActiveIndex = ecl_grid_get_active_index1(localEclGrid, gIdx); int matrixActiveIndex = ecl_grid_get_active_index1(localEclGrid, gIdx);
if (matrixActiveIndex != -1) if (matrixActiveIndex != -1)
{ {
cell.setGlobalMatrixActiveIndex(matrixActiveStartIndex + matrixActiveIndex); cell.setActiveIndexInMatrixModel(matrixActiveStartIndex + matrixActiveIndex);
} }
else else
{ {
cell.setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T); cell.setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
} }
} }
@ -123,11 +123,11 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
int fractureActiveIndex = ecl_grid_get_active_fracture_index1(localEclGrid, gIdx); int fractureActiveIndex = ecl_grid_get_active_fracture_index1(localEclGrid, gIdx);
if (fractureActiveIndex != -1) if (fractureActiveIndex != -1)
{ {
cell.setGlobalFractureActiveIndex(fractureActiveStartIndex + fractureActiveIndex); cell.setActiveIndexInFractureModel(fractureActiveStartIndex + fractureActiveIndex);
} }
else else
{ {
cell.setGlobalFractureActiveIndex(cvf::UNDEFINED_SIZE_T); cell.setActiveIndexInFractureModel(cvf::UNDEFINED_SIZE_T);
} }
} }
@ -321,7 +321,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigReservoir* reservo
if (!transferGeometry(mainEclGrid, reservoir)) return false; if (!transferGeometry(mainEclGrid, reservoir)) return false;
progInfo.setProgress(7); progInfo.setProgress(7);
progInfo.setProgressDescription("Releasing reader memory"); progInfo.setProgressDescription("Releasing reader memory");
ecl_grid_free( mainEclGrid ); ecl_grid_free( mainEclGrid );
progInfo.setProgress(8); progInfo.setProgress(8);
@ -348,12 +348,23 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
caf::ProgressInfo progInfo(2,""); caf::ProgressInfo progInfo(2,"");
// Get the number of active cells in the grid std::vector<size_t> matrixModelActiveCellCounts;
size_t numActiveCells = reservoir->mainGrid()->globalMatrixActiveCellCount(); std::vector<size_t> fractureModelActiveCellCount;
size_t numGrids = reservoir->mainGrid()->gridCount();
std::vector<RigGridBase*> grids;
reservoir->allGrids(&grids);
for (size_t i = 0; i < grids.size(); i++)
{
matrixModelActiveCellCounts.push_back(grids[i]->matrixModelActiveCellCount());
fractureModelActiveCellCount.push_back(grids[i]->fractureModelActiveCellCount());
}
// Create access object for dynamic results // Create access object for dynamic results
m_dynamicResultsAccess = dynamicResultsAccess(m_fileSet, numGrids, numActiveCells); m_dynamicResultsAccess = dynamicResultsAccess(m_fileSet, matrixModelActiveCellCounts, fractureModelActiveCellCount);
if (m_dynamicResultsAccess.isNull())
{
return false;
}
RigReservoirCellResults* resCellResults = reservoir->mainGrid()->results(); RigReservoirCellResults* resCellResults = reservoir->mainGrid()->results();
@ -379,14 +390,14 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
{ {
// Open init file // Open init file
cvf::ref<RifEclipseOutputFileTools> initFile = new RifEclipseOutputFileTools; cvf::ref<RifEclipseOutputFileTools> initFile = new RifEclipseOutputFileTools;
if (!initFile->open(initFileName)) if (!initFile->open(initFileName, matrixModelActiveCellCounts, fractureModelActiveCellCount))
{ {
return false; return false;
} }
// Get the names of the static results // Get the names of the static results
QStringList staticResults; QStringList staticResults;
initFile->keywordsWithGivenResultValueCount(&staticResults, numActiveCells); initFile->validKeywords(&staticResults, RifReaderInterface::MATRIX_RESULTS);
QStringList staticResultNames = staticResults; QStringList staticResultNames = staticResults;
QList<QDateTime> staticDate; QList<QDateTime> staticDate;
@ -410,7 +421,7 @@ bool RifReaderEclipseOutput::buildMetaData(RigReservoir* reservoir)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Create results access object (.UNRST or .X0001 ... .XNNNN) /// Create results access object (.UNRST or .X0001 ... .XNNNN)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEclipseRestartDataAccess* RifReaderEclipseOutput::dynamicResultsAccess(const QStringList& fileSet, size_t numGrids, size_t numActiveCells) RifEclipseRestartDataAccess* RifReaderEclipseOutput::dynamicResultsAccess(const QStringList& fileSet, const std::vector<size_t>& matrixActiveCellCounts, const std::vector<size_t>& fractureActiveCellCounts)
{ {
RifEclipseRestartDataAccess* resultsAccess = NULL; RifEclipseRestartDataAccess* resultsAccess = NULL;
@ -418,8 +429,8 @@ RifEclipseRestartDataAccess* RifReaderEclipseOutput::dynamicResultsAccess(const
QString unrstFileName = RifEclipseOutputFileTools::fileNameByType(fileSet, ECL_UNIFIED_RESTART_FILE); QString unrstFileName = RifEclipseOutputFileTools::fileNameByType(fileSet, ECL_UNIFIED_RESTART_FILE);
if (unrstFileName.size() > 0) if (unrstFileName.size() > 0)
{ {
resultsAccess = new RifEclipseUnifiedRestartFileAccess(numGrids, numActiveCells); resultsAccess = new RifEclipseUnifiedRestartFileAccess();
if (!resultsAccess->open(QStringList(unrstFileName))) if (!resultsAccess->open(QStringList(unrstFileName), matrixActiveCellCounts, fractureActiveCellCounts))
{ {
delete resultsAccess; delete resultsAccess;
return NULL; return NULL;
@ -431,8 +442,8 @@ RifEclipseRestartDataAccess* RifReaderEclipseOutput::dynamicResultsAccess(const
QStringList restartFiles = RifEclipseOutputFileTools::fileNamesByType(fileSet, ECL_RESTART_FILE); QStringList restartFiles = RifEclipseOutputFileTools::fileNamesByType(fileSet, ECL_RESTART_FILE);
if (restartFiles.size() > 0) if (restartFiles.size() > 0)
{ {
resultsAccess = new RifEclipseRestartFilesetAccess(numGrids, numActiveCells); resultsAccess = new RifEclipseRestartFilesetAccess();
if (!resultsAccess->open(restartFiles)) if (!resultsAccess->open(restartFiles, matrixActiveCellCounts, fractureActiveCellCounts))
{ {
delete resultsAccess; delete resultsAccess;
return NULL; return NULL;
@ -449,7 +460,7 @@ RifEclipseRestartDataAccess* RifReaderEclipseOutput::dynamicResultsAccess(const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get all values of a given static result as doubles /// Get all values of a given static result as doubles
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifReaderEclipseOutput::staticResult(const QString& result, std::vector<double>* values) bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector<double>* values)
{ {
CVF_ASSERT(values); CVF_ASSERT(values);
CVF_ASSERT(m_staticResultsAccess.notNull()); CVF_ASSERT(m_staticResultsAccess.notNull());
@ -459,7 +470,7 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, std::vector<dou
for (i = 0; i < numOccurrences; i++) for (i = 0; i < numOccurrences; i++)
{ {
std::vector<double> partValues; std::vector<double> partValues;
if (!m_staticResultsAccess->keywordData(result, i, &partValues)) return false; if (!m_staticResultsAccess->keywordData(result, i, matrixOrFracture, &partValues)) return false;
values->insert(values->end(), partValues.begin(), partValues.end()); values->insert(values->end(), partValues.begin(), partValues.end());
} }
@ -469,10 +480,10 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, std::vector<dou
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get dynamic result at given step index. Will concatenate values for the main grid and all sub grids. /// Get dynamic result at given step index. Will concatenate values for the main grid and all sub grids.
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifReaderEclipseOutput::dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values)
{ {
CVF_ASSERT(m_dynamicResultsAccess.notNull()); CVF_ASSERT(m_dynamicResultsAccess.notNull());
return m_dynamicResultsAccess->results(result, stepIndex, values); return m_dynamicResultsAccess->results(result, matrixOrFracture, stepIndex, values);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -42,8 +42,8 @@ public:
bool open(const QString& fileName, RigReservoir* reservoir); bool open(const QString& fileName, RigReservoir* reservoir);
void close(); void close();
bool staticResult(const QString& result, std::vector<double>* values); bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector<double>* values);
bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values); bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values);
static bool transferGeometry(const ecl_grid_type* mainEclGrid, RigReservoir* reservoir); static bool transferGeometry(const ecl_grid_type* mainEclGrid, RigReservoir* reservoir);
@ -54,15 +54,15 @@ private:
int findSmallestActiveCellIndexK( const RigGridBase* grid, int cellI, int cellJ); int findSmallestActiveCellIndexK( const RigGridBase* grid, int cellI, int cellJ);
static RifEclipseRestartDataAccess* staticResultsAccess(const QStringList& fileSet, size_t numGrids, size_t numActiveCells); static RifEclipseRestartDataAccess* staticResultsAccess(const QStringList& fileSet, const std::vector<size_t>& matrixModelActiveCellCounts, const std::vector<size_t>& fractureModelActiveCellCounts);
static RifEclipseRestartDataAccess* dynamicResultsAccess(const QStringList& fileSet, size_t numGrids, size_t numActiveCells); static RifEclipseRestartDataAccess* dynamicResultsAccess(const QStringList& fileSet, const std::vector<size_t>& matrixModelActiveCellCounts, const std::vector<size_t>& fractureModelActiveCellCounts);
private: private:
QString m_fileName; // Name of file used to start accessing Eclipse output files QString m_fileName; // Name of file used to start accessing Eclipse output files
QStringList m_fileSet; // Set of files in filename's path with same base name as filename QStringList m_fileSet; // Set of files in filename's path with same base name as filename
QList<QDateTime> m_timeSteps; QList<QDateTime> m_timeSteps;
cvf::ref<RifEclipseOutputFileTools> m_staticResultsAccess; // File access to static results cvf::ref<RifEclipseOutputFileTools> m_staticResultsAccess; // File access to static results
cvf::ref<RifEclipseRestartDataAccess> m_dynamicResultsAccess; // File access to dynamic results cvf::ref<RifEclipseRestartDataAccess> m_dynamicResultsAccess; // File access to dynamic results
}; };

View File

@ -35,6 +35,13 @@ class RigReservoir;
//================================================================================================== //==================================================================================================
class RifReaderInterface : public cvf::Object class RifReaderInterface : public cvf::Object
{ {
public:
enum PorosityModelResultType
{
MATRIX_RESULTS,
FRACTURE_RESULTS
};
public: public:
RifReaderInterface() {} RifReaderInterface() {}
virtual ~RifReaderInterface() {} virtual ~RifReaderInterface() {}
@ -42,8 +49,7 @@ public:
virtual bool open(const QString& fileName, RigReservoir* reservoir) = 0; virtual bool open(const QString& fileName, RigReservoir* reservoir) = 0;
virtual void close() = 0; virtual void close() = 0;
virtual bool staticResult(const QString& result, std::vector<double>* values) = 0; virtual bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector<double>* values) = 0;
virtual bool dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) = 0; virtual bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values) = 0;
}; };

View File

@ -101,7 +101,7 @@ bool RifReaderMockModel::inputProperty(const QString& propertyName, std::vector<
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifReaderMockModel::staticResult(const QString& result, std::vector<double>* values) bool RifReaderMockModel::staticResult(const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, std::vector<double>* values)
{ {
m_reservoirBuilder.staticResult(m_reservoir.p(), result, values); m_reservoirBuilder.staticResult(m_reservoir.p(), result, values);
@ -111,7 +111,7 @@ bool RifReaderMockModel::staticResult(const QString& result, std::vector<double>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifReaderMockModel::dynamicResult(const QString& result, size_t stepIndex, std::vector<double>* values) bool RifReaderMockModel::dynamicResult(const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values)
{ {
m_reservoirBuilder.dynamicResult(m_reservoir.p(), result, stepIndex, values); m_reservoirBuilder.dynamicResult(m_reservoir.p(), result, stepIndex, values);

View File

@ -36,8 +36,8 @@ public:
virtual bool open( const QString& fileName, RigReservoir* reservoir ); virtual bool open( const QString& fileName, RigReservoir* reservoir );
virtual void close(); virtual void close();
virtual bool staticResult( const QString& result, std::vector<double>* values ); virtual bool staticResult( const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, std::vector<double>* values );
virtual bool dynamicResult( const QString& result, size_t stepIndex, std::vector<double>* values ); virtual bool dynamicResult( const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values );
private: private:
void populateReservoir(RigReservoir* reservoir); void populateReservoir(RigReservoir* reservoir);

View File

@ -140,7 +140,7 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
size_t resultValueIndex = cellIndex; size_t resultValueIndex = cellIndex;
if (cellScalarResultUseGlobalActiveIndex) if (cellScalarResultUseGlobalActiveIndex)
{ {
resultValueIndex = grid->cell(cellIndex).globalMatrixActiveIndex(); resultValueIndex = grid->cell(cellIndex).activeIndexInMatrixModel();
} }
{ {
@ -169,7 +169,7 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
resultValueIndex = cellIndex; resultValueIndex = cellIndex;
if (edgeScalarResultUseGlobalActiveIndex[cubeFaceIdx]) if (edgeScalarResultUseGlobalActiveIndex[cubeFaceIdx])
{ {
resultValueIndex = grid->cell(cellIndex).globalMatrixActiveIndex(); resultValueIndex = grid->cell(cellIndex).activeIndexInMatrixModel();
} }
// Assuming static values to be mapped onto cell edge, always using time step zero // Assuming static values to be mapped onto cell edge, always using time step zero

View File

@ -475,8 +475,8 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
const RigCell& cell = grid->cell(cellIndex); const RigCell& cell = grid->cell(cellIndex);
if ( !invalidCellsIsVisible && cell.isInvalid() if ( !invalidCellsIsVisible && cell.isInvalid()
|| !inactiveCellsIsVisible && !cell.matrixActive() || !inactiveCellsIsVisible && !cell.isActiveInMatrixModel()
|| !activeCellsIsVisible && cell.matrixActive() || !activeCellsIsVisible && cell.isActiveInMatrixModel()
|| mainGridIsVisible && (cell.subGrid() != NULL) || mainGridIsVisible && (cell.subGrid() != NULL)
|| cell.isWellCell() || cell.isWellCell()
) )
@ -607,7 +607,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
size_t resultValueIndex = cellIndex; size_t resultValueIndex = cellIndex;
if (useGlobalActiveIndex) if (useGlobalActiveIndex)
{ {
resultValueIndex = grid->cell(cellIndex).globalMatrixActiveIndex(); resultValueIndex = grid->cell(cellIndex).activeIndexInMatrixModel();
} }
double scalarValue = grid->mainGrid()->results()->cellScalarResult(timeStepIndex, scalarResultIndex, resultValueIndex); double scalarValue = grid->mainGrid()->results()->cellScalarResult(timeStepIndex, scalarResultIndex, resultValueIndex);

View File

@ -89,7 +89,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
{ {
caseName = m_reservoirView->eclipseCase()->caseName(); caseName = m_reservoirView->eclipseCase()->caseName();
totCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cells().size()); totCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cells().size());
activeCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->globalMatrixActiveCellCount()); activeCellCount = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->globalMatrixModelActiveCellCount());
iSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountI()); iSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountI());
jSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountJ()); jSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountJ());
kSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountK()); kSize = QString::number(m_reservoirView->eclipseCase()->reservoirData()->mainGrid()->cellCountK());

View File

@ -119,7 +119,7 @@ void RimCellRangeFilter::setDefaultValues()
if (mainGrid) if (mainGrid)
{ {
cvf::Vec3st min, max; cvf::Vec3st min, max;
mainGrid->activeCellsBoundingBox(min, max); mainGrid->matrixModelActiveCellsBoundingBox(min, max);
// Adjust to Eclipse indexing // Adjust to Eclipse indexing
min.x() = min.x() + 1; min.x() = min.x() + 1;
@ -162,7 +162,7 @@ void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
if (mainGrid) if (mainGrid)
{ {
cvf::Vec3st min, max; cvf::Vec3st min, max;
mainGrid->activeCellsBoundingBox(min, max); mainGrid->matrixModelActiveCellsBoundingBox(min, max);
// Adjust to Eclipse indexing // Adjust to Eclipse indexing
min.x() = min.x() + 1; min.x() = min.x() + 1;

View File

@ -377,12 +377,12 @@ cvf::ref<RifReaderInterface> RimInputReservoir::createMockModel(QString modelNam
mockFileInterface->open("", reservoir.p()); mockFileInterface->open("", reservoir.p());
{ {
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(1, 3, 4); size_t idx = reservoir->mainGrid()->cellIndexFromIJK(1, 3, 4);
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T); reservoir->mainGrid()->cell(idx).setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
} }
{ {
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(2, 2, 3); size_t idx = reservoir->mainGrid()->cellIndexFromIJK(2, 2, 3);
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T); reservoir->mainGrid()->cell(idx).setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
} }
// Add a property // Add a property

View File

@ -1199,7 +1199,7 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
for ( fIdx = 0; fIdx < cellCountFenceDirection; ++fIdx) for ( fIdx = 0; fIdx < cellCountFenceDirection; ++fIdx)
{ {
size_t fenceCellIndex = grid->cellIndexFromIJK(*pI,*pJ,*pK); size_t fenceCellIndex = grid->cellIndexFromIJK(*pI,*pJ,*pK);
if (grid->cell(fenceCellIndex).matrixActive()) if (grid->cell(fenceCellIndex).isActiveInMatrixModel())
{ {
(*visibleCells)[fenceCellIndex] = true; (*visibleCells)[fenceCellIndex] = true;
} }

View File

@ -118,12 +118,12 @@ cvf::ref<RifReaderInterface> RimResultReservoir::createMockModel(QString modelNa
mockFileInterface->open("", reservoir.p()); mockFileInterface->open("", reservoir.p());
{ {
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(1, 3, 4); size_t idx = reservoir->mainGrid()->cellIndexFromIJK(1, 3, 4);
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T); reservoir->mainGrid()->cell(idx).setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
} }
{ {
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(2, 2, 3); size_t idx = reservoir->mainGrid()->cellIndexFromIJK(2, 2, 3);
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T); reservoir->mainGrid()->cell(idx).setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
} }
} }
else if (modelName == "Result Mock Debug Model With Results") else if (modelName == "Result Mock Debug Model With Results")

View File

@ -40,8 +40,8 @@ RigCell::RigCell() :
m_hostGrid(NULL), m_hostGrid(NULL),
m_isInvalid(false), m_isInvalid(false),
m_isWellCell(false), m_isWellCell(false),
m_globalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T), m_activeIndexInMatrixModel(cvf::UNDEFINED_SIZE_T),
m_globalFractureActiveIndex(cvf::UNDEFINED_SIZE_T), m_activeIndexInFractureModel(cvf::UNDEFINED_SIZE_T),
m_cellIndex(cvf::UNDEFINED_SIZE_T) m_cellIndex(cvf::UNDEFINED_SIZE_T)
{ {
memcpy(m_cornerIndices.m_array, undefinedCornersArray, 8*sizeof(size_t)); memcpy(m_cornerIndices.m_array, undefinedCornersArray, 8*sizeof(size_t));

View File

@ -34,16 +34,16 @@ public:
RigCell(); RigCell();
~RigCell(); // Not virtual, to save space. Do not inherit from this class ~RigCell(); // Not virtual, to save space. Do not inherit from this class
caf::SizeTArray8& cornerIndices() { return m_cornerIndices;} caf::SizeTArray8& cornerIndices() { return m_cornerIndices;}
const caf::SizeTArray8& cornerIndices() const { return m_cornerIndices;} const caf::SizeTArray8& cornerIndices() const { return m_cornerIndices;}
bool matrixActive() const { return m_globalMatrixActiveIndex != cvf::UNDEFINED_SIZE_T; } bool isActiveInMatrixModel() const { return m_activeIndexInMatrixModel != cvf::UNDEFINED_SIZE_T; }
size_t globalMatrixActiveIndex() const { return m_globalMatrixActiveIndex; } size_t activeIndexInMatrixModel() const { return m_activeIndexInMatrixModel; }
void setGlobalMatrixActiveIndex(size_t val) { m_globalMatrixActiveIndex = val; } void setActiveIndexInMatrixModel(size_t val) { m_activeIndexInMatrixModel = val; }
bool fractureActive() const { return m_globalFractureActiveIndex != cvf::UNDEFINED_SIZE_T; } bool isActiveInFractureModel() const { return m_activeIndexInFractureModel != cvf::UNDEFINED_SIZE_T; }
size_t globalFractureActiveIndex() const { return m_globalFractureActiveIndex; } size_t activeIndexInFractureModel() const { return m_activeIndexInFractureModel; }
void setGlobalFractureActiveIndex(size_t val) { m_globalFractureActiveIndex = val; } void setActiveIndexInFractureModel(size_t val) { m_activeIndexInFractureModel = val; }
bool isInvalid() const { return m_isInvalid; } bool isInvalid() const { return m_isInvalid; }
void setInvalid( bool val ) { m_isInvalid = val; } void setInvalid( bool val ) { m_isInvalid = val; }
@ -87,8 +87,8 @@ private:
size_t m_parentCellIndex; ///< Grid cell index of the cell in the parent grid containing this cell size_t m_parentCellIndex; ///< Grid cell index of the cell in the parent grid containing this cell
size_t m_mainGridCellIndex; size_t m_mainGridCellIndex;
size_t m_globalMatrixActiveIndex; ///< This cell's running index of all the active calls in the reservoir. Used for result mapping size_t m_activeIndexInMatrixModel; ///< This cell's running index of all the active calls (matrix) in the reservoir
size_t m_globalFractureActiveIndex; ///< This cell's running index of all the active calls in the reservoir. Used for result mapping size_t m_activeIndexInFractureModel; ///< This cell's running index of all the active calls (fracture) in the reservoir
size_t m_cellIndex; ///< This cells index in the grid it belongs to. size_t m_cellIndex; ///< This cells index in the grid it belongs to.
}; };

View File

@ -29,8 +29,8 @@ RigGridBase::RigGridBase(RigMainGrid* mainGrid):
m_gridPointDimensions(0,0,0), m_gridPointDimensions(0,0,0),
m_mainGrid(mainGrid), m_mainGrid(mainGrid),
m_indexToStartOfCells(0), m_indexToStartOfCells(0),
m_matrixActiveCellCount(cvf::UNDEFINED_SIZE_T), m_matrixModelActiveCellCount(cvf::UNDEFINED_SIZE_T),
m_fractureActiveCellCount(cvf::UNDEFINED_SIZE_T) m_fractureModelActiveCellCount(cvf::UNDEFINED_SIZE_T)
{ {
if (mainGrid == NULL) if (mainGrid == NULL)
{ {
@ -257,7 +257,7 @@ double RigGridBase::cellScalar(size_t timeStepIndex, size_t scalarSetIndex, size
bool useGlobalActiveIndex = m_mainGrid->results()->isUsingGlobalActiveIndex(scalarSetIndex); bool useGlobalActiveIndex = m_mainGrid->results()->isUsingGlobalActiveIndex(scalarSetIndex);
if (useGlobalActiveIndex) if (useGlobalActiveIndex)
{ {
resultValueIndex = cell(cellIndex).globalMatrixActiveIndex(); resultValueIndex = cell(cellIndex).activeIndexInMatrixModel();
if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL; if (resultValueIndex == cvf::UNDEFINED_SIZE_T) return HUGE_VAL;
} }
@ -359,7 +359,7 @@ bool RigGridBase::isCellActive(size_t i, size_t j, size_t k) const
{ {
size_t idx = cellIndexFromIJK(i, j, k); size_t idx = cellIndexFromIJK(i, j, k);
const RigCell& c = cell(idx); const RigCell& c = cell(idx);
if (!c.matrixActive() || c.isInvalid()) if (!c.isActiveInMatrixModel() || c.isInvalid())
{ {
return false; return false;
} }
@ -529,52 +529,52 @@ double RigGridBase::characteristicCellSize()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigGridBase::activeMatrixCellCount() size_t RigGridBase::matrixModelActiveCellCount()
{ {
if (m_matrixActiveCellCount == cvf::UNDEFINED_SIZE_T) if (m_matrixModelActiveCellCount == cvf::UNDEFINED_SIZE_T)
{ {
computeMatrixAndFractureActiveCellCount(); computeMatrixAndFractureModelActiveCellCount();
} }
CVF_ASSERT(m_matrixActiveCellCount != cvf::UNDEFINED_SIZE_T); CVF_ASSERT(m_matrixModelActiveCellCount != cvf::UNDEFINED_SIZE_T);
return m_matrixActiveCellCount; return m_matrixModelActiveCellCount;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigGridBase::activeFractureCellCount() size_t RigGridBase::fractureModelActiveCellCount()
{ {
if (m_fractureActiveCellCount == cvf::UNDEFINED_SIZE_T) if (m_fractureModelActiveCellCount == cvf::UNDEFINED_SIZE_T)
{ {
computeMatrixAndFractureActiveCellCount(); computeMatrixAndFractureModelActiveCellCount();
} }
CVF_ASSERT(m_fractureActiveCellCount != cvf::UNDEFINED_SIZE_T); CVF_ASSERT(m_fractureModelActiveCellCount != cvf::UNDEFINED_SIZE_T);
return m_fractureActiveCellCount; return m_fractureModelActiveCellCount;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigGridBase::computeMatrixAndFractureActiveCellCount() void RigGridBase::computeMatrixAndFractureModelActiveCellCount()
{ {
m_matrixActiveCellCount = 0; m_matrixModelActiveCellCount = 0;
m_fractureActiveCellCount = 0; m_fractureModelActiveCellCount = 0;
for (size_t i = 0; i < cellCount(); i++) for (size_t i = 0; i < cellCount(); i++)
{ {
const RigCell& c = cell(i); const RigCell& c = cell(i);
if (c.matrixActive()) if (c.isActiveInMatrixModel())
{ {
m_matrixActiveCellCount++; m_matrixModelActiveCellCount++;
} }
if (c.fractureActive()) if (c.isActiveInFractureModel())
{ {
m_fractureActiveCellCount++; m_fractureModelActiveCellCount++;
} }
} }
} }

View File

@ -58,9 +58,9 @@ public:
bool isMainGrid() const; bool isMainGrid() const;
RigMainGrid* mainGrid() const { return m_mainGrid; } RigMainGrid* mainGrid() const { return m_mainGrid; }
size_t activeMatrixCellCount(); size_t matrixModelActiveCellCount();
size_t activeFractureCellCount(); size_t fractureModelActiveCellCount();
void computeMatrixAndFractureActiveCellCount(); void computeMatrixAndFractureModelActiveCellCount();
protected: protected:
friend class RigMainGrid;//::initAllSubGridsParentGridPointer(); friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
@ -109,8 +109,8 @@ private:
size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0. size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0.
RigMainGrid* m_mainGrid; RigMainGrid* m_mainGrid;
size_t m_matrixActiveCellCount; size_t m_matrixModelActiveCellCount;
size_t m_fractureActiveCellCount; size_t m_fractureModelActiveCellCount;
}; };

View File

@ -29,7 +29,8 @@ RigMainGrid::RigMainGrid(void)
m_activeCellPositionMax(cvf::Vec3st::UNDEFINED), m_activeCellPositionMax(cvf::Vec3st::UNDEFINED),
m_validCellPositionMin(cvf::Vec3st::UNDEFINED), m_validCellPositionMin(cvf::Vec3st::UNDEFINED),
m_validCellPositionMax(cvf::Vec3st::UNDEFINED), m_validCellPositionMax(cvf::Vec3st::UNDEFINED),
m_globalMatrixActiveCellCount(cvf::UNDEFINED_SIZE_T) m_globalMatrixModelActiveCellCount(cvf::UNDEFINED_SIZE_T),
m_globalFractureModelActiveCellCount(cvf::UNDEFINED_SIZE_T)
{ {
m_results = new RigReservoirCellResults(this); m_results = new RigReservoirCellResults(this);
@ -79,35 +80,33 @@ void RigMainGrid::initAllSubCellsMainGridCellIndex()
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Calculates the number of active cells in the complete reservoir. ///
/// Caches the result, so subsequent calls are fast
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
size_t RigMainGrid::globalMatrixActiveCellCount() size_t RigMainGrid::globalMatrixModelActiveCellCount()
{ {
if (m_globalMatrixActiveCellCount != cvf::UNDEFINED_SIZE_T) return m_globalMatrixActiveCellCount; if (m_globalMatrixModelActiveCellCount != cvf::UNDEFINED_SIZE_T) return m_globalMatrixModelActiveCellCount;
if (m_cells.size() == 0) return 0; computeGlobalActiveCellCount();
size_t numActiveCells = 0; return m_globalMatrixModelActiveCellCount;
size_t i;
for (i = 0; i < m_cells.size(); i++)
{
if (m_cells[i].matrixActive()) numActiveCells++;
}
m_globalMatrixActiveCellCount = numActiveCells;
return m_globalMatrixActiveCellCount;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigMainGrid::activeCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const size_t RigMainGrid::globalFractureModelActiveCellCount()
{
if (m_globalFractureModelActiveCellCount != cvf::UNDEFINED_SIZE_T) return m_globalFractureModelActiveCellCount;
computeGlobalActiveCellCount();
return m_globalFractureModelActiveCellCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const
{ {
min = m_activeCellPositionMin; min = m_activeCellPositionMin;
max = m_activeCellPositionMax; max = m_activeCellPositionMax;
@ -116,7 +115,7 @@ void RigMainGrid::activeCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) con
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::BoundingBox RigMainGrid::activeCellsBoundingBox() const cvf::BoundingBox RigMainGrid::matrixModelActiveCellsBoundingBox() const
{ {
return m_activeCellsBoundingBox; return m_activeCellsBoundingBox;
} }
@ -183,7 +182,7 @@ void RigMainGrid::computeActiveAndValidCellRanges()
validBB.add(i, j, k); validBB.add(i, j, k);
} }
if (c.matrixActive()) if (c.isActiveInMatrixModel())
{ {
activeBB.add(i, j, k); activeBB.add(i, j, k);
} }
@ -222,7 +221,7 @@ void RigMainGrid::computeBoundingBox()
for (i = 0; i < cellCount(); i++) for (i = 0; i < cellCount(); i++)
{ {
const RigCell& c = cell(i); const RigCell& c = cell(i);
if (c.matrixActive()) if (c.isActiveInMatrixModel())
{ {
const caf::SizeTArray8& indices = c.cornerIndices(); const caf::SizeTArray8& indices = c.cornerIndices();
@ -256,7 +255,7 @@ void RigMainGrid::computeCachedData()
/// ///
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigMainGrid::calculateActiveCellInfo(std::vector<qint32> &gridNumber, void RigMainGrid::calculateMatrixModelActiveCellInfo(std::vector<qint32> &gridNumber,
std::vector<qint32> &cellI, std::vector<qint32> &cellI,
std::vector<qint32> &cellJ, std::vector<qint32> &cellJ,
std::vector<qint32> &cellK, std::vector<qint32> &cellK,
@ -265,7 +264,7 @@ void RigMainGrid::calculateActiveCellInfo(std::vector<qint32> &gridNumber,
std::vector<qint32> &hostCellJ, std::vector<qint32> &hostCellJ,
std::vector<qint32> &hostCellK) std::vector<qint32> &hostCellK)
{ {
size_t numActiveCells = this->globalMatrixActiveCellCount(); size_t numMatrixModelActiveCells = this->globalMatrixModelActiveCellCount();
gridNumber.clear(); gridNumber.clear();
cellI.clear(); cellI.clear();
@ -276,18 +275,18 @@ void RigMainGrid::calculateActiveCellInfo(std::vector<qint32> &gridNumber,
hostCellJ.clear(); hostCellJ.clear();
hostCellK.clear(); hostCellK.clear();
gridNumber.reserve(numActiveCells); gridNumber.reserve(numMatrixModelActiveCells);
cellI.reserve(numActiveCells); cellI.reserve(numMatrixModelActiveCells);
cellJ.reserve(numActiveCells); cellJ.reserve(numMatrixModelActiveCells);
cellK.reserve(numActiveCells); cellK.reserve(numMatrixModelActiveCells);
parentGridNumber.reserve(numActiveCells); parentGridNumber.reserve(numMatrixModelActiveCells);
hostCellI.reserve(numActiveCells); hostCellI.reserve(numMatrixModelActiveCells);
hostCellJ.reserve(numActiveCells); hostCellJ.reserve(numMatrixModelActiveCells);
hostCellK.reserve(numActiveCells); hostCellK.reserve(numMatrixModelActiveCells);
for (size_t cIdx = 0; cIdx < m_cells.size(); ++cIdx) for (size_t cIdx = 0; cIdx < m_cells.size(); ++cIdx)
{ {
if (m_cells[cIdx].matrixActive()) if (m_cells[cIdx].isActiveInMatrixModel())
{ {
RigGridBase* grid = m_cells[cIdx].hostGrid(); RigGridBase* grid = m_cells[cIdx].hostGrid();
CVF_ASSERT(grid != NULL); CVF_ASSERT(grid != NULL);
@ -351,11 +350,27 @@ const RigGridBase* RigMainGrid::gridByIndex(size_t localGridIndex) const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigMainGrid::computeActiveCellCountForAllGrids() void RigMainGrid::computeActiveCellCountForAllGrids()
{ {
computeMatrixAndFractureActiveCellCount(); computeMatrixAndFractureModelActiveCellCount();
size_t i; size_t i;
for (i = 0; i < m_localGrids.size(); ++i) for (i = 0; i < m_localGrids.size(); ++i)
{ {
m_localGrids[i]->computeMatrixAndFractureActiveCellCount(); m_localGrids[i]->computeMatrixAndFractureModelActiveCellCount();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::computeGlobalActiveCellCount()
{
m_globalMatrixModelActiveCellCount = 0;
m_globalFractureModelActiveCellCount = 0;
size_t i;
for (i = 0; i < m_cells.size(); i++)
{
if (m_cells[i].isActiveInMatrixModel()) m_globalMatrixModelActiveCellCount++;
if (m_cells[i].isActiveInFractureModel()) m_globalFractureModelActiveCellCount++;
} }
} }

View File

@ -43,8 +43,10 @@ public:
RigReservoirCellResults* results() {return m_results.p();} RigReservoirCellResults* results() {return m_results.p();}
const RigReservoirCellResults* results() const {return m_results.p();} const RigReservoirCellResults* results() const {return m_results.p();}
size_t globalMatrixActiveCellCount(); size_t globalMatrixModelActiveCellCount();
void activeCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const; size_t globalFractureModelActiveCellCount();
void matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void validCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const; void validCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void addLocalGrid(RigLocalGrid* localGrid); void addLocalGrid(RigLocalGrid* localGrid);
@ -52,7 +54,7 @@ public:
RigGridBase* gridByIndex(size_t localGridIndex); RigGridBase* gridByIndex(size_t localGridIndex);
const RigGridBase* gridByIndex(size_t localGridIndex) const; const RigGridBase* gridByIndex(size_t localGridIndex) const;
void calculateActiveCellInfo(std::vector<qint32>& gridNumber, void calculateMatrixModelActiveCellInfo(std::vector<qint32>& gridNumber,
std::vector<qint32>& i, std::vector<qint32>& i,
std::vector<qint32>& j, std::vector<qint32>& j,
std::vector<qint32>& k, std::vector<qint32>& k,
@ -62,7 +64,7 @@ public:
std::vector<qint32>& hostCellK); std::vector<qint32>& hostCellK);
void computeCachedData(); void computeCachedData();
cvf::BoundingBox activeCellsBoundingBox() const; cvf::BoundingBox matrixModelActiveCellsBoundingBox() const;
// Overrides // Overrides
virtual cvf::Vec3d displayModelOffset() const; virtual cvf::Vec3d displayModelOffset() const;
@ -72,6 +74,7 @@ private:
void initAllSubCellsMainGridCellIndex(); void initAllSubCellsMainGridCellIndex();
void computeActiveAndValidCellRanges(); void computeActiveAndValidCellRanges();
void computeBoundingBox(); void computeBoundingBox();
void computeGlobalActiveCellCount();
void computeActiveCellCountForAllGrids(); void computeActiveCellCountForAllGrids();
private: private:
@ -79,7 +82,8 @@ private:
std::vector<RigCell> m_cells; ///< Global array of all cells in the reservoir (including the ones in LGR's) std::vector<RigCell> m_cells; ///< Global array of all cells in the reservoir (including the ones in LGR's)
cvf::Collection<RigLocalGrid> m_localGrids; ///< List of all the LGR's in this reservoir cvf::Collection<RigLocalGrid> m_localGrids; ///< List of all the LGR's in this reservoir
cvf::ref<RigReservoirCellResults> m_results; cvf::ref<RigReservoirCellResults> m_results;
size_t m_globalMatrixActiveCellCount; size_t m_globalMatrixModelActiveCellCount;
size_t m_globalFractureModelActiveCellCount;
cvf::Vec3st m_activeCellPositionMin; cvf::Vec3st m_activeCellPositionMin;
cvf::Vec3st m_activeCellPositionMax; cvf::Vec3st m_activeCellPositionMax;

View File

@ -156,11 +156,11 @@ void RigReservoirBuilderMock::appendCells(size_t nodeStartIndex, size_t cellCoun
if (!(i % 5)) if (!(i % 5))
{ {
riCell.setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T); riCell.setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
} }
else else
{ {
riCell.setGlobalMatrixActiveIndex(activeCellIndex++); riCell.setActiveIndexInMatrixModel(activeCellIndex++);
} }
cells.push_back(riCell); cells.push_back(riCell);
@ -296,7 +296,7 @@ bool RigReservoirBuilderMock::staticResult(RigReservoir* reservoir, const QStrin
for (k = 0; k < reservoir->mainGrid()->cells().size(); k++) for (k = 0; k < reservoir->mainGrid()->cells().size(); k++)
{ {
RigCell& cell = reservoir->mainGrid()->cells()[k]; RigCell& cell = reservoir->mainGrid()->cells()[k];
if (cell.matrixActive()) if (cell.isActiveInMatrixModel())
{ {
if (cell.hostGrid() == reservoir->mainGrid()) if (cell.hostGrid() == reservoir->mainGrid())
{ {
@ -333,7 +333,7 @@ bool RigReservoirBuilderMock::dynamicResult(RigReservoir* reservoir, const QStri
for (k = 0; k < reservoir->mainGrid()->cells().size(); k++) for (k = 0; k < reservoir->mainGrid()->cells().size(); k++)
{ {
RigCell& cell = reservoir->mainGrid()->cells()[k]; RigCell& cell = reservoir->mainGrid()->cells()[k];
if (cell.matrixActive()) if (cell.isActiveInMatrixModel())
{ {
if (cell.hostGrid() == reservoir->mainGrid()) if (cell.hostGrid() == reservoir->mainGrid())
{ {

View File

@ -292,7 +292,7 @@ size_t RigReservoirCellResults::findOrLoadScalarResult(RimDefines::ResultCatType
for (i = 0; i < timeStepCount; i++) for (i = 0; i < timeStepCount; i++)
{ {
std::vector<double>& values = m_cellScalarResults[resultGridIndex][i]; std::vector<double>& values = m_cellScalarResults[resultGridIndex][i];
if (!m_readerInterface->dynamicResult(resultName, i, &values)) if (!m_readerInterface->dynamicResult(resultName, RifReaderInterface::MATRIX_RESULTS, i, &values))
{ {
resultLoadingSucess = false; resultLoadingSucess = false;
} }
@ -303,7 +303,7 @@ size_t RigReservoirCellResults::findOrLoadScalarResult(RimDefines::ResultCatType
m_cellScalarResults[resultGridIndex].resize(1); m_cellScalarResults[resultGridIndex].resize(1);
std::vector<double>& values = m_cellScalarResults[resultGridIndex][0]; std::vector<double>& values = m_cellScalarResults[resultGridIndex][0];
if (!m_readerInterface->staticResult(resultName, &values)) if (!m_readerInterface->staticResult(resultName, RifReaderInterface::MATRIX_RESULTS, &values))
{ {
resultLoadingSucess = false; resultLoadingSucess = false;
} }
@ -512,14 +512,14 @@ void RigReservoirCellResults::computeDepthRelatedResults()
std::vector< std::vector<double> >& tops = cellScalarResults(topsResultGridIndex); std::vector< std::vector<double> >& tops = cellScalarResults(topsResultGridIndex);
std::vector< std::vector<double> >& bottom = cellScalarResults(bottomResultGridIndex); std::vector< std::vector<double> >& bottom = cellScalarResults(bottomResultGridIndex);
bool computeValuesForActiveCellsOnly = m_ownerMainGrid->globalMatrixActiveCellCount() > 0; bool computeValuesForActiveCellsOnly = m_ownerMainGrid->globalMatrixModelActiveCellCount() > 0;
size_t cellIdx = 0; size_t cellIdx = 0;
for (cellIdx = 0; cellIdx < m_ownerMainGrid->cells().size(); cellIdx++) for (cellIdx = 0; cellIdx < m_ownerMainGrid->cells().size(); cellIdx++)
{ {
const RigCell& cell = m_ownerMainGrid->cells()[cellIdx]; const RigCell& cell = m_ownerMainGrid->cells()[cellIdx];
if (computeValuesForActiveCellsOnly && !cell.matrixActive()) if (computeValuesForActiveCellsOnly && !cell.isActiveInMatrixModel())
{ {
continue; continue;
} }
@ -651,7 +651,7 @@ bool RigReservoirCellResults::isUsingGlobalActiveIndex(size_t scalarResultIndex)
CVF_TIGHT_ASSERT(scalarResultIndex < m_cellScalarResults.size()); CVF_TIGHT_ASSERT(scalarResultIndex < m_cellScalarResults.size());
if (!m_cellScalarResults[scalarResultIndex].size()) return true; if (!m_cellScalarResults[scalarResultIndex].size()) return true;
if (m_cellScalarResults[scalarResultIndex][0].size() == m_ownerMainGrid->globalMatrixActiveCellCount()) return true; if (m_cellScalarResults[scalarResultIndex][0].size() == m_ownerMainGrid->globalMatrixModelActiveCellCount()) return true;
if (m_cellScalarResults[scalarResultIndex][0].size() == m_ownerMainGrid->cellCount()) return false; if (m_cellScalarResults[scalarResultIndex][0].size() == m_ownerMainGrid->cellCount()) return false;
CVF_TIGHT_ASSERT(false); // Wrong number of results CVF_TIGHT_ASSERT(false); // Wrong number of results

View File

@ -368,7 +368,7 @@ void RiaSocketServer::readCommandFromOctave()
return; return;
} }
reservoir->reservoirData()->mainGrid()->calculateActiveCellInfo(activeCellInfo[0], activeCellInfo[1], activeCellInfo[2], activeCellInfo[3], reservoir->reservoirData()->mainGrid()->calculateMatrixModelActiveCellInfo(activeCellInfo[0], activeCellInfo[1], activeCellInfo[2], activeCellInfo[3],
activeCellInfo[4], activeCellInfo[5], activeCellInfo[6], activeCellInfo[7]); activeCellInfo[4], activeCellInfo[5], activeCellInfo[6], activeCellInfo[7]);
// First write timestep count // First write timestep count
@ -441,7 +441,7 @@ void RiaSocketServer::readPropertyDataFromOctave()
size_t cellCountFromOctave = m_bytesPerTimeStepToRead / sizeof(double); size_t cellCountFromOctave = m_bytesPerTimeStepToRead / sizeof(double);
size_t gridActiveCellCount = m_currentReservoir->reservoirData()->mainGrid()->globalMatrixActiveCellCount(); size_t gridActiveCellCount = m_currentReservoir->reservoirData()->mainGrid()->globalMatrixModelActiveCellCount();
size_t gridTotalCellCount = m_currentReservoir->reservoirData()->mainGrid()->cellCount(); size_t gridTotalCellCount = m_currentReservoir->reservoirData()->mainGrid()->cellCount();
if (cellCountFromOctave != gridActiveCellCount && cellCountFromOctave != gridTotalCellCount) if (cellCountFromOctave != gridActiveCellCount && cellCountFromOctave != gridTotalCellCount)