Template Class DeviceMacroProperty

Inheritance Relationships

Base Type

Class Documentation

template<typename T, unsigned int I = 1, unsigned int J = 1, unsigned int K = 1, unsigned int W = 1>
class DeviceMacroProperty : public flamegpu::ReadOnlyDeviceMacroProperty<T, 1, 1, 1, 1>

Public Functions

__device__ explicit DeviceMacroProperty(T *_ptr, unsigned int *_rwf)

Constructor

Parameters:
  • _ptr – Pointer to buffer

  • _rwf – Pointer to read_write_flag

__device__ __forceinline__ DeviceMacroProperty<T, J, K, W, 1> operator[](unsigned int i) const

Access the next dimension of the array

Throws:
  • exception::DeviceError – If i >= I.

  • exception::DeviceError – If template arguments I, J, K , W are all 1. Which denotes the macro property has no dimensions remaining to be indexed.

__device__ __forceinline__ DeviceMacroProperty<T, I, J, K, W> &operator+=(T val)

atomic add

Note

Only suitable where T is type int32_t, uint32_t, uint64_t, float, double

Parameters:

val – The 2nd operand

Returns:

a reference to this Note, taking value of the returned object will fail, due to the risk of atomic conflicts

__device__ __forceinline__ DeviceMacroProperty<T, I, J, K, W> &operator-=(T val)

atomic subtraction

Note

Only suitable where T is type int32_t or uint32_t

Parameters:

val – The 2nd operand

Returns:

a reference to this Note, taking value of the returned object will fail, due to the risk of atomic conflicts

__device__ __forceinline__ T operator+(T val) const

atomic add

Parameters:

val – The 2nd operand

Returns:

(this + val)

__device__ __forceinline__ T operator-(T val) const

atomic subtraction

Parameters:

val – The 2nd operand

Returns:

(this - val)

__device__ __forceinline__ T operator++()

atomic pre-increment

Note

A reference is not returned, as this makes it easy to fall into the trap (race condition) of reading it’s value.

Note

Only suitable where T is type uint32_t

Returns:

the value after the increment operation is performed

__device__ __forceinline__ T operator--()

atomic pre-decrement

Note

A reference is not returned, as this makes it easy to fall into the trap (race condition) of reading it’s value.

Note

Only suitable where T is type uint32_t

Returns:

the value after the decrement operation is performed

__device__ __forceinline__ T operator++(int)

atomic post-increment

Note

Only suitable where T is type uint32_t

Returns:

the value before increment operation is performed

__device__ __forceinline__ T operator--(int)

atomic post-decrement

Note

Only suitable where T is type uint32_t

Returns:

the value before increment operation is performed

__device__ __forceinline__ T min(T val)

atomic min

Note

Only suitable where T is type int32_t, uint32_t, uint64_t

Returns:

min(this, val)

__device__ __forceinline__ T max(T val)

atomic max

Note

Only suitable where T is type int32_t, uint32_t, uint64_t

Returns:

max(this, val)

__device__ __forceinline__ T CAS(T compare, T val)

atomic compare and swap Computes (old == compare ? val : old)

Note

Only suitable where T is type int32_t, uint32_t, uint64_t, uint16_t

Returns:

old

__device__ __forceinline__ T exchange(T val)

atomic exchange Returns the current value stored in the element, and replaces it with val

Note

Only suitable for 32/64 bit types

Returns:

the value before the exchange