mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5932 NNC data : Compute geometry when NNC data is asked for
This commit is contained in:
@@ -3105,13 +3105,6 @@ void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellRe
|
||||
if ( cellResultsData && cellResultsData->activeFormationNames() &&
|
||||
!cellResultsData->activeFormationNames()->formationNames().empty() )
|
||||
{
|
||||
// If import of NNC is disabled in preferences, we must make ensure that computed NNC connections are in place
|
||||
if ( mainGrid->nncData()->nativeConnectionCount() == mainGrid->nncData()->connections().size() )
|
||||
{
|
||||
mainGrid->nncData()->computeCompleteSetOfNncs( mainGrid, cellResultsData->activeCellInfo(), includeInactiveCells );
|
||||
mainGrid->distributeNNCsToFaults();
|
||||
}
|
||||
|
||||
auto fnNamesResAddr = RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES,
|
||||
RiaDefines::activeFormationNamesResultName() );
|
||||
auto fnAllanResultResAddr =
|
||||
|
||||
@@ -555,13 +555,6 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo, bool
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( computeNncs )
|
||||
{
|
||||
this->nncData()->computeCompleteSetOfNncs( this, activeCellInfo, includeInactiveCells );
|
||||
}
|
||||
|
||||
distributeNNCsToFaults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +66,8 @@ public:
|
||||
|
||||
size_t totalTemporaryGridCellCount() const;
|
||||
|
||||
RigNNCData* nncData();
|
||||
RigNNCData* nncData();
|
||||
|
||||
void setFaults( const cvf::Collection<RigFault>& faults );
|
||||
const cvf::Collection<RigFault>& faults() const;
|
||||
cvf::Collection<RigFault>& faults();
|
||||
|
||||
@@ -23,15 +23,39 @@
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigNNCData::RigNNCData()
|
||||
: m_connectionsAreProcessed( false )
|
||||
, m_mainGrid( nullptr )
|
||||
, m_activeCellInfo( nullptr )
|
||||
, m_computeNncForInactiveCells( false )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::setSourceDataForProcessing( RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells )
|
||||
{
|
||||
m_mainGrid = mainGrid;
|
||||
m_activeCellInfo = activeCellInfo;
|
||||
m_computeNncForInactiveCells = includeInactiveCells;
|
||||
|
||||
m_connectionsAreProcessed = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -67,7 +91,6 @@ void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells )
|
||||
{
|
||||
m_nativeConnectionCount = m_connections.size();
|
||||
RigConnectionContainer otherConnections =
|
||||
RigCellFaceGeometryTools::computeOtherNncs( mainGrid, m_connections, activeCellInfo, includeInactiveCells );
|
||||
|
||||
@@ -91,9 +114,42 @@ void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::setConnections( RigConnectionContainer& connections )
|
||||
void RigNNCData::ensureConnectionDataIsProcecced()
|
||||
{
|
||||
m_connections = connections;
|
||||
if ( m_connectionsAreProcessed ) return;
|
||||
|
||||
if ( m_mainGrid )
|
||||
{
|
||||
caf::ProgressInfo progressInfo( 3, "Computing NNC Data" );
|
||||
|
||||
RiaLogging::info( "NNC geometry computation - starting process" );
|
||||
|
||||
processNativeConnections( *m_mainGrid );
|
||||
progressInfo.incrementProgress();
|
||||
|
||||
computeCompleteSetOfNncs( m_mainGrid, m_activeCellInfo, m_computeNncForInactiveCells );
|
||||
progressInfo.incrementProgress();
|
||||
|
||||
m_connectionsAreProcessed = true;
|
||||
|
||||
m_mainGrid->distributeNNCsToFaults();
|
||||
|
||||
RiaLogging::info( "NNC geometry computation - completed process" );
|
||||
|
||||
RiaLogging::info( QString( "Native NNC count : %1" ).arg( nativeConnectionCount() ) );
|
||||
RiaLogging::info( QString( "Computed NNC count : %2" ).arg( m_connections.size() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::setNativeConnections( RigConnectionContainer& connections )
|
||||
{
|
||||
m_connections = connections;
|
||||
m_nativeConnectionCount = m_connections.size();
|
||||
|
||||
m_connectionsAreProcessed = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -107,8 +163,10 @@ size_t RigNNCData::nativeConnectionCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigConnectionContainer& RigNNCData::connections() const
|
||||
RigConnectionContainer& RigNNCData::connections()
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
|
||||
return m_connections;
|
||||
}
|
||||
|
||||
@@ -117,12 +175,24 @@ const RigConnectionContainer& RigNNCData::connections() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType )
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
|
||||
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
||||
results.resize( 1 );
|
||||
results[0].resize( m_connections.size(), HUGE_VAL );
|
||||
return results[0];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::makeScalarResultAndSetValues( const QString& nncDataType, const std::vector<double>& values )
|
||||
{
|
||||
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
||||
results.resize( 1 );
|
||||
results[0] = values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -49,19 +49,20 @@ public:
|
||||
|
||||
RigNNCData();
|
||||
|
||||
void processNativeConnections( const RigMainGrid& mainGrid );
|
||||
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
void ensureConnectionDataIsProcecced();
|
||||
void setSourceDataForProcessing( RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
|
||||
void setConnections( RigConnectionContainer& connections );
|
||||
void setNativeConnections( RigConnectionContainer& connections );
|
||||
size_t nativeConnectionCount() const;
|
||||
|
||||
const RigConnectionContainer& connections() const;
|
||||
RigConnectionContainer& connections();
|
||||
|
||||
std::vector<double>& makeStaticConnectionScalarResult( QString nncDataType );
|
||||
const std::vector<double>* staticConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
const std::vector<double>* staticConnectionScalarResultByName( const QString& nncDataType ) const;
|
||||
void makeScalarResultAndSetValues( const QString& nncDataType, const std::vector<double>& values );
|
||||
|
||||
std::vector<std::vector<double>>& makeDynamicConnectionScalarResult( QString nncDataType, size_t timeStepCount );
|
||||
const std::vector<std::vector<double>>* dynamicConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
@@ -91,9 +92,19 @@ private:
|
||||
const QString getNNCDataTypeFromScalarResultIndex( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
bool isNative( QString nncDataType ) const;
|
||||
|
||||
void processNativeConnections( const RigMainGrid& mainGrid );
|
||||
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
|
||||
private:
|
||||
RigConnectionContainer m_connections;
|
||||
size_t m_nativeConnectionCount;
|
||||
std::map<QString, std::vector<std::vector<double>>> m_connectionResults;
|
||||
std::map<RigEclipseResultAddress, QString> m_resultAddrToNNCDataType;
|
||||
|
||||
bool m_connectionsAreProcessed;
|
||||
RigMainGrid* m_mainGrid;
|
||||
const RigActiveCellInfo* m_activeCellInfo;
|
||||
bool m_computeNncForInactiveCells;
|
||||
};
|
||||
|
||||
@@ -558,7 +558,7 @@ void RigReservoirBuilderMock::addFaults( RigEclipseCaseData* eclipseCase )
|
||||
addNnc( grid, i1, j1, k1, i2, j2, k2, nncConnections );
|
||||
}
|
||||
|
||||
grid->nncData()->setConnections( nncConnections );
|
||||
grid->nncData()->setNativeConnections( nncConnections );
|
||||
|
||||
std::vector<double>& tranVals =
|
||||
grid->nncData()->makeStaticConnectionScalarResult( RiaDefines::propertyNameCombTrans() );
|
||||
|
||||
Reference in New Issue
Block a user