#5273 Struct Grid: Add enum GridAxisType for IJK axis

This commit is contained in:
Magne Sjaastad 2020-01-15 09:42:38 +01:00
parent b6ec0e7315
commit 170e0ad173
5 changed files with 48 additions and 18 deletions

View File

@ -621,8 +621,9 @@ void RifEclipseInputFileTools::saveFault( QTextStream&
if ( refinement != cvf::Vec3st( 1, 1, 1 ) )
{
if ( faultCellAndFace.m_nativeFace == cvf::StructGridInterface::POS_I ||
faultCellAndFace.m_nativeFace == cvf::StructGridInterface::NEG_I )
auto gridAxis = cvf::StructGridInterface::gridAxisFromFace( faultCellAndFace.m_nativeFace );
if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_I )
{
if ( faultCellAndFace.m_nativeFace == cvf::StructGridInterface::POS_I )
{
@ -639,8 +640,7 @@ void RifEclipseInputFileTools::saveFault( QTextStream&
}
}
}
else if ( faultCellAndFace.m_nativeFace == cvf::StructGridInterface::POS_J ||
faultCellAndFace.m_nativeFace == cvf::StructGridInterface::NEG_J )
else if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_J )
{
if ( faultCellAndFace.m_nativeFace == cvf::StructGridInterface::POS_J )
{
@ -658,8 +658,7 @@ void RifEclipseInputFileTools::saveFault( QTextStream&
}
}
}
else if ( faultCellAndFace.m_nativeFace == cvf::StructGridInterface::POS_K ||
faultCellAndFace.m_nativeFace == cvf::StructGridInterface::NEG_K )
else if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_K )
{
if ( faultCellAndFace.m_nativeFace == cvf::StructGridInterface::POS_K )
{

View File

@ -291,13 +291,13 @@ void RigCaseToCaseRangeFilterMapper::convertRangeFilterEndPoints( const RigRange
cvf::UNDEFINED_SIZE_T};
for ( int faceIdx = 0; faceIdx < 6; ++faceIdx )
{
auto gridAxis = cvf::StructGridInterface::gridAxisFromFace(
cvf::StructGridInterface::FaceType( faceIdx ) );
int ijOrk = 0;
if ( faceIdx == cvf::StructGridInterface::POS_I || faceIdx == cvf::StructGridInterface::NEG_I )
ijOrk = 0;
if ( faceIdx == cvf::StructGridInterface::POS_J || faceIdx == cvf::StructGridInterface::NEG_J )
ijOrk = 1;
if ( faceIdx == cvf::StructGridInterface::POS_K || faceIdx == cvf::StructGridInterface::NEG_K )
ijOrk = 2;
if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_I ) ijOrk = 0;
if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_J ) ijOrk = 1;
if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_K ) ijOrk = 2;
cvf::ubyte surfCorners[4];
cvf::StructGridInterface::cellFaceVertexIndices( (cvf::StructGridInterface::FaceType)faceIdx,

View File

@ -247,24 +247,22 @@ std::vector<RigConnection> RigCellFaceGeometryTools::computeOtherNncs( const Rig
size_t ck = std::numeric_limits<size_t>::max();
mainGrid->ijkFromCellIndex( candidateCellIndex, &ci, &cj, &ck );
if ( sourceCellFace == cvf::StructGridInterface::POS_I ||
sourceCellFace == cvf::StructGridInterface::NEG_I )
auto gridAxis = cvf::StructGridInterface::gridAxisFromFace( sourceCellFace );
if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_I )
{
if ( ni != ci )
{
continue;
}
}
else if ( sourceCellFace == cvf::StructGridInterface::POS_J ||
sourceCellFace == cvf::StructGridInterface::NEG_J )
else if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_J )
{
if ( nj != cj )
{
continue;
}
}
else if ( sourceCellFace == cvf::StructGridInterface::POS_K ||
sourceCellFace == cvf::StructGridInterface::NEG_K )
else if ( gridAxis == cvf::StructGridInterface::GridAxisType::AXIS_K )
{
if ( nk != ck )
{

View File

@ -204,6 +204,29 @@ void StructGridInterface::neighborIJKAtCellFace(size_t i, size_t j, size_t k, Fa
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
StructGridInterface::GridAxisType StructGridInterface::gridAxisFromFace(FaceType face)
{
GridAxisType axis = GridAxisType::NO_AXIS;
if (face == cvf::StructGridInterface::POS_I || face == cvf::StructGridInterface::NEG_I)
{
axis = GridAxisType::AXIS_I;
}
else if (face == cvf::StructGridInterface::POS_J || face == cvf::StructGridInterface::NEG_J)
{
axis = GridAxisType::AXIS_J;
}
else if (face == cvf::StructGridInterface::POS_K || face == cvf::StructGridInterface::NEG_K)
{
axis = GridAxisType::AXIS_K;
}
return axis;
}
//--------------------------------------------------------------------------------------------------
/// Models with large absolute values for coordinate scalars will often end up with z-fighting due
/// to numerical limits in float used by OpenGL. displayModelOffset() is intended

View File

@ -70,6 +70,14 @@ public:
typedef caf::AppEnum<StructGridInterface::FaceType> FaceEnum;
enum class GridAxisType
{
AXIS_I,
AXIS_J,
AXIS_K,
NO_AXIS
};
public:
StructGridInterface();
@ -109,6 +117,8 @@ public:
static FaceType oppositeFace(FaceType face);
static void neighborIJKAtCellFace(size_t i, size_t j, size_t k, StructGridInterface::FaceType face, size_t* ni, size_t* nj, size_t* nk);
static GridAxisType gridAxisFromFace(FaceType face);
private:
mutable double m_characteristicCellSizeI;
mutable double m_characteristicCellSizeJ;