mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added fracture active index
p4#: 20294
This commit is contained in:
@@ -83,7 +83,7 @@ static const size_t cellMappingECLRi[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
|
||||
// Static functions
|
||||
//**************************************************************************************************
|
||||
|
||||
bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const ecl_grid_type* localEclGrid, size_t matrixActiveStartIndex)
|
||||
bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const ecl_grid_type* localEclGrid, size_t matrixActiveStartIndex, size_t fractureActiveStartIndex)
|
||||
{
|
||||
int cellCount = ecl_grid_get_global_size(localEclGrid);
|
||||
size_t cellStartIndex = mainGrid->cells().size();
|
||||
@@ -106,15 +106,30 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
|
||||
{
|
||||
RigCell& cell = mainGrid->cells()[cellStartIndex + gIdx];
|
||||
|
||||
// The invalid (tainted) cell concept in ecl was not correct at all,
|
||||
// so this is disabeled.
|
||||
//bool invalid = ecl_grid_cell_invalid1(localEclGrid, gIdx);
|
||||
//cell.setInvalid(invalid);
|
||||
|
||||
cell.setCellIndex(gIdx);
|
||||
bool matrixActive = ecl_grid_cell_active1(localEclGrid, gIdx);
|
||||
cell.setMatrixActive(matrixActive);
|
||||
cell.setGlobalMatrixActiveIndex(matrixActive ? matrixActiveStartIndex + ecl_grid_get_active_index1(localEclGrid, gIdx) : cvf::UNDEFINED_SIZE_T);
|
||||
{
|
||||
int matrixActiveIndex = ecl_grid_get_active_index1(localEclGrid, gIdx);
|
||||
if (matrixActiveIndex != -1)
|
||||
{
|
||||
cell.setGlobalMatrixActiveIndex(matrixActiveStartIndex + matrixActiveIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int fractureActiveIndex = ecl_grid_get_active_fracture_index1(localEclGrid, gIdx);
|
||||
if (fractureActiveIndex != -1)
|
||||
{
|
||||
cell.setGlobalFractureActiveIndex(fractureActiveStartIndex + fractureActiveIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.setGlobalFractureActiveIndex(cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
}
|
||||
|
||||
int parentCellIndex = ecl_grid_get_parent_cell1(localEclGrid, gIdx);
|
||||
if (parentCellIndex == -1)
|
||||
@@ -254,19 +269,22 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
||||
progInfo.setProgressDescription("Main Grid");
|
||||
progInfo.setNextProgressIncrement(3);
|
||||
|
||||
transferGridCellData(mainGrid, mainGrid, mainEclGrid, 0);
|
||||
transferGridCellData(mainGrid, mainGrid, mainEclGrid, 0, 0);
|
||||
|
||||
progInfo.setProgress(3);
|
||||
|
||||
size_t globalMatrixActiveSize = ecl_grid_get_active_size(mainEclGrid);
|
||||
size_t globalMatrixActiveSize = ecl_grid_get_nactive(mainEclGrid);
|
||||
size_t globalFractureActiveSize = ecl_grid_get_nactive_fracture(mainEclGrid);
|
||||
|
||||
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
||||
{
|
||||
progInfo.setProgressDescription("LGR number " + QString::number(lgrIdx+1));
|
||||
|
||||
ecl_grid_type* localEclGrid = ecl_grid_iget_lgr(mainEclGrid, lgrIdx);
|
||||
transferGridCellData(mainGrid, static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1)), localEclGrid, globalMatrixActiveSize);
|
||||
globalMatrixActiveSize += ecl_grid_get_active_size(localEclGrid);
|
||||
transferGridCellData(mainGrid, static_cast<RigLocalGrid*>(mainGrid->gridByIndex(lgrIdx+1)), localEclGrid, globalMatrixActiveSize, globalFractureActiveSize);
|
||||
globalMatrixActiveSize += ecl_grid_get_nactive(localEclGrid);
|
||||
globalFractureActiveSize += ecl_grid_get_nactive_fracture(localEclGrid);
|
||||
|
||||
progInfo.setProgress(3 + lgrIdx);
|
||||
}
|
||||
|
||||
|
||||
@@ -377,12 +377,12 @@ cvf::ref<RifReaderInterface> RimInputReservoir::createMockModel(QString modelNam
|
||||
mockFileInterface->open("", reservoir.p());
|
||||
{
|
||||
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(1, 3, 4);
|
||||
reservoir->mainGrid()->cell(idx).setMatrixActive(false);
|
||||
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
|
||||
{
|
||||
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(2, 2, 3);
|
||||
reservoir->mainGrid()->cell(idx).setMatrixActive(false);
|
||||
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
|
||||
// Add a property
|
||||
|
||||
@@ -118,12 +118,12 @@ cvf::ref<RifReaderInterface> RimResultReservoir::createMockModel(QString modelNa
|
||||
mockFileInterface->open("", reservoir.p());
|
||||
{
|
||||
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(1, 3, 4);
|
||||
reservoir->mainGrid()->cell(idx).setMatrixActive(false);
|
||||
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
|
||||
{
|
||||
size_t idx = reservoir->mainGrid()->cellIndexFromIJK(2, 2, 3);
|
||||
reservoir->mainGrid()->cell(idx).setMatrixActive(false);
|
||||
reservoir->mainGrid()->cell(idx).setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
}
|
||||
else if (modelName == "Result Mock Debug Model With Results")
|
||||
|
||||
@@ -38,10 +38,10 @@ RigCell::RigCell() :
|
||||
m_mainGridCellIndex(cvf::UNDEFINED_SIZE_T),
|
||||
m_subGrid(NULL),
|
||||
m_hostGrid(NULL),
|
||||
m_isMatrixActive(true),
|
||||
m_isInvalid(false),
|
||||
m_isWellCell(false),
|
||||
m_globalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T),
|
||||
m_globalFractureActiveIndex(cvf::UNDEFINED_SIZE_T),
|
||||
m_cellIndex(cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
memcpy(m_cornerIndices.m_array, undefinedCornersArray, 8*sizeof(size_t));
|
||||
|
||||
@@ -37,8 +37,13 @@ public:
|
||||
caf::SizeTArray8& cornerIndices() { return m_cornerIndices;}
|
||||
const caf::SizeTArray8& cornerIndices() const { return m_cornerIndices;}
|
||||
|
||||
bool matrixActive() const { return m_isMatrixActive; }
|
||||
void setMatrixActive(bool val) { m_isMatrixActive = val; }
|
||||
bool matrixActive() const { return m_globalMatrixActiveIndex != cvf::UNDEFINED_SIZE_T; }
|
||||
size_t globalMatrixActiveIndex() const { return m_globalMatrixActiveIndex; }
|
||||
void setGlobalMatrixActiveIndex(size_t val) { m_globalMatrixActiveIndex = val; }
|
||||
|
||||
bool fractureActive() const { return m_globalFractureActiveIndex != cvf::UNDEFINED_SIZE_T; }
|
||||
size_t globalFractureActiveIndex() const { return m_globalFractureActiveIndex; }
|
||||
void setGlobalFractureActiveIndex(size_t val) { m_globalFractureActiveIndex = val; }
|
||||
|
||||
bool isInvalid() const { return m_isInvalid; }
|
||||
void setInvalid( bool val ) { m_isInvalid = val; }
|
||||
@@ -49,8 +54,6 @@ public:
|
||||
size_t cellIndex() const { return m_cellIndex; }
|
||||
void setCellIndex(size_t val) { m_cellIndex = val; }
|
||||
|
||||
size_t globalMatrixActiveIndex() const { return m_globalMatrixActiveIndex; }
|
||||
void setGlobalMatrixActiveIndex(size_t val) { m_globalMatrixActiveIndex = val; }
|
||||
|
||||
RigLocalGrid* subGrid() const { return m_subGrid; }
|
||||
void setSubGrid(RigLocalGrid* subGrid) { m_subGrid = subGrid; }
|
||||
@@ -73,7 +76,6 @@ public:
|
||||
private:
|
||||
caf::SizeTArray8 m_cornerIndices;
|
||||
|
||||
bool m_isMatrixActive;
|
||||
bool m_isInvalid;
|
||||
bool m_isWellCell;
|
||||
|
||||
@@ -85,6 +87,8 @@ private:
|
||||
size_t m_parentCellIndex; ///< Grid cell index of the cell in the parent grid containing this cell
|
||||
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_globalMatrixActiveIndex; ///< This cell's running index of all the active calls in the reservoir. Used for result mapping
|
||||
size_t m_globalFractureActiveIndex; ///< This cell's running index of all the active calls in the reservoir. Used for result mapping
|
||||
|
||||
size_t m_cellIndex; ///< This cells index in the grid it belongs to.
|
||||
};
|
||||
|
||||
@@ -134,6 +134,7 @@ void RigReservoirBuilderMock::appendCubeNodes(const cvf::Vec3d& min, const cvf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigReservoirBuilderMock::appendCells(size_t nodeStartIndex, size_t cellCount, RigGridBase* hostGrid, std::vector<RigCell>& cells)
|
||||
{
|
||||
size_t activeCellIndex = 0;
|
||||
size_t i;
|
||||
for (i = 0; i < cellCount; i++)
|
||||
{
|
||||
@@ -152,7 +153,15 @@ void RigReservoirBuilderMock::appendCells(size_t nodeStartIndex, size_t cellCoun
|
||||
riCell.cornerIndices()[7] = nodeStartIndex + i * 8 + 7;
|
||||
|
||||
riCell.setParentCellIndex(0);
|
||||
if (!(i % 5)) riCell.setMatrixActive(false);
|
||||
|
||||
if (!(i % 5))
|
||||
{
|
||||
riCell.setGlobalMatrixActiveIndex(cvf::UNDEFINED_SIZE_T);
|
||||
}
|
||||
else
|
||||
{
|
||||
riCell.setGlobalMatrixActiveIndex(activeCellIndex++);
|
||||
}
|
||||
|
||||
cells.push_back(riCell);
|
||||
}
|
||||
@@ -283,7 +292,6 @@ bool RigReservoirBuilderMock::inputProperty(RigReservoir* reservoir, const QStri
|
||||
bool RigReservoirBuilderMock::staticResult(RigReservoir* reservoir, const QString& result, std::vector<double>* values)
|
||||
{
|
||||
size_t k;
|
||||
size_t rIdx = 0;
|
||||
|
||||
for (k = 0; k < reservoir->mainGrid()->cells().size(); k++)
|
||||
{
|
||||
@@ -298,10 +306,6 @@ bool RigReservoirBuilderMock::staticResult(RigReservoir* reservoir, const QStrin
|
||||
{
|
||||
values->push_back(500);
|
||||
}
|
||||
|
||||
cell.setGlobalMatrixActiveIndex(rIdx);
|
||||
++rIdx;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +330,6 @@ bool RigReservoirBuilderMock::dynamicResult(RigReservoir* reservoir, const QStri
|
||||
double offsetValue = 100 * resultIndex;
|
||||
|
||||
size_t k;
|
||||
size_t rIdx = 0;
|
||||
for (k = 0; k < reservoir->mainGrid()->cells().size(); k++)
|
||||
{
|
||||
RigCell& cell = reservoir->mainGrid()->cells()[k];
|
||||
@@ -341,9 +344,6 @@ bool RigReservoirBuilderMock::dynamicResult(RigReservoir* reservoir, const QStri
|
||||
{
|
||||
values->push_back(500);
|
||||
}
|
||||
|
||||
cell.setGlobalMatrixActiveIndex(rIdx);
|
||||
++rIdx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user