Class HostEnvironmentDirectedGraph::VertexMap

Nested Relationships

This class is a nested type of Class HostEnvironmentDirectedGraph.

Nested Types

Class Documentation

class VertexMap

A map for accessing vertex storage via vertex ID

Public Functions

size_type size() const
Returns:

The number of vertices with a valid ID

size_type allocated_size() const

Returns:

The number of vertices that memory has been allocated for

Vertex operator[](id_t vertex_id)

Return a view into the vertex map of the specified vertex If the vertex has not already been created, it will be created

Parameters:

vertex_id – Identifier of the vertex to access

Throws:
Vertex atIndex(unsigned int index)

Return a view into the allocated vertex buffer at the specified index

Throws:

exception::OutOfBoundsException – If index exceeds the number of vertices allocated via HostEnvironmentDirectedGraph::setVertexCount()

inline Iterator begin()

Returns an iterator to the first vertex in the buffer that backs the vertex map

Unlike a traditional C++ map iterator, this does not dereference to a key-value pair, as it returns all allocated vertices including those which have not had their key (ID) set, such IDs evaluate as ID_NOT_SET

inline Iterator end()

Returns an iterator to one beyond the last vertex in the buffer that backs the vertex map

Unlike a traditional C++ map iterator, this does not dereference to a key-value pair, as it returns all allocated vertices including those which have not had their key (ID) set, such IDs evaluate as ID_NOT_SET

struct Iterator

Iterator for VertexMap

Unlike a traditional C++ map iterator, this does not dereference to a key-value pair, as it returns all allocated vertices including those which have not had their key (ID) set, such IDs evaluate as ID_NOT_SET

Public Types

using iterator_category = std::forward_iterator_tag
using difference_type = unsigned int
using value_type = Vertex
using pointer = Vertex*
using reference = Vertex&

Public Functions

inline Iterator(std::shared_ptr<detail::CUDAEnvironmentDirectedGraphBuffers> _directed_graph, const cudaStream_t _stream, difference_type _index)
inline reference operator*() const
inline pointer operator->() const
inline Iterator &operator++()
inline Iterator operator++(int)
inline bool operator==(const Iterator &other) const
inline bool operator!=(const Iterator &other) const
inline Iterator begin()
inline Iterator end()
class Vertex

Public Functions

Vertex(std::shared_ptr<detail::CUDAEnvironmentDirectedGraphBuffers> _directed_graph, cudaStream_t _stream, id_t _vertex_id, bool is_index = false)
void setID(id_t vertex_id)

Set the id for the current vertex

Parameters:

vertex_id – The value to set the current vertex’s id

template<typename T>
void setProperty(const std::string &property_name, T property_value)

Set the value of the specified property of the current vertex

Parameters:
  • property_name – The name of the property to set

  • property_value – The value to set the current vertex’s property

Template Parameters:

T – The type of the property

Throws:

exception::InvalidArgument – If property_name does not refer to a valid vertex property

template<typename T, flamegpu::size_type N = 0>
void setProperty(const std::string &property_name, flamegpu::size_type element_index, T property_value)
template<typename T, flamegpu::size_type N>
void setProperty(const std::string &property_name, const std::array<T, N> &property_value)
id_t getID() const

Returns the id for the current vertex

template<typename T>
T getProperty(const std::string &property_name) const

Returns the value of the specified property of the current vertex

Parameters:

property_name – The name of the property to set

Template Parameters:

T – The type of the property

Throws:
  • exception::InvalidArgument – If property_name does not refer to a valid vertex property

  • exception::InvalidGraphProperty – If a vertex property with the matching name and type does not exist

template<typename T, flamegpu::size_type N = 0>
T getProperty(const std::string &property_name, unsigned int element_index) const
template<typename T, flamegpu::size_type N>
std::array<T, N> getProperty(const std::string &property_name) const