StreamlineGenerator Class Reference

Class used to generate evenly spaced streamlines. More...

#include <streamlines.h>

Collaboration diagram for StreamlineGenerator:

Collaboration graph
[legend]

List of all members.

Public Types

typedef VelocityFunctor VelocityFunc

Public Member Functions

 StreamlineGenerator (const SL_Rectangle &domain, float dsep, float dtest, float stepsize, int maxiter, VelocityFunc v, SLIterAlg inter_type)
 Constructor.
const std::vector< Streamline > & GetStreamlines () const
 Returns the computed streamlines.

Private Member Functions

bool IsOutsideBounds (const vec2 &v) const
 Test if point outside the field specified by domain.
void ComputeCellPosition (const vec2 &v, int &cx, int &cy) const
 Computes the grid cell position for the given point.
void BeginTraceLine ()
 Called when a new traceline is being traced.
void EndTraceLine ()
 Called when tracing of a streamline has ended.
float GetMinDistance (const vec2 &v) const
 Returns the minimum distance to the other streamlines or HUGE if they are far away.
void PutIntoGrid (const vec2 &v)
 Put the point into the grid used for fast proximity tests.
void DelayedPutIntoGrid (const vec2 &v)
void TraceLine (const vec2 &startpos, Streamline &sline)
 Trace a single streamline and stay away from the existing ones.
void TraceAndStore (const vec2 &v, Streamline &sl)
 Helper function.
float ComputeThickness (float mindist)
 Computes the thinkness of the streamline (for tapering).
bool InterpolateTo (vec2 &position, bool forward)
 Helper function that moves a current point acording to it's associated velocity (or against that vector).

Private Attributes

SL_Rectangle domain
 Defines which values the velocity fields coordinates should be mapped to.
SLIterAlg inter_type
 Which type of integration should be used for following the 'flow'.
VelocityFunc v
 Functor that access the velocity field's value at a given location.
std::vector< Streamlinestreamlines
 Collection of all calculated streamlines.
size_t grid_add_delay
 Specifies at which length of the points queue the points are put into real streamlines.
detail::Array2d< std::list
< vec2 > > 
grid
 Grid used for speadup.
std::list< vec2point_queue
 Queue of generated seed points.
Parameters for the algorythm
float dsep
float dtest
float stepsize
float stepsize_half
int maxiter


Detailed Description

Class used to generate evenly spaced streamlines.

Definition at line 202 of file streamlines.h.


Member Typedef Documentation

Function pointer used to get the velocity field. The returned vector must be normalized!

Definition at line 207 of file streamlines.h.


Constructor & Destructor Documentation

StreamlineGenerator::StreamlineGenerator ( const SL_Rectangle domain,
float  dsep,
float  dtest,
float  stepsize,
int  maxiter,
VelocityFunc  v,
SLIterAlg  inter_type 
)


Member Function Documentation

bool StreamlineGenerator::IsOutsideBounds ( const vec2 v  )  const [inline, private]

Test if point outside the field specified by domain.

