Added RigActiveCellInfo

Started refactoring aiming for extracting all active cell information into RigActiveCellInfo.
p4#: 20445
This commit is contained in:
Magne Sjaastad 2013-02-11 15:12:53 +01:00
parent c77f1879eb
commit 8fd8a31aec
12 changed files with 132 additions and 41 deletions

View File

@ -103,6 +103,7 @@ list( APPEND CPP_SOURCES
ReservoirDataModel/RigReservoirBuilderMock.cpp
ReservoirDataModel/RigWellResults.cpp
ReservoirDataModel/RigGridScalarDataAccess.cpp
ReservoirDataModel/RigActiveCellInfo.cpp
)
list( APPEND CPP_SOURCES
@ -158,6 +159,7 @@ set( RAW_SOURCES ${CPP_SOURCES} )
list( REMOVE_ITEM RAW_SOURCES RIStdInclude.cpp)
list( REMOVE_ITEM RAW_SOURCES ReservoirDataModel/RigReaderInterfaceECL.cpp)
list( REMOVE_ITEM RAW_SOURCES ReservoirDataModel/RigGridScalarDataAccess.cpp)
list( REMOVE_ITEM RAW_SOURCES ReservoirDataModel/RigActiveCellInfo.cpp)
list( REMOVE_ITEM RAW_SOURCES ModelVisualization/RivCellEdgeEffectGenerator.cpp)
list( REMOVE_ITEM RAW_SOURCES ModelVisualization/RivPipeGeometryGenerator.cpp)
list( REMOVE_ITEM RAW_SOURCES ModelVisualization/RivWellPipesPartMgr.cpp)

View File

@ -41,6 +41,8 @@ set( RESERVOIRDATAMODEL_CPP_SOURCES
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigWellResults.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigGridScalarDataAccess.cpp
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/RigActiveCellInfo.cpp
${ResInsight_SOURCE_DIR}/cafUserInterface/cafProgressInfo.cpp
)

View File

@ -169,7 +169,9 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigGridBase* localGrid, const e
}
// Mark inactive long pyramid looking cells as invalid
if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) )
// Forslag
//if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) )
if (!invalid)
{
cell.setInvalid(cell.isLongPyramidCell());
}
@ -746,24 +748,6 @@ void RifReaderEclipseOutput::readWellCells(RigReservoir* reservoir)
reservoir->setWellResults(wells);
}
//--------------------------------------------------------------------------------------------------
// For case DUALPORO, the well K index is reported outside the grid. If this happens,
// for the given IJ position, search from K=0 and upwards for first active cell.
//--------------------------------------------------------------------------------------------------
int RifReaderEclipseOutput::findSmallestActiveCellIndexK(const RigGridBase* grid, int cellI, int cellJ)
{
if (!grid) return -1;
for (int candidateCellK = 0; candidateCellK < grid->cellCountK(); candidateCellK++ )
{
if (grid->isCellActive(cellI, cellJ, candidateCellK))
{
return candidateCellK;
}
}
return -1;
}
//--------------------------------------------------------------------------------------------------
///

View File

@ -57,8 +57,6 @@ private:
void extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector<double>* values, const std::vector<double>& fileValues);
int findSmallestActiveCellIndexK( const RigGridBase* grid, int cellI, int cellJ);
static RifEclipseRestartDataAccess* staticResultsAccess(const QStringList& fileSet);
static RifEclipseRestartDataAccess* dynamicResultsAccess(const QStringList& fileSet);

View File

@ -0,0 +1,20 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigActiveCellInfo.h"

View File

