mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2046 Ignore neighbours with small area overlap
This commit is contained in:
parent
daeb7c3bdc
commit
0762a2f08f
@ -32,6 +32,7 @@
|
|||||||
#include "RigMainGrid.h"
|
#include "RigMainGrid.h"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include "cvfGeometryTools.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Based on the points and cells, calculate a pipe centerline
|
/// Based on the points and cells, calculate a pipe centerline
|
||||||
@ -534,7 +535,15 @@ public:
|
|||||||
{
|
{
|
||||||
if (cellNeighborsPair.second.size() > 2)
|
if (cellNeighborsPair.second.size() > 2)
|
||||||
{
|
{
|
||||||
|
// // If any of the other neighbors are found as neighbor to a particular neighbor we have a loop
|
||||||
|
// const auto & neighbors = cellNeighborsPair.second;
|
||||||
|
// for (size_t currentNeighbor : neighbors)
|
||||||
|
// {
|
||||||
|
// const auto& neighborsToCurrentNeighbor = m_cellsWithNeighbors[currentNeighbor];
|
||||||
|
// std::set<size_t> intersection;
|
||||||
|
// std::set_difference(neighbors.begin(), neighbors.end(), neighborsToCurrentNeighbor.begin(), neighborsToCurrentNeighbor.end(), std::back_inserter(intersection));
|
||||||
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,6 +789,10 @@ private:
|
|||||||
{
|
{
|
||||||
const std::vector<RigWellResultPoint>& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints;
|
const std::vector<RigWellResultPoint>& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints;
|
||||||
size_t cellCount = orgWellResultPoints.size();
|
size_t cellCount = orgWellResultPoints.size();
|
||||||
|
const std::vector<cvf::Vec3d>& nodes = m_eclipseCaseData->mainGrid()->nodes();
|
||||||
|
double cellSizeI, cellSizeJ, cellSizeK;
|
||||||
|
m_eclipseCaseData->mainGrid()->characteristicCellSizes(&cellSizeI, &cellSizeJ, &cellSizeK);
|
||||||
|
double stdArea = cellSizeK*(cellSizeI+cellSizeJ)*0.5;
|
||||||
|
|
||||||
for ( size_t cIdx = 0; cIdx < cellCount; ++ cIdx )
|
for ( size_t cIdx = 0; cIdx < cellCount; ++ cIdx )
|
||||||
{
|
{
|
||||||
@ -795,10 +808,29 @@ private:
|
|||||||
if ( idxToCloseCell != cIdx && m_cellsWithNeighbors[cIdx].count(idxToCloseCell) == 0 )
|
if ( idxToCloseCell != cIdx && m_cellsWithNeighbors[cIdx].count(idxToCloseCell) == 0 )
|
||||||
{
|
{
|
||||||
const RigCell& c2 = m_eclipseCaseData->cellFromWellResultCell(orgWellResultPoints[idxToCloseCell]);
|
const RigCell& c2 = m_eclipseCaseData->cellFromWellResultCell(orgWellResultPoints[idxToCloseCell]);
|
||||||
auto contactFace = RigNNCData::calculateCellFaceOverlap(c1, c2, *(m_eclipseCaseData->mainGrid()), nullptr, nullptr);
|
std::vector<size_t> poygonIndices;
|
||||||
|
std::vector<cvf::Vec3d> intersections;
|
||||||
|
|
||||||
|
auto contactFace = RigNNCData::calculateCellFaceOverlap(c1, c2, *(m_eclipseCaseData->mainGrid()), &poygonIndices, &intersections);
|
||||||
|
|
||||||
if ( contactFace != cvf::StructGridInterface::NO_FACE )
|
if ( contactFace != cvf::StructGridInterface::NO_FACE )
|
||||||
{
|
{
|
||||||
|
std::vector<cvf::Vec3d> realPolygon;
|
||||||
|
|
||||||
|
for ( size_t pIdx = 0; pIdx < poygonIndices.size(); ++pIdx )
|
||||||
|
{
|
||||||
|
if ( poygonIndices[pIdx] < nodes.size() )
|
||||||
|
realPolygon.push_back(nodes[poygonIndices[pIdx]]);
|
||||||
|
else
|
||||||
|
realPolygon.push_back(intersections[poygonIndices[pIdx] - nodes.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Polygon area vector
|
||||||
|
|
||||||
|
cvf::Vec3d area = cvf::GeometryTools::polygonAreaNormal3D(realPolygon);
|
||||||
|
|
||||||
|
if (area.length() < 1e-3 * stdArea) continue;
|
||||||
|
|
||||||
m_cellsWithNeighbors[cIdx].insert(idxToCloseCell);
|
m_cellsWithNeighbors[cIdx].insert(idxToCloseCell);
|
||||||
m_cellsWithNeighbors[idxToCloseCell].insert(cIdx);
|
m_cellsWithNeighbors[idxToCloseCell].insert(cIdx);
|
||||||
}
|
}
|
||||||
@ -839,7 +871,7 @@ private:
|
|||||||
|
|
||||||
branchList.push_back(cellWithNeighborsPair.first);
|
branchList.push_back(cellWithNeighborsPair.first);
|
||||||
|
|
||||||
unsigned endToGrow = 0; // 0 end, 1 front, 1< new branch
|
unsigned endToGrow = 0; // 0 end, 1 front, > 1 new branch
|
||||||
for ( size_t neighbour : cellWithNeighborsPair.second )
|
for ( size_t neighbour : cellWithNeighborsPair.second )
|
||||||
{
|
{
|
||||||
if ( m_unusedWellCellIndices.count(neighbour) )
|
if ( m_unusedWellCellIndices.count(neighbour) )
|
||||||
|
Loading…
Reference in New Issue
Block a user