Skip to content

Commit

Permalink
Add option to flip node order for both parts
Browse files Browse the repository at this point in the history
Use data node coordinates to decide element sets
  • Loading branch information
jonjenssen committed Feb 13, 2024
1 parent 336dc57 commit 839d88c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ RimFaultReactivationModel::RimFaultReactivationModel()
CAF_PDM_InitField( &m_faultZoneCells, "FaultZoneCells", 0, "Fault Zone Width [cells]" );

CAF_PDM_InitField( &m_showModelPlane, "ShowModelPlane", true, "Show 2D Model" );
CAF_PDM_InitField( &m_flipNodeOrderFW, "FlipNodeOrderFW", false, "FW: Flip Node Order" );
CAF_PDM_InitField( &m_flipNodeOrderHW, "FlipNodeOrderHW", false, "HW: Flip Node Order" );

CAF_PDM_InitFieldNoDefault( &m_fault, "Fault", "Fault" );
m_fault.uiCapability()->setUiReadOnly( true );
Expand Down Expand Up @@ -342,6 +344,7 @@ void RimFaultReactivationModel::updateVisualization()
m_2Dmodel->setGenerator( generator );
m_2Dmodel->updateGeometry( m_startCellIndex, (cvf::StructGridInterface::FaceType)m_startCellFace() );
m_2Dmodel->postProcessElementSets( eclipseCase() );
m_2Dmodel->flipNodeOrder( m_flipNodeOrderFW, m_flipNodeOrderHW );

view->scheduleCreateDisplayModelAndRedraw();
}
Expand Down Expand Up @@ -472,6 +475,9 @@ void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::Pdm

gridModelGrp->add( &m_modelThickness );

gridModelGrp->add( &m_flipNodeOrderFW );
gridModelGrp->add( &m_flipNodeOrderHW );

auto appModelGrp = modelGrp->addNewGroup( "Appearance" );
appModelGrp->setCollapsedByDefault();
appModelGrp->add( &m_modelPart1Color );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ class RimFaultReactivationModel : public RimCheckableNamedObject, public RimPoly
caf::PdmField<cvf::Color3f> m_modelPart2Color;

caf::PdmField<bool> m_showModelPlane;
caf::PdmField<bool> m_flipNodeOrderFW;
caf::PdmField<bool> m_flipNodeOrderHW;

caf::PdmField<double> m_modelExtentFromAnchor;
caf::PdmField<double> m_modelMinZ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,12 @@ void RigFaultReactivationModel::postProcessElementSets( const RimEclipseCase* eC
m_3dparts[part]->postProcessElementSets( eCase->mainGrid(), cellInfo );
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFaultReactivationModel::flipNodeOrder( bool flipFW, bool flipHW )
{
if ( flipFW ) m_3dparts[GridPart::FW]->flipNodeOrder();
if ( flipHW ) m_3dparts[GridPart::HW]->flipNodeOrder();
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class RigFaultReactivationModel : public cvf::Object
RimFaultReactivation::GridPart normalPointsAt() const;

void postProcessElementSets( const RimEclipseCase* eCase );
void flipNodeOrder( bool flipFW, bool flipHW );

private:
std::shared_ptr<RigFaultReactivationModelGenerator> m_generator;
Expand Down
16 changes: 14 additions & 2 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ void RigGriddedPart3d::postProcessElementSets( const RigMainGrid* mainGrid, cons
{
if ( usedElements.contains( element ) ) continue;

auto corners = elementCorners( element );
auto corners = elementDataCorners( element );
bool bActive = false;

size_t cellIdx = 0;
Expand Down Expand Up @@ -738,7 +738,7 @@ void RigGriddedPart3d::updateElementSet( ElementSets elSet,
break;
}

auto corners = elementCorners( elIdx + t );
auto corners = elementDataCorners( elIdx + t );

size_t cellIdx = 0;
for ( const auto& p : corners )
Expand Down Expand Up @@ -767,3 +767,15 @@ void RigGriddedPart3d::updateElementSet( ElementSets elSet,
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGriddedPart3d::flipNodeOrder()
{
for ( auto& nodes : m_elementIndices )
{
std::swap( nodes[1], nodes[3] );
std::swap( nodes[5], nodes[7] );
}
}
1 change: 1 addition & 0 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class RigGriddedPart3d : public cvf::Object
void setUseLocalCoordinates( bool useLocalCoordinates );

void postProcessElementSets( const RigMainGrid* mainGrid, const RigActiveCellInfo* cellInfo );
void flipNodeOrder();

bool useLocalCoordinates() const;
double topHeight() const;
Expand Down

0 comments on commit 839d88c

Please sign in to comment.