DHART
Loading...
Searching...
No Matches
spatialstructures_C.h
Go to the documentation of this file.
1
9#include <cinterface_utils.h>
10#include <vector>
11#include <array>
12
18#define C_INTERFACE extern "C" __declspec(dllexport) int
19
20namespace HF {
21 namespace SpatialStructures {
22 class Graph;
23 struct Subgraph;
24
25 enum class COST_AGGREGATE : int;
26
27 struct Node; // Careful with these forward declares!
28 struct Edge; // Spent like 2 hours reading mangled names
29 // because I accidentally defined these
30 // as classes (V) instead of structs (U)
31
32 enum class Direction : int;
33 }
34}
35
40const enum COST_ALG_KEY {
43};
44
49const std::vector<std::string> Key_To_Costs {
50 "CrossSlope",
51 "EnergyExpenditure"
52};
53
72inline std::string AlgorithmCostTitle(COST_ALG_KEY key) {
73 return Key_To_Costs[key];
74}
75
240 const HF::SpatialStructures::Graph* graph,
241 std::vector<HF::SpatialStructures::Node>** out_vector_ptr,
242 HF::SpatialStructures::Node** out_data_ptr
243);
244
277 const HF::SpatialStructures::Graph* graph,
278 const HF::SpatialStructures::Node* Node,
279 std::vector<HF::SpatialStructures::Edge>** out_vector_ptr,
280 HF::SpatialStructures::Edge** out_edge_list_ptr,
281 int* out_edge_list_size
282);
283
315 const std::vector<HF::SpatialStructures::Node>* node_list,
316 int* out_size
317);
318
330 const std::vector<HF::SpatialStructures::Edge>* edge_list,
331 int* out_size
332);
333
334
371 int parent,
372 int child,
373 const char * cost_type,
374 float* out_float
375);
376
413 const HF::SpatialStructures::Graph* graph,
414 int agg,
415 bool directed,
416 const char* cost_type,
417 std::vector<float>** out_vector_ptr,
418 float** out_data_ptr
419);
420
435 const float* nodes,
436 int num_nodes,
438);
439
477 const float* parent,
478 const float* child,
479 float score,
480 const char * cost_type
481);
482
507 int parent_id,
508 int child_id,
509 float score,
510 const char * cost_type
511);
512
537 int* out_nnz,
538 int* out_num_rows,
539 int* out_num_cols,
540 float** out_data_ptr,
541 int** out_inner_indices_ptr,
542 int** out_outer_indices_ptr,
543 const char* cost_type
544);
545
580 const float* point,
581 int* out_id
582);
583
603);
604
636 const char* cost_type
637);
638
649 std::vector<HF::SpatialStructures::Node>* nodelist_to_destroy
650);
651
662 std::vector<HF::SpatialStructures::Edge>* edgelist_to_destroy
663);
664
675 HF::SpatialStructures::Graph* graph_to_destroy
676);
677
704
733
777 const int* ids,
778 const char* attribute,
779 const char** scores,
780 int num_nodes
781);
782
824 const char* attribute,
825 char** out_scores,
826 int* out_score_size
827);
828
839C_INTERFACE DeleteScoreArray(char** scores_to_delete, int num_char_arrays);
840
871
899
900
915 HF::SpatialStructures::Graph * graph_ptr,
916 const char * attr_key,
917 const char * cost_string,
919
std::string AlgorithmCostTitle(COST_ALG_KEY key)
Get the cost algorithm title (as std::string) from the COST_ALG_KEY enum member.
const std::vector< std::string > Key_To_Costs
Keys of costs for calling CalculateAndStore functions.
#define C_INTERFACE
Specifies C linkage for functions defined in the C Interface. Used for exporting C Interface function...
COST_ALG_KEY
Indices of keys for costs returned from calling CalculateAndStore functions.
@ CROSS_SLOPE
Cost created by CalculateAndStoreCrossSlope.
@ ENERGY_EXPENDITURE
Cost created by CalculateAndStoreEnergyExpenditure.
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,...
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.
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.
C_INTERFACE CreateGraph(const float *nodes, int num_nodes, HF::SpatialStructures::Graph **out_graph)
Create a new empty graph.
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.
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,...
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...
C_INTERFACE GetSizeOfGraph(const HF::SpatialStructures::Graph *g, int *out_size)
Get the number of nodes in a graph.
C_INTERFACE DestroyGraph(HF::SpatialStructures::Graph *graph_to_destroy)
Delete a graph.
Definition: CInterface.cpp:80
C_INTERFACE GetSizeOfEdgeVector(const std::vector< HF::SpatialStructures::Edge > *edge_list, int *out_size)
Get the size of an edge vector.
Definition: CInterface.cpp:65
C_INTERFACE ClearAttributeType(HF::SpatialStructures::Graph *g, const char *s)
Deletes the node attribute values of the type denoted by s, from graph *g.
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.
C_INTERFACE GetNodeAttributes(const HF::SpatialStructures::Graph *g, const char *attribute, char **out_scores, int *out_score_size)
Retrieve node attribute values from *g.
C_INTERFACE CalculateAndStoreEnergyExpenditure(HF::SpatialStructures::Graph *g)
Calculates energy expenditure for all subgraphs in *g and stores them in the graph at AlgorithmCostTi...
C_INTERFACE DestroyNodes(std::vector< HF::SpatialStructures::Node > *nodelist_to_destroy)
Delete the vector of nodes at the given pointer.
Definition: CInterface.cpp:70
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
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.
C_INTERFACE Compress(HF::SpatialStructures::Graph *graph)
Compress the given graph into a CSR representation.
C_INTERFACE GetSizeOfNodeVector(const std::vector< HF::SpatialStructures::Node > *node_list, int *out_size)
Get the size of a node vector.
Definition: CInterface.cpp:60
C_INTERFACE DestroyEdges(std::vector< HF::SpatialStructures::Edge > *edgelist_to_destroy)
Delete the vector of edges at the given pointer.
Definition: CInterface.cpp:75
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.
C_INTERFACE DeleteScoreArray(char **scores_to_delete, int num_char_arrays)
Free the memory of every (char *) in scores_to_delete.
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.
C_INTERFACE CalculateAndStoreCrossSlope(HF::SpatialStructures::Graph *g)
Calculates cross slope for all subgraphs in *g.
Perform human scale analysis on 3D environments.
COST_AGGREGATE
Methods of aggregating the costs for edges for each node in the graph.
Definition: graph.h:28
Direction
Node to use for calculating the cost of an edge when converting node attributes to edge costs.
Definition: graph.h:39
A connection to a child node.
Definition: Edge.h:29
A Graph of nodes connected by edges that supports both integers and HF::SpatialStructures::Node.
Definition: graph.h:486
A point in space with an ID.
Definition: node.h:38