mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -2,132 +2,127 @@
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
// Copyright (C) Ceetron Solutions AS
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigNNCData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigNNCData::RigNNCData()
|
||||
RigNNCData::RigNNCData() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::processConnections( const RigMainGrid& mainGrid )
|
||||
{
|
||||
// cvf::Trace::show("NNC: Total number: " + cvf::String((int)m_connections.size()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::processConnections(const RigMainGrid& mainGrid)
|
||||
{
|
||||
//cvf::Trace::show("NNC: Total number: " + cvf::String((int)m_connections.size()));
|
||||
|
||||
for (size_t cnIdx = 0; cnIdx < m_connections.size(); ++cnIdx)
|
||||
for ( size_t cnIdx = 0; cnIdx < m_connections.size(); ++cnIdx )
|
||||
{
|
||||
const RigCell& c1 = mainGrid.globalCellArray()[m_connections[cnIdx].m_c1GlobIdx];
|
||||
const RigCell& c2 = mainGrid.globalCellArray()[m_connections[cnIdx].m_c2GlobIdx];
|
||||
|
||||
std::vector<size_t> connectionPolygon;
|
||||
std::vector<cvf::Vec3d> connectionIntersections;
|
||||
std::vector<size_t> connectionPolygon;
|
||||
std::vector<cvf::Vec3d> connectionIntersections;
|
||||
cvf::StructGridInterface::FaceType connectionFace = cvf::StructGridInterface::NO_FACE;
|
||||
|
||||
connectionFace = calculateCellFaceOverlap(c1, c2, mainGrid, &connectionPolygon, &connectionIntersections);
|
||||
connectionFace = calculateCellFaceOverlap( c1, c2, mainGrid, &connectionPolygon, &connectionIntersections );
|
||||
|
||||
if (connectionFace != cvf::StructGridInterface::NO_FACE)
|
||||
if ( connectionFace != cvf::StructGridInterface::NO_FACE )
|
||||
{
|
||||
// Found an overlap polygon. Store data about connection
|
||||
|
||||
m_connections[cnIdx].m_c1Face = connectionFace;
|
||||
for (size_t pIdx = 0; pIdx < connectionPolygon.size(); ++pIdx)
|
||||
for ( size_t pIdx = 0; pIdx < connectionPolygon.size(); ++pIdx )
|
||||
{
|
||||
if (connectionPolygon[pIdx] < mainGrid.nodes().size())
|
||||
m_connections[cnIdx].m_polygon.push_back(mainGrid.nodes()[connectionPolygon[pIdx]]);
|
||||
if ( connectionPolygon[pIdx] < mainGrid.nodes().size() )
|
||||
m_connections[cnIdx].m_polygon.push_back( mainGrid.nodes()[connectionPolygon[pIdx]] );
|
||||
else
|
||||
m_connections[cnIdx].m_polygon.push_back(connectionIntersections[connectionPolygon[pIdx] - mainGrid.nodes().size()]);
|
||||
m_connections[cnIdx].m_polygon.push_back(
|
||||
connectionIntersections[connectionPolygon[pIdx] - mainGrid.nodes().size()] );
|
||||
}
|
||||
|
||||
// Add to search map, possibly not needed
|
||||
//m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c1GlobIdx][connectionFace].push_back(cnIdx);
|
||||
//m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c2GlobIdx][cvf::StructGridInterface::oppositeFace(connectionFace].push_back(cnIdx);
|
||||
// m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c1GlobIdx][connectionFace].push_back(cnIdx);
|
||||
// m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c2GlobIdx][cvf::StructGridInterface::oppositeFace(connectionFace].push_back(cnIdx);
|
||||
}
|
||||
else
|
||||
{
|
||||
//cvf::Trace::show("NNC: No overlap found for : C1: " + cvf::String((int)m_connections[cnIdx].m_c1GlobIdx) + "C2: " + cvf::String((int)m_connections[cnIdx].m_c2GlobIdx));
|
||||
// cvf::Trace::show("NNC: No overlap found for : C1: " + cvf::String((int)m_connections[cnIdx].m_c1GlobIdx)
|
||||
// + "C2: " + cvf::String((int)m_connections[cnIdx].m_c2GlobIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::StructGridInterface::FaceType RigNNCData::calculateCellFaceOverlap(const RigCell &c1,
|
||||
const RigCell &c2,
|
||||
const RigMainGrid &mainGrid,
|
||||
std::vector<size_t>* connectionPolygon,
|
||||
std::vector<cvf::Vec3d>* connectionIntersections)
|
||||
cvf::StructGridInterface::FaceType RigNNCData::calculateCellFaceOverlap( const RigCell& c1,
|
||||
const RigCell& c2,
|
||||
const RigMainGrid& mainGrid,
|
||||
std::vector<size_t>* connectionPolygon,
|
||||
std::vector<cvf::Vec3d>* connectionIntersections )
|
||||
{
|
||||
// Try to find the shared face
|
||||
|
||||
bool isPossibleNeighborInDirection[6]={ true, true, true, true, true, true };
|
||||
bool isPossibleNeighborInDirection[6] = {true, true, true, true, true, true};
|
||||
|
||||
if ( c1.hostGrid() == c2.hostGrid() )
|
||||
{
|
||||
char hasNeighbourInAnyDirection = 0;
|
||||
|
||||
size_t i1, j1, k1;
|
||||
c1.hostGrid()->ijkFromCellIndex(c1.gridLocalCellIndex(), &i1, &j1, &k1);
|
||||
c1.hostGrid()->ijkFromCellIndex( c1.gridLocalCellIndex(), &i1, &j1, &k1 );
|
||||
size_t i2, j2, k2;
|
||||
c2.hostGrid()->ijkFromCellIndex(c2.gridLocalCellIndex(), &i2, &j2, &k2);
|
||||
c2.hostGrid()->ijkFromCellIndex( c2.gridLocalCellIndex(), &i2, &j2, &k2 );
|
||||
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_I] = ( ( i1 + 1 ) == i2 );
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_I] = ( ( i2 + 1 ) == i1 );
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_J] = ( ( j1 + 1 ) == j2 );
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_J] = ( ( j2 + 1 ) == j1 );
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_K] = ( ( k1 + 1 ) == k2 );
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_K] = ( ( k2 + 1 ) == k1 );
|
||||
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_I] = ((i1 + 1) == i2);
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_I] = ((i2 + 1) == i1);
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_J] = ((j1 + 1) == j2);
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_J] = ((j2 + 1) == j1);
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_K] = ((k1 + 1) == k2);
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_K] = ((k2 + 1) == k1);
|
||||
hasNeighbourInAnyDirection = isPossibleNeighborInDirection[cvf::StructGridInterface::POS_I] +
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_I] +
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_J] +
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_J] +
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_K] +
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_K];
|
||||
|
||||
hasNeighbourInAnyDirection =
|
||||
isPossibleNeighborInDirection[cvf::StructGridInterface::POS_I]
|
||||
+ isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_I]
|
||||
+ isPossibleNeighborInDirection[cvf::StructGridInterface::POS_J]
|
||||
+ isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_J]
|
||||
+ isPossibleNeighborInDirection[cvf::StructGridInterface::POS_K]
|
||||
+ isPossibleNeighborInDirection[cvf::StructGridInterface::NEG_K];
|
||||
|
||||
|
||||
// If cell 2 is not adjancent with respect to any of the six ijk directions,
|
||||
// If cell 2 is not adjancent with respect to any of the six ijk directions,
|
||||
// assume that we have no overlapping area.
|
||||
|
||||
if ( !hasNeighbourInAnyDirection )
|
||||
{
|
||||
// Add to search map
|
||||
//m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c1GlobIdx][cvf::StructGridInterface::NO_FACE].push_back(cnIdx);
|
||||
//m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c2GlobIdx][cvf::StructGridInterface::NO_FACE].push_back(cnIdx);
|
||||
// m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c1GlobIdx][cvf::StructGridInterface::NO_FACE].push_back(cnIdx);
|
||||
// m_cellIdxToFaceToConnectionIdxMap[m_connections[cnIdx].m_c2GlobIdx][cvf::StructGridInterface::NO_FACE].push_back(cnIdx);
|
||||
|
||||
//cvf::Trace::show("NNC: No direct neighbors : C1: " + cvf::String((int)m_connections[cnIdx].m_c1GlobIdx) + " C2: " + cvf::String((int)m_connections[cnIdx].m_c2GlobIdx));
|
||||
// cvf::Trace::show("NNC: No direct neighbors : C1: " + cvf::String((int)m_connections[cnIdx].m_c1GlobIdx) +
|
||||
// " C2: " + cvf::String((int)m_connections[cnIdx].m_c2GlobIdx));
|
||||
return cvf::StructGridInterface::NO_FACE;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
// Possibly do some testing to avoid unneccesary overlap calculations
|
||||
cvf::Vec3d normal;
|
||||
for ( char fIdx = 0; fIdx < 6; ++fIdx )
|
||||
@@ -146,8 +141,7 @@ cvf::StructGridInterface::FaceType RigNNCData::calculateCellFaceOverlap(const Ri
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
for ( unsigned char fIdx = 0; fIdx < 6; ++fIdx )
|
||||
{
|
||||
@@ -158,27 +152,26 @@ cvf::StructGridInterface::FaceType RigNNCData::calculateCellFaceOverlap(const Ri
|
||||
|
||||
// Calculate connection polygon
|
||||
|
||||
std::vector<size_t> polygon;
|
||||
std::vector<size_t> polygon;
|
||||
std::vector<cvf::Vec3d> intersections;
|
||||
std::array<size_t, 4> face1;
|
||||
std::array<size_t, 4> face2;
|
||||
c1.faceIndices((cvf::StructGridInterface::FaceType)(fIdx), &face1);
|
||||
c2.faceIndices(cvf::StructGridInterface::oppositeFace((cvf::StructGridInterface::FaceType)(fIdx)), &face2);
|
||||
std::array<size_t, 4> face1;
|
||||
std::array<size_t, 4> face2;
|
||||
c1.faceIndices( ( cvf::StructGridInterface::FaceType )( fIdx ), &face1 );
|
||||
c2.faceIndices( cvf::StructGridInterface::oppositeFace( ( cvf::StructGridInterface::FaceType )( fIdx ) ), &face2 );
|
||||
|
||||
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads(
|
||||
&polygon,
|
||||
&intersections,
|
||||
(cvf::EdgeIntersectStorage<size_t>*)nullptr,
|
||||
cvf::wrapArrayConst(&mainGrid.nodes()),
|
||||
face1.data(),
|
||||
face2.data(),
|
||||
1e-6);
|
||||
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads( &polygon,
|
||||
&intersections,
|
||||
(cvf::EdgeIntersectStorage<size_t>*)nullptr,
|
||||
cvf::wrapArrayConst( &mainGrid.nodes() ),
|
||||
face1.data(),
|
||||
face2.data(),
|
||||
1e-6 );
|
||||
|
||||
if ( foundOverlap )
|
||||
{
|
||||
if (connectionPolygon)(*connectionPolygon) = polygon;
|
||||
if (connectionIntersections) (*connectionIntersections) = intersections;
|
||||
return (cvf::StructGridInterface::FaceType)(fIdx);
|
||||
if ( connectionPolygon ) ( *connectionPolygon ) = polygon;
|
||||
if ( connectionIntersections ) ( *connectionIntersections ) = intersections;
|
||||
return ( cvf::StructGridInterface::FaceType )( fIdx );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,30 +179,30 @@ cvf::StructGridInterface::FaceType RigNNCData::calculateCellFaceOverlap(const Ri
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult(QString nncDataType)
|
||||
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType )
|
||||
{
|
||||
std::vector< std::vector<double> >& results = m_connectionResults[nncDataType];
|
||||
results.resize(1);
|
||||
results[0].resize(m_connections.size(), HUGE_VAL);
|
||||
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
||||
results.resize( 1 );
|
||||
results[0].resize( m_connections.size(), HUGE_VAL );
|
||||
return results[0];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>* RigNNCData::staticConnectionScalarResult(const RigEclipseResultAddress& resVarAddr) const
|
||||
const std::vector<double>* RigNNCData::staticConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return nullptr;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return nullptr;
|
||||
|
||||
std::map<QString, std::vector< std::vector<double> > >::const_iterator it = m_connectionResults.find(nncDataType);
|
||||
std::map<QString, std::vector<std::vector<double>>>::const_iterator it = m_connectionResults.find( nncDataType );
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
CVF_ASSERT(it->second.size() == 1);
|
||||
return &(it->second[0]);
|
||||
CVF_ASSERT( it->second.size() == 1 );
|
||||
return &( it->second[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -218,17 +211,16 @@ const std::vector<double>* RigNNCData::staticConnectionScalarResult(const RigEcl
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>* RigNNCData::staticConnectionScalarResultByName(const QString& nncDataType) const
|
||||
const std::vector<double>* RigNNCData::staticConnectionScalarResultByName( const QString& nncDataType ) const
|
||||
{
|
||||
std::map<QString, std::vector< std::vector<double> > >::const_iterator it = m_connectionResults.find(nncDataType);
|
||||
std::map<QString, std::vector<std::vector<double>>>::const_iterator it = m_connectionResults.find( nncDataType );
|
||||
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
CVF_ASSERT(it->second.size() == 1);
|
||||
return &(it->second[0]);
|
||||
CVF_ASSERT( it->second.size() == 1 );
|
||||
return &( it->second[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -237,28 +229,30 @@ const std::vector<double>* RigNNCData::staticConnectionScalarResultByName(const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector< std::vector<double> >& RigNNCData::makeDynamicConnectionScalarResult(QString nncDataType, size_t timeStepCount)
|
||||
std::vector<std::vector<double>>& RigNNCData::makeDynamicConnectionScalarResult( QString nncDataType,
|
||||
size_t timeStepCount )
|
||||
{
|
||||
auto& results = m_connectionResults[nncDataType];
|
||||
results.resize(timeStepCount);
|
||||
results.resize( timeStepCount );
|
||||
return results;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector< std::vector<double> >* RigNNCData::dynamicConnectionScalarResult(const RigEclipseResultAddress& resVarAddr) const
|
||||
const std::vector<std::vector<double>>*
|
||||
RigNNCData::dynamicConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return nullptr;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return nullptr;
|
||||
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
return &(it->second);
|
||||
return &( it->second );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -267,77 +261,81 @@ const std::vector< std::vector<double> >* RigNNCData::dynamicConnectionScalarRes
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>* RigNNCData::dynamicConnectionScalarResult(const RigEclipseResultAddress& resVarAddr, size_t timeStep) const
|
||||
const std::vector<double>* RigNNCData::dynamicConnectionScalarResult( const RigEclipseResultAddress& resVarAddr,
|
||||
size_t timeStep ) const
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return nullptr;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return nullptr;
|
||||
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
if (it->second.size() > timeStep)
|
||||
if ( it->second.size() > timeStep )
|
||||
{
|
||||
return &(it->second[timeStep]);
|
||||
return &( it->second[timeStep] );
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<std::vector<double>>* RigNNCData::dynamicConnectionScalarResultByName(const QString& nncDataType) const
|
||||
const std::vector<std::vector<double>>* RigNNCData::dynamicConnectionScalarResultByName( const QString& nncDataType ) const
|
||||
{
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
if (it != m_connectionResults.end())
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
return &(it->second);
|
||||
return &( it->second );
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>* RigNNCData::dynamicConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const
|
||||
const std::vector<double>* RigNNCData::dynamicConnectionScalarResultByName( const QString& nncDataType,
|
||||
size_t timeStep ) const
|
||||
{
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
if (it != m_connectionResults.end())
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
if (it->second.size() > timeStep)
|
||||
if ( it->second.size() > timeStep )
|
||||
{
|
||||
return &(it->second[timeStep]);
|
||||
return &( it->second[timeStep] );
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector< std::vector<double> >& RigNNCData::makeGeneratedConnectionScalarResult(QString nncDataType, size_t timeStepCount)
|
||||
std::vector<std::vector<double>>& RigNNCData::makeGeneratedConnectionScalarResult( QString nncDataType,
|
||||
size_t timeStepCount )
|
||||
{
|
||||
auto& results = m_connectionResults[nncDataType];
|
||||
results.resize(timeStepCount);
|
||||
results.resize( timeStepCount );
|
||||
return results;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector< std::vector<double> >* RigNNCData::generatedConnectionScalarResult(const RigEclipseResultAddress& resVarAddr) const
|
||||
const std::vector<std::vector<double>>*
|
||||
RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return nullptr;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return nullptr;
|
||||
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
return &(it->second);
|
||||
return &( it->second );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -346,38 +344,39 @@ const std::vector< std::vector<double> >* RigNNCData::generatedConnectionScalarR
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>* RigNNCData::generatedConnectionScalarResult(const RigEclipseResultAddress& resVarAddr, size_t timeStep) const
|
||||
const std::vector<double>* RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr,
|
||||
size_t timeStep ) const
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return nullptr;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return nullptr;
|
||||
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
if (it->second.size() > timeStep)
|
||||
if ( it->second.size() > timeStep )
|
||||
{
|
||||
return &(it->second[timeStep]);
|
||||
return &( it->second[timeStep] );
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector< std::vector<double> >* RigNNCData::generatedConnectionScalarResult(const RigEclipseResultAddress& resVarAddr)
|
||||
std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return nullptr;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return nullptr;
|
||||
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
return &(it->second);
|
||||
return &( it->second );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -386,136 +385,138 @@ std::vector< std::vector<double> >* RigNNCData::generatedConnectionScalarResult(
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>* RigNNCData::generatedConnectionScalarResult(const RigEclipseResultAddress& resVarAddr, size_t timeStep)
|
||||
std::vector<double>* RigNNCData::generatedConnectionScalarResult( const RigEclipseResultAddress& resVarAddr,
|
||||
size_t timeStep )
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return nullptr;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return nullptr;
|
||||
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
|
||||
if (it != m_connectionResults.end())
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
if (it->second.size() > timeStep)
|
||||
if ( it->second.size() > timeStep )
|
||||
{
|
||||
return &(it->second[timeStep]);
|
||||
return &( it->second[timeStep] );
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType) const
|
||||
const std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType ) const
|
||||
{
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
if (it != m_connectionResults.end())
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
return &(it->second);
|
||||
return &( it->second );
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<double>* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType, size_t timeStep) const
|
||||
const std::vector<double>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType,
|
||||
size_t timeStep ) const
|
||||
{
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
if (it != m_connectionResults.end())
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
if (it->second.size() > timeStep)
|
||||
if ( it->second.size() > timeStep )
|
||||
{
|
||||
return &(it->second[timeStep]);
|
||||
return &( it->second[timeStep] );
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType)
|
||||
std::vector<std::vector<double>>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType )
|
||||
{
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
if (it != m_connectionResults.end())
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
return &(it->second);
|
||||
return &( it->second );
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>* RigNNCData::generatedConnectionScalarResultByName(const QString& nncDataType, size_t timeStep)
|
||||
std::vector<double>* RigNNCData::generatedConnectionScalarResultByName( const QString& nncDataType, size_t timeStep )
|
||||
{
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
if (it != m_connectionResults.end())
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
if ( it != m_connectionResults.end() )
|
||||
{
|
||||
if (it->second.size() > timeStep)
|
||||
if ( it->second.size() > timeStep )
|
||||
{
|
||||
return &(it->second[timeStep]);
|
||||
return &( it->second[timeStep] );
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RigNNCData::availableProperties(NNCResultType resultType) const
|
||||
std::vector<QString> RigNNCData::availableProperties( NNCResultType resultType ) const
|
||||
{
|
||||
std::vector<QString> properties;
|
||||
|
||||
for (auto it : m_connectionResults)
|
||||
for ( auto it : m_connectionResults )
|
||||
{
|
||||
if (resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 && isNative(it.first))
|
||||
if ( resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
||||
{
|
||||
properties.push_back(it.first);
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
else if (resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 && isNative(it.first))
|
||||
else if ( resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
||||
{
|
||||
properties.push_back(it.first);
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
else if (resultType == NNC_GENERATED && !isNative(it.first))
|
||||
else if ( resultType == NNC_GENERATED && !isNative( it.first ) )
|
||||
{
|
||||
properties.push_back(it.first);
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::setEclResultAddress(const QString& nncDataType, const RigEclipseResultAddress& resVarAddr)
|
||||
void RigNNCData::setEclResultAddress( const QString& nncDataType, const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
m_resultAddrToNNCDataType[resVarAddr] = nncDataType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigNNCData::hasScalarValues(const RigEclipseResultAddress& resVarAddr)
|
||||
bool RigNNCData::hasScalarValues( const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex(resVarAddr);
|
||||
if (nncDataType.isNull()) return false;
|
||||
QString nncDataType = getNNCDataTypeFromScalarResultIndex( resVarAddr );
|
||||
if ( nncDataType.isNull() ) return false;
|
||||
|
||||
auto it = m_connectionResults.find(nncDataType);
|
||||
return (it != m_connectionResults.end());
|
||||
auto it = m_connectionResults.find( nncDataType );
|
||||
return ( it != m_connectionResults.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString RigNNCData::getNNCDataTypeFromScalarResultIndex(const RigEclipseResultAddress& resVarAddr) const
|
||||
const QString RigNNCData::getNNCDataTypeFromScalarResultIndex( const RigEclipseResultAddress& resVarAddr ) const
|
||||
{
|
||||
auto it = m_resultAddrToNNCDataType.find(resVarAddr);
|
||||
if (it != m_resultAddrToNNCDataType.end())
|
||||
auto it = m_resultAddrToNNCDataType.find( resVarAddr );
|
||||
if ( it != m_resultAddrToNNCDataType.end() )
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
@@ -523,17 +524,14 @@ const QString RigNNCData::getNNCDataTypeFromScalarResultIndex(const RigEclipseRe
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigNNCData::isNative(QString nncDataType) const
|
||||
bool RigNNCData::isNative( QString nncDataType ) const
|
||||
{
|
||||
if (nncDataType == RigNNCData::propertyNameCombTrans() ||
|
||||
nncDataType == RigNNCData::propertyNameFluxGas() ||
|
||||
nncDataType == RigNNCData::propertyNameFluxOil() ||
|
||||
nncDataType == RigNNCData::propertyNameFluxWat() ||
|
||||
nncDataType == RigNNCData::propertyNameRiCombMult() ||
|
||||
nncDataType == RigNNCData::propertyNameRiCombTrans() ||
|
||||
nncDataType == RigNNCData::propertyNameRiCombTransByArea())
|
||||
if ( nncDataType == RigNNCData::propertyNameCombTrans() || nncDataType == RigNNCData::propertyNameFluxGas() ||
|
||||
nncDataType == RigNNCData::propertyNameFluxOil() || nncDataType == RigNNCData::propertyNameFluxWat() ||
|
||||
nncDataType == RigNNCData::propertyNameRiCombMult() || nncDataType == RigNNCData::propertyNameRiCombTrans() ||
|
||||
nncDataType == RigNNCData::propertyNameRiCombTransByArea() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user