mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8375 NNC : Create NNC generators when NNC data is available
This approach fixes an NNC visibility issue related to use of m_rimFault->faultGeometry()->connectionIndices() before any was assigned in RigMainGrid::distributeNNCsToFaults()
This commit is contained in:
parent
869921d300
commit
8fea45c267
@ -247,7 +247,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
|||||||
|
|
||||||
for ( size_t nIdx = 0; nIdx < nncData->eclipseConnectionCount(); ++nIdx )
|
for ( size_t nIdx = 0; nIdx < nncData->eclipseConnectionCount(); ++nIdx )
|
||||||
{
|
{
|
||||||
const RigConnection& conn = nncData->eclipseConnections()[nIdx];
|
const RigConnection& conn = nncData->availableConnections()[nIdx];
|
||||||
if ( conn.polygon().size() )
|
if ( conn.polygon().size() )
|
||||||
{
|
{
|
||||||
double resultValue = 0.0;
|
double resultValue = 0.0;
|
||||||
|
@ -125,13 +125,16 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createOutlineMeshDrawable(
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RivFaultGeometryGenerator::hasConnection( size_t cellIdx,
|
bool RivFaultGeometryGenerator::hasConnection( size_t cellIdx,
|
||||||
cvf::StructGridInterface::FaceType face,
|
cvf::StructGridInterface::FaceType face,
|
||||||
RigConnectionContainer& conns )
|
const RigConnectionContainer& conns,
|
||||||
|
const std::vector<size_t>& nncConnectionIndices )
|
||||||
{
|
{
|
||||||
cvf::StructGridInterface::FaceType oppositeFace = cvf::StructGridInterface::oppositeFace( face );
|
cvf::StructGridInterface::FaceType oppositeFace = cvf::StructGridInterface::oppositeFace( face );
|
||||||
|
|
||||||
for ( size_t i = 0; i < conns.size(); i++ )
|
for ( auto i : nncConnectionIndices )
|
||||||
{
|
{
|
||||||
auto& r = conns[i];
|
if ( i >= conns.size() ) continue;
|
||||||
|
|
||||||
|
const auto& r = conns[i];
|
||||||
|
|
||||||
if ( ( r.c1GlobIdx() == cellIdx ) && ( r.face() == face ) && r.hasCommonArea() ) return true;
|
if ( ( r.c1GlobIdx() == cellIdx ) && ( r.face() == face ) && r.hasCommonArea() ) return true;
|
||||||
|
|
||||||
@ -152,7 +155,8 @@ void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeig
|
|||||||
|
|
||||||
cvf::Vec3d offset = m_grid->displayModelOffset();
|
cvf::Vec3d offset = m_grid->displayModelOffset();
|
||||||
|
|
||||||
auto& connections = m_nncData->connections();
|
auto connIndices = m_fault->connectionIndices();
|
||||||
|
auto& connections = m_nncData->availableConnections();
|
||||||
|
|
||||||
const std::vector<RigFault::FaultFace>& faultFaces = m_fault->faultFaces();
|
const std::vector<RigFault::FaultFace>& faultFaces = m_fault->faultFaces();
|
||||||
|
|
||||||
@ -172,7 +176,8 @@ void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeig
|
|||||||
|
|
||||||
if ( !( *m_cellVisibility )[cellIndex] ) continue;
|
if ( !( *m_cellVisibility )[cellIndex] ) continue;
|
||||||
|
|
||||||
if ( onlyShowFacesWithDefinedNeighbors && !hasConnection( cellIndex, face, connections ) ) continue;
|
if ( onlyShowFacesWithDefinedNeighbors && !hasConnection( cellIndex, face, connections, connIndices ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
cvf::Vec3d cornerVerts[8];
|
cvf::Vec3d cornerVerts[8];
|
||||||
m_grid->cellCornerVertices( cellIndex, cornerVerts );
|
m_grid->cellCornerVertices( cellIndex, cornerVerts );
|
||||||
|
@ -65,7 +65,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
void computeArrays( bool onlyShowFacesWithDefinedNeighbors );
|
void computeArrays( bool onlyShowFacesWithDefinedNeighbors );
|
||||||
|
|
||||||
bool hasConnection( size_t cellIdx, cvf::StructGridInterface::FaceType face, RigConnectionContainer& conns );
|
bool hasConnection( size_t cellIdx,
|
||||||
|
cvf::StructGridInterface::FaceType face,
|
||||||
|
const RigConnectionContainer& conns,
|
||||||
|
const std::vector<size_t>& nncConnectionIndices );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Input
|
// Input
|
||||||
|
@ -72,8 +72,6 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid,
|
|||||||
|
|
||||||
{
|
{
|
||||||
CVF_ASSERT( rimFault->faultGeometry() );
|
CVF_ASSERT( rimFault->faultGeometry() );
|
||||||
cvf::ref<cvf::Array<size_t>> connIdxes = new cvf::Array<size_t>;
|
|
||||||
connIdxes->assign( rimFault->faultGeometry()->connectionIndices() );
|
|
||||||
|
|
||||||
m_nativeFaultGenerator =
|
m_nativeFaultGenerator =
|
||||||
new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), grid->mainGrid()->nncData(), true );
|
new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), grid->mainGrid()->nncData(), true );
|
||||||
@ -84,18 +82,8 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid,
|
|||||||
m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||||
m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||||
|
|
||||||
m_NNCGenerator = new RivNNCGeometryGenerator( false,
|
|
||||||
grid->mainGrid()->nncData(),
|
|
||||||
grid->mainGrid()->displayModelOffset(),
|
|
||||||
connIdxes.p() );
|
|
||||||
|
|
||||||
m_NNCTextureCoords = new cvf::Vec2fArray;
|
m_NNCTextureCoords = new cvf::Vec2fArray;
|
||||||
|
|
||||||
m_allanNNCGenerator = new RivNNCGeometryGenerator( true,
|
|
||||||
grid->mainGrid()->nncData(),
|
|
||||||
grid->mainGrid()->displayModelOffset(),
|
|
||||||
connIdxes.p() );
|
|
||||||
|
|
||||||
m_allanNNCTextureCoords = new cvf::Vec2fArray;
|
m_allanNNCTextureCoords = new cvf::Vec2fArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +94,9 @@ void RivFaultPartMgr::setCellVisibility( cvf::UByteArray* cellVisibilities )
|
|||||||
{
|
{
|
||||||
m_nativeFaultGenerator->setCellVisibility( cellVisibilities );
|
m_nativeFaultGenerator->setCellVisibility( cellVisibilities );
|
||||||
m_oppositeFaultGenerator->setCellVisibility( cellVisibilities );
|
m_oppositeFaultGenerator->setCellVisibility( cellVisibilities );
|
||||||
m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
|
||||||
m_allanNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
if ( m_NNCGenerator.notNull() ) m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
||||||
|
if ( m_allanNNCGenerator.notNull() ) m_allanNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
||||||
|
|
||||||
clearFlags();
|
clearFlags();
|
||||||
}
|
}
|
||||||
@ -403,6 +392,20 @@ void RivFaultPartMgr::generatePartGeometry()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RivFaultPartMgr::generateNativeNncPartGeometry()
|
void RivFaultPartMgr::generateNativeNncPartGeometry()
|
||||||
{
|
{
|
||||||
|
if ( m_NNCGenerator.isNull() )
|
||||||
|
{
|
||||||
|
auto nncConnectionIndices = m_rimFault->faultGeometry()->connectionIndices();
|
||||||
|
if ( !nncConnectionIndices.empty() )
|
||||||
|
{
|
||||||
|
m_NNCGenerator = new RivNNCGeometryGenerator( false,
|
||||||
|
m_grid->mainGrid()->nncData(),
|
||||||
|
m_grid->mainGrid()->displayModelOffset(),
|
||||||
|
nncConnectionIndices );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_NNCGenerator.isNull() ) return;
|
||||||
|
|
||||||
cvf::ref<cvf::DrawableGeo> geo = m_NNCGenerator->generateSurface();
|
cvf::ref<cvf::DrawableGeo> geo = m_NNCGenerator->generateSurface();
|
||||||
if ( geo.notNull() )
|
if ( geo.notNull() )
|
||||||
{
|
{
|
||||||
@ -438,6 +441,20 @@ void RivFaultPartMgr::generateNativeNncPartGeometry()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RivFaultPartMgr::generateAllNncPartGeometry()
|
void RivFaultPartMgr::generateAllNncPartGeometry()
|
||||||
{
|
{
|
||||||
|
if ( m_allanNNCGenerator.isNull() )
|
||||||
|
{
|
||||||
|
auto nncConnectionIndices = m_rimFault->faultGeometry()->connectionIndices();
|
||||||
|
if ( !nncConnectionIndices.empty() )
|
||||||
|
{
|
||||||
|
m_allanNNCGenerator = new RivNNCGeometryGenerator( true,
|
||||||
|
m_grid->mainGrid()->nncData(),
|
||||||
|
m_grid->mainGrid()->displayModelOffset(),
|
||||||
|
nncConnectionIndices );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_allanNNCGenerator.isNull() ) return;
|
||||||
|
|
||||||
cvf::ref<cvf::DrawableGeo> geo = m_allanNNCGenerator->generateSurface();
|
cvf::ref<cvf::DrawableGeo> geo = m_allanNNCGenerator->generateSurface();
|
||||||
if ( geo.notNull() )
|
if ( geo.notNull() )
|
||||||
{
|
{
|
||||||
|
@ -31,10 +31,10 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllan,
|
RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllan,
|
||||||
RigNNCData* nncData,
|
RigNNCData* nncData,
|
||||||
const cvf::Vec3d& offset,
|
const cvf::Vec3d& offset,
|
||||||
const cvf::Array<size_t>* nncIndexes )
|
const std::vector<size_t>& nncIndexes )
|
||||||
: m_includeAllanDiagramGeometry( includeAllan )
|
: m_includeAllanDiagramGeometry( includeAllan )
|
||||||
, m_nncData( nncData )
|
, m_nncData( nncData )
|
||||||
, m_nncIndexes( nncIndexes )
|
, m_nncIndexes( nncIndexes )
|
||||||
@ -76,7 +76,7 @@ void RivNNCGeometryGenerator::computeArrays()
|
|||||||
|
|
||||||
const cvf::Vec3f offset( m_offset );
|
const cvf::Vec3f offset( m_offset );
|
||||||
long long numConnections =
|
long long numConnections =
|
||||||
static_cast<long long>( m_nncIndexes.isNull() ? m_nncData->allConnections().size() : m_nncIndexes->size() );
|
static_cast<long long>( m_nncIndexes.empty() ? m_nncData->allConnections().size() : m_nncIndexes.size() );
|
||||||
|
|
||||||
bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull();
|
bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull();
|
||||||
std::vector<RigCell>* allCells = nullptr;
|
std::vector<RigCell>* allCells = nullptr;
|
||||||
@ -88,7 +88,7 @@ void RivNNCGeometryGenerator::computeArrays()
|
|||||||
#pragma omp parallel for ordered
|
#pragma omp parallel for ordered
|
||||||
for ( long long nIdx = 0; nIdx < numConnections; ++nIdx )
|
for ( long long nIdx = 0; nIdx < numConnections; ++nIdx )
|
||||||
{
|
{
|
||||||
size_t conIdx = m_nncIndexes.isNull() ? nIdx : ( *m_nncIndexes )[nIdx];
|
size_t conIdx = m_nncIndexes.empty() ? nIdx : m_nncIndexes[nIdx];
|
||||||
|
|
||||||
if ( !m_includeAllanDiagramGeometry && conIdx >= m_nncData->eclipseConnectionCount() )
|
if ( !m_includeAllanDiagramGeometry && conIdx >= m_nncData->eclipseConnectionCount() )
|
||||||
{
|
{
|
||||||
|
@ -42,10 +42,10 @@ class RigEclipseResultAddress;
|
|||||||
class RivNNCGeometryGenerator : public cvf::Object
|
class RivNNCGeometryGenerator : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RivNNCGeometryGenerator( bool includeAllan,
|
RivNNCGeometryGenerator( bool includeAllan,
|
||||||
RigNNCData* nncData,
|
RigNNCData* nncData,
|
||||||
const cvf::Vec3d& offset,
|
const cvf::Vec3d& offset,
|
||||||
const cvf::Array<size_t>* nncIndexes );
|
const std::vector<size_t>& nncIndexes );
|
||||||
|
|
||||||
~RivNNCGeometryGenerator() override;
|
~RivNNCGeometryGenerator() override;
|
||||||
|
|
||||||
@ -70,11 +70,11 @@ private:
|
|||||||
bool m_includeAllanDiagramGeometry;
|
bool m_includeAllanDiagramGeometry;
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
cvf::ref<RigNNCData> m_nncData;
|
cvf::ref<RigNNCData> m_nncData;
|
||||||
cvf::cref<cvf::Array<size_t>> m_nncIndexes;
|
std::vector<size_t> m_nncIndexes;
|
||||||
cvf::cref<cvf::UByteArray> m_cellVisibility;
|
cvf::cref<cvf::UByteArray> m_cellVisibility;
|
||||||
cvf::cref<RigGridBase> m_grid;
|
cvf::cref<RigGridBase> m_grid;
|
||||||
cvf::Vec3d m_offset;
|
cvf::Vec3d m_offset;
|
||||||
// Triangles
|
// Triangles
|
||||||
cvf::ref<cvf::Vec3fArray> m_vertices;
|
cvf::ref<cvf::Vec3fArray> m_vertices;
|
||||||
|
|
||||||
|
@ -79,12 +79,6 @@ void RigActiveCellInfo::setCellResultIndex( size_t reservoirCellIndex, size_t re
|
|||||||
CVF_TIGHT_ASSERT( reservoirCellResultIndex < m_cellIndexToResultIndex.size() );
|
CVF_TIGHT_ASSERT( reservoirCellResultIndex < m_cellIndexToResultIndex.size() );
|
||||||
|
|
||||||
m_cellIndexToResultIndex[reservoirCellIndex] = reservoirCellResultIndex;
|
m_cellIndexToResultIndex[reservoirCellIndex] = reservoirCellResultIndex;
|
||||||
|
|
||||||
// if ( reservoirCellResultIndex >= m_reservoirActiveCellCount )
|
|
||||||
// {
|
|
||||||
//#pragma omp critical
|
|
||||||
// m_reservoirActiveCellCount = reservoirCellResultIndex + 1;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -265,7 +265,7 @@ size_t RigNNCData::eclipseConnectionCount() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const RigConnectionContainer& RigNNCData::eclipseConnections() const
|
const RigConnectionContainer& RigNNCData::availableConnections() const
|
||||||
{
|
{
|
||||||
// Return connections without calling ensureConnectionDataIsProcessed() to avoid potential heavy computations
|
// Return connections without calling ensureConnectionDataIsProcessed() to avoid potential heavy computations
|
||||||
// Relevant if only native connection data is required
|
// Relevant if only native connection data is required
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
void setEclipseConnections( RigConnectionContainer& eclipseConnections );
|
void setEclipseConnections( RigConnectionContainer& eclipseConnections );
|
||||||
void buildPolygonsForEclipseConnections();
|
void buildPolygonsForEclipseConnections();
|
||||||
size_t eclipseConnectionCount() const;
|
size_t eclipseConnectionCount() const;
|
||||||
const RigConnectionContainer& eclipseConnections() const;
|
const RigConnectionContainer& availableConnections() const;
|
||||||
|
|
||||||
bool ensureAllConnectionDataIsProcessed();
|
bool ensureAllConnectionDataIsProcessed();
|
||||||
RigConnectionContainer& allConnections();
|
RigConnectionContainer& allConnections();
|
||||||
|
Loading…
Reference in New Issue
Block a user