2013-12-10 15:44:40 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-24 00:14:52 -05:00
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-12-10 15:44:40 -06:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2013-12-10 15:44:40 -06:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2013-12-10 15:44:40 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RigNNCData.h"
|
2020-01-14 02:34:27 -06:00
|
|
|
|
|
|
|
#include "RigCellFaceGeometryTools.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RigEclipseResultAddress.h"
|
2013-12-10 15:44:40 -06:00
|
|
|
#include "RigMainGrid.h"
|
2020-01-14 02:34:27 -06:00
|
|
|
|
2020-05-15 00:32:33 -05:00
|
|
|
#include "RiaLogging.h"
|
|
|
|
|
|
|
|
#include "cafProgressInfo.h"
|
|
|
|
|
2013-12-11 07:55:14 -06:00
|
|
|
#include "cvfGeometryTools.h"
|
2013-12-10 15:44:40 -06:00
|
|
|
|
2020-05-15 00:32:33 -05:00
|
|
|
#include <QString>
|
|
|
|
|
2013-12-10 15:44:40 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-10 15:44:40 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RigNNCData::RigNNCData()
|
2020-05-15 00:32:33 -05:00
|
|
|
: m_connectionsAreProcessed( false )
|
|
|
|
, m_mainGrid( nullptr )
|
|
|
|
, m_activeCellInfo( nullptr )
|
|
|
|
, m_computeNncForInactiveCells( false )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigNNCData::setSourceDataForProcessing( RigMainGrid* mainGrid,
|
|
|
|
const RigActiveCellInfo* activeCellInfo,
|
|
|
|
bool includeInactiveCells )
|
2020-02-12 04:13:38 -06:00
|
|
|
{
|
2020-05-15 00:32:33 -05:00
|
|
|
m_mainGrid = mainGrid;
|
|
|
|
m_activeCellInfo = activeCellInfo;
|
|
|
|
m_computeNncForInactiveCells = includeInactiveCells;
|
|
|
|
|
|
|
|
m_connectionsAreProcessed = false;
|
2020-02-12 04:13:38 -06:00
|
|
|
}
|
2013-12-10 15:44:40 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-10 15:44:40 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-17 01:39:06 -06:00
|
|
|
void RigNNCData::processNativeConnections( const RigMainGrid& mainGrid )
|
2013-12-10 15:44:40 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
// cvf::Trace::show("NNC: Total number: " + cvf::String((int)m_connections.size()));
|
2013-12-11 07:55:14 -06:00
|
|
|
|
2020-05-13 05:09:07 -05:00
|
|
|
#pragma omp parallel for
|
2020-05-21 02:00:41 -05:00
|
|
|
for ( int cnIdx = 0; cnIdx < (int)m_connections.size(); ++cnIdx )
|
2013-12-10 15:44:40 -06:00
|
|
|
{
|
2020-05-14 12:11:45 -05:00
|
|
|
const RigCell& c1 = mainGrid.globalCellArray()[m_connections[cnIdx].c1GlobIdx()];
|
|
|
|
const RigCell& c2 = mainGrid.globalCellArray()[m_connections[cnIdx].c2GlobIdx()];
|
2013-12-10 15:44:40 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<size_t> connectionPolygon;
|
|
|
|
std::vector<cvf::Vec3d> connectionIntersections;
|
2017-11-02 03:31:09 -05:00
|
|
|
cvf::StructGridInterface::FaceType connectionFace = cvf::StructGridInterface::NO_FACE;
|
|
|
|
|
2020-02-12 04:43:15 -06:00
|
|
|
connectionFace =
|
|
|
|
RigCellFaceGeometryTools::calculateCellFaceOverlap( c1, c2, mainGrid, &connectionPolygon, &connectionIntersections );
|
2013-12-11 07:55:14 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( connectionFace != cvf::StructGridInterface::NO_FACE )
|
2017-11-02 03:31:09 -05:00
|
|
|
{
|
2020-05-14 12:11:45 -05:00
|
|
|
m_connections[cnIdx].setFace( connectionFace );
|
|
|
|
m_connections[cnIdx].setPolygon(
|
|
|
|
RigCellFaceGeometryTools::extractPolygon( mainGrid.nodes(), connectionPolygon, connectionIntersections ) );
|
2017-11-02 03:31:09 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-15 01:45:40 -06:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-13 07:20:46 -05:00
|
|
|
void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
|
|
|
const RigActiveCellInfo* activeCellInfo,
|
|
|
|
bool includeInactiveCells )
|
2020-01-15 01:45:40 -06:00
|
|
|
{
|
2020-05-12 11:19:27 -05:00
|
|
|
RigConnectionContainer otherConnections =
|
2020-05-13 07:20:46 -05:00
|
|
|
RigCellFaceGeometryTools::computeOtherNncs( mainGrid, m_connections, activeCellInfo, includeInactiveCells );
|
2020-01-15 01:45:40 -06:00
|
|
|
|
2020-01-29 07:52:12 -06:00
|
|
|
if ( !otherConnections.empty() )
|
|
|
|
{
|
2020-05-14 12:11:45 -05:00
|
|
|
m_connections.push_back( otherConnections );
|
2020-01-29 07:52:12 -06:00
|
|
|
|
|
|
|
// Transmissibility values from Eclipse has been read into propertyNameCombTrans in
|
|
|
|
// RifReaderEclipseOutput::transferStaticNNCData(). Initialize computed NNCs with zero transmissibility
|
|
|
|
auto it = m_connectionResults.find( RiaDefines::propertyNameCombTrans() );
|
|
|
|
if ( it != m_connectionResults.end() )
|
|
|
|
{
|
|
|
|
if ( !it->second.empty() )
|
|
|
|
{
|
|
|
|
it->second[0].resize( m_connections.size(), 0.0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-15 01:45:40 -06:00
|
|
|
}
|
|
|
|
|
2020-05-15 05:15:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
size_t RigNNCData::connectionsWithNoCommonArea( QStringList& connectionTextFirstItems, size_t maxItemCount )
|
|
|
|
{
|
|
|
|
size_t connectionWithNoCommonAreaCount = 0;
|
|
|
|
|
|
|
|
for ( size_t connIndex = 0; connIndex < m_connections.size(); connIndex++ )
|
|
|
|
{
|
|
|
|
if ( !m_connections[connIndex].hasCommonArea() )
|
|
|
|
{
|
|
|
|
connectionWithNoCommonAreaCount++;
|
|
|
|
|
2020-05-21 02:00:41 -05:00
|
|
|
if ( connectionTextFirstItems.size() < static_cast<int>( maxItemCount ) )
|
2020-05-15 05:15:30 -05:00
|
|
|
{
|
|
|
|
QString firstConnectionText;
|
|
|
|
QString secondConnectionText;
|
|
|
|
|
|
|
|
{
|
|
|
|
size_t gridLocalCellIndex;
|
|
|
|
const RigGridBase* hostGrid =
|
|
|
|
m_mainGrid->gridAndGridLocalIdxFromGlobalCellIdx( m_connections[connIndex].c1GlobIdx(),
|
|
|
|
&gridLocalCellIndex );
|
|
|
|
|
|
|
|
size_t i, j, k;
|
|
|
|
if ( hostGrid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k ) )
|
|
|
|
{
|
|
|
|
// Adjust to 1-based Eclipse indexing
|
|
|
|
i++;
|
|
|
|
j++;
|
|
|
|
k++;
|
|
|
|
|
|
|
|
if ( !hostGrid->isMainGrid() )
|
|
|
|
{
|
|
|
|
QString gridName = QString::fromStdString( hostGrid->gridName() );
|
|
|
|
firstConnectionText = gridName + " ";
|
|
|
|
}
|
|
|
|
firstConnectionText += QString( "[%1 %2 %3] - " ).arg( i ).arg( j ).arg( k );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
size_t gridLocalCellIndex;
|
|
|
|
const RigGridBase* hostGrid =
|
|
|
|
m_mainGrid->gridAndGridLocalIdxFromGlobalCellIdx( m_connections[connIndex].c2GlobIdx(),
|
|
|
|
&gridLocalCellIndex );
|
|
|
|
|
|
|
|
size_t i, j, k;
|
|
|
|
if ( hostGrid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k ) )
|
|
|
|
{
|
|
|
|
// Adjust to 1-based Eclipse indexing
|
|
|
|
i++;
|
|
|
|
j++;
|
|
|
|
k++;
|
|
|
|
|
|
|
|
if ( !hostGrid->isMainGrid() )
|
|
|
|
{
|
|
|
|
QString gridName = QString::fromStdString( hostGrid->gridName() );
|
|
|
|
secondConnectionText = gridName + " ";
|
|
|
|
}
|
|
|
|
secondConnectionText += QString( "[%1 %2 %3]" ).arg( i ).arg( j ).arg( k );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
connectionTextFirstItems.push_back( firstConnectionText + secondConnectionText );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return connectionWithNoCommonAreaCount;
|
|
|
|
}
|
|
|
|
|
2020-01-15 01:45:40 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-13 08:06:16 -06:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-16 08:51:59 -05:00
|
|
|
bool RigNNCData::ensureConnectionDataIsProcecced()
|
2020-01-13 08:06:16 -06:00
|
|
|
{
|
2020-05-16 08:51:59 -05:00
|
|
|
if ( m_connectionsAreProcessed ) return false;
|
2020-05-15 00:32:33 -05:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2020-05-15 05:15:30 -05:00
|
|
|
QStringList noCommonAreaText;
|
|
|
|
const size_t maxItemCount = 20;
|
|
|
|
|
|
|
|
size_t noCommonAreaCount = connectionsWithNoCommonArea( noCommonAreaText, maxItemCount );
|
|
|
|
|
2020-05-15 00:32:33 -05:00
|
|
|
RiaLogging::info( "NNC geometry computation - completed process" );
|
|
|
|
|
|
|
|
RiaLogging::info( QString( "Native NNC count : %1" ).arg( nativeConnectionCount() ) );
|
2020-05-15 05:15:30 -05:00
|
|
|
RiaLogging::info( QString( "Computed NNC count : %1" ).arg( m_connections.size() ) );
|
|
|
|
|
|
|
|
RiaLogging::info( QString( "NNCs with no common area count : %1" ).arg( noCommonAreaCount ) );
|
|
|
|
|
|
|
|
if ( !noCommonAreaText.isEmpty() )
|
|
|
|
{
|
|
|
|
RiaLogging::info( QString( "Listing first %1 NNCs with no common area " ).arg( noCommonAreaText.size() ) );
|
|
|
|
|
|
|
|
for ( const auto& s : noCommonAreaText )
|
|
|
|
{
|
|
|
|
RiaLogging::info( s );
|
|
|
|
}
|
|
|
|
}
|
2020-05-15 00:32:33 -05:00
|
|
|
}
|
2020-05-16 08:51:59 -05:00
|
|
|
|
|
|
|
return true;
|
2020-05-15 00:32:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigNNCData::setNativeConnections( RigConnectionContainer& connections )
|
|
|
|
{
|
|
|
|
m_connections = connections;
|
|
|
|
m_nativeConnectionCount = m_connections.size();
|
|
|
|
|
|
|
|
m_connectionsAreProcessed = false;
|
2020-01-13 08:06:16 -06:00
|
|
|
}
|
|
|
|
|
2020-01-17 07:44:36 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
size_t RigNNCData::nativeConnectionCount() const
|
|
|
|
{
|
|
|
|
return m_nativeConnectionCount;
|
|
|
|
}
|
|
|
|
|
2020-01-13 08:06:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-15 00:32:33 -05:00
|
|
|
RigConnectionContainer& RigNNCData::connections()
|
2020-01-13 08:06:16 -06:00
|
|
|
{
|
2020-05-15 00:32:33 -05:00
|
|
|
ensureConnectionDataIsProcecced();
|
|
|
|
|
2020-01-13 08:06:16 -06:00
|
|
|
return m_connections;
|
|
|
|
}
|
|
|
|
|
2014-09-04 02:28:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-09-04 02:28:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType )
|
2014-09-04 02:28:39 -05:00
|
|
|
{
|
2020-05-15 00:32:33 -05:00
|
|
|
ensureConnectionDataIsProcecced();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
|
|
|
results.resize( 1 );
|
|
|
|
results[0].resize( m_connections.size(), HUGE_VAL );
|
2017-06-26 03:25:08 -05:00
|
|
|
return results[0];
|
|
|
|
}
|
|
|
|
|
2020-05-15 00:32:33 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-06-26 03:25:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-26 03:25:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<double>* RigNNCData::staticConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return nullptr;
|
2017-06-26 03:25:08 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
std::map<QString, std::vector<std::vector<double>>>::const_iterator it = m_connectionResults.find( nncDataType );
|
2017-06-29 04:19:07 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2017-06-29 04:19:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CVF_ASSERT( it->second.size() == 1 );
|
|
|
|
return &( it->second[0] );
|
2017-06-29 04:19:07 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-29 04:19:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<double>* RigNNCData::staticConnectionScalarResultByName( const QString& nncDataType ) const
|
2017-06-29 04:19:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
std::map<QString, std::vector<std::vector<double>>>::const_iterator it = m_connectionResults.find( nncDataType );
|
2017-06-26 03:25:08 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CVF_ASSERT( it->second.size() == 1 );
|
|
|
|
return &( it->second[0] );
|
2017-06-26 03:25:08 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-26 03:25:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:43:15 -06:00
|
|
|
std::vector<std::vector<double>>& RigNNCData::makeDynamicConnectionScalarResult( QString nncDataType, size_t timeStepCount )
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
|
|
|
auto& results = m_connectionResults[nncDataType];
|
2019-09-06 03:40:57 -05:00
|
|
|
results.resize( timeStepCount );
|
2014-09-04 02:28:39 -05:00
|
|
|
return results;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-09-04 02:28:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<std::vector<double>>*
|
|
|
|
RigNNCData::dynamicConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const
|
2014-09-04 02:28:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return nullptr;
|
2017-06-26 03:25:08 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
2017-06-26 03:25:08 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second );
|
2017-06-26 03:25:08 -05:00
|
|
|
}
|
2014-09-04 02:28:39 -05:00
|
|
|
else
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
2014-09-04 02:28:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-09-04 02:28:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<double>* RigNNCData::dynamicConnectionScalarResult( const RigEclipseResultAddress& resVarAddr,
|
|
|
|
size_t timeStep ) const
|
2014-09-04 02:28:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return nullptr;
|
2017-06-26 03:25:08 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
2017-06-26 03:25:08 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2014-09-24 06:28:08 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it->second.size() > timeStep )
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second[timeStep] );
|
2017-06-26 03:25:08 -05:00
|
|
|
}
|
2014-09-24 06:28:08 -05:00
|
|
|
}
|
2017-06-26 03:25:08 -05:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-26 03:25:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<std::vector<double>>* RigNNCData::dynamicConnectionScalarResultByName( const QString& nncDataType ) const
|
2017-06-29 04:19:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
|
|
|
if ( it != m_connectionResults.end() )
|
2017-06-29 04:19:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second );
|
2017-06-29 04:19:07 -05:00
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-29 04:19:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:43:15 -06:00
|
|
|
const std::vector<double>* RigNNCData::dynamicConnectionScalarResultByName( const QString& nncDataType, size_t timeStep ) const
|
2017-06-29 04:19:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
|
|
|
if ( it != m_connectionResults.end() )
|
2017-06-29 04:19:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it->second.size() > timeStep )
|
2017-06-29 04:19:07 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second[timeStep] );
|
2017-06-29 04:19:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:43:15 -06:00
|
|
|
std::vector<std::vector<double>>& RigNNCData::makeGeneratedConnectionScalarResult( QString nncDataType, size_t timeStepCount )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
|
|
|
auto& results = m_connectionResults[nncDataType];
|
2019-09-06 03:40:57 -05:00
|
|
|
results.resize( timeStepCount );
|
2017-08-08 06:12:43 -05:00
|
|
|
return results;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<std::vector<double>>*
|
|
|
|
RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return nullptr;
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<double>* RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr,
|
|
|
|
size_t timeStep ) const
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return nullptr;
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it->second.size() > timeStep )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second[timeStep] );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return nullptr;
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:43:15 -06:00
|
|
|
std::vector<double>* RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr, size_t timeStep )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return nullptr;
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
2017-08-08 06:12:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it->second.size() > timeStep )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second[timeStep] );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType ) const
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const std::vector<double>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType,
|
|
|
|
size_t timeStep ) const
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it->second.size() > timeStep )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second[timeStep] );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-08 06:12:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<double>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType, size_t timeStep )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
|
|
|
if ( it != m_connectionResults.end() )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( it->second.size() > timeStep )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
return &( it->second[timeStep] );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-08-07 08:28:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-08-07 08:28:27 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<QString> RigNNCData::availableProperties( NNCResultType resultType ) const
|
2017-08-07 08:28:27 -05:00
|
|
|
{
|
|
|
|
std::vector<QString> properties;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto it : m_connectionResults )
|
2017-08-07 08:28:27 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
2017-08-07 08:28:27 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
properties.push_back( it.first );
|
2017-08-07 08:28:27 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
2017-08-08 06:12:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
properties.push_back( it.first );
|
2017-08-08 06:12:43 -05:00
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
else if ( resultType == NNC_GENERATED && !isNative( it.first ) )
|
2017-08-07 08:28:27 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
properties.push_back( it.first );
|
2017-08-07 08:28:27 -05:00
|
|
|
}
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2017-08-07 08:28:27 -05:00
|
|
|
return properties;
|
|
|
|
}
|
|
|
|
|
2017-06-29 04:19:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-29 04:19:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RigNNCData::setEclResultAddress( const QString& nncDataType, const RigEclipseResultAddress& resVarAddr )
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
2019-01-25 05:58:07 -06:00
|
|
|
m_resultAddrToNNCDataType[resVarAddr] = nncDataType;
|
2014-09-04 02:28:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-09-04 02:28:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
bool RigNNCData::hasScalarValues( const RigEclipseResultAddress& resVarAddr )
|
2014-09-04 02:28:39 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
|
|
|
if ( nncDataType.isNull() ) return false;
|
2017-06-26 03:25:08 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_connectionResults.find( nncDataType );
|
|
|
|
return ( it != m_connectionResults.end() );
|
2014-09-04 02:28:39 -05:00
|
|
|
}
|
|
|
|
|
2017-06-26 03:25:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-26 03:25:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
const QString RigNNCData::getNNCDataTypeFromScalarResultIndex( const RigEclipseResultAddress& resVarAddr ) const
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
auto it = m_resultAddrToNNCDataType.find( resVarAddr );
|
|
|
|
if ( it != m_resultAddrToNNCDataType.end() )
|
2017-06-26 03:25:08 -05:00
|
|
|
{
|
2017-06-29 04:19:07 -05:00
|
|
|
return it->second;
|
2017-06-26 03:25:08 -05:00
|
|
|
}
|
2017-06-29 04:19:07 -05:00
|
|
|
return QString();
|
2017-06-26 03:25:08 -05:00
|
|
|
}
|
|
|
|
|
2013-12-11 07:55:14 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2013-12-11 07:55:14 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
bool RigNNCData::isNative( QString nncDataType ) const
|
2013-12-11 07:55:14 -06:00
|
|
|
{
|
2020-01-13 07:45:39 -06:00
|
|
|
if ( nncDataType == RiaDefines::propertyNameCombTrans() || nncDataType == RiaDefines::propertyNameFluxGas() ||
|
|
|
|
nncDataType == RiaDefines::propertyNameFluxOil() || nncDataType == RiaDefines::propertyNameFluxWat() ||
|
|
|
|
nncDataType == RiaDefines::propertyNameRiCombMult() || nncDataType == RiaDefines::propertyNameRiCombTrans() ||
|
|
|
|
nncDataType == RiaDefines::propertyNameRiCombTransByArea() )
|
2013-12-11 07:55:14 -06:00
|
|
|
{
|
2017-08-08 06:12:43 -05:00
|
|
|
return true;
|
2013-12-11 07:55:14 -06:00
|
|
|
}
|
2017-08-08 06:12:43 -05:00
|
|
|
return false;
|
2013-12-10 15:44:40 -06:00
|
|
|
}
|