mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
First iteration showing vectors for NNC data.
This commit is contained in:
parent
4cb57b729a
commit
2423dc977b
@ -110,6 +110,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
|
||||
std::vector<cvf::StructGridInterface::FaceType> directions;
|
||||
std::vector<RigEclipseResultAddress> resultAddresses;
|
||||
|
||||
if ( result->showVectorI() )
|
||||
{
|
||||
directions.push_back( cvf::StructGridInterface::POS_I );
|
||||
@ -127,8 +128,18 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
}
|
||||
|
||||
RigCaseCellResultsData* resultsData = eclipseCaseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData();
|
||||
RigActiveCellInfo* activeCellInfo = eclipseCaseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
const std::vector<std::vector<double>>* nncResultVals = nullptr;
|
||||
if ( result->showNncData() )
|
||||
{
|
||||
if ( result->resultAddressCombined().m_resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||
{
|
||||
nncResultVals = nncData->dynamicConnectionScalarResult( result->resultAddressCombined() );
|
||||
}
|
||||
}
|
||||
|
||||
const cvf::Vec3d offset = eclipseCase->mainGrid()->displayModelOffset();
|
||||
|
||||
const std::vector<RigCell>& cells = eclipseCase->mainGrid()->globalCellArray();
|
||||
@ -136,11 +147,10 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
{
|
||||
if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) )
|
||||
{
|
||||
size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx );
|
||||
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
|
||||
{
|
||||
size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx );
|
||||
double resultValue = resultsData->cellScalarResults( resultAddresses[dir], timeStepIndex ).at( resultIdx );
|
||||
|
||||
if ( std::abs( resultValue ) >= result->threshold() )
|
||||
{
|
||||
cvf::Vec3d faceCenter = cells[gcIdx].faceCenter( directions[dir] ) - offset;
|
||||
@ -159,6 +169,38 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode
|
||||
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( nncResultVals && nncResultVals->size() > 0 && nncResultVals->at( timeStepIndex ).size() > 0 )
|
||||
{
|
||||
// The nnc connections can have more connections than reported from Eclipse, clamp the result index to
|
||||
// Eclipse Results
|
||||
|
||||
double resultValue = 0.0;
|
||||
if ( resultIdx < nncResultVals->at( timeStepIndex ).size() )
|
||||
{
|
||||
resultValue = ( *nncResultVals )[timeStepIndex][resultIdx];
|
||||
}
|
||||
if ( std::abs( resultValue ) >= result->threshold() )
|
||||
{
|
||||
for ( int dir = 0; dir < static_cast<int>( directions.size() ); dir++ )
|
||||
{
|
||||
cvf::Vec3d faceCenter = cells[gcIdx].faceCenter( directions[dir] ) - offset;
|
||||
cvf::Vec3d cellCenter = cells[gcIdx].center() - offset;
|
||||
cvf::Vec3d faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling;
|
||||
|
||||
if ( result->scaleMethod() == RimElementVectorResult::RESULT )
|
||||
{
|
||||
faceNormal *= std::abs( resultValue );
|
||||
}
|
||||
|
||||
tensorVisualizations.push_back(
|
||||
ElementVectorResultVisualization( faceCenter,
|
||||
faceNormal,
|
||||
resultValue,
|
||||
std::cbrt( cells[gcIdx].volume() / 3.0 ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ RimElementVectorResult::RimElementVectorResult()
|
||||
CAF_PDM_InitField( &m_showVectorI, "ShowVectorI", true, "I", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showVectorJ, "ShowVectorJ", true, "J", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showVectorK, "ShowVectorK", true, "K", "", "", "" );
|
||||
CAF_PDM_InitField( &m_showNncData, "ShowNncData", true, "Show NNC data", "", "", "" );
|
||||
CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color", "", "", "" );
|
||||
@ -136,6 +137,14 @@ bool RimElementVectorResult::showVectorK() const
|
||||
return m_showVectorK();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimElementVectorResult::showNncData() const
|
||||
{
|
||||
return m_showNncData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -315,6 +324,7 @@ void RimElementVectorResult::defineUiOrdering( QString uiConfigName, caf::PdmUiO
|
||||
visibilityGroup->add( &m_showVectorI );
|
||||
visibilityGroup->add( &m_showVectorJ );
|
||||
visibilityGroup->add( &m_showVectorK );
|
||||
visibilityGroup->add( &m_showNncData );
|
||||
visibilityGroup->add( &m_threshold );
|
||||
|
||||
caf::PdmUiGroup* vectorColorsGroup = uiOrdering.addNewGroup( "Vector Colors" );
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
bool showVectorI() const;
|
||||
bool showVectorJ() const;
|
||||
bool showVectorK() const;
|
||||
bool showNncData() const;
|
||||
float threshold() const;
|
||||
float sizeScale() const;
|
||||
TensorColors vectorColors() const;
|
||||
@ -102,6 +103,7 @@ private:
|
||||
caf::PdmField<bool> m_showVectorI;
|
||||
caf::PdmField<bool> m_showVectorJ;
|
||||
caf::PdmField<bool> m_showVectorK;
|
||||
caf::PdmField<bool> m_showNncData;
|
||||
caf::PdmField<float> m_threshold;
|
||||
caf::PdmField<caf::AppEnum<TensorColors>> m_vectorColor;
|
||||
caf::PdmField<cvf::Color3f> m_uniformVectorColor;
|
||||
|
Loading…
Reference in New Issue
Block a user