Utopia  2
Framework for studying models of complex & adaptive systems.
Enumerations | Functions
Utopia::DataIO::GraphUtilsHelper Namespace Reference

Enumerations

enum class  EntityKind { vertex , edge }
 Kinds of Entities to get properties from. More...
 

Functions

template<typename Graph >
std::pair< std::shared_ptr< HDFDataset >, std::shared_ptr< HDFDataset > > setup_graph_containers (const Graph &g, const std::shared_ptr< HDFGroup > &grp)
 
template<typename First , typename Second , typename... Tail>
constexpr std::tuple< Tail... > tuple_tail (const std::tuple< First, Second, Tail... > &t)
 Builds new tuple containing all elements but the first two. More...
 
template<typename CoordT >
auto coords_container ()
 
template<EntityKind entity_kind, typename Graph , typename NWGroup , typename ItPair >
auto generate_write_function (const Graph &g, NWGroup &&nw_grp, std::string label, ItPair &&it_pair, std::size_t num_entities)
 

Enumeration Type Documentation

◆ EntityKind

Kinds of Entities to get properties from.

Enumerator
vertex 
edge 

Function Documentation

◆ coords_container()

template<typename CoordT >
auto Utopia::DataIO::GraphUtilsHelper::coords_container ( )

Creates empty vector with element-type CoordT. If CoordT is string-like std::string is enforced

◆ generate_write_function()

template<EntityKind entity_kind, typename Graph , typename NWGroup , typename ItPair >
auto Utopia::DataIO::GraphUtilsHelper::generate_write_function ( const Graph &  g,
NWGroup &&  nw_grp,
std::string  label,
ItPair &&  it_pair,
std::size_t  num_entities 
)

This function generates a write function for graph entity properties.

The generated lambda function can then be called on each write specification in the adaptor tuple. It writes the specified data to a new dataset and adds attributes, fire-and-forget. Depending on the shape of the write specifications 1d or 2d datasets are written, see Utopia::DataIO::save_graph_entity_properties for more detail. Only relying on the given iterator pair, this function allows to handle vertex and edge iterations equivalently.

Template Parameters
EntityKindThe kind of entity to get the data from. This can be either vertices or edges.
Graph
NWGroup
ItPair
Parameters
gThe graph from which to save vertex or edge properties.
nw_grpThe HDFGroup the data should be written to.
labelThe name of the dataset to which the adaptors write data.
it_pairThe iterator pair used to access the desired entities.
num_entitiesThe number of entities of kind 'EntityKind' in graph g.
Returns
auto The generated write function

◆ setup_graph_containers()

template<typename Graph >
std::pair<std::shared_ptr<HDFDataset>, std::shared_ptr<HDFDataset> > Utopia::DataIO::GraphUtilsHelper::setup_graph_containers ( const Graph &  g,
const std::shared_ptr< HDFGroup > &  grp 
)

This function opens the vertex and edge datasets for a single graph and adds attributes.

Via the attributes the size of the graph is stored and the trivial coordinates (i.e. vertex idx and edge idx) are added.

Template Parameters
Graph
Parameters
gThe graph to save
grpThe HDFGroup the graph should be stored in
Returns
std::pair<std::shared_ptr<HDFDataset<HDFGroup>>, std::shared_ptr<HDFDataset<HDFGroup>>> Pair containing [vertex dataset, edge dataset]

◆ tuple_tail()

template<typename First , typename Second , typename... Tail>
constexpr std::tuple<Tail...> Utopia::DataIO::GraphUtilsHelper::tuple_tail ( const std::tuple< First, Second, Tail... > &  t)
constexpr

Builds new tuple containing all elements but the first two.