Waterflow
Visualize water in terrain
FlowSource Class Reference

Contains the parameters of a flow source.. More...

#include <flowSource.h>

List of all members.

Public Member Functions

 FlowSource ()
 Initializes an epty source with time set to zero, it sould be populated with data using the set* functions.
 ~FlowSource ()
 default destructor for now.
bool getChange (float dt)
 Checks for changes in pressure after performing an update on the source.
std::vector< float > getNormal ()
 This function finds a thee valued vector with xyz defining the Normal direction at the internal time specified by the update function.
std::vector< int > getPosition ()
 Gets the position of the flow source.
float getPressure ()
 This function finds the curent pressure depandeing on the internal time set by the update function.
float getRadius ()
 Gets the radius of the flow source.
float getWaterLeft ()
 Gets the water left in the flow source as descriebed by totalWater.
void setNormal (std::vector< std::vector< float > > N, std::vector< int > t)
 This function expects a vector filled with vectors that hold 3 values, xyz, and a time vector that specifies when to change the Normal direction. this time vector can be independent from the one used for pressure. For vector correspondences and time vetor specifications see setPressure()
void setPosition (int x, int y, int z)
 This function expects three ints symbolizing the 3D space cordinates of the source expressed in voxels.
void setPressure (std::vector< float > P, std::vector< float > t)
 Sets the pressure vector and the pressure time vector. This functoin expects pressure and time values in two seperates vectors with a N to N corespondence, where N is the vector position. For example P = [1.5 , 2.1, 1.7] time = [1, 3, 8] gives that the pressure is 2.1 between the time 1 and 3.
void setRadius (float r)
 Sets the radius of the source.
void setTotalWater (float tot)
 This sets a float symbolising the total water in a source.
void update (float dt)
 This function updates the source by progressing the internal source time. this should be called regularly by the simulation.

Public Attributes

float currPres
 The current pressure in the source.

Private Attributes

float currTime
 The current internal source time, this should be linear maped to simulation time.
std::vector< std::vector< float > > normal
 Vector of vectors containing normal direction as xyz.
std::vector< int > normalTime
 "-1" specifies an infinite source.
std::vector< float > pressure
 Vector containing pressure values.
std::vector< float > pressureTime
 "-1" specifies an infinite source.
float radius
 The radius of the source.
float totalWater
 The total water of the source.
int xpos
 The x position of the source.
int ypos
 The y position of the source.
int zpos
 The z position of the source.

Detailed Description

Contains the parameters of a flow source..

This class is a container for parameters of a flow source. Parameters can be added and read using public functions.

Definition at line 14 of file flowSource.h.


Member Function Documentation

bool FlowSource::getChange ( float  dt)

Checks for changes in pressure after performing an update on the source.

Parameters:
dtThe time given as float to be used for advancing the currTime value of the source.
Returns:
True if the currPres value has changed after update, false otherwise.

Definition at line 93 of file flowSource.cpp.

std::vector< float > FlowSource::getNormal ( )

This function finds a thee valued vector with xyz defining the Normal direction at the internal time specified by the update function.

Returns:
The flow normal as xyz vector

Definition at line 59 of file flowSource.cpp.

std::vector< int > FlowSource::getPosition ( )

Gets the position of the flow source.

Returns:
The position given in voxels by a vector with xyz values.

Definition at line 75 of file flowSource.cpp.

This function finds the curent pressure depandeing on the internal time set by the update function.

Returns:
The current pressure

Definition at line 44 of file flowSource.cpp.

Gets the radius of the flow source.

Returns:
Radius of the source,
Warning:
this value never changes in current implementation

Definition at line 88 of file flowSource.cpp.

Gets the water left in the flow source as descriebed by totalWater.

Returns:
Water left in source,
Warning:
this value never changes in current implementation

Definition at line 84 of file flowSource.cpp.

void FlowSource::setNormal ( std::vector< std::vector< float > >  N,
std::vector< int >  t 
)

This function expects a vector filled with vectors that hold 3 values, xyz, and a time vector that specifies when to change the Normal direction. this time vector can be independent from the one used for pressure. For vector correspondences and time vetor specifications see setPressure()

Parameters:
Nis a vector of vectors containig the xyz values.
ttime vector see getPressure().
See also:
setPressure()

Definition at line 16 of file flowSource.cpp.

void FlowSource::setPosition ( int  x,
int  y,
int  z 
)

This function expects three ints symbolizing the 3D space cordinates of the source expressed in voxels.

Parameters:
xis the x value of the source in voxels.
yis the y value of the source in voxels.
zis the z value of the source in voxels.

Definition at line 22 of file flowSource.cpp.

void FlowSource::setPressure ( std::vector< float >  P,
std::vector< float >  t 
)

Sets the pressure vector and the pressure time vector. This functoin expects pressure and time values in two seperates vectors with a N to N corespondence, where N is the vector position. For example P = [1.5 , 2.1, 1.7] time = [1, 3, 8] gives that the pressure is 2.1 between the time 1 and 3.

Parameters:
Pthe pressure vector containing floats to be set.
tthe time vector containing ints to be set, this must be sorted from smallest to largest and only using values larger thamn 0 with the exception of "-1" that must be at the end if included.

Definition at line 10 of file flowSource.cpp.

void FlowSource::setRadius ( float  r)

Sets the radius of the source.

Parameters:
rThe radius of the source to be set.

Definition at line 34 of file flowSource.cpp.

void FlowSource::setTotalWater ( float  tot)

This sets a float symbolising the total water in a source.

Todo:
Implement method changing this parameter.
Parameters:
totIs the total water at the start of the simulation in the source.

Definition at line 29 of file flowSource.cpp.

void FlowSource::update ( float  dt)

This function updates the source by progressing the internal source time. this should be called regularly by the simulation.

Todo:
make this function also recalculate the total water left.

Definition at line 39 of file flowSource.cpp.


Member Data Documentation

std::vector<int> FlowSource::normalTime [private]

"-1" specifies an infinite source.

Vector containing time instances specifying change of normal.

Definition at line 16 of file flowSource.h.

std::vector<float> FlowSource::pressureTime [private]

"-1" specifies an infinite source.

Vector containing time instances specifying change of pressure, "-1" is the only negativ vaslue allowed and must be at the end.

Definition at line 18 of file flowSource.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations