mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-07 14:43:10 -06:00
#8403 Ensure the NNC connection polygon is created before computing area
This commit is contained in:
parent
e09a839228
commit
87780b2b8a
@ -164,70 +164,73 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling;
|
||||
};
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int gcIdx = 0; gcIdx < static_cast<int>( cells.size() ); ++gcIdx )
|
||||
if ( !resultAddresses.empty() && !directions.empty() )
|
||||
{
|
||||
if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) )
|
||||
#pragma omp parallel for
|
||||
for ( int gcIdx = 0; gcIdx < static_cast<int>( cells.size() ); ++gcIdx )
|
||||
{
|
||||
size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx );
|
||||
if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE )
|
||||
if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) )
|
||||
{
|
||||
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
|
||||
size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx );
|
||||
if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE )
|
||||
{
|
||||
double resultValue = 0.0;
|
||||
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
|
||||
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
|
||||
{
|
||||
resultValue +=
|
||||
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
|
||||
}
|
||||
double resultValue = 0.0;
|
||||
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
|
||||
{
|
||||
resultValue +=
|
||||
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
|
||||
}
|
||||
|
||||
if ( std::abs( resultValue ) >= result->threshold() )
|
||||
{
|
||||
cvf::Vec3d faceCenter;
|
||||
cvf::Vec3d faceNormal;
|
||||
getFaceCenterAndNormal( static_cast<size_t>( gcIdx ), directions[dir], faceCenter, faceNormal );
|
||||
faceNormal *= std::abs( resultValue );
|
||||
if ( std::abs( resultValue ) >= result->threshold() )
|
||||
{
|
||||
cvf::Vec3d faceCenter;
|
||||
cvf::Vec3d faceNormal;
|
||||
getFaceCenterAndNormal( static_cast<size_t>( gcIdx ), directions[dir], faceCenter, faceNormal );
|
||||
faceNormal *= std::abs( resultValue );
|
||||
|
||||
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_1 )
|
||||
tensorVisualizations.push_back(
|
||||
ElementVectorResultVisualization( faceCenter,
|
||||
faceNormal,
|
||||
resultValue,
|
||||
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( result->vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL )
|
||||
{
|
||||
cvf::Vec3d aggregatedVector;
|
||||
cvf::Vec3d aggregatedResult;
|
||||
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
|
||||
{
|
||||
double resultValue = 0.0;
|
||||
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
|
||||
{
|
||||
resultValue +=
|
||||
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
|
||||
}
|
||||
|
||||
cvf::Vec3d faceCenter;
|
||||
cvf::Vec3d faceNormal;
|
||||
cvf::Vec3d faceNormalScaled;
|
||||
getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal );
|
||||
faceNormalScaled = faceNormal * resultValue;
|
||||
aggregatedVector += faceNormalScaled;
|
||||
aggregatedResult += faceNormal.getNormalized() * resultValue;
|
||||
}
|
||||
if ( aggregatedResult.length() >= result->threshold() )
|
||||
{
|
||||
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 )
|
||||
tensorVisualizations.push_back(
|
||||
ElementVectorResultVisualization( faceCenter,
|
||||
faceNormal,
|
||||
resultValue,
|
||||
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ),
|
||||
aggregatedVector,
|
||||
aggregatedResult.length(),
|
||||
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( result->vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL )
|
||||
{
|
||||
cvf::Vec3d aggregatedVector;
|
||||
cvf::Vec3d aggregatedResult;
|
||||
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
|
||||
{
|
||||
double resultValue = 0.0;
|
||||
for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() )
|
||||
{
|
||||
resultValue +=
|
||||
resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx );
|
||||
}
|
||||
|
||||
cvf::Vec3d faceCenter;
|
||||
cvf::Vec3d faceNormal;
|
||||
cvf::Vec3d faceNormalScaled;
|
||||
getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal );
|
||||
faceNormalScaled = faceNormal * resultValue;
|
||||
aggregatedVector += faceNormalScaled;
|
||||
aggregatedResult += faceNormal.getNormalized() * resultValue;
|
||||
}
|
||||
if ( aggregatedResult.length() >= result->threshold() )
|
||||
{
|
||||
#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 )
|
||||
tensorVisualizations.push_back(
|
||||
ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ),
|
||||
aggregatedVector,
|
||||
aggregatedResult.length(),
|
||||
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,12 +645,14 @@ bool RigNNCData::generateScalarValues( const RigEclipseResultAddress& resVarAddr
|
||||
auto it = m_connectionResults.find( nameit->second );
|
||||
if ( it == m_connectionResults.end() ) return false;
|
||||
|
||||
auto& srcdata = it->second;
|
||||
// Connection polygons are used to compute the center for the NNC flow vectors
|
||||
// If connection polygons are present, this is a no-op
|
||||
buildPolygonsForEclipseConnections();
|
||||
|
||||
auto& srcdata = it->second;
|
||||
auto& dstdata = makeDynamicConnectionScalarResult( resVarAddr.resultName(), srcdata.size() );
|
||||
|
||||
const double epsilon = 1.0e-3;
|
||||
|
||||
const double epsilon = 1.0e-3;
|
||||
std::vector<double> areas( m_connections.size() );
|
||||
|
||||
for ( size_t dataIdx = 0; dataIdx < m_connections.size(); dataIdx++ )
|
||||
|
Loading…
Reference in New Issue
Block a user