mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Streamlines : Show dominant flow phase velocity
This commit is contained in:
parent
4a9e759e4b
commit
bde6fc7d9c
@ -97,6 +97,7 @@ void RivStreamlinesPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBasicLi
|
||||
streamline.appendTracerPoint( tracer.tracerPoints()[i].position() );
|
||||
streamline.appendAbsVelocity( tracer.tracerPoints()[i].absValue() );
|
||||
streamline.appendDirection( tracer.tracerPoints()[i].direction() );
|
||||
streamline.appendPhase( tracer.tracerPoints()[i].phaseType() );
|
||||
}
|
||||
m_streamlines.push_back( streamline );
|
||||
}
|
||||
@ -257,6 +258,27 @@ void RivStreamlinesPartMgr::createResultColorTextureCoords( cvf::Vec2fArray*
|
||||
for ( size_t i = 0; i < streamline.countTracerPoints(); i++ )
|
||||
{
|
||||
cvf::Vec2f texCoord = mapper->mapToTextureCoord( streamline.getAbsVelocity( i ) );
|
||||
|
||||
if ( streamlineCollection->colorMode() == RimStreamlineInViewCollection::ColorMode::PHASE_COLORS )
|
||||
{
|
||||
double phaseValue = 0.0;
|
||||
auto phase = streamline.getPhase( i );
|
||||
if ( phase == RiaDefines::PhaseType::GAS_PHASE )
|
||||
{
|
||||
phaseValue = 1.0;
|
||||
}
|
||||
else if ( phase == RiaDefines::PhaseType::OIL_PHASE )
|
||||
{
|
||||
phaseValue = 0.5;
|
||||
}
|
||||
else if ( phase == RiaDefines::PhaseType::WATER_PHASE )
|
||||
{
|
||||
phaseValue = 0.0;
|
||||
}
|
||||
|
||||
texCoord.x() = phaseValue;
|
||||
}
|
||||
|
||||
if ( streamlineCollection &&
|
||||
streamlineCollection->visualizationMode() == RimStreamlineInViewCollection::VisualizationMode::VECTORS )
|
||||
{
|
||||
@ -682,6 +704,14 @@ void RivStreamlinesPartMgr::Streamline::appendDirection( cvf::Vec3d direction )
|
||||
directions.push_back( direction );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivStreamlinesPartMgr::Streamline::appendPhase( RiaDefines::PhaseType phase )
|
||||
{
|
||||
dominantPhases.push_back( phase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -690,6 +720,7 @@ void RivStreamlinesPartMgr::Streamline::clear()
|
||||
tracerPoints.clear();
|
||||
absVelocities.clear();
|
||||
directions.clear();
|
||||
dominantPhases.clear();
|
||||
delete part.p();
|
||||
}
|
||||
|
||||
@ -725,6 +756,14 @@ cvf::Vec3d RivStreamlinesPartMgr::Streamline::getDirection( size_t index ) const
|
||||
return directions[index];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RivStreamlinesPartMgr::Streamline::getPhase( size_t index ) const
|
||||
{
|
||||
return dominantPhases[index];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -132,26 +132,31 @@ private:
|
||||
{
|
||||
Streamline() { animIndex = 0; };
|
||||
|
||||
void appendTracerPoint( cvf::Vec3d point );
|
||||
void appendAbsVelocity( double velocity );
|
||||
void appendDirection( cvf::Vec3d direction );
|
||||
void clear();
|
||||
cvf::ref<cvf::Part> getPart();
|
||||
cvf::Vec3d getTracerPoint( size_t index ) const;
|
||||
double getAbsVelocity( size_t index ) const;
|
||||
cvf::Vec3d getDirection( size_t index ) const;
|
||||
size_t countTracerPoints() const;
|
||||
void setPart( cvf::ref<cvf::Part> part );
|
||||
size_t getAnimationIndex() const;
|
||||
void incrementAnimationIndex( size_t increment = 1.0 );
|
||||
void setAnimationIndex( size_t index );
|
||||
void appendTracerPoint( cvf::Vec3d point );
|
||||
void appendAbsVelocity( double velocity );
|
||||
void appendDirection( cvf::Vec3d direction );
|
||||
void appendPhase( RiaDefines::PhaseType phase );
|
||||
void clear();
|
||||
cvf::ref<cvf::Part> getPart();
|
||||
cvf::Vec3d getTracerPoint( size_t index ) const;
|
||||
double getAbsVelocity( size_t index ) const;
|
||||
cvf::Vec3d getDirection( size_t index ) const;
|
||||
RiaDefines::PhaseType getPhase( size_t index ) const;
|
||||
|
||||
size_t countTracerPoints() const;
|
||||
void setPart( cvf::ref<cvf::Part> part );
|
||||
size_t getAnimationIndex() const;
|
||||
void incrementAnimationIndex( size_t increment = 1.0 );
|
||||
void setAnimationIndex( size_t index );
|
||||
|
||||
private:
|
||||
std::vector<cvf::Vec3d> tracerPoints;
|
||||
std::vector<double> absVelocities;
|
||||
std::vector<cvf::Vec3d> directions;
|
||||
cvf::ref<cvf::Part> part;
|
||||
size_t animIndex;
|
||||
std::vector<cvf::Vec3d> tracerPoints;
|
||||
std::vector<double> absVelocities;
|
||||
std::vector<cvf::Vec3d> directions;
|
||||
std::vector<RiaDefines::PhaseType> dominantPhases;
|
||||
|
||||
cvf::ref<cvf::Part> part;
|
||||
size_t animIndex;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
@ -73,7 +71,15 @@ void AppEnum<RimStreamlineInViewCollection::StreamlinePhaseType>::setUp()
|
||||
addItem( RimStreamlineInViewCollection::StreamlinePhaseType::GAS, "GAS", "Gas" );
|
||||
addItem( RimStreamlineInViewCollection::StreamlinePhaseType::WATER, "WATER", "Water" );
|
||||
addItem( RimStreamlineInViewCollection::StreamlinePhaseType::COMBINED, "COMBINED", "Combined" );
|
||||
setDefault( RimStreamlineInViewCollection::StreamlinePhaseType::OIL );
|
||||
setDefault( RimStreamlineInViewCollection::StreamlinePhaseType::COMBINED );
|
||||
}
|
||||
|
||||
template <>
|
||||
void AppEnum<RimStreamlineInViewCollection::ColorMode>::setUp()
|
||||
{
|
||||
addItem( RimStreamlineInViewCollection::ColorMode::PHASE_COLORS, "PHASE_COLORS", "Dominant Phase" );
|
||||
addItem( RimStreamlineInViewCollection::ColorMode::VELOCITY, "VELOCITY", "Velocity" );
|
||||
setDefault( RimStreamlineInViewCollection::ColorMode::PHASE_COLORS );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
@ -87,40 +93,42 @@ RimStreamlineInViewCollection::RimStreamlineInViewCollection()
|
||||
: m_shouldGenerateTracers( false )
|
||||
, m_currentTimestep( -1 )
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Streamlines", ":/Erase.png", "", "" );
|
||||
CAF_PDM_InitObject( "Streamlines", ":/Erase.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", "", "", "" );
|
||||
m_legendConfig = new RimRegularLegendConfig();
|
||||
m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS );
|
||||
m_legendConfig.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_collectionName, "Name", "Name", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_collectionName, "Name", "Name", "", "", "" );
|
||||
m_collectionName = "Streamlines";
|
||||
m_collectionName.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_flowThreshold, "FlowThreshold", "Flow Threshold [m/day]", "", "", "" );
|
||||
m_flowThreshold = 0.001;
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowThreshold, "FlowThreshold", "Flow Threshold [m/day]", "", "", "" );
|
||||
m_flowThreshold = 0.01;
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_lengthThreshold, "LengthThreshold", "Minimum Length [m]", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_lengthThreshold, "LengthThreshold", "Minimum Length [m]", "", "", "" );
|
||||
m_lengthThreshold = 100.0;
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_resolution, "Resolution", "Resolution [days]", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_resolution, "Resolution", "Resolution [days]", "", "", "" );
|
||||
m_resolution = 20.0;
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_maxDays, "MaxDays", "Max Days", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_maxDays, "MaxDays", "Max Days", "", "", "" );
|
||||
m_maxDays = 50000;
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_useProducers, "UseProducers", "Producer Wells", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_useProducers, "UseProducers", "Producer Wells", "", "", "" );
|
||||
m_useProducers = true;
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_useInjectors, "UseInjectors", "Injector Wells", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_useInjectors, "UseInjectors", "Injector Wells", "", "", "" );
|
||||
m_useInjectors = true;
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_phases, "Phase", StreamlinePhaseTypeEnum( StreamlinePhaseType::OIL ), "Phase", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_phases, "Phase", "Phase", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_isActive, "isActive", false, "Active", "", "", "" );
|
||||
m_isActive.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_visualizationMode, "VisualizationMode", "Visualization Mode", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_colorMode, "ColorMode", "Colors", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_animationSpeed, "AnimationSpeed", "Animation Speed", "", "", "" );
|
||||
m_animationSpeed.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() );
|
||||
@ -139,11 +147,7 @@ RimStreamlineInViewCollection::RimStreamlineInViewCollection()
|
||||
m_tracerLength.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() );
|
||||
m_tracerLength = 100;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_injectionDeltaTime, "InjectionDeltaTime", "Pause between injections", "", "", "" );
|
||||
m_injectionDeltaTime.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() );
|
||||
m_injectionDeltaTime = 500;
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_streamlines, "Streamlines", "Streamlines", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_streamlines, "Streamlines", "Streamlines", "", "", "" );
|
||||
m_streamlines.uiCapability()->setUiTreeHidden( true );
|
||||
m_streamlines.xmlCapability()->disableIO();
|
||||
|
||||
@ -232,6 +236,14 @@ RimStreamlineInViewCollection::VisualizationMode RimStreamlineInViewCollection::
|
||||
return m_visualizationMode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimStreamlineInViewCollection::ColorMode RimStreamlineInViewCollection::colorMode() const
|
||||
{
|
||||
return m_colorMode();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -297,8 +309,11 @@ void RimStreamlineInViewCollection::updateLegendRangesTextAndVisibility( RiuView
|
||||
double negClosestToZero = -HUGE_VAL;
|
||||
m_legendConfig->setClosestToZeroValues( posClosestToZero, negClosestToZero, posClosestToZero, negClosestToZero );
|
||||
|
||||
nativeOrOverrideViewer->addColorLegendToBottomLeftCorner( m_legendConfig->titledOverlayFrame(),
|
||||
isUsingOverrideViewer );
|
||||
if ( colorMode() == ColorMode::VELOCITY )
|
||||
{
|
||||
nativeOrOverrideViewer->addColorLegendToBottomLeftCorner( m_legendConfig->titledOverlayFrame(),
|
||||
isUsingOverrideViewer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,14 +363,6 @@ size_t RimStreamlineInViewCollection::tracerLength() const
|
||||
return m_tracerLength();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimStreamlineInViewCollection::injectionDeltaTime() const
|
||||
{
|
||||
return m_injectionDeltaTime();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -560,12 +567,12 @@ void RimStreamlineInViewCollection::defineUiOrdering( QString uiConfigName, caf:
|
||||
|
||||
caf::PdmUiGroup* visualizationGroup = uiOrdering.addNewGroup( "Visualization Settings" );
|
||||
visualizationGroup->add( &m_visualizationMode );
|
||||
visualizationGroup->add( &m_colorMode );
|
||||
|
||||
if ( m_visualizationMode() == VisualizationMode::ANIMATION )
|
||||
{
|
||||
visualizationGroup->add( &m_animationSpeed );
|
||||
visualizationGroup->add( &m_tracerLength );
|
||||
visualizationGroup->add( &m_injectionDeltaTime );
|
||||
}
|
||||
if ( m_visualizationMode() == VisualizationMode::MANUAL )
|
||||
{
|
||||
@ -623,15 +630,6 @@ void RimStreamlineInViewCollection::defineEditorAttribute( const caf::PdmFieldHa
|
||||
myAttr->m_maximum = static_cast<int>( 1000 );
|
||||
}
|
||||
}
|
||||
else if ( field == &m_injectionDeltaTime )
|
||||
{
|
||||
caf::PdmUiSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiSliderEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->m_minimum = 1;
|
||||
myAttr->m_maximum = static_cast<int>( 1000 );
|
||||
}
|
||||
}
|
||||
else if ( field == &m_scaleFactor )
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
@ -650,8 +648,7 @@ void RimStreamlineInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_animationSpeed || changedField == &m_animationIndex ||
|
||||
changedField == &m_injectionDeltaTime || changedField == &m_tracerLength )
|
||||
if ( changedField == &m_animationSpeed || changedField == &m_animationIndex || changedField == &m_tracerLength )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -60,6 +60,13 @@ public:
|
||||
};
|
||||
using StreamlinePhaseTypeEnum = caf::AppEnum<StreamlinePhaseType>;
|
||||
|
||||
enum class ColorMode
|
||||
{
|
||||
PHASE_COLORS = 0,
|
||||
VELOCITY,
|
||||
};
|
||||
using ColorModeEnum = caf::AppEnum<ColorMode>;
|
||||
|
||||
public:
|
||||
RimStreamlineInViewCollection();
|
||||
~RimStreamlineInViewCollection() override;
|
||||
@ -70,11 +77,11 @@ public:
|
||||
std::list<RiaDefines::PhaseType> phases() const;
|
||||
|
||||
VisualizationMode visualizationMode() const;
|
||||
ColorMode colorMode() const;
|
||||
size_t animationSpeed() const;
|
||||
size_t animationIndex() const;
|
||||
double scaleFactor() const;
|
||||
size_t tracerLength() const;
|
||||
size_t injectionDeltaTime() const;
|
||||
|
||||
bool isActive() const;
|
||||
|
||||
@ -119,11 +126,13 @@ private:
|
||||
caf::PdmChildArrayField<RimStreamline*> m_streamlines;
|
||||
caf::PdmField<StreamlinePhaseTypeEnum> m_phases;
|
||||
caf::PdmField<VisualizationModeEnum> m_visualizationMode;
|
||||
caf::PdmField<size_t> m_animationSpeed;
|
||||
caf::PdmField<size_t> m_animationIndex;
|
||||
caf::PdmField<double> m_scaleFactor;
|
||||
caf::PdmField<size_t> m_tracerLength;
|
||||
caf::PdmField<size_t> m_injectionDeltaTime;
|
||||
caf::PdmField<ColorModeEnum> m_colorMode;
|
||||
|
||||
// Animation
|
||||
caf::PdmField<size_t> m_animationSpeed;
|
||||
caf::PdmField<size_t> m_animationIndex;
|
||||
caf::PdmField<double> m_scaleFactor;
|
||||
caf::PdmField<size_t> m_tracerLength;
|
||||
|
||||
size_t m_maxAnimationIndex;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user