Class DeviceEnvironmentDirectedGraph

Nested Relationships

Nested Types

Class Documentation

class DeviceEnvironmentDirectedGraph

Read-only accessor to a specific directed graph Directed graphs can only be modified via host functions

Public Functions

__device__ __forceinline__ inline DeviceEnvironmentDirectedGraph(const detail::curve::Curve::VariableHash _graph_hash)
__device__ __forceinline__ id_t getVertexID(unsigned int vertex_index) const
__device__ __forceinline__ unsigned int getVertexIndex(id_t vertex_id) const
template<typename T, unsigned int M>
__device__ __forceinline__ T getVertexProperty(const char (&property_name)[M], unsigned int vertex_index) const
template<typename T, flamegpu::size_type N, unsigned int M>
__device__ __forceinline__ T getVertexProperty(const char (&property_name)[M], unsigned int vertex_index, unsigned int element_index) const
__device__ __forceinline__ id_t getEdgeSource(unsigned int edge_index) const
__device__ __forceinline__ id_t getEdgeDestination(unsigned int edge_index) const
__device__ __forceinline__ unsigned int getEdgeIndex(unsigned int source_vertex_index, unsigned int destination_vertex_index) const
template<typename T, unsigned int M>
__device__ __forceinline__ T getEdgeProperty(const char (&property_name)[M], unsigned int edge_index) const
template<typename T, flamegpu::size_type N, unsigned int M>
__device__ __forceinline__ T getEdgeProperty(const char (&property_name)[M], unsigned int edge_index, unsigned int element_index) const
__device__ inline OutEdgeFilter outEdges(const id_t &vertex_index) const

Returns a Filter object which provides access to an edge iterator for iterating a subset of edge which leave the specified vertex

Parameters:

vertex_index – The index of the vertex to retrieve leaving edges for

__device__ inline InEdgeFilter inEdges(const id_t &vertex_index) const

Returns a Filter object which provides access to an edge iterator for iterating a subset of edge which join the specified vertex

Parameters:

vertex_index – The index of the vertex to retrieve joining edges for

class InEdgeFilter

This class is created when a vertex is provided to DeviceEnvironmentDirectedGraph::inEdges()(id_t) It provides iterator access to the subset of edges found leaving the specified vertex

Public Functions

__device__ inline InEdgeFilter(detail::curve::Curve::VariableHash _graph_hash, const id_t &vertex_index)

Constructor, takes the search parameters required Begin key and end key specify the [begin, end) contiguous range of bucket. (inclusive begin, exclusive end)

Parameters:
  • _graph_hash – Graph hash for accessing data via curve

  • vertex_index – The index of the vertex to retrieve leaving edges for

__device__ inline iterator begin(void) const

Returns an iterator to the start of the in edge list subset joining the vertex

__device__ inline iterator end(void) const

Returns an iterator to the position beyond the end of the edge list subset joining the vertex

Note

This iterator is the same for all edge list subsets

__device__ inline unsigned int size(void) const

Returns the number of edges in the filtered bucket

class Edge

Provides access to a specific edge Returned by the iterator

See also

In::Filter::iterator

Public Functions

__device__ inline Edge(const InEdgeFilter &parent, const unsigned int &_ipbm_index)

Constructs an edge and directly initialises all of it’s member variables

Note

See member variable documentation for their purposes

__device__ inline bool operator==(const Edge &rhs) const

Equality operator Compares all internal member vars for equality

Note

Does not compare _parent

__device__ inline bool operator!=(const Edge &rhs) const

Inequality operator Returns inverse of equality operator

See also

operator==(const Edge&)

__device__ inline Edge &operator++()

Updates the edge to return variables from the next edge joining the vertex

Returns:

Returns itself

__device__ inline unsigned int getIndex() const

Returns the index of the current edge within the graph’s full list of edges

Note

Edge indexes are not constant, they can change if edges are updated causing the graph’s CSR to be rebuilt

template<typename T, flamegpu::size_type N>
__device__ T getProperty(const char (&property_name)[N]) const

Returns the value for the current edge attached to the named property

Parameters:

property_name – Name of the property

Template Parameters:
  • T – type of the property

  • N – Length of property name (this should be implicit if a string literal is passed to property_name)

Returns:

The specified variable, else 0x0 if an error occurs

template<typename T, flamegpu::size_type N, unsigned int M>
__device__ T getProperty(const char (&property_name)[M], const unsigned int &index) const

Returns the specified property array element from the current edge attached to the named property

Parameters:
  • property_name – name used for accessing the property, this value should be a string literal e.g. “foobar”

  • index – Index of the element within the property array to return

Template Parameters:
  • T – Type of the edge property being accessed

  • N – The length of the edge’s array property, as set within the model description hierarchy

  • M – Length of property name (this should be implicit if a string literal is passed to property_name)

Throws:
  • exception::DeviceError – If name is not a valid property within the edge (flamegpu must be built with SEATBELTS enabled for device error checking)

  • exception::DeviceError – If T is not the type of property ‘name’ within the message (flamegpu must be built with SEATBELTS enabled for device error checking)

  • exception::DeviceError – If index is out of bounds for the property array specified by name (flamegpu must be built with SEATBELTS enabled for device error checking)

__device__ unsigned int getEdgeSource() const

