mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Store coarsening boxes in RigGridBase
Assign index to coarse cells back to coarse box they are a part of p4#: 21675
This commit is contained in:
parent
d6560d017e
commit
eff924c630
@ -141,10 +141,6 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn
|
|||||||
cell.setParentCellIndex(parentCellIndex);
|
cell.setParentCellIndex(parentCellIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Coarse cell info
|
|
||||||
ecl_coarse_cell_type * coarseCellData = ecl_grid_get_cell_coarse_group1( localEclGrid , localCellIdx);
|
|
||||||
cell.setInCoarseCell(coarseCellData != NULL);
|
|
||||||
|
|
||||||
// Corner coordinates
|
// Corner coordinates
|
||||||
int cIdx;
|
int cIdx;
|
||||||
for (cIdx = 0; cIdx < 8; ++cIdx)
|
for (cIdx = 0; cIdx < 8; ++cIdx)
|
||||||
@ -308,7 +304,8 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
|||||||
activeCellInfo->setGridActiveCellCounts(0, globalMatrixActiveSize);
|
activeCellInfo->setGridActiveCellCounts(0, globalMatrixActiveSize);
|
||||||
fractureActiveCellInfo->setGridActiveCellCounts(0, globalFractureActiveSize);
|
fractureActiveCellInfo->setGridActiveCellCounts(0, globalFractureActiveSize);
|
||||||
|
|
||||||
|
transferCoarseningInfo(mainEclGrid, mainGrid);
|
||||||
|
|
||||||
|
|
||||||
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
for (lgrIdx = 0; lgrIdx < numLGRs; ++lgrIdx)
|
||||||
{
|
{
|
||||||
@ -327,6 +324,9 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid,
|
|||||||
|
|
||||||
activeCellInfo->setGridActiveCellCounts(lgrIdx + 1, matrixActiveCellCount);
|
activeCellInfo->setGridActiveCellCounts(lgrIdx + 1, matrixActiveCellCount);
|
||||||
fractureActiveCellInfo->setGridActiveCellCounts(lgrIdx + 1, fractureActiveCellCount);
|
fractureActiveCellInfo->setGridActiveCellCounts(lgrIdx + 1, fractureActiveCellCount);
|
||||||
|
|
||||||
|
transferCoarseningInfo(localEclGrid, localGrid);
|
||||||
|
|
||||||
progInfo.setProgress(3 + lgrIdx);
|
progInfo.setProgress(3 + lgrIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1024,3 +1024,39 @@ std::vector<QDateTime> RifReaderEclipseOutput::timeSteps()
|
|||||||
return m_timeSteps;
|
return m_timeSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RifReaderEclipseOutput::transferCoarseningInfo(const ecl_grid_type* eclGrid, RigGridBase* grid)
|
||||||
|
{
|
||||||
|
int coarseGroupCount = ecl_grid_get_num_coarse_groups(eclGrid);
|
||||||
|
for (int i = 0; i < coarseGroupCount; i++)
|
||||||
|
{
|
||||||
|
ecl_coarse_cell_type* coarse_cell = ecl_grid_iget_coarse_group(eclGrid, i);
|
||||||
|
CVF_ASSERT(coarse_cell);
|
||||||
|
|
||||||
|
size_t i1 = static_cast<size_t>(ecl_coarse_cell_get_i1(coarse_cell));
|
||||||
|
size_t i2 = static_cast<size_t>(ecl_coarse_cell_get_i2(coarse_cell));
|
||||||
|
size_t j1 = static_cast<size_t>(ecl_coarse_cell_get_j1(coarse_cell));
|
||||||
|
size_t j2 = static_cast<size_t>(ecl_coarse_cell_get_j2(coarse_cell));
|
||||||
|
size_t k1 = static_cast<size_t>(ecl_coarse_cell_get_k1(coarse_cell));
|
||||||
|
size_t k2 = static_cast<size_t>(ecl_coarse_cell_get_k2(coarse_cell));
|
||||||
|
|
||||||
|
size_t coarseningBoxIdx = grid->addCoarseningBox(i1, i2, j1, j2, k1, k2);
|
||||||
|
|
||||||
|
for (size_t k = k1; k <= k2; k++)
|
||||||
|
{
|
||||||
|
for (size_t j = j1; j <= j2; j++)
|
||||||
|
{
|
||||||
|
for (size_t i = i1; i <= i2; i++)
|
||||||
|
{
|
||||||
|
size_t cellIdx = grid->cellIndexFromIJK(i, j, k);
|
||||||
|
RigCell c = grid->cell(cellIdx);
|
||||||
|
|
||||||
|
c.setCoarseningBoxIndex(coarseningBoxIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, 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, RigCaseData* eclipseCase);
|
static bool transferGeometry(const ecl_grid_type* mainEclGrid, RigCaseData* eclipseCase);
|
||||||
|
static void transferCoarseningInfo(const ecl_grid_type* eclGrid, RigGridBase* grid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readActiveCellInfo();
|
bool readActiveCellInfo();
|
||||||
|
@ -42,7 +42,7 @@ RigCell::RigCell() :
|
|||||||
m_hostGrid(NULL),
|
m_hostGrid(NULL),
|
||||||
m_isInvalid(false),
|
m_isInvalid(false),
|
||||||
m_cellIndex(cvf::UNDEFINED_SIZE_T),
|
m_cellIndex(cvf::UNDEFINED_SIZE_T),
|
||||||
m_isInCoarseCell(false)
|
m_coarseningBoxIndex(cvf::UNDEFINED_SIZE_T)
|
||||||
{
|
{
|
||||||
memcpy(m_cornerIndices.m_array, undefinedCornersArray, 8*sizeof(size_t));
|
memcpy(m_cornerIndices.m_array, undefinedCornersArray, 8*sizeof(size_t));
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ public:
|
|||||||
size_t mainGridCellIndex() const { return m_mainGridCellIndex; }
|
size_t mainGridCellIndex() const { return m_mainGridCellIndex; }
|
||||||
void setMainGridCellIndex(size_t mainGridCellContainingThisCell) { m_mainGridCellIndex = mainGridCellContainingThisCell; }
|
void setMainGridCellIndex(size_t mainGridCellContainingThisCell) { m_mainGridCellIndex = mainGridCellContainingThisCell; }
|
||||||
|
|
||||||
bool isInCoarseCell() const { return m_isInCoarseCell; }
|
size_t coarseningBoxIndex() const { return m_coarseningBoxIndex; }
|
||||||
void setInCoarseCell(bool isInCoarseCell) { m_isInCoarseCell = isInCoarseCell; }
|
void setCoarseningBoxIndex(size_t coarseningBoxIndex) { m_coarseningBoxIndex = coarseningBoxIndex; }
|
||||||
|
|
||||||
void setCellFaceFault(cvf::StructGridInterface::FaceType face) { m_cellFaceFaults[face] = true; }
|
void setCellFaceFault(cvf::StructGridInterface::FaceType face) { m_cellFaceFaults[face] = true; }
|
||||||
bool isCellFaceFault(cvf::StructGridInterface::FaceType face) const { return m_cellFaceFaults[face]; }
|
bool isCellFaceFault(cvf::StructGridInterface::FaceType face) const { return m_cellFaceFaults[face]; }
|
||||||
@ -71,9 +71,10 @@ private:
|
|||||||
RigGridBase* m_hostGrid;
|
RigGridBase* m_hostGrid;
|
||||||
RigLocalGrid* m_subGrid;
|
RigLocalGrid* m_subGrid;
|
||||||
|
|
||||||
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;
|
||||||
bool m_isInCoarseCell;
|
|
||||||
|
size_t m_coarseningBoxIndex; ///< If defined, index into list of coarsening boxes in RigGridBase
|
||||||
|
|
||||||
bool m_cellFaceFaults[6];
|
bool m_cellFaceFaults[6];
|
||||||
|
|
||||||
|
@ -457,6 +457,42 @@ size_t RigGridBase::globalGridCellIndex(size_t localGridCellIndex) const
|
|||||||
return m_indexToStartOfCells + localGridCellIndex;
|
return m_indexToStartOfCells + localGridCellIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
size_t RigGridBase::addCoarseningBox(size_t i1, size_t i2, size_t j1, size_t j2, size_t k1, size_t k2)
|
||||||
|
{
|
||||||
|
caf::SizeTArray6 box;
|
||||||
|
box[0] = i1;
|
||||||
|
box[1] = i2;
|
||||||
|
box[2] = j1;
|
||||||
|
box[3] = j2;
|
||||||
|
box[4] = k1;
|
||||||
|
box[5] = k2;
|
||||||
|
|
||||||
|
m_coarseningBoxInfo.push_back(box);
|
||||||
|
|
||||||
|
return m_coarseningBoxInfo.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigGridBase::coarseningBox(size_t coarseningBoxIndex, size_t* i1, size_t* i2, size_t* j1, size_t* j2, size_t* k1, size_t* k2) const
|
||||||
|
{
|
||||||
|
CVF_ASSERT(coarseningBoxIndex < m_coarseningBoxInfo.size());
|
||||||
|
|
||||||
|
CVF_ASSERT(i1 && i2 && j1 && j2 && k1 && k2);
|
||||||
|
|
||||||
|
caf::SizeTArray6 box = m_coarseningBoxInfo[coarseningBoxIndex];
|
||||||
|
*i1 = box[0];
|
||||||
|
*i2 = box[1];
|
||||||
|
*j1 = box[2];
|
||||||
|
*j2 = box[3];
|
||||||
|
*k1 = box[4];
|
||||||
|
*k2 = box[5];
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "cvfStructGridScalarDataAccess.h"
|
#include "cvfStructGridScalarDataAccess.h"
|
||||||
#include "RifReaderInterface.h"
|
#include "RifReaderInterface.h"
|
||||||
|
#include "cafFixedArray.h"
|
||||||
|
|
||||||
|
|
||||||
class RigMainGrid;
|
class RigMainGrid;
|
||||||
@ -63,6 +64,9 @@ public:
|
|||||||
void computeFaults();
|
void computeFaults();
|
||||||
bool isMainGrid() const;
|
bool isMainGrid() const;
|
||||||
RigMainGrid* mainGrid() const { return m_mainGrid; }
|
RigMainGrid* mainGrid() const { return m_mainGrid; }
|
||||||
|
|
||||||
|
size_t addCoarseningBox(size_t i1, size_t i2, size_t j1, size_t j2, size_t k1, size_t k2);
|
||||||
|
void coarseningBox(size_t coarseningBoxIndex, size_t* i1, size_t* i2, size_t* j1, size_t* j2, size_t* k1, size_t* k2) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
|
friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
|
||||||
@ -101,6 +105,7 @@ 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;
|
||||||
|
|
||||||
|
std::vector<caf::SizeTArray6> m_coarseningBoxInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -540,12 +540,18 @@ public:
|
|||||||
hostCellJ.push_back(static_cast<qint32>(pj + 1)); // NB: 1-based index in Octave
|
hostCellJ.push_back(static_cast<qint32>(pj + 1)); // NB: 1-based index in Octave
|
||||||
hostCellK.push_back(static_cast<qint32>(pk + 1)); // NB: 1-based index in Octave
|
hostCellK.push_back(static_cast<qint32>(pk + 1)); // NB: 1-based index in Octave
|
||||||
|
|
||||||
// TODO: Handle coarse box concept
|
size_t coarseningIdx = globalCells[cIdx].coarseningBoxIndex();
|
||||||
coarseBoxIdx.push_back(-1);
|
if (coarseningIdx != cvf::UNDEFINED_SIZE_T)
|
||||||
|
{
|
||||||
|
coarseBoxIdx.push_back(static_cast<qint32>(coarseningIdx));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coarseBoxIdx.push_back(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool RiaGetActiveCellInfo_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellInfo>(RiaGetActiveCellInfo::commandName());
|
static bool RiaGetActiveCellInfo_init = RiaSocketCommandFactory::instance()->registerCreator<RiaGetActiveCellInfo>(RiaGetActiveCellInfo::commandName());
|
||||||
|
@ -40,6 +40,7 @@ typedef FixedArray<int, 4> IntArray4;
|
|||||||
typedef FixedArray<int, 8> IntArray8;
|
typedef FixedArray<int, 8> IntArray8;
|
||||||
typedef FixedArray<size_t, 3> SizeTArray3;
|
typedef FixedArray<size_t, 3> SizeTArray3;
|
||||||
typedef FixedArray<size_t, 4> SizeTArray4;
|
typedef FixedArray<size_t, 4> SizeTArray4;
|
||||||
|
typedef FixedArray<size_t, 6> SizeTArray6;
|
||||||
typedef FixedArray<size_t, 8> SizeTArray8;
|
typedef FixedArray<size_t, 8> SizeTArray8;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user