@ -0,0 +1,91 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cvfBoundingBox.h"
#include <vector>
class RigActiveCellInfo
{
public:
RigActiveCellInfo();
void setGlobalCellCount(size_t globalCellCount);
bool isActiveInMatrixModel(size_t globalCellIndex) const;
size_t activeIndexInMatrixModel(size_t globalCellIndex) const;
void setActiveIndexInMatrixModel(size_t globalCellIndex, size_t globalActiveCellIndex);
bool isActiveInFractureModel(size_t globalCellIndex) const;
size_t activeIndexInFractureModel(size_t globalCellIndex) const;
void setActiveIndexInFractureModel(size_t globalCellIndex, size_t globalActiveCellIndex);
// From RigBase
// From RigMainGrid
size_t globalMatrixModelActiveCellCount() const;
size_t globalFractureModelActiveCellCount() const;
void setGlobalMatrixModelActiveCellCount (size_t globalMatrixModelActiveCellCount) { m_globalMatrixModelActiveCellCount = globalMatrixModelActiveCellCount; }
void setGlobalFractureModelActiveCellCount(size_t globalFractureModelActiveCellCount) { m_globalFractureModelActiveCellCount = globalFractureModelActiveCellCount;}
void matrixModelActiveCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
void validCellsBoundingBox(cvf::Vec3st& min, cvf::Vec3st& max) const;
private:
class GridActiveCellCounts
{
public:
size_t matrixModelActiveCellCount() const;
void setMatrixModelActiveCellCount(size_t activeMatrixModelCellCount);
size_t fractureModelActiveCellCount() const ;
void setFractureModelActiveCellCount(size_t activeFractureModelCellCount);
private:
size_t m_matrixModelActiveCellCount;
size_t m_fractureModelActiveCellCount;
};
private:
std::vector<size_t> m_activeInMatrixModel;
std::vector<size_t> m_activeInFractureModel;
std::vector<GridActiveCellCounts> m_perGridActiveCellInfo;
// From RigMainGrid
size_t m_globalMatrixModelActiveCellCount;
size_t m_globalFractureModelActiveCellCount;
cvf::Vec3st m_activeCellPositionMin;
cvf::Vec3st m_activeCellPositionMax;
cvf::Vec3st m_validCellPositionMin;
cvf::Vec3st m_validCellPositionMax;
cvf::BoundingBox m_activeCellsBoundingBox;
};

View File

@ -89,8 +89,9 @@ private:
bool m_cellFaceFaults[6];
// Result case specific data
bool m_isInvalid;
// Result case specific data
bool m_isWellCell;
size_t m_activeIndexInMatrixModel; ///< This cell's running index of all the active calls (matrix) in the reservoir

View File

@ -303,22 +303,6 @@ bool RigGridBase::isCellValid(size_t i, size_t j, size_t k) const
return !c.isInvalid();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigGridBase::isCellActive(size_t i, size_t j, size_t k) const
{
size_t idx = cellIndexFromIJK(i, j, k);
const RigCell& c = cell(idx);
if (!c.isActiveInMatrixModel() || c.isInvalid())
{
return false;
}
else
{
return true;
}
}
//--------------------------------------------------------------------------------------------------
/// TODO: Use structgrid::neighborIJKAtCellFace

View File

@ -93,7 +93,6 @@ public:
virtual size_t gridPointIndexFromIJK( size_t i, size_t j, size_t k ) const;
virtual cvf::Vec3d gridPointCoordinate( size_t i, size_t j, size_t k ) const;
virtual bool isCellActive( size_t i, size_t j, size_t k ) const;
virtual bool isCellValid( size_t i, size_t j, size_t k ) const;
virtual bool cellIJKNeighbor(size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const;

View File

@ -51,6 +51,17 @@ public:
bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultCell& sourceWellCellResult, const RigWellResultCell& otherWellCellResult) const;
// From RigMainGrid, can this function be moved to Octave socket server?
void calculateMatrixModelActiveCellInfo(std::vector<qint32>& gridNumber,
std::vector<qint32>& i,
std::vector<qint32>& j,
std::vector<qint32>& k,
std::vector<qint32>& parentGridNumber,
std::vector<qint32>& hostCellI,
std::vector<qint32>& hostCellJ,
std::vector<qint32>& hostCellK);
private:
void computeWellCellsPrGrid();

View File

@ -230,7 +230,7 @@ void StructGridInterface::characteristicCellSizes(double* iSize, double* jSize,
size_t i;
for (i = 0; i < cellCountI(); i += 10) // NB! Evaluate every n-th cell
{
if (isCellActive(i, j, k))
if (isCellValid(i, j, k))
{
size_t cellIndex = cellIndexFromIJK(i, j, k);
cellCornerVertices(cellIndex, cornerVerts);

View File

@ -57,7 +57,6 @@ public:
size_t cellCountK() const;
virtual bool isCellValid(size_t i, size_t j, size_t k) const = 0;
virtual bool isCellActive(size_t i, size_t j, size_t k) const = 0;
virtual cvf::Vec3d minCoordinate() const = 0;
virtual cvf::Vec3d maxCoordinate() const = 0;