Removed the m_isWellCell member from RigCell, to make the grid data completely independent of case / result data

p4#: 20859
This commit is contained in:
Jacob Støren 2013-03-12 10:03:25 +01:00
parent 94065f29ed
commit 9ab0a397ef
5 changed files with 41 additions and 49 deletions

View File

@ -252,10 +252,10 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
switch (geometryType) switch (geometryType)
{ {
case ACTIVE: case ACTIVE:
computeNativeVisibility(cellVisibility, grid, activeCellInfo, false, false, true, m_reservoirView->showMainGrid() ); computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), false, false, true, m_reservoirView->showMainGrid() );
break; break;
case ALL_WELL_CELLS: case ALL_WELL_CELLS:
computeAllWellCellsVisibility(cellVisibility, grid); copyByteArray(cellVisibility, eclipseCase->wellCellsInGrid(gridIdx));
break; break;
case VISIBLE_WELL_CELLS: case VISIBLE_WELL_CELLS:
{ {
@ -290,7 +290,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
} }
break; break;
case INACTIVE: case INACTIVE:
computeNativeVisibility(cellVisibility, grid, activeCellInfo, m_reservoirView->showInvalidCells(), true, false, m_reservoirView->showMainGrid()); computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), m_reservoirView->showInvalidCells(), true, false, m_reservoirView->showMainGrid());
break; break;
case RANGE_FILTERED: case RANGE_FILTERED:
{ {
@ -385,28 +385,29 @@ void RivReservoirViewPartMgr::createPropertyFilteredGeometry(size_t frameIndex)
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells(); bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
for (size_t i = 0; i < grids.size(); ++i) for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
{ {
cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredGeometryFrames[frameIndex]->cellVisibility(i); cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredGeometryFrames[frameIndex]->cellVisibility(gIdx);
cvf::ref<cvf::UByteArray> rangeVisibility; cvf::ref<cvf::UByteArray> rangeVisibility;
cvf::ref<cvf::UByteArray> fenceVisibility; cvf::ref<cvf::UByteArray> fenceVisibility;
cvf::cref<cvf::UByteArray> cellIsWellCellStatuses = res->wellCellsInGrid(gIdx);
if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED); if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED);
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility(i); rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx);
fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(i); fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);
cellVisibility->resize(rangeVisibility->size()); cellVisibility->resize(rangeVisibility->size());
#pragma omp parallel for #pragma omp parallel for
for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx) for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx)
{ {
(*cellVisibility)[cellIdx] = (!hasActiveRangeFilters && !grids[i]->cell(cellIdx).isWellCell()) || (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx]; (*cellVisibility)[cellIdx] = (!hasActiveRangeFilters && !(*cellIsWellCellStatuses)[cellIdx]) || (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx];
} }
computePropertyVisibility(cellVisibility.p(), grids[i], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection()); computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection());
m_propFilteredGeometryFrames[frameIndex]->setCellVisibility(i, cellVisibility.p()); m_propFilteredGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p());
} }
m_propFilteredGeometryFramesNeedsRegen[frameIndex] = false; m_propFilteredGeometryFramesNeedsRegen[frameIndex] = false;
@ -435,26 +436,28 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells(); bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
for (size_t i = 0; i < grids.size(); ++i) for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
{ {
cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredWellGeometryFrames[frameIndex]->cellVisibility(i); cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredWellGeometryFrames[frameIndex]->cellVisibility(gIdx);
cvf::ref<cvf::UByteArray> rangeVisibility; cvf::ref<cvf::UByteArray> rangeVisibility;
cvf::ref<cvf::UByteArray> wellCellsOutsideVisibility; cvf::ref<cvf::UByteArray> wellCellsOutsideVisibility;
cvf::cref<cvf::UByteArray> cellIsWellCellStatuses = res->wellCellsInGrid(gIdx);
if (m_geometriesNeedsRegen[RANGE_FILTERED_WELL_CELLS]) createGeometry(RANGE_FILTERED_WELL_CELLS); if (m_geometriesNeedsRegen[RANGE_FILTERED_WELL_CELLS]) createGeometry(RANGE_FILTERED_WELL_CELLS);
rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(i); rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx);
if (m_geometriesNeedsRegen[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER); if (m_geometriesNeedsRegen[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
wellCellsOutsideVisibility = m_geometries[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(i); wellCellsOutsideVisibility = m_geometries[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);
cellVisibility->resize(rangeVisibility->size()); cellVisibility->resize(rangeVisibility->size());
#pragma omp parallel for #pragma omp parallel for
for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx) for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx)
{ {
(*cellVisibility)[cellIdx] = (!hasActiveRangeFilters && grids[i]->cell(cellIdx).isWellCell()) || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideVisibility)[cellIdx]; (*cellVisibility)[cellIdx] = (!hasActiveRangeFilters && !(*cellIsWellCellStatuses)[cellIdx]) || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideVisibility)[cellIdx];
} }
computePropertyVisibility(cellVisibility.p(), grids[i], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection()); computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection());
m_propFilteredWellGeometryFrames[frameIndex]->setCellVisibility(i, cellVisibility.p()); m_propFilteredWellGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p());
} }
m_propFilteredWellGeometryFramesNeedsRegen[frameIndex] = false; m_propFilteredWellGeometryFramesNeedsRegen[frameIndex] = false;
@ -463,7 +466,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Evaluate visibility based on cell state /// Evaluate visibility based on cell state
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses,
bool invalidCellsIsVisible, bool invalidCellsIsVisible,
bool inactiveCellsIsVisible, bool inactiveCellsIsVisible,
bool activeCellsIsVisible, bool activeCellsIsVisible,
@ -472,6 +475,9 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
CVF_ASSERT(cellVisibility != NULL); CVF_ASSERT(cellVisibility != NULL);
CVF_ASSERT(grid != NULL); CVF_ASSERT(grid != NULL);
CVF_ASSERT(activeCellInfo != NULL); CVF_ASSERT(activeCellInfo != NULL);
CVF_ASSERT(cellIsInWellStatuses != NULL);
CVF_ASSERT(cellIsInWellStatuses->size() >= grid->cellCount());
cellVisibility->resize(grid->cellCount()); cellVisibility->resize(grid->cellCount());
#pragma omp parallel for #pragma omp parallel for
@ -484,7 +490,7 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
|| !inactiveCellsIsVisible && !activeCellInfo->isActiveInMatrixModel(globalCellIndex) || !inactiveCellsIsVisible && !activeCellInfo->isActiveInMatrixModel(globalCellIndex)
|| !activeCellsIsVisible && activeCellInfo->isActiveInMatrixModel(globalCellIndex) || !activeCellsIsVisible && activeCellInfo->isActiveInMatrixModel(globalCellIndex)
|| mainGridIsVisible && (cell.subGrid() != NULL) || mainGridIsVisible && (cell.subGrid() != NULL)
|| cell.isWellCell() || (*cellIsInWellStatuses)[cellIndex]
) )
{ {
(*cellVisibility)[cellIndex] = false; (*cellVisibility)[cellIndex] = false;
@ -498,27 +504,23 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Evaluate Well cell visibility based on cell state /// Copy the data from source into destination. This is not trivial to do using cvf::Array ...
/// using parallelized operator [] and not memcopy. Do not know what is faster.
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeAllWellCellsVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid ) void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const cvf::UByteArray* source )
{ {
CVF_ASSERT(cellVisibility != NULL); CVF_ASSERT(destination != NULL);
CVF_ASSERT(grid != NULL); CVF_ASSERT(source != NULL);
cellVisibility->resize(grid->cellCount());
if (destination->size() != source->size())
{
destination->resize(source->size());
}
#pragma omp parallel for #pragma omp parallel for
for (int cellIndex = 0; cellIndex < static_cast<int>(grid->cellCount()); cellIndex++) for (int cellIndex = 0; cellIndex < static_cast<int>(source->size()); cellIndex++)
{ {
const RigCell& cell = grid->cell(cellIndex); (*destination)[cellIndex] = (*source)[cellIndex];
if ( cell.isWellCell() )
{
(*cellVisibility)[cellIndex] = true;
}
else
{
(*cellVisibility)[cellIndex] = false;
}
} }
} }

