diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp index cf7c241852..80cc02b929 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.cpp @@ -441,3 +441,12 @@ size_t RigFemPart::resultValueIdxFromResultPosType( RigFemResultPosEnum resultPo CVF_ASSERT( false ); return 0u; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigFemPart::isHexahedron( size_t elementIdx ) const +{ + RigElementType elType = elementType( elementIdx ); + return elType == HEX8 || elType == HEX8P; +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h index 0ffb1c3579..9c65befbd1 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPart.h @@ -59,6 +59,7 @@ public: int elmId( size_t elementIdx ) const { return m_elementId[elementIdx]; } RigElementType elementType( size_t elementIdx ) const { return m_elementTypes[elementIdx]; } + bool isHexahedron( size_t elementIdx ) const; const int* connectivities( size_t elementIdx ) const { return &m_allElementConnectivities[m_elementConnectivityStartIndices[elementIdx]]; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp index 5855bd30ac..e9f5bbd8ad 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorMudWeightWindow.cpp @@ -209,7 +209,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( #pragma omp parallel for for ( int elmIdx = 0; elmIdx < elementCount; ++elmIdx ) { - RigElementType elmType = femPart->elementType( elmIdx ); + bool isHexahedron = femPart->isHexahedron( elmIdx ); double wellPathDeviation = getValueForElement( RimMudWeightWindowParameters::ParameterType::WELL_DEVIATION, parameterFrameData, @@ -247,7 +247,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( int elmNodeCount = RigFemTypes::elementNodeCount( femPart->elementType( elmIdx ) ); - if ( elmType == HEX8P || elmType == HEX8 ) + if ( isHexahedron ) { for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx ) { @@ -385,7 +385,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( #pragma omp parallel for for ( int elmIdx = 0; elmIdx < elementCount; ++elmIdx ) { - RigElementType elmType = femPart->elementType( elmIdx ); + bool isHexahedron = femPart->isHexahedron( elmIdx ); int elmNodeCount = RigFemTypes::elementNodeCount( femPart->elementType( elmIdx ) ); @@ -394,7 +394,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( size_t kMin = std::min( k, kRefLayer ); size_t kMax = std::max( k, kRefLayer ); - if ( ( elmType == HEX8P || elmType == HEX8 ) && validIndex ) + if ( isHexahedron && validIndex ) { for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx ) { @@ -406,7 +406,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate( for ( size_t currentK = kMin; currentK < kMax; currentK++ ) { size_t kElmIdx = femPartGrid->cellIndexFromIJK( i, j, currentK ); - if ( kElmIdx != cvf::UNDEFINED_SIZE_T && femPart->elementType( kElmIdx ) == HEX8P ) + if ( kElmIdx != cvf::UNDEFINED_SIZE_T && femPart->isHexahedron( kElmIdx ) ) { size_t kElmNodResIdx = femPart->elementNodeResultIdx( kElmIdx, elmNodIdx );