DHART
Loading...
Searching...
No Matches
spatialstructures_C.h File Reference

Header file related to manipulating nodes, edges, and graphs via CInterface. More...

#include <cinterface_utils.h>
#include <vector>
#include <array>
+ Include dependency graph for spatialstructures_C.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  HF
 Perform human scale analysis on 3D environments.
 
namespace  HF::SpatialStructures
 Contains standard fundamental data structures for representing space used throughout DHARTAPI.
 

Macros

#define C_INTERFACE   extern "C" __declspec(dllexport) int
 Specifies C linkage for functions defined in the C Interface. Used for exporting C Interface functions from the DHART DLL. More...
 

Enumerations

enum  COST_ALG_KEY { CROSS_SLOPE , ENERGY_EXPENDITURE }
 Indices of keys for costs returned from calling CalculateAndStore functions. More...
 

Functions

std::string AlgorithmCostTitle (COST_ALG_KEY key)
 Get the cost algorithm title (as std::string) from the COST_ALG_KEY enum member. More...
 
C_INTERFACE GetAllNodesFromGraph (const HF::SpatialStructures::Graph *graph, std::vector< HF::SpatialStructures::Node > **out_vector_ptr, HF::SpatialStructures::Node **out_data_ptr)
 Get a vector of every node in the given graph pointer. More...
 
C_INTERFACE GetEdgesForNode (const HF::SpatialStructures::Graph *graph, const HF::SpatialStructures::Node *Node, std::vector< HF::SpatialStructures::Edge > **out_vector_ptr, HF::SpatialStructures::Edge **out_edge_list_ptr, int *out_edge_list_size)
 Get a vector of edges every node in the given graph pointer. More...
 
C_INTERFACE GetSizeOfNodeVector (const std::vector< HF::SpatialStructures::Node > *node_list, int *out_size)
 Get the size of a node vector. More...
 
C_INTERFACE GetSizeOfEdgeVector (const std::vector< HF::SpatialStructures::Edge > *edge_list, int *out_size)
 Get the size of an edge vector. More...
 
C_INTERFACE GetEdgeCost (const HF::SpatialStructures::Graph *g, int parent, int child, const char *cost_type, float *out_float)
 Get the cost of traversing from parent to child More...
 
C_INTERFACE AggregateCosts (const HF::SpatialStructures::Graph *graph, int agg, bool directed, const char *cost_type, std::vector< float > **out_vector_ptr, float **out_data_ptr)
 Get an ordered array of costs for each node aggregated by the desired function. More...
 
C_INTERFACE CreateGraph (const float *nodes, int num_nodes, HF::SpatialStructures::Graph **out_graph)
 Create a new empty graph. More...
 
C_INTERFACE AddEdgeFromNodes (HF::SpatialStructures::Graph *graph, const float *parent, const float *child, float score, const char *cost_type)
 Add an edge between parent and child. If parent or child does not already exist in the graph, they will be added and automatically assigned new IDs. More...
 
C_INTERFACE AddEdgeFromNodeIDs (HF::SpatialStructures::Graph *graph, int parent_id, int child_id, float score, const char *cost_type)
 Create a new edge between parent_id and child_id. If these IDs do not exist in the graph, they will be added. More...
 
C_INTERFACE GetCSRPointers (HF::SpatialStructures::Graph *graph, int *out_nnz, int *out_num_rows, int *out_num_cols, float **out_data_ptr, int **out_inner_indices_ptr, int **out_outer_indices_ptr, const char *cost_type)
 Retrieve all information for a graph's CSR representation. This will compress the graph if it was not already compressed. More...
 
C_INTERFACE GetNodeID (HF::SpatialStructures::Graph *graph, const float *point, int *out_id)
 Get the ID of the given node in the graph. If the node does not exist, out_id will be set to -1. More...
 
C_INTERFACE Compress (HF::SpatialStructures::Graph *graph)
 Compress the given graph into a CSR representation. More...
 
C_INTERFACE ClearGraph (HF::SpatialStructures::Graph *graph, const char *cost_type)
 Clear the nodes/edges for the given graph, or clear a specific cost type. More...
 
C_INTERFACE DestroyNodes (std::vector< HF::SpatialStructures::Node > *nodelist_to_destroy)
 Delete the vector of nodes at the given pointer. More...
 
C_INTERFACE DestroyEdges (std::vector< HF::SpatialStructures::Edge > *edgelist_to_destroy)
 Delete the vector of edges at the given pointer. More...
 
