mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3038 Remove code duplication
This commit is contained in:
parent
9617128464
commit
69d8d84612
@ -623,48 +623,12 @@ bool RimFracture::isEclipseCellWithinContainment(const RigMainGrid* mainGri
|
||||
CVF_ASSERT(fractureTemplate());
|
||||
if (!fractureTemplate()->fractureContainment()->isEnabled()) return true;
|
||||
|
||||
size_t anchorEclipseCell = findAnchorEclipseCell(mainGrid);
|
||||
size_t anchorEclipseCell = mainGrid->findReservoirCellIndexFromPoint(m_anchorPosition);
|
||||
|
||||
return fractureTemplate()->fractureContainment()->isEclipseCellWithinContainment(
|
||||
mainGrid, anchorEclipseCell, globalCellIndex, containmentCells);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimFracture::findAnchorEclipseCell(const RigMainGrid* mainGrid ) const
|
||||
{
|
||||
cvf::BoundingBox pointBBox;
|
||||
pointBBox.add(m_anchorPosition);
|
||||
|
||||
std::vector<size_t> cellIndices;
|
||||
mainGrid->findIntersectingCells(pointBBox, &cellIndices);
|
||||
|
||||
size_t cellContainingAchorPoint = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
for ( size_t cellIndex : cellIndices )
|
||||
{
|
||||
auto cornerIndices = mainGrid->globalCellArray()[cellIndex].cornerIndices();
|
||||
cvf::Vec3d vertices[8];
|
||||
vertices[0] = (mainGrid->nodes()[cornerIndices[0]]);
|
||||
vertices[1] = (mainGrid->nodes()[cornerIndices[1]]);
|
||||
vertices[2] = (mainGrid->nodes()[cornerIndices[2]]);
|
||||
vertices[3] = (mainGrid->nodes()[cornerIndices[3]]);
|
||||
vertices[4] = (mainGrid->nodes()[cornerIndices[4]]);
|
||||
vertices[5] = (mainGrid->nodes()[cornerIndices[5]]);
|
||||
vertices[6] = (mainGrid->nodes()[cornerIndices[6]]);
|
||||
vertices[7] = (mainGrid->nodes()[cornerIndices[7]]);
|
||||
|
||||
if ( RigHexIntersectionTools::isPointInCell(m_anchorPosition, vertices) )
|
||||
{
|
||||
cellContainingAchorPoint = cellIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return cellContainingAchorPoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -70,8 +70,6 @@ public:
|
||||
const std::set<size_t>& containmentCells,
|
||||
size_t globalCellIndex) const;
|
||||
|
||||
size_t findAnchorEclipseCell(const RigMainGrid* mainGrid) const;
|
||||
|
||||
cvf::Mat4d transformMatrix() const;
|
||||
double dip() const;
|
||||
double tilt() const;
|
||||
|
@ -228,7 +228,7 @@ std::set<size_t> RimFractureContainmentTools::fracturedCellsTruncatedByFaults(co
|
||||
|
||||
if (maximumFaultThrow > -1.0)
|
||||
{
|
||||
size_t anchorCellGlobalIndex = fracture->findAnchorEclipseCell(mainGrid);
|
||||
size_t anchorCellGlobalIndex = mainGrid->findReservoirCellIndexFromPoint(fracture->anchorPosition());
|
||||
appendNeighborCells(cellsIntersectingFracturePlane,
|
||||
mainGrid,
|
||||
anchorCellGlobalIndex,
|
||||
|
@ -358,7 +358,8 @@ QString RimSimWellFracture::createOneBasedIJKText() const
|
||||
{
|
||||
RigMainGrid* mainGrid = ownerCaseMainGrid();
|
||||
size_t i,j,k;
|
||||
size_t anchorCellIdx = findAnchorEclipseCell(mainGrid);
|
||||
size_t anchorCellIdx= mainGrid->findReservoirCellIndexFromPoint(anchorPosition());
|
||||
|
||||
if (anchorCellIdx == cvf::UNDEFINED_SIZE_T) return "";
|
||||
|
||||
size_t gridLocalCellIdx;
|
||||
|
Loading…
Reference in New Issue
Block a user