Returns the source vertex indexof this edge

Note

getEdgeDestination() is not provided, as this value is required to access an edge via iteration so should already be available

class iterator

Stock iterator for iterating DeviceEnvironmentDirectedGraph::Edge objects

Public Functions

__device__ inline iterator(const InEdgeFilter &parent, const unsigned int &cell_index)

Constructor This iterator is constructed by DeviceEnvironmentDirectedGraph::InEdgeFilter::begin()(id_t)

__device__ inline iterator &operator++()

Moves to the next edge (Prefix increment operator)

__device__ inline iterator operator++(int)

Moves to the next edge (Postfix increment operator, returns value prior to increment)

__device__ inline bool operator==(const iterator &rhs) const

Equality operator Compares edge

__device__ inline bool operator!=(const iterator &rhs) const

Inequality operator Compares edge

__device__ inline Edge &operator*()

Dereferences the iterator to return the edge object, for accessing variables

__device__ inline Edge *operator->()

Dereferences the iterator to return the edge object, for accessing variables

class OutEdgeFilter

This class is created when a vertex is provided to DeviceEnvironmentDirectedGraph::outEdges()(id_t) It provides iterator access to the subset of edges found leaving the specified vertex

Public Functions

__device__ inline OutEdgeFilter(detail::curve::Curve::VariableHash _graph_hash, const id_t &vertex_index)

Constructor, takes the search parameters required Begin key and end key specify the [begin, end) contiguous range of bucket. (inclusive begin, exclusive end)

Parameters:
  • _graph_hash – Graph hash for accessing data via curve

  • vertex_index – The index of the vertex to retrieve leaving edges for

__device__ inline iterator begin(void) const

Returns an iterator to the start of the message list subset about the search origin

__device__ inline iterator end(void) const

Returns an iterator to the position beyond the end of the edge list subset leaving the vertex

Note

This iterator is the same for all edge list subsets

__device__ inline unsigned int size(void) const

Returns the number of edges in the filtered bucket

class Edge

Provides access to a specific edge Returned by the iterator

See also

In::Filter::iterator

Public Functions

__device__ inline Edge(const OutEdgeFilter &parent, const unsigned int &_edge_index)

Constructs an edge and directly initialises all of it’s member variables

Note

See member variable documentation for their purposes

__device__ inline bool operator==(const Edge &rhs) const

Equality operator Compares all internal member vars for equality

Note

Does not compare _parent

__device__ inline bool operator!=(const Edge &rhs) const

Inequality operator Returns inverse of equality operator

See also

operator==(const Edge&)

__device__ inline Edge &operator++()

Updates the edge to return variables from the next edge leaving the vertex

Returns:

Returns itself

__device__ inline unsigned int getIndex() const

Returns the index of the current edge within the graph’s full list of edges

Note

Edge indexes are not constant, they can change if edges are updated causing the graph’s CSR to be rebuilt

template<typename T, flamegpu::size_type N>
__device__ T getProperty(const char (&property_name)[N]) const

Returns the value for the current edge attached to the named property

Parameters:

property_name – Name of the property

Template Parameters:
  • T – type of the property

  • N – Length of property name (this should be implicit if a string literal is passed to property_name)

Returns:

The specified variable, else 0x0 if an error occurs

template<typename T, flamegpu::size_type N, unsigned int M>
__device__ T getProperty(const char (&property_name)[M], const unsigned int &index) const

Returns the specified property array element from the current edge attached to the named property

Parameters:
  • property_name – name used for accessing the property, this value should be a string literal e.g. “foobar”

  • index – Index of the element within the property array to return

Template Parameters:
  • T – Type of the edge property being accessed

  • N – The length of the edge’s array property, as set within the model description hierarchy

  • M – Length of property name (this should be implicit if a string literal is passed to property_name)

Throws:
  • exception::DeviceError – If name is not a valid property within the edge (flamegpu must be built with SEATBELTS enabled for device error checking)

  • exception::DeviceError – If T is not the type of property ‘name’ within the message (flamegpu must be built with SEATBELTS enabled for device error checking)

  • exception::DeviceError – If index is out of bounds for the property array specified by name (flamegpu must be built with SEATBELTS enabled for device error checking)

__device__ unsigned int getEdgeDestination() const

Returns the destination vertex index of this edge

Note

getEdgeSource() is not provided, as this value is required to access an edge via iteration so should already be available

class iterator

Stock iterator for iterating DeviceEnvironmentDirectedGraph::Edge objects

Public Functions

__device__ inline iterator(const OutEdgeFilter &parent, const unsigned int &cell_index)

Constructor This iterator is constructed by DeviceEnvironmentDirectedGraph::OutEdgeFilter::begin()(id_t)

__device__ inline iterator &operator++()

Moves to the next edge (Prefix increment operator)

__device__ inline iterator operator++(int)

Moves to the next edge (Postfix increment operator, returns value prior to increment)

__device__ inline bool operator==(const iterator &rhs) const

Equality operator Compares edge

__device__ inline bool operator!=(const iterator &rhs) const

Inequality operator Compares edge

__device__ inline Edge &operator*()

Dereferences the iterator to return the edge object, for accessing variables

__device__ inline Edge *operator->()

Dereferences the iterator to return the edge object, for accessing variables