Streamlines : Show dominant flow phase velocity

This commit is contained in:
Magne Sjaastad
2021-02-26 10:29:03 +01:00
parent 4a9e759e4b
commit bde6fc7d9c
4 changed files with 114 additions and 64 deletions

View File

@@ -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];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -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: