slm: OpenCL code base  0.1
writearray.cl
Go to the documentation of this file.
1 
10 #ifdef KERNEL_INTEGRATE_TRAJECTORY
11 static inline void atomic_write_sl_data(__global uint *slt, __global uint *slc,
32  const float l_trajectory) {
33  // Add streamline length-so-far to total slt for this pixel
34  // - rounding up to & casting as 32bit int
35  // There may be issues for short trajectories as a result.
36  // Also if step distance is << pixel width.
37  atomic_add(slt, (uint)(l_trajectory+0.5f));
38  // Increment the 'visit' counter slc at this pixel.
39  atomic_inc(slc);
40 }
41 #endif
42 
43 #ifdef KERNEL_INTEGRATE_TRAJECTORY
44 static inline void check_atomic_write_sl_data(const uint idx, uint *prev_idx,
72  const bool mask_flag,
73  __global uint *slt, __global uint *slc,
74  const float l_trajectory) {
75  if (!mask_flag) {
76  // Add streamline length-so-far to total slt for this pixel
77  // - rounding up to & casting as 32bit int
78  // There may be issues for short trajectories as a result.
79  // Also if step distance is << pixel width.
80  atomic_add(slt, (uint)(l_trajectory+0.5f));
81  // Increment the 'visit' counter slc at this pixel.
82  atomic_inc(slc);
83  }
84  *prev_idx = idx;
85 }
86 #endif
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...
Definition: writearray.cl:31
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...
Definition: writearray.cl:71