Waterflow
Visualize water in terrain
|
Contains the parameters of a flow source.. More...
#include <flowSource.h>
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. |
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.
bool FlowSource::getChange | ( | float | dt | ) |
Checks for changes in pressure after performing an update on the source.
dt | The time given as float to be used for advancing the currTime value of the source. |
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.
Definition at line 59 of file flowSource.cpp.
std::vector< int > FlowSource::getPosition | ( | ) |
Gets the position of the flow source.
Definition at line 75 of file flowSource.cpp.
float FlowSource::getPressure | ( | ) |
This function finds the curent pressure depandeing on the internal time set by the update function.
Definition at line 44 of file flowSource.cpp.
float FlowSource::getRadius | ( | ) |
Gets the radius of the flow source.
Definition at line 88 of file flowSource.cpp.
float FlowSource::getWaterLeft | ( | ) |
Gets the water left in the flow source as descriebed by totalWater.
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()
N | is a vector of vectors containig the xyz values. |
t | time vector see getPressure(). |
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.
x | is the x value of the source in voxels. |
y | is the y value of the source in voxels. |
z | is 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.
P | the pressure vector containing floats to be set. |
t | the 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.
r | The 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.
tot | Is 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.
Definition at line 39 of file flowSource.cpp.
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.