(#540) Range filter matching: Prioritize cell matches with collapsed eclipse cells less.

To make better matches when one or more corner of the range is in a
collapsed cells area
This commit is contained in:
Jacob Støren
2015-10-22 15:21:28 +02:00
parent 9d106ec76b
commit 44d1aaa3f1
4 changed files with 94 additions and 29 deletions

View File

@@ -221,6 +221,49 @@ bool RigCell::isLongPyramidCell(double maxHeightFactor, double nodeNearTolerance
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigCell::isCollapsedCell(double nodeNearTolerance) const
{
const std::vector<cvf::Vec3d>& nodes = m_hostGrid->mainGrid()->nodes();
bool isPyramidCell = false;
cvf::ubyte faceVertexIndices[4];
cvf::ubyte oppFaceVertexIndices[4];
int face;
for ( face = 0; face < 6 ; face += 2)
{
cvf::StructGridInterface::cellFaceVertexIndices(static_cast<cvf::StructGridInterface::FaceType>(face), faceVertexIndices);
cvf::StructGridInterface::cellFaceVertexIndices(cvf::StructGridInterface::oppositeFace(static_cast<cvf::StructGridInterface::FaceType>(face)), oppFaceVertexIndices);
cvf::Vec3d c0 = nodes[m_cornerIndices[faceVertexIndices[0]]];
cvf::Vec3d c1 = nodes[m_cornerIndices[faceVertexIndices[1]]];
cvf::Vec3d c2 = nodes[m_cornerIndices[faceVertexIndices[2]]];
cvf::Vec3d c3 = nodes[m_cornerIndices[faceVertexIndices[3]]];
cvf::Vec3d oc0 = nodes[m_cornerIndices[oppFaceVertexIndices[0]]];
cvf::Vec3d oc1 = nodes[m_cornerIndices[oppFaceVertexIndices[1]]];
cvf::Vec3d oc2 = nodes[m_cornerIndices[oppFaceVertexIndices[2]]];
cvf::Vec3d oc3 = nodes[m_cornerIndices[oppFaceVertexIndices[3]]];
int zeroLengthEdgeCount = 0;
if (isNear(c0, oc0, nodeNearTolerance)) { ++zeroLengthEdgeCount; }
if (isNear(c1, oc3, nodeNearTolerance)) { ++zeroLengthEdgeCount; }
if (isNear(c2, oc2, nodeNearTolerance)) { ++zeroLengthEdgeCount; }
if (isNear(c3, oc1, nodeNearTolerance)) { ++zeroLengthEdgeCount; }
if (zeroLengthEdgeCount >= 4)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------