Class MessageSpatial3D
Defined in File MessageSpatial3D.h
Nested Relationships
Nested Types
Class Documentation
-
class MessageSpatial3D
3D Continuous spatial messaging functionality
User specifies the environment bounds and search radius When accessing messages, a search origin is specified A subset of messages, including those within radius of the search origin are returned The user must distance check that they fall within the search radius manually Unlike FLAMEGPU1, these spatial messages do not wrap over environment bounds.
-
class CDescription : public flamegpu::MessageSpatial2D::CDescription
Subclassed by flamegpu::MessageSpatial3D::Description
Public Functions
-
Constructor, creates an interface to the MessageData
- Parameters:
data – Data store of this message’s data
-
CDescription(const CDescription &other_agent) = default
Copy constructor Creates a new interface to the same MessageData/ModelData
-
CDescription(CDescription &&other_agent) = default
-
CDescription &operator=(const CDescription &other_agent) = default
Assignment operator Assigns this interface to the same MessageData/ModelData
-
CDescription &operator=(CDescription &&other_agent) = default
-
bool operator==(const CDescription &rhs) const
Equality operator, checks whether message Description hierarchies are functionally the same
Note
Instead compare pointers if you wish to check that they are the same instance
- Parameters:
rhs – right hand side
- Returns:
True when messages are the same
-
bool operator!=(const CDescription &rhs) const
Equality operator, checks whether message Description hierarchies are functionally different
Note
Instead compare pointers if you wish to check that they are not the same instance
- Parameters:
rhs – right hand side
- Returns:
True when messages are not the same
-
float getMinZ() const
Const accessors
-
float getMaxZ() const
-
-
class CUDAModelHandler : public flamegpu::MessageSpecialisationHandler
CUDA host side handler of spatial messages Allocates memory for and constructs PBM
Public Functions
-
explicit CUDAModelHandler(detail::CUDAMessage &a)
Constructor
Initialises metadata, decides PBM size etc
- Parameters:
a – Parent CUDAMessage, used to access message settings, data ptrs etc
-
inline ~CUDAModelHandler() override
Destructor Frees all alocated memory
-
virtual void init(detail::CUDAScatter &scatter, unsigned int streamId, cudaStream_t stream) override
Allocates memory for the constructed index. Sets data asthough message list is empty
- Parameters:
scatter – Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
streamId – Index of stream specific structures used
stream – The CUDAStream to use for CUDA operations
-
virtual void buildIndex(detail::CUDAScatter &scatter, unsigned int streamId, cudaStream_t stream) override
Reconstructs the partition boundary matrix This should be called before reading newly output messages
- Parameters:
scatter – Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)
streamId – The stream index to use for accessing stream specific resources such as scan compaction arrays and buffers
stream – The CUDAStream to use for CUDA operations
-
virtual void allocateMetaDataDevicePtr(cudaStream_t stream) override
Allocates memory for the constructed index. The memory allocation is checked by build index.
-
virtual void freeMetaDataDevicePtr() override
Releases memory for the constructed index.
-
inline virtual const void *getMetaDataDevicePtr() const override
Returns a pointer to the metadata struct, this is required for reading the message data
-
explicit CUDAModelHandler(detail::CUDAMessage &a)
-
struct Data : public flamegpu::MessageSpatial2D::Data
Internal data representation of Spatial3D messages within model description hierarchy
See also
Public Functions
-
virtual ~Data() = default
-
virtual std::unique_ptr<MessageSpecialisationHandler> getSpecialisationHander(detail::CUDAMessage &owner) const override
-
virtual std::type_index getType() const override
Used internally to validate that the corresponding Message type is attached via the agent function shim.
- Returns:
The std::type_index of the Message type which must be used.
-
virtual flamegpu::MessageSortingType getSortingType() const override
Return the sorting type for this message type
Protected Functions
Copy constructor This is unsafe, should only be used internally, use clone() instead
-
Normal constructor, only to be called by ModelDescription
Friends
- friend class ModelDescription
- friend struct ModelData
-
virtual ~Data() = default
-
class Description : public flamegpu::MessageSpatial3D::CDescription
User accessible interface to Spatial3D messages within mode description hierarchy
See also
Public Functions
-
Constructor, creates an interface to the MessageData
- Parameters:
data – Data store of this agent’s data
-
Description(const Description &other_message) = default
Copy constructor Creates a new interface to the same MessageData/ModelData
-
Description(Description &&other_message) = default
-
Description &operator=(const Description &other_message) = default
Assignment operator Assigns this interface to the same MessageData/ModelData
-
Description &operator=(Description &&other_message) = default
-
void setMinZ(float z)
Accessors
-
void setMaxZ(float z)
-
void setMin(float x, float y, float z)
-
void setMax(float x, float y, float z)
-
-
struct GridPos3D
Basic class to group 3 dimensional bin coordinates Would use glm::ivec3, but project does not currently have glm
-
class In
This class is accessible via DeviceAPI.message_in if MessageSpatial3D is specified in FLAMEGPU_AGENT_FUNCTION It gives access to functionality for reading spatially partitioned messages
Public Functions
-
__device__ inline In(const void *_metadata)
Constructor Initialises member variables
- Parameters:
_metadata – Reinterpreted as type MessageSpatial3D::MetaData
-
__device__ inline Filter operator()(const float x, const float y, const float z) const
Returns a Filter object which provides access to message iterator for iterating a subset of messages including those within the radius of the search origin
- Parameters:
x – Search origin x coord
y – Search origin y coord
z – Search origin z coord
-
__device__ inline WrapFilter wrap(const float x, const float y, const float z) const
Returns a WrapFilter object which provides access to message iterator for iterating a subset of messages including those within the radius of the search origin
Note
Unlike the regular iterator, this iterator will not return messages outside of the search radius. The wrapped distance can be returned via WrapFilter::Message::distance()
- Parameters:
x – Search origin x coord
y – Search origin y coord
z – Search origin z coord
-
__forceinline__ __device__ inline float radius() const
Returns the search radius of the message list defined in the model description
-
class Filter
This class is created when a search origin is provided to MessageSpatial3D::In::operator()(float, float, float) It provides iterator access to a subset of the full message list, according to the provided search origin
See also
MessageSpatial3D::In::operator()(float, float, float)
Public Functions
-
__device__ inline Filter(const MetaData *_metadata, float x, float y, float z)
Constructor, takes the search parameters requried
- Parameters:
_metadata – Pointer to message list metadata
x – Search origin x coord
y – Search origin y coord
z – search origin z coord
-
class iterator
Stock iterator for iterating MessageSpatial3D::In::Filter::Message objects
Public Functions
-
__device__ inline iterator(const Filter &parent, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
Constructor This iterator is constructed by MessageSpatial3D::In::Filter::begin()(float, float, float)
See also
MessageSpatial3D::In::Operator()(float, float, float)
-
__device__ inline iterator(const Filter &parent)
False constructor Only used by Filter::end(), creates a null objct
-
__device__ inline iterator operator++(int)
Moves to the next message (Postfix increment operator, returns value prior to increment)
-
__device__ inline iterator(const Filter &parent, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
-
class Message
Provides access to a specific message Returned by the iterator
See also
Public Functions
-
__device__ inline Message(const Filter &parent, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
Constructs a message and directly initialises all of it’s member variables
Note
See member variable documentation for their purposes
-
__device__ inline bool operator==(const Message &rhs) const
Equality operator Compares all internal member vars for equality
Note
Does not compare _parent
-
__device__ inline bool operator!=(const Message&) const
This should only be called to compare against end() It has been modified to check for end of iteration with minimal instructions Therefore it does not even perform the equality operation
Note
Use operator==() if proper equality is required
-
__device__ inline Message &operator++()
Updates the message to return variables from the next message in the message list
- Returns:
Returns itself
-
template<typename T, unsigned int N>
__device__ T getVariable(const char (&variable_name)[N]) const Returns the value for the current message attached to the named variable
- Parameters:
variable_name – Name of the variable
- Template Parameters:
T – type of the variable
N – Length of variable name (this should be implicit if a string literal is passed to variable name)
- Returns:
The specified variable, else 0x0 if an error occurs
-
template<typename T, flamegpu::size_type N, unsigned int M>
__device__ T getVariable(const char (&variable_name)[M], unsigned int index) const Returns the specified variable array element from the current message attached to the named variable
- Parameters:
variable_name – name used for accessing the variable, this value should be a string literal e.g. “foobar”
index – Index of the element within the variable array to return
- Template Parameters:
T – Type of the message variable being accessed
N – The length of the array variable, as set within the model description hierarchy
M – Length of variable_name, this should always be implicit if passing a string literal
- Throws:
exception::DeviceError – If name is not a valid variable within the agent (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)
exception::DeviceError – If T is not the type of variable ‘name’ within the message (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)
exception::DeviceError – If index is out of bounds for the variable array specified by name (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)
-
__device__ inline Message(const Filter &parent, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
-
__device__ inline Filter(const MetaData *_metadata, float x, float y, float z)
-
class WrapFilter
This class is created when a search origin is provided to MessageSpatial3D::In::wrap()(float, float, float) It provides iterator access to a subset of the full message list, according to the provided search origin
See also
MessageSpatial3D::In::wrap()(float, float, float)
Public Functions
-
__device__ inline WrapFilter(const MetaData *_metadata, float x, float y, float z)
Constructor, takes the search parameters requried
- Parameters:
_metadata – Pointer to message list metadata
x – Search origin x coord
y – Search origin y coord
z – search origin z coord
-
class iterator
Stock iterator for iterating MessageSpatial3D::In::Filter::Message objects
Public Functions
-
__device__ inline iterator(const WrapFilter &parent, const int relative_cell_x, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
Constructor This iterator is constructed by MessageSpatial3D::In::WrapFilter::begin()(float, float, float)
See also
MessageSpatial3D::In::wrap()(float, float, float)
-
__device__ inline iterator(const WrapFilter &parent)
False constructor Only used by Filter::end(), creates a null objct
-
__device__ inline iterator operator++(int)
Moves to the next message (Postfix increment operator, returns value prior to increment)
-
__device__ inline iterator(const WrapFilter &parent, const int relative_cell_x, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
-
class Message
Provides access to a specific message Returned by the iterator
See also
Public Functions
-
__device__ inline Message(const WrapFilter &parent, const int relative_cell_x, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
Constructs a message and directly initialises all of it’s member variables
Note
See member variable documentation for their purposes
-
__device__ inline Message(const WrapFilter &parent)
False minimal constructor used by iterator::end()
-
__device__ inline bool operator==(const Message &rhs) const
Equality operator Compares all internal member vars for equality
Note
Does not compare _parent
-
__device__ inline bool operator!=(const Message&) const
This should only be called to compare against end() It has been modified to check for end of iteration with minimal instructions Therefore it does not even perform the equality operation
Note
Use operator==() if proper equality is required
-
__device__ inline Message &operator++()
Updates the message to return variables from the next message in the message list
- Returns:
Returns itself
-
template<typename T, unsigned int N>
__device__ T getVariable(const char (&variable_name)[N]) const Returns the value for the current message attached to the named variable
- Parameters:
variable_name – Name of the variable
- Template Parameters:
T – type of the variable
N – Length of variable name (this should be implicit if a string literal is passed to variable name)
- Returns:
The specified variable, else 0x0 if an error occurs
-
template<typename T, flamegpu::size_type N, unsigned int M>
__device__ T getVariable(const char (&variable_name)[M], unsigned int index) const Returns the specified variable array element from the current message attached to the named variable
- Parameters:
variable_name – name used for accessing the variable, this value should be a string literal e.g. “foobar”
index – Index of the element within the variable array to return
- Template Parameters:
T – Type of the message variable being accessed
N – The length of the array variable, as set within the model description hierarchy
M – Length of variable_name, this should always be implicit if passing a string literal
- Throws:
exception::DeviceError – If name is not a valid variable within the agent (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)
exception::DeviceError – If T is not the type of variable ‘name’ within the message (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)
exception::DeviceError – If index is out of bounds for the variable array specified by name (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)
-
__device__ inline float getVirtualX() const
Returns the virtual x variable of the message, relative to the search origin This is the closest x coordinate the message would have, relative to the observer’s x coordinate in a wrapped environment
-
__device__ inline float getVirtualY() const
Returns the virtual y variable of the message, relative to the search origin This is the closest y coordinate the message would have, relative to the observer’s y coordinate in a wrapped environment
-
__device__ inline float getVirtualZ() const
Returns the virtual z variable of the message, relative to the search origin This is the closest z coordinate the message would have, relative to the observer’s z coordinate in a wrapped environment
-
__device__ inline float getVirtualX(const float x1) const
Returns the virtual x variable of the message This is the closest x coordinate the message would have, relative to the observer’s x coordinate in a wrapped environment
- Parameters:
x1 – The x coordinate of the observer
-
__device__ inline float getVirtualY(const float y1) const
Returns the virtual y variable of the message This is the closest y coordinate the message would have, relative to the observer’s y coordinate in a wrapped environment
- Parameters:
y1 – The y coordinate of the observer
-
__device__ inline float getVirtualZ(const float z1) const
Returns the virtual z variable of the message This is the closest z coordinate the message would have, relative to the observer’s z coordinate in a wrapped environment
- Parameters:
z1 – The z coordinate of the observer
-
__device__ inline Message(const WrapFilter &parent, const int relative_cell_x, const int relative_cell_y, const int relative_cell_z, const int _cell_index_max, const int _cell_index)
-
__device__ inline WrapFilter(const MetaData *_metadata, float x, float y, float z)
-
__device__ inline In(const void *_metadata)
-
struct MetaData
MetaData required by spatial partitioning during message reads
Public Members
-
float min[3]
Minimum environment bounds
-
float max[3]
Maximum environment bounds
-
float radius
Search radius (also used as subdividision bin width)
-
unsigned int *PBM
Pointer to the partition boundary matrix in device memory The PBM is never stored on the host
-
unsigned int gridDim[3]
The number of subdividision bins in each dimensions
-
float environmentWidth[3]
max-lowerBound
-
float min[3]
-
class Out : public flamegpu::MessageBruteForce::Out
This class is accessible via DeviceAPI.message_out if MessageSpatial3D is specified in FLAMEGPU_AGENT_FUNCTION It gives access to functionality for outputting spatially partitioned messages
Public Functions
-
__device__ inline Out(const void*, unsigned int *scan_flag_messageOutput)
Constructer Initialises member variables
- Parameters:
scan_flag_messageOutput – Scan flag array for optional message output
-
__device__ inline void setLocation(float x, float y, float z) const
Sets the location for this agents message
Note
Convenience wrapper for setVariable()
- Parameters:
x – Message x coord
y – Message y coord
z – Message z coord
-
__device__ inline Out(const void*, unsigned int *scan_flag_messageOutput)
-
class CDescription : public flamegpu::MessageSpatial2D::CDescription