c_block contains areas with 0 velocity (the block itself) Consider such areas as ouside of bounds (since the alg. can't go on from there anyway. If the position is moved into such a "dead space" the position can become QNAN or IND ...

Definition at line 245 of file streamlines.h.

References SL_Rectangle::bottom, domain, SL_Rectangle::left, SL_Rectangle::right, SL_Rectangle::top, vec2::x, and vec2::y.

Referenced by InterpolateTo(), and TraceLine().

void StreamlineGenerator::ComputeCellPosition ( const vec2 v,
int &  cx,
int &  cy 
) const [inline, private]

Computes the grid cell position for the given point.

Definition at line 257 of file streamlines.h.

References SL_Rectangle::bottom, domain, dsep, SL_Rectangle::left, vec2::x, and vec2::y.

Referenced by GetMinDistance(), and PutIntoGrid().

void StreamlineGenerator::BeginTraceLine (  )  [private]

Called when a new traceline is being traced.

Definition at line 64 of file streamlines.cpp.

Referenced by TraceLine().

void StreamlineGenerator::EndTraceLine (  )  [private]

Called when tracing of a streamline has ended.

Flush the point queue.

Definition at line 66 of file streamlines.cpp.

References point_queue, and PutIntoGrid().

Referenced by TraceLine().

float StreamlineGenerator::GetMinDistance ( const vec2 v  )  const [private]

Returns the minimum distance to the other streamlines or HUGE if they are far away.

Definition at line 5 of file streamlines.cpp.

References ComputeCellPosition(), dot(), detail::Array2d< T >::GetSizeX(), detail::Array2d< T >::GetSizeY(), grid, x, and y.

Referenced by TraceLine().

void StreamlineGenerator::PutIntoGrid ( const vec2 v  )  [private]

Put the point into the grid used for fast proximity tests.

Definition at line 46 of file streamlines.cpp.

References ComputeCellPosition(), and grid.

Referenced by DelayedPutIntoGrid(), and EndTraceLine().

void StreamlineGenerator::DelayedPutIntoGrid ( const vec2 v  )  [private]

First put the point in a queue and only add it sometime later when the streamline has grown to prevent false self intersections.

Definition at line 53 of file streamlines.cpp.

References grid_add_delay, point_queue, and PutIntoGrid().

Referenced by TraceLine().

void StreamlineGenerator::TraceLine ( const vec2 startpos,
Streamline sline 
) [private]

Trace a single streamline and stay away from the existing ones.

Definition at line 96 of file streamlines.cpp.

References BeginTraceLine(), ComputeThickness(), DelayedPutIntoGrid(), dtest, EndTraceLine(), GetMinDistance(), InterpolateTo(), IsOutsideBounds(), maxiter, and v.

Referenced by TraceAndStore().

void StreamlineGenerator::TraceAndStore ( const vec2 v,
Streamline sl 
) [private]

Helper function.

Definition at line 164 of file streamlines.cpp.

References streamlines, and TraceLine().

Referenced by StreamlineGenerator().

float StreamlineGenerator::ComputeThickness ( float  mindist  )  [inline, private]

Computes the thinkness of the streamline (for tapering).

Definition at line 286 of file streamlines.h.

References dsep, and dtest.

Referenced by TraceLine().

bool StreamlineGenerator::InterpolateTo ( vec2 position,
bool  forward 
) [private]

Helper function that moves a current point acording to it's associated velocity (or against that vector).

Definition at line 76 of file streamlines.cpp.

References inter_type, IsOutsideBounds(), ITER_EULER, ITER_RK, stepsize, stepsize_half, and v.

Referenced by TraceLine().

const std::vector<Streamline>& StreamlineGenerator::GetStreamlines (  )  const [inline]

Returns the computed streamlines.

Definition at line 306 of file streamlines.h.

References streamlines.

Referenced by FlowVisCanvas::Prepare_Streamlines().


Member Data Documentation

Defines which values the velocity fields coordinates should be mapped to.

Definition at line 211 of file streamlines.h.

Referenced by ComputeCellPosition(), and IsOutsideBounds().

float StreamlineGenerator::dsep [private]

Definition at line 215 of file streamlines.h.

Referenced by ComputeCellPosition(), and ComputeThickness().

float StreamlineGenerator::dtest [private]

Definition at line 216 of file streamlines.h.

Referenced by ComputeThickness(), and TraceLine().

Definition at line 218 of file streamlines.h.

Referenced by InterpolateTo().

Definition at line 219 of file streamlines.h.

Referenced by InterpolateTo().

Definition at line 221 of file streamlines.h.

Referenced by TraceLine().

Which type of integration should be used for following the 'flow'.

Definition at line 225 of file streamlines.h.

Referenced by InterpolateTo().

Functor that access the velocity field's value at a given location.

Definition at line 228 of file streamlines.h.

Referenced by InterpolateTo(), and TraceLine().

Collection of all calculated streamlines.

Definition at line 231 of file streamlines.h.

Referenced by GetStreamlines(), StreamlineGenerator(), and TraceAndStore().

Specifies at which length of the points queue the points are put into real streamlines.

Definition at line 234 of file streamlines.h.

Referenced by DelayedPutIntoGrid().

Grid used for speadup.

Definition at line 237 of file streamlines.h.

Referenced by GetMinDistance(), and PutIntoGrid().

std::list<vec2> StreamlineGenerator::point_queue [private]

Queue of generated seed points.

Definition at line 240 of file streamlines.h.

Referenced by DelayedPutIntoGrid(), and EndTraceLine().


The documentation for this class was generated from the following files:

Generated on Wed Jan 21 16:22:24 2009 for FlowVis by  doxygen 1.5.6