slm: OpenCL code base
0.1
|
Functions to carry out Runge-Kutta integration steps along streamlines & record them. More...
Functions | |
static void | compute_step_vec (const float dt, const __global float2 *uv_array, float2 *dxy1_vec, float2 *dxy2_vec, float2 *uv1_vec, float2 *uv2_vec, const float2 vec, float2 *next_vec, uint *idx) |
Compute a 2nd-order Runge-Kutta integration step along a streamline. More... | |
static void | compute_step_vec_jittered (const float dt, const __global float2 *uv_array, uint *rng_state, float2 *dxy1_vec, float2 *dxy2_vec, float2 *uv1_vec, float2 *uv2_vec, const float2 vec, float2 *next_vec, uint *idx) |
Compute a jittered 2nd-order Runge-Kutta integration step along a streamline. More... | |
static void | update_record_trajectory_write_sl_data (const float dl, float *l_trajectory, const float2 vec, const float2 prev_vec, uint *n_steps, uint *idx, uint *prev_idx, __global char2 *trajectory_vec, __global const bool *mask_array, __global uint *slt_array, __global uint *slc_array) |
Update variables tracking trajectory length and integration step counter. More... | |
static void | update_trajectory_write_sl_data (float dl, float *l_trajectory, float2 vec, float2 prev_vec, uint *n_steps, uint *idx, uint *prev_idx, __global const bool *mask_array, __global uint *slt_array, __global uint *slc_array) |
Update variables tracking trajectory length and integration step counter. More... | |
static void | update_record_trajectory (float dl, float *l_trajectory, float2 vec, float2 prev_vec, uint *n_steps, __global char2 *trajectory_vec) |
Update variables tracking trajectory length and integration step counter. More... | |
static void | update_record_private_trajectory (float dl, float *l_trajectory, float2 vec, float2 prev_vec, uint *n_steps, __private char2 *trajectory_vec) |
Update variables tracking trajectory length and integration step counter. More... | |
static void | update_trajectory (float dl, float *l_trajectory, uint *n_steps) |
Update variables tracking trajectory length and integration step counter. More... | |
static void | finalize_trajectory (const uint global_id, uint n_steps, float l_trajectory, __global ushort *traj_nsteps_array, __global float *traj_length_array) |
Record the (final) trajectory length and count of integration steps to global arrays traj_length_array and traj_nsteps_array respectively. More... | |
static void | atomic_write_sl_data (__global uint *slt, __global uint *slc, const float l_trajectory) |
Add the current streamline length (l_trajectory ) to the current pixel of the slt accumulation array. More... | |
static void | check_atomic_write_sl_data (const uint idx, uint *prev_idx, const bool mask_flag, __global uint *slt, __global uint *slc, const float l_trajectory) |
Extended version of atomic_write_sl_data() to include testing whether the current pixel is masked, and an assignment of the previous pixel index to the current pixel index. More... | |
Functions to carry out Runge-Kutta integration steps along streamlines & record them.
|
inlinestatic |
Add the current streamline length (l_trajectory
) to the current pixel of the slt
accumulation array.
Similarly, increment the streamline count at the current pixel of the slc
accumulation array. Atomic operations are used since several kernel instances may need to write to the same pixel effectively simultaneously.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in,out] | slc | grid recording accumulated count of streamline integration steps across each pixel (padded) |
[in,out] | slt | grid recording accumulated count of streamline segment lengths crossing each pixel (padded) |
[in] | l_trajectory | total streamline distance so far |
Definition at line 31 of file writearray.cl.
|
inlinestatic |
Extended version of atomic_write_sl_data() to include testing whether the current pixel is masked, and an assignment of the previous pixel index to the current pixel index.
Add the current streamline length (l_trajectory
) to the current pixel of the slt
accumulation array. Similarly, increment the streamline count at the current pixel of the slc
accumulation array. Atomic operations are used since several kernel instances may need to write to the same pixel effectively simultaneously.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in] | idx | array index of pixel at current (x,y) position |
[in,out] | prev_idx | array index of pixel at previous (x,y) position |
[in] | mask_flag | whether current pixel is masked or not |
[in,out] | slc | grid recording accumulated count of streamline integration steps across each pixel (padded) |
[in,out] | slt | grid recording accumulated count of streamline segment lengths crossing each pixel (padded) |
[in] | l_trajectory | total streamline distance so far |
Definition at line 71 of file writearray.cl.
|
inlinestatic |
Compute a 2nd-order Runge-Kutta integration step along a streamline.
Compiled if any of the following are defined:
[in] | dt | delta time step |
[in] | uv_array | (float *, RO): gridded velocity vector components (u,v) |
[in,out] | dxy1_vec | R-K first order delta step vector |
[in,out] | dxy2_vec | R-K second order delta step vector |
[in,out] | uv1_vec | flow velocity vector at current coordinate (at vec ) |
[in,out] | uv2_vec | flow velocity vector at RK1 stepped coordinate (at vec + dxy1_vec ) |
[in] | vec | current (x,y) coordinate vector at tip of streamline trajectory |
[in,out] | next_vec | next (x,y) coordinate vector on streamline trajectory |
[in,out] | idx | array index of pixel at current (x,y) position |
Definition at line 41 of file computestep.cl.
|
inlinestatic |
Compute a jittered 2nd-order Runge-Kutta integration step along a streamline.
Jittering is achieved by adding a uniform random vector to of the RK2 flow velocity vectors, then normalizing to provide two RK2 unit step vectors. The [0,1) uniform variates are scaled by JITTER_MAGNITUDE before addition to the unit flow vectors.
Compiled if KERNEL_INTEGRATE_TRAJECTORY and IS_RNG_AVAILABLE is defined.
[in] | dt | delta time step |
[in] | uv_array | (float *, RO): gridded velocity vector components (u,v) |
[in,out] | rng_state | RNG state (thus initally the seed) and RNG variate |
[in,out] | dxy1_vec | R-K first order delta step vector |
[in,out] | dxy2_vec | R-K second order delta step vector |
[in,out] | uv1_vec | flow velocity vector at current coordinate (at vec ) |
[in,out] | uv2_vec | flow velocity vector at RK1 stepped coordinate (at vec + dxy1_vec ) |
[in] | vec | current (x,y) coordinate vector at tip of streamline trajectory |
[in,out] | next_vec | next (x,y) coordinate vector on streamline trajectory |
[in,out] | idx | array index of pixel at current (x,y) position |
Definition at line 85 of file computestep.cl.
|
inlinestatic |
Record the (final) trajectory length and count of integration steps to global arrays traj_length_array
and traj_nsteps_array
respectively.
This action takes place at the end of streamline tracing in each integration kernel instance.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in] | global_id | ID of the kernel instance |
[in] | n_steps | number of integration steps so far in streamline trajectory |
[in] | l_trajectory | total streamline distance so far |
[out] | traj_nsteps_array | list of number of steps along each trajectory; one per seed_point_array vector |
[out] | traj_length_array | list of lengths of each trajectory; one per seed_point_array vector |
Definition at line 213 of file trajectoryfns.cl.
|
inlinestatic |
Update variables tracking trajectory length and integration step counter.
Record (to private array) a compressed version of the current trajectory step vector.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in] | dl | step distance |
[in,out] | l_trajectory | total streamline distance so far |
[in] | vec | current (x,y) coordinate vector at tip of streamline trajectory |
[in] | prev_vec | previous (x,y) coordinate vector on streamline trajectory |
[in,out] | n_steps | number of integration steps so far in streamline trajectory |
[in,out] | trajectory_vec | streamline trajectory record (2d array of compressed (x,y) vectors) |
Definition at line 156 of file trajectoryfns.cl.
|
inlinestatic |
Update variables tracking trajectory length and integration step counter.
Record (to global array) a compressed version of the current trajectory step vector.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in] | dl | step distance |
[in,out] | l_trajectory | total streamline distance so far |
[in] | vec | current (x,y) coordinate vector at tip of streamline trajectory |
[in] | prev_vec | previous (x,y) coordinate vector on streamline trajectory |
[in,out] | n_steps | number of integration steps so far in streamline trajectory |
[in,out] | trajectory_vec | streamline trajectory record (2d array of compressed (x,y) vectors) |
Definition at line 125 of file trajectoryfns.cl.
|
inlinestatic |
Update variables tracking trajectory length and integration step counter.
Record (to global array) a compressed version of the current trajectory step vector. Write length and count data to global arrays.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in] | dl | step distance |
[in,out] | l_trajectory | total streamline distance so far |
[in,out] | vec | current (x,y) coordinate vector at tip of streamline trajectory |
[in,out] | prev_vec | previous (x,y) coordinate vector on streamline trajectory |
[in,out] | n_steps | number of integration steps so far in streamline trajectory |
[in,out] | idx | array index of pixel at current (x,y) position |
[in,out] | prev_idx | array index of pixel at previous (x,y) position |
[in,out] | trajectory_vec | streamline trajectory record (2d array of compressed (x,y) vectors) |
[in] | mask_array | grid pixel mask (padded), with true = masked, false = good |
[in,out] | slc_array | grid recording accumulated count of streamline integration steps across each pixel (padded) |
[in,out] | slt_array | grid recording accumulated count of streamline segment lengths crossing each pixel (padded) |
Definition at line 44 of file trajectoryfns.cl.
|
inlinestatic |
Update variables tracking trajectory length and integration step counter.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in] | dl | step distance |
[in,out] | l_trajectory | total streamline distance so far |
[in,out] | n_steps | number of integration steps so far in streamline trajectory |
Definition at line 182 of file trajectoryfns.cl.
|
inlinestatic |
Update variables tracking trajectory length and integration step counter.
Write length and count data to global arrays.
Compiled if KERNEL_INTEGRATE_TRAJECTORY is defined.
[in] | dl | step distance |
[in,out] | l_trajectory | total streamline distance so far |
[in] | vec | current (x,y) coordinate vector at tip of streamline trajectory |
[in] | prev_vec | previous (x,y) coordinate vector on streamline trajectory |
[in,out] | n_steps | number of integration steps so far in streamline trajectory |
[in,out] | idx | array index of pixel at current (x,y) position |
[in,out] | prev_idx | array index of pixel at previous (x,y) position |
[in] | mask_array | grid pixel mask (padded), with true = masked, false = good |
[in,out] | slc_array | grid recording accumulated count of streamline integration steps across each pixel (padded) |
[in,out] | slt_array | grid recording accumulated count of streamline segment lengths crossing each pixel (padded) |
Definition at line 88 of file trajectoryfns.cl.