mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5273 Allen Diagrams: Create special geometry for Allen NNC results
This commit is contained in:
parent
3eb43342af
commit
71b118e7fb
@ -72,13 +72,22 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid,
|
||||
m_nativeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), true );
|
||||
m_oppositeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), false );
|
||||
|
||||
m_NNCGenerator = new RivNNCGeometryGenerator( grid->mainGrid()->nncData(),
|
||||
m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
m_NNCGenerator = new RivNNCGeometryGenerator( false,
|
||||
grid->mainGrid()->nncData(),
|
||||
grid->mainGrid()->displayModelOffset(),
|
||||
connIdxes.p() );
|
||||
|
||||
m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
m_NNCTextureCoords = new cvf::Vec2fArray;
|
||||
m_NNCTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
m_allenNNCGenerator = new RivNNCGeometryGenerator( true,
|
||||
grid->mainGrid()->nncData(),
|
||||
grid->mainGrid()->displayModelOffset(),
|
||||
connIdxes.p() );
|
||||
|
||||
m_allenNNCTextureCoords = new cvf::Vec2fArray;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -89,6 +98,7 @@ void RivFaultPartMgr::setCellVisibility( cvf::UByteArray* cellVisibilities )
|
||||
m_nativeFaultGenerator->setCellVisibility( cellVisibilities );
|
||||
m_oppositeFaultGenerator->setCellVisibility( cellVisibilities );
|
||||
m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
||||
m_allenNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
||||
|
||||
generatePartGeometry();
|
||||
}
|
||||
@ -397,6 +407,34 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geo = m_allenNNCGenerator->generateSurface();
|
||||
if ( geo.notNull() )
|
||||
{
|
||||
geo->computeNormals();
|
||||
|
||||
if ( useBufferObjects )
|
||||
{
|
||||
geo->setRenderMode( cvf::DrawableGeo::BUFFER_OBJECT );
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName( "Allen NNC in Fault. Grid " + cvf::String( static_cast<int>( m_grid->gridIndex() ) ) );
|
||||
part->setDrawable( geo.p() );
|
||||
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivSourceInfo> si = new RivSourceInfo( m_rimFault, m_grid->gridIndex() );
|
||||
si->m_NNCIndices = m_allenNNCGenerator->triangleToNNCIndex().p();
|
||||
part->setSourceInfo( si.p() );
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask( faultBit );
|
||||
part->setPriority( RivPartPriority::PartType::Nnc );
|
||||
|
||||
m_allenNNCFaces = part;
|
||||
}
|
||||
}
|
||||
|
||||
createLabelWithAnchorLine( m_nativeFaultFaces.p() );
|
||||
|
||||
updatePartEffect();
|
||||
@ -449,7 +487,9 @@ void RivFaultPartMgr::updatePartEffect()
|
||||
m_nativeFaultFaces->setPriority( RivPartPriority::PartType::TransparentFault );
|
||||
if ( m_oppositeFaultFaces.notNull() )
|
||||
m_oppositeFaultFaces->setPriority( RivPartPriority::PartType::TransparentFault );
|
||||
|
||||
if ( m_NNCFaces.notNull() ) m_NNCFaces->setPriority( RivPartPriority::PartType::TransparentNnc );
|
||||
if ( m_allenNNCFaces.notNull() ) m_allenNNCFaces->setPriority( RivPartPriority::PartType::TransparentNnc );
|
||||
|
||||
if ( m_nativeFaultGridLines.notNull() )
|
||||
{
|
||||
@ -643,7 +683,15 @@ void RivFaultPartMgr::appendMeshLinePartsToModel( cvf::ModelBasicList* model )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::appendNNCFacesToModel( cvf::ModelBasicList* model )
|
||||
void RivFaultPartMgr::appendCompleteNNCFacesToModel( cvf::ModelBasicList* model )
|
||||
{
|
||||
if ( m_allenNNCFaces.notNull() ) model->addPart( m_allenNNCFaces.p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::appendNativeNNCFacesToModel( cvf::ModelBasicList* model )
|
||||
{
|
||||
if ( m_NNCFaces.notNull() ) model->addPart( m_NNCFaces.p() );
|
||||
}
|
||||
@ -730,6 +778,12 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
|
||||
resultType,
|
||||
eclResAddr,
|
||||
nativeTimeStepIndex );
|
||||
|
||||
m_allenNNCGenerator->textureCoordinates( m_allenNNCTextureCoords.p(),
|
||||
mapper,
|
||||
resultType,
|
||||
eclResAddr,
|
||||
nativeTimeStepIndex );
|
||||
}
|
||||
}
|
||||
|
||||
@ -750,10 +804,18 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
|
||||
nncEffect = nncEffgen.generateCachedEffect();
|
||||
}
|
||||
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>( m_NNCFaces->drawable() );
|
||||
if ( dg ) dg->setTextureCoordArray( m_NNCTextureCoords.p() );
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>( m_NNCFaces->drawable() );
|
||||
if ( dg ) dg->setTextureCoordArray( m_NNCTextureCoords.p() );
|
||||
}
|
||||
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>( m_allenNNCFaces->drawable() );
|
||||
if ( dg ) dg->setTextureCoordArray( m_allenNNCTextureCoords.p() );
|
||||
}
|
||||
|
||||
m_NNCFaces->setEffect( nncEffect.p() );
|
||||
m_allenNNCFaces->setEffect( nncEffect.p() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -780,5 +842,6 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
|
||||
}
|
||||
|
||||
m_NNCFaces->setEffect( nncEffect.p() );
|
||||
m_allenNNCFaces->setEffect( nncEffect.p() );
|
||||
}
|
||||
}
|
||||
|
@ -68,10 +68,12 @@ public:
|
||||
|
||||
void appendNativeFaultFacesToModel( cvf::ModelBasicList* model );
|
||||
void appendOppositeFaultFacesToModel( cvf::ModelBasicList* model );
|
||||
void appendNNCFacesToModel( cvf::ModelBasicList* model );
|
||||
void appendLabelPartsToModel( cvf::ModelBasicList* model );
|
||||
void appendMeshLinePartsToModel( cvf::ModelBasicList* model );
|
||||
|
||||
void appendNativeNNCFacesToModel( cvf::ModelBasicList* model );
|
||||
void appendCompleteNNCFacesToModel( cvf::ModelBasicList* model );
|
||||
|
||||
private:
|
||||
void generatePartGeometry();
|
||||
void updatePartEffect();
|
||||
@ -108,6 +110,10 @@ private:
|
||||
cvf::ref<cvf::Part> m_NNCFaces;
|
||||
cvf::ref<cvf::Vec2fArray> m_NNCTextureCoords;
|
||||
|
||||
cvf::ref<RivNNCGeometryGenerator> m_allenNNCGenerator;
|
||||
cvf::ref<cvf::Part> m_allenNNCFaces;
|
||||
cvf::ref<cvf::Vec2fArray> m_allenNNCTextureCoords;
|
||||
|
||||
cvf::ref<cvf::Part> m_faultLabelPart;
|
||||
cvf::ref<cvf::Part> m_faultLabelLinePart;
|
||||
};
|
||||
|
@ -31,10 +31,12 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivNNCGeometryGenerator::RivNNCGeometryGenerator( const RigNNCData* nncData,
|
||||
RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllen,
|
||||
const RigNNCData* nncData,
|
||||
const cvf::Vec3d& offset,
|
||||
const cvf::Array<size_t>* nncIndexes )
|
||||
: m_nncData( nncData )
|
||||
: m_includeAllenDiagramGeometry( includeAllen )
|
||||
, m_nncData( nncData )
|
||||
, m_nncIndexes( nncIndexes )
|
||||
, m_offset( offset )
|
||||
{
|
||||
@ -86,6 +88,11 @@ void RivNNCGeometryGenerator::computeArrays()
|
||||
{
|
||||
size_t conIdx = m_nncIndexes.isNull() ? nIdx : ( *m_nncIndexes )[nIdx];
|
||||
|
||||
if ( !m_includeAllenDiagramGeometry && conIdx >= m_nncData->nativeConnectionCount() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const RigConnection& conn = m_nncData->connections()[conIdx];
|
||||
|
||||
if ( conn.m_polygon.size() )
|
||||
|
@ -42,7 +42,11 @@ class RigEclipseResultAddress;
|
||||
class RivNNCGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivNNCGeometryGenerator( const RigNNCData* nncData, const cvf::Vec3d& offset, const cvf::Array<size_t>* nncIndexes );
|
||||
RivNNCGeometryGenerator( bool includeAllen,
|
||||
const RigNNCData* nncData,
|
||||
const cvf::Vec3d& offset,
|
||||
const cvf::Array<size_t>* nncIndexes );
|
||||
|
||||
~RivNNCGeometryGenerator() override;
|
||||
|
||||
void setCellVisibility( const cvf::UByteArray* cellVisibilities, const RigGridBase* grid );
|
||||
@ -63,6 +67,8 @@ private:
|
||||
void computeArrays();
|
||||
|
||||
private:
|
||||
bool m_includeAllenDiagramGeometry;
|
||||
|
||||
// Input
|
||||
cvf::cref<RigNNCData> m_nncData;
|
||||
cvf::cref<cvf::Array<size_t>> m_nncIndexes;
|
||||
|
@ -154,7 +154,9 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
{
|
||||
if ( faultCollection->showNNCs() )
|
||||
{
|
||||
bool showNncs = true;
|
||||
bool showNncs = true;
|
||||
bool showAllenNncGeometry = false;
|
||||
|
||||
if ( faultCollection->hideNncsWhenNoResultIsAvailable() )
|
||||
{
|
||||
RigEclipseResultAddress eclipseResultAddress;
|
||||
@ -167,6 +169,11 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
eclipseResultAddress = cellResultColors->eclipseResultAddress();
|
||||
}
|
||||
|
||||
if ( eclipseResultAddress.m_resultCatType == RiaDefines::ALLEN_DIAGRAMS )
|
||||
{
|
||||
showAllenNncGeometry = true;
|
||||
}
|
||||
|
||||
RigMainGrid* mainGrid = m_reservoirView->mainGrid();
|
||||
if ( !( mainGrid && mainGrid->nncData()->hasScalarValues( eclipseResultAddress ) ) )
|
||||
{
|
||||
@ -176,7 +183,14 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
|
||||
if ( showNncs )
|
||||
{
|
||||
rivFaultPart->appendNNCFacesToModel( &parts );
|
||||
if ( showAllenNncGeometry )
|
||||
{
|
||||
rivFaultPart->appendCompleteNNCFacesToModel( &parts );
|
||||
}
|
||||
else
|
||||
{
|
||||
rivFaultPart->appendNativeNNCFacesToModel( &parts );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,14 @@ void RigNNCData::setConnections( std::vector<RigConnection>& connections )
|
||||
m_connections = connections;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigNNCData::nativeConnectionCount() const
|
||||
{
|
||||
return m_nativeConnectionCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -50,7 +50,8 @@ public:
|
||||
void processNativeConnections( const RigMainGrid& mainGrid );
|
||||
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid );
|
||||
|
||||
void setConnections( std::vector<RigConnection>& connections );
|
||||
void setConnections( std::vector<RigConnection>& connections );
|
||||
size_t nativeConnectionCount() const;
|
||||
|
||||
const std::vector<RigConnection>& connections() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user