View File

@ -78,10 +78,10 @@ private:
void clearGeometryCache(ReservoirGeometryCacheType geomType); void clearGeometryCache(ReservoirGeometryCacheType geomType);
static void computeNativeVisibility (cvf::UByteArray* cellVisibility, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, bool invalidCellsIsVisible, bool inactiveCellsIsVisible, bool activeCellsIsVisible, bool mainGridIsVisible); static void computeNativeVisibility (cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses, bool invalidCellsIsVisible, bool inactiveCellsIsVisible, bool activeCellsIsVisible, bool mainGridIsVisible);
static void computeRangeVisibility (cvf::UByteArray* cellVisibility, const RigGridBase* grid, const cvf::UByteArray* nativeVisibility, const RimCellRangeFilterCollection* rangeFilterColl); static void computeRangeVisibility (cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const cvf::UByteArray* nativeVisibility, const RimCellRangeFilterCollection* rangeFilterColl);
static void computePropertyVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, size_t timeStepIndex, const cvf::UByteArray* rangeFilterVisibility, RimCellPropertyFilterCollection* propFilterColl); static void computePropertyVisibility(cvf::UByteArray* cellVisibilities, const RigGridBase* grid, size_t timeStepIndex, const cvf::UByteArray* rangeFilterVisibility, RimCellPropertyFilterCollection* propFilterColl);
static void computeAllWellCellsVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid ); static void copyByteArray(cvf::UByteArray* cellVisibilities, const cvf::UByteArray* cellIsWellStatuses );
private: private:

View File

@ -41,7 +41,6 @@ RigCell::RigCell() :
m_subGrid(NULL), m_subGrid(NULL),
m_hostGrid(NULL), m_hostGrid(NULL),
m_isInvalid(false), m_isInvalid(false),
m_isWellCell(false),
m_cellIndex(cvf::UNDEFINED_SIZE_T), m_cellIndex(cvf::UNDEFINED_SIZE_T),
m_isInCoarseCell(false) m_isInCoarseCell(false)
{ {

View File

@ -40,13 +40,9 @@ public:
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; }
bool isWellCell() const { return m_isWellCell; }
void setAsWellCell(bool isWellCell) { m_isWellCell = isWellCell; }
size_t cellIndex() const { return m_cellIndex; } size_t cellIndex() const { return m_cellIndex; }
void setCellIndex(size_t val) { m_cellIndex = val; } void setCellIndex(size_t val) { m_cellIndex = val; }
RigLocalGrid* subGrid() const { return m_subGrid; } RigLocalGrid* subGrid() const { return m_subGrid; }
void setSubGrid(RigLocalGrid* subGrid) { m_subGrid = subGrid; } void setSubGrid(RigLocalGrid* subGrid) { m_subGrid = subGrid; }
@ -82,7 +78,4 @@ private:
bool m_cellFaceFaults[6]; bool m_cellFaceFaults[6];
bool m_isInvalid; bool m_isInvalid;
// Result case specific data
bool m_isWellCell;
}; };

View File

@ -141,7 +141,6 @@ void RigEclipseCase::computeWellCellsPrGrid()
size_t gridCellIndex = wellCells.m_wellHead.m_gridCellIndex; size_t gridCellIndex = wellCells.m_wellHead.m_gridCellIndex;
CVF_ASSERT(gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size()); CVF_ASSERT(gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size());
grids[gridIndex]->cell(gridCellIndex).setAsWellCell(true);
m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true); m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true);
size_t sIdx; size_t sIdx;
@ -156,7 +155,6 @@ void RigEclipseCase::computeWellCellsPrGrid()
CVF_ASSERT(gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size()); CVF_ASSERT(gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size());
grids[gridIndex]->cell(gridCellIndex).setAsWellCell(true);
m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true); m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true);
} }
} }