Skip to content

Commit

Permalink
Fix data access crash when no temp is available
Browse files Browse the repository at this point in the history
Change element node order
  • Loading branch information
jonjenssen committed Feb 15, 2024
1 parent 5cfabbb commit bac0073
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ void RimFaultReactivationDataAccessorTemperature::updateResultAccessor()
m_resultAccessor =
RigResultAccessorFactory::createFromResultAddress( m_caseData, 0, RiaDefines::PorosityModelType::MATRIX_MODEL, m_timeStep, resVarAddress );

auto [wellPaths, extractors] =
RimFaultReactivationDataAccessorWellLogExtraction::createEclipseWellPathExtractors( *m_model, *m_caseData, m_seabedDepth );
m_wellPaths = wellPaths;
m_extractors = extractors;
if ( m_resultAccessor.notNull() )
{
auto [wellPaths, extractors] =
RimFaultReactivationDataAccessorWellLogExtraction::createEclipseWellPathExtractors( *m_model, *m_caseData, m_seabedDepth );
m_wellPaths = wellPaths;
m_extractors = extractors;

m_gradient = computeGradient();
m_gradient = computeGradient();
}
}

//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ 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 @@ -344,7 +342,6 @@ 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 @@ -475,9 +472,6 @@ 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,8 +162,6 @@ 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,12 +264,3 @@ 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,7 +87,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t sta
m_horizontalPartition,
m_modelThickness,
m_topReservoirBack.z(),
m_modelNormal,
-1.0 * m_modelNormal,
m_faultZoneCells );

frontPart->generateLocalNodes( m_localCoordTransform );
Expand Down
26 changes: 7 additions & 19 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,15 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
{
for ( int t = 0; t < nThicknessCells; t++, elementIdx++ )
{
m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i );
m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i + nThicknessOff );
m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i + nThicknessOff + 1 );
m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i + 1 );

m_elementIndices[elementIdx].push_back( t + i );
m_elementIndices[elementIdx].push_back( t + i + nThicknessOff );
m_elementIndices[elementIdx].push_back( t + i + nThicknessOff + 1 );
m_elementIndices[elementIdx].push_back( t + i + 1 );
m_elementIndices[elementIdx].push_back( t + i + nThicknessOff + 1 );
m_elementIndices[elementIdx].push_back( t + i + nThicknessOff );

m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i );
m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i + 1 );
m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i + nThicknessOff + 1 );
m_elementIndices[elementIdx].push_back( t + nextLayerIdxOff + i + nThicknessOff );

if ( v == 0 )
{
Expand Down Expand Up @@ -767,15 +767,3 @@ 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: 0 additions & 1 deletion ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ 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 bac0073

Please sign in to comment.