CSol
|
#include <bf/csol_bf.h>
Public Member Functions | |
BF_Fire_Tile (CSol_Solver &, int, int, unsigned int, int, unsigned int, cl::Kernel &, cl::Kernel &, cl::Kernel &) | |
Bushfire tile constructor. More... | |
BF_Fire_Tile (const BF_Fire_Tile &) | |
~BF_Fire_Tile () | |
void | addUserBuffer (cl::Kernel &, QString, REAL) |
Add a user data buffer to the tile. More... | |
bool | bufferToGridTile (GridScalar &, int) |
Read from padded tile buffer to grid. More... | |
bool | buildUserArgumentList (std::list< QString > &) |
Build a correctly ordered user buffer argument list for program generation. More... | |
bool | createEmptyRealCLBuffer (cl::Kernel &, cl::Buffer &, unsigned int, REAL, unsigned int layers=1) |
Empty REAL buffer creation Creates an empty OpenCL REAL buffer within the tile. More... | |
bool | createEmptyUintCLBuffer (cl::Kernel &, cl::Buffer &, unsigned int, unsigned int, unsigned int layers=1) |
Empty integer buffer creation Creates an empty OpenCL integer buffer within the tile. More... | |
REAL | get_fE_max () |
Returns maximum front distance along east boundary. More... | |
REAL | get_fE_min () |
Returns minimum front distance along east boundary. More... | |
REAL | get_fN_max () |
Returns maximum front distance along north boundary. More... | |
REAL | get_fN_min () |
Returns minimum front distance along north boundary. More... | |
REAL | get_fS_max () |
Returns maximum front distance along south boundary. More... | |
REAL | get_fS_min () |
Returns minimum front distance along south boundary. More... | |
REAL | get_fW_max () |
Returns maximum front distance along west boundary. More... | |
REAL | get_fW_min () |
Returns minimum front distance along west boundary. More... | |
REAL | get_idt () |
Returns reciprocal of CFL timestep. More... | |
cl::Buffer *const | get_pba () |
Returns arrival time buffer. More... | |
cl::Buffer *const | get_pbc () |
Returns tile classification buffer. More... | |
cl::Buffer *const | get_pbconst () |
Returns tile constant buffer. More... | |
cl::Buffer *const | get_pbdata () |
Returns tile data buffer. More... | |
cl::Buffer *const | get_pbf0 () |
Returns tile front buffer. More... | |
cl::Buffer *const | get_pbpoi () |
Returns points-of-interest raster buffer. More... | |
cl::Buffer *const | get_pbrand () |
Returns tile random buffer. More... | |
cl::Buffer *const | get_pbs () |
Returns speed buffer. More... | |
cl::Buffer *const | get_pbw_u () |
Returns tile wind u (x-component) buffer. More... | |
cl::Buffer *const | get_pbw_v () |
Returns tile wind v (y-component) buffer. More... | |
cl::Buffer *const | get_pbx () |
Returns user buffers. More... | |
REAL | get_s_max () |
Returns maximum speed in tile. More... | |
REAL | get_t_poi () |
Returns maximum speed in tile. More... | |
bool | getUserBuffer (QString &, cl::Buffer &) |
Access a named user data buffer in the tile. More... | |
bool | init (cl::Kernel &) |
Run user initialisation code on the tile. More... | |
bool | initBuffer (DataExecution::ObjectArray &, int) |
bool | initBuffer (GridScalar &, int) |
Write REAL Grid to OpenCL buffer. More... | |
void | initFront (cl::Kernel &) |
Initialise the front buffer. More... | |
bool | initUserBuffer (DataExecution::ObjectArray &, QString, REAL, int) |
Write REAL Grid to OpenCL user buffer. More... | |
bool | limitUserBuffer (cl::Kernel &, QString, REAL, REAL) |
Apply limit to a user-defined data buffer. More... | |
bool | LS_addPointSource (cl::Kernel &, REAL, REAL, REAL) |
Level set operation: Add point source. More... | |
bool | LS_build (cl::Kernel &, REAL) |
Level set operation: Build speed values. More... | |
bool | LS_calculateCurvature (cl::Kernel &) |
Level set operation: Calculate curvature. More... | |
bool | LS_reinit (cl::Kernel &, bool) |
Level set operation: Single re-initialisation step. More... | |
bool | LS_reinitWeighted (cl::Kernel &, bool) |
Level set operation: Single weighted re-initialisation step. More... | |
bool | LS_setScalarBoundaries (cl::Kernel &, bool) |
Level set operation: Update boundary values from neighbouring tiles. More... | |
bool | LS_setUserBoundaries (cl::Kernel &, QString) |
Level set operation: Update user boundary values from neighbouring tiles. More... | |
bool | LS_update (cl::Kernel &, REAL, cl::Buffer &, uint) |
Level set operation: Update arrival times. More... | |
bool | LS_updateRK (cl::Kernel &, REAL, cl::Buffer &, uint) |
Level set operation: Runge-Kutta timestep. More... | |
BF_Fire_Tile & | operator= (const BF_Fire_Tile &) |
bool | randomiseUserBuffer (cl::Kernel &, QString, REAL) |
Add random variation to a user-defined data buffer. More... | |
template<typename T > | |
bool | sampleArray (DataExecution::ObjectArray &, Grid< T > &, T, int) |
Sub-samples an array of Grids into a tile. More... | |
void | set_dt (REAL dt_) |
Sets tile timestep. More... | |
bool | updateUserBuffer (cl::Kernel &, QString, BF_User_Temporal &) |
Update the internal user buffer with new values from time-varying spatial data. More... | |
Public Member Functions inherited from BF_Tile | |
BF_Tile (CSol_Solver &, int, int) | |
Bushfire tile constructor. More... | |
virtual | ~BF_Tile () |
void | deleteTile () |
De-activates the tile. More... | |
REAL | get_hx () |
Returns tile spacing in x-direction. More... | |
REAL | get_hy () |
Returns tile spacing in y-direction. More... | |
bool | get_isAlive () |
Returns true if tile is active, false otherwise. More... | |
REAL | get_ox () |
Returns global tile offset in x-direction. More... | |
REAL | get_oy () |
Returns global tile offset in y-direction. More... | |
int | get_size () |
Returns tile dimensions. More... | |
int | get_tx () |
Returns integer tile offset in x-direction. More... | |
int | get_ty () |
Returns integer tile offset in y-direction. More... | |
bool | hasNeighbourE () |
Returns true if tile has a east neighbour, false otherwise. More... | |
bool | hasNeighbourN () |
Returns true if tile has a north neighbour, false otherwise. More... | |
bool | hasNeighbourNE () |
Returns true if tile has a north-east neighbour, false otherwise. More... | |
bool | hasNeighbourNW () |
Returns true if tile has a north-west neighbour, false otherwise. More... | |
bool | hasNeighbourS () |
Returns true if tile has a south neighbour, false otherwise. More... | |
bool | hasNeighbourSE () |
Returns true if tile has a south-east neighbour, false otherwise. More... | |
bool | hasNeighbourSW () |
Returns true if tile has a south-west neighbour, false otherwise. More... | |
bool | hasNeighbourW () |
Returns true if tile has a west neighbour, false otherwise. More... | |
void | setNeighbourE (BF_Tile *pTile) |
Sets tile east neighbour. More... | |
void | setNeighbourN (BF_Tile *pTile) |
Sets tile north neighbour. More... | |
void | setNeighbourNE (BF_Tile *pTile) |
Sets tile north-east neighbour. More... | |
void | setNeighbourNW (BF_Tile *pTile) |
Sets tile north-west neighbour. More... | |
void | setNeighbours (std::map< BF::int64, BF_Tile * > &) |
Sets tile neighbours. More... | |
void | setNeighbourS (BF_Tile *pTile) |
Sets tile south neighbour. More... | |
void | setNeighbourSE (BF_Tile *pTile) |
Sets tile south-east neighbour. More... | |
void | setNeighbourSW (BF_Tile *pTile) |
Sets tile south-west neighbour. More... | |
void | setNeighbourW (BF_Tile *pTile) |
Sets tile west neighbour. More... | |
Additional Inherited Members | |
Public Types inherited from BF_Tile | |
enum | bufferType { bFront, bClass, bArrival, bOut, bUser } |
Tile buffer types. More... | |
enum | direction { North, South, West, East } |
Tile directions. More... | |
Protected Attributes inherited from BF_Tile | |
cl::Context & | context |
REAL | hx |
REAL | hy |
Cell spacing in world units. More... | |
bool | isAlive |
Active flag. More... | |
int | localSize |
OpenCL group size. More... | |
REAL | ox |
REAL | oy |
Tile origin in world units. More... | |
BF_Tile * | pTileE |
BF_Tile * | pTileN |
BF_Tile * | pTileNE |
BF_Tile * | pTileNW |
BF_Tile * | pTileS |
BF_Tile * | pTileSE |
BF_Tile * | pTileSW |
BF_Tile * | pTileW |
cl::CommandQueue & | queue |
int | tileSize |
Number of cells in each tile. More... | |
int | tx |
int | ty |
Cell offset in tile world units. More... | |
BF_Fire_Tile | ( | CSol_Solver & | solver_, |
int | tx_, | ||
int | ty_, | ||
unsigned int | seed, | ||
int | constants_, | ||
unsigned int | nxLayers_, | ||
cl::Kernel & | fillUintBufferKernel, | ||
cl::Kernel & | fillRealBufferKernel, | ||
cl::Kernel & | initRandKernel | ||
) |
Creates a two-dimensional computational tile for the bushfire solver. Each tile has equal x and y dimensions of 'tileSize' with x and y spacings of 'hx' and 'hy', respectively. Every tile is reference according to the first tile created in the simulation. This first tile has a integer location of (0, 0) along with a global offset from the lower-left corner which is passed to this constructor for each subsequent tile creation.
solver_ | the parent solver instance. |
tx_ | the integer x-location of the tile with respect to the first tile created. |
ty_ | the integer y-location of the tile with respect to the first tile created. |
seed | the random number seed for the tile. |
constants_ | the number of user-defined constants required for the simulation. |
fillUintBufferKernel | the OpenCL kernel to fill a buffer with an unsigned integer value. |
fillRealBufferKernel | the OpenCL kernel to fill a buffer with an REAL value. |
initRandKernel | the OpenCL kernel to initialise the random number generator. |
|
inline |
BF_Fire_Tile | ( | const BF_Fire_Tile & | ) |
void addUserBuffer | ( | cl::Kernel & | fillRealBufferKernel, |
QString | userName, | ||
REAL | externalVal | ||
) |
Creates and adds a user-defined data buffer to the tile. This is inserted into a local map, identified by the given name of the user data buffer. The buffer is initialised to 'externalVal' on creation.
fillRealBufferKernel | the OpenCL kernel to fill a buffer with an REAL value. |
userName | the name of the user buffer. |
externalVal | the initialisation value for the user buffer. |
bool bufferToGridTile | ( | GridScalar & | g, |
int | type | ||
) |
Reads from internal OpenCL buffers to a Grid for downstream processing.
g | the Grid to read data into. |
type | the data type to read, given by bufferType. |
bool buildUserArgumentList | ( | std::list< QString > & | userDataNames | ) |
userDataNames | list of user data sets referred to in user-defined programs. |
bool createEmptyRealCLBuffer | ( | cl::Kernel & | fillRealBufferKernel, |
cl::Buffer & | buffer, | ||
unsigned int | tileSize, | ||
REAL | v, | ||
unsigned int | layers = 1 |
||
) |
fillRealBufferKernel | the OpenCL kernel to fill a buffer with an REAL value. |
buffer | the OpenCL buffer to fill. |
tileSize | the number of tile cells in the x and y directions. |
v | the REAL fill value. |
bool createEmptyUintCLBuffer | ( | cl::Kernel & | fillUintBufferKernel, |
cl::Buffer & | buffer, | ||
unsigned int | tileSize, | ||
unsigned int | v, | ||
unsigned int | layers = 1 |
||
) |
fillUintBufferKernel | the OpenCL kernel to fill a buffer with an unsigned integer value. |
buffer | the OpenCL buffer to fill. |
tileSize | the number of tile cells in the x and y directions. |
v | the integer fill value. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Implements BF_Tile.
|
inline |
|
inlinevirtual |
Implements BF_Tile.
|
inlinevirtual |
Implements BF_Tile.
|
inline |
|
inline |
|
inline |
bool getUserBuffer | ( | QString & | userName, |
cl::Buffer & | buffer | ||
) |
userName | the name of the user buffer. |
buffer | handle to the user buffer. |
bool init | ( | cl::Kernel & | initKernel | ) |
initKernel | the user-defined initialisation kernel. |
bool initBuffer | ( | DataExecution::ObjectArray & | , |
int | |||
) |
bool initBuffer | ( | GridScalar & | g, |
int | type | ||
) |
Grids are sampled into dimensions compatible with the tile before writing to the buffer, so the Grid passed to this function can be any dimension and contain null values. Any null or out-of-bounds values are replaced by an 'infinite' value for the front grid, or an 'unburnt' value for the arrival time grid. The global positions of the Grid and buffer are used for the sampling.
g | the Grid to write to the internal OpenCL buffer. |
type | the data type to write, given by bufferType. |
void initFront | ( | cl::Kernel & | fillRealBufferKernel | ) |
fillRealBufferKernel | the OpenCL kernel to fill a buffer with an REAL value. |
bool initUserBuffer | ( | DataExecution::ObjectArray & | , |
QString | , | ||
REAL | , | ||
int | |||
) |
Grids are sampled into dimensions compatible with the tile before writing to the buffer, so the Grid passed to this function can be any dimension and contain null values. Any null or out-of-bounds values are replaced by 'externalVal'. The global positions of the Grid and buffer are used for the sampling.
arr | the array of Grids to write to the internal OpenCL buffer. |
userName | the name of the user buffer. |
externalVal | the value to use for out-of-bounds or external values. |
interpolationType | the type of interpolation to use. |
bool limitUserBuffer | ( | cl::Kernel & | limitKernel, |
QString | userName, | ||
REAL | max, | ||
REAL | min | ||
) |
Replaces any value over maximum value with the maximum, and any value under the minimum value with the minimum.
limitKernel | the OpenCL kernel for limiting. |
userName | the name of the user buffer. |
max | the maximum value. |
min | the minimum value. |
bool LS_addPointSource | ( | cl::Kernel & | addPointSource, |
REAL | dox, | ||
REAL | doy, | ||
REAL | r | ||
) |
Adds a circular point source to the front. The radius of the point source should be at least two cells accross to esure correct resolution.
addPointSource | point source kernel. |
dox | point source x-location. |
doy | point source y-location. |
r | point source radius. |
bool LS_build | ( | cl::Kernel & | buildKernel, |
REAL | solverTime | ||
) |
Calculates the speed at each point in the tile based on the user-input speed definition. The function also carries out a reduction operation to find the maximum speed in the tile for the CFL condition. The maximum and minium boundary values are also stored for detection of the front location, which is used for creating new tiles and deactivating existing tiles.
buildKernel | build kernel. |
RKstep | step value: 0 for first Runge-Kutta step, 1 for second step. |
bool LS_calculateCurvature | ( | cl::Kernel & | curvature | ) |
Experimental curvature calculation.
curvature | curvature kernel. |
bool LS_reinit | ( | cl::Kernel & | reinitKernel, |
bool | flip | ||
) |
reinitKernel | re-initialisation kernel. |
flip | true if the primary front grid is used, false if the secondary front grid is used. |
bool LS_reinitWeighted | ( | cl::Kernel & | reinitWeightedKernel, |
bool | flip | ||
) |
reinitWeightedKernel | re-initialisation kernel with speed weighting. |
flip | true if the primary front grid is used, false if the secondary front grid is used. |
bool LS_setScalarBoundaries | ( | cl::Kernel & | setScalarBoundariesKernel, |
bool | flip | ||
) |
This sets the external values around the boundaries of each tile to the values from the boundaries of neighbouring tiles (scatter operation).
setScalarBoundariesKernel | boundary kernel. |
flip | true if the primary front grid is used, false if the secondary front grid is used. |
bool LS_setUserBoundaries | ( | cl::Kernel & | setScalarBoundariesKernel, |
QString | userName | ||
) |
This sets the external values for user-defined layers around the boundaries of each tile to the values from the boundaries of neighbouring tiles (scatter operation).
setScalarBoundariesKernel | boundary kernel. |
userName | the name of the user buffer. |
bool LS_update | ( | cl::Kernel & | updateKernel, |
REAL | solverTime, | ||
cl::Buffer & | bpoi_out, | ||
uint | npoi | ||
) |
Updates the arrival times within each tile and runs post-processing.
updateKernel | update kernel. |
solverTime | current solver time. |
bpoi_out | the output buffer for the points-of-interest. |
npoi | the total number of points-of-interest. |
bool LS_updateRK | ( | cl::Kernel & | updateRKKernel, |
REAL | solverTime, | ||
cl::Buffer & | bpoi_out, | ||
uint | npoi | ||
) |
Carries out a Runge-Kutta based as a second step, after an intial Euler step. This function also updates the arrival times within each tile, flags any points-of-interest (PoI) that have been touched by the front during the timestep and runs the user-defined output model for any cells which are currently ignited.
updateRKKernel | Runge-Kutta time intergration kernel. |
solverTime | current solver time. |
bpoi_out | the output buffer for the points-of-interest. |
npoi | the total number of points-of-interest. |
BF_Fire_Tile& operator= | ( | const BF_Fire_Tile & | ) |
bool randomiseUserBuffer | ( | cl::Kernel & | randomiseKernel, |
QString | userName, | ||
REAL | stdev | ||
) |
Replaces the value in the buffer with new value from a normal distribution. The initial value in the buffer is used as the mean, and a new value is selected from a normal distribution with a given standard distribution width 'stdev'.
randomiseKernel | the OpenCL kernel for randomisation. |
userName | the name of the user buffer. |
stdev | the standard deviation of the normal distribution. |
bool sampleArray | ( | DataExecution::ObjectArray & | arr, |
Grid< T > & | gTile, | ||
T | fillValue, | ||
int | interpolationType | ||
) |
arr | the array of Grids to sample. |
gTile | the tile grid write. |
|
inline |
bool updateUserBuffer | ( | cl::Kernel & | interpolateKernel, |
QString | userName, | ||
BF_User_Temporal & | userData | ||
) |
interpolateKernel | the OpenCL kernel for trilinear interpolation. |
userName | the name of the user buffer. |
userData | the time-varying user data. |