C_INTERFACE DestroyGraph (HF::SpatialStructures::Graph *graph_to_destroy)
 Delete a graph. More...
 
C_INTERFACE CalculateAndStoreCrossSlope (HF::SpatialStructures::Graph *g)
 Calculates cross slope for all subgraphs in *g. More...
 
C_INTERFACE CalculateAndStoreEnergyExpenditure (HF::SpatialStructures::Graph *g)
 Calculates energy expenditure for all subgraphs in *g and stores them in the graph at AlgorithmCostTitle(ALG_COST_KEY::EnergyExpenditure) More...
 
C_INTERFACE AddNodeAttributes (HF::SpatialStructures::Graph *g, const int *ids, const char *attribute, const char **scores, int num_nodes)
 Add a new node attribute in the graph for the nodes at ids. More...
 
C_INTERFACE GetNodeAttributes (const HF::SpatialStructures::Graph *g, const char *attribute, char **out_scores, int *out_score_size)
 Retrieve node attribute values from *g. More...
 
C_INTERFACE DeleteScoreArray (char **scores_to_delete, int num_char_arrays)
 Free the memory of every (char *) in scores_to_delete. More...
 
C_INTERFACE ClearAttributeType (HF::SpatialStructures::Graph *g, const char *s)
 Deletes the node attribute values of the type denoted by s, from graph *g. More...
 
C_INTERFACE GetSizeOfGraph (const HF::SpatialStructures::Graph *g, int *out_size)
 Get the number of nodes in a graph. More...
 
C_INTERFACE GraphAttrsToCosts (HF::SpatialStructures::Graph *graph_ptr, const char *attr_key, const char *cost_string, HF::SpatialStructures::Direction dir)
 Create a cost in the graph based on a set of node parameters. More...
 

Variables

const std::vector< std::string > Key_To_Costs
 Keys of costs for calling CalculateAndStore functions. More...
 

Detailed Description

Header file related to manipulating nodes, edges, and graphs via CInterface.

Author
TBA
Date
19 Aug 2020

Definition in file spatialstructures_C.h.

Macro Definition Documentation

◆ C_INTERFACE

#define C_INTERFACE   extern "C" __declspec(dllexport) int

Specifies C linkage for functions defined in the C Interface. Used for exporting C Interface functions from the DHART DLL.

\define C_INTERFACE

Definition at line 18 of file spatialstructures_C.h.

Enumeration Type Documentation

◆ COST_ALG_KEY

Indices of keys for costs returned from calling CalculateAndStore functions.

Enumerator
CROSS_SLOPE 

Cost created by CalculateAndStoreCrossSlope.

ENERGY_EXPENDITURE 

Cost created by CalculateAndStoreEnergyExpenditure.

Definition at line 40 of file spatialstructures_C.h.

Function Documentation

◆ AlgorithmCostTitle()

std::string AlgorithmCostTitle ( COST_ALG_KEY  key)
inline

Get the cost algorithm title (as std::string) from the COST_ALG_KEY enum member.

Parameters
keyEnum member representing algorithm cost type:
COST_ALG_KEY::CROSS_SLOPE
COST_ALG_KEY::ENERGY_EXPENDITURE
are valid parameters.
Returns
A human-readable string representation of key.
// In the enum COST_ALG_KEY, there are two members:
// COST_ALG_KEY::CROSS_SLOPE, and COST_ALG_KEY::ENERGY_EXPENDITURE.
// If we want a string representation of COST_ALG_KEY::CROSS_SLOPE,
// we invoke AlgorithmCostTitle:
std::cout << "Cost type: " << cost_str << std::endl;
std::string AlgorithmCostTitle(COST_ALG_KEY key)
Get the cost algorithm title (as std::string) from the COST_ALG_KEY enum member.
@ CROSS_SLOPE
Cost created by CalculateAndStoreCrossSlope.


Cost type: CrossSlope

Definition at line 72 of file spatialstructures_C.h.

References Key_To_Costs.

Referenced by CalculateAndStoreCrossSlope(), and CalculateAndStoreEnergyExpenditure().

+ Here is the caller graph for this function:

Variable Documentation

◆ Key_To_Costs

Key_To_Costs
Initial value:
{
"CrossSlope",
"EnergyExpenditure"
}

Keys of costs for calling CalculateAndStore functions.

Definition at line 49 of file spatialstructures_C.h.

Referenced by AlgorithmCostTitle().