OpenMPI  0.1.1
carto_base_graph.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2006 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  *
19  */
20 
21 #ifndef OPAL_CARTO_BASE_GRAPH_H
22 #define OPAL_CARTO_BASE_GRAPH_H
23 
24 /* THIS FILE CONTAINS THE ACTUAL BASE FUNCTION IMPLEMENTATIONS FOR
25  * THE CARTO FRAMEWORK - THESE FUNCTIONS ARE TO BE CALLED STRICTLY
26  * FROM THE VARIOUS COMPONENTS, AS PASSED THROUGH BY THE PUBLIC
27  * BASE FUNCTIONS
28  *
29  * DO -NOT- CALL THESE FUNCTIONS DIRECTLY!
30  */
31 
32 #include "opal_config.h"
33 
34 #include "opal/mca/carto/carto.h"
35 
36 BEGIN_C_DECLS
37 
38 OPAL_DECLSPEC extern opal_carto_graph_t *opal_carto_base_common_host_graph;
39 
40 /**
41  * Create new carto graph.
42  *
43  * @param graph an empty graph pointer
44  */
45 OPAL_DECLSPEC void opal_carto_base_graph_create_fn(opal_carto_graph_t **graph);
46 
47 /**
48  * Add a node to carto graph.
49  *
50  * @param graph the carto graph to add the node to.
51  * @param node the node to add.
52  */
53 OPAL_DECLSPEC void
55 
56 /**
57  * Free a carto graph
58  * @param graph the graph we want to free.
59  */
60 OPAL_DECLSPEC void opal_carto_base_free_graph_fn(opal_carto_graph_t *graph);
61 
62 /**
63  * Connect two nodes by adding an edge to the graph.
64  *
65  * @param graph the graph that the nodes belongs to.
66  * @param start the start node
67  * @param end the end node
68  * @param weight the weight of the connection
69  *
70  * @return int success or error (if one of the nodes does not
71  * belong to the graph.
72  */
73 OPAL_DECLSPEC int
75  opal_carto_base_node_t *end, uint32_t weight);
76 
77 /**
78  * Duplicate a carto graph and reduce the new graph to contain
79  * nodes from a ceratin type(s)
80  *
81  * @param destination The new graph.
82  * @param source the original graph.
83  * @param node_type the node type(s) that the new graph will
84  * include.
85  */
86 OPAL_DECLSPEC void
88  const char *node_type);
89 
90 
91 /**
92  * opal_carto_base_get_nodes_distance - returns the distance of
93  * all the nodes from the reference node.
94  *
95  * @param graph
96  * @param reference_node
97  * @param node_type the type of the nodes in the returned array
98  * @param dist_array
99  *
100  * @return int number of nodes in the returned array.
101  */
102 OPAL_DECLSPEC int
104  const char *node_type, opal_value_array_t *dist_array);
105 
106 /**
107  * Find the shortest path between two nodes in the graph
108  *
109  * @param graph the graph that the nodes belongs to.
110  * @param node1 first node.
111  * @param node2 second node.
112  *
113  * @return uint32_t he distance between the nodes.
114  */
115 OPAL_DECLSPEC uint32_t
117  opal_carto_base_node_t *node2);
118 
119 /**
120  * Find a node in the graph according to its name.
121  *
122  * @param graph the graph in which we are searching.
123  * @param node_name the node name.
124  *
125  * @return opal_carto_base_node_t* the node with the name -if
126  * found or NULL.
127  */
128 OPAL_DECLSPEC opal_carto_base_node_t
129 *opal_carto_base_graph_find_node_fn(opal_carto_graph_t *graph, const char *node_name);
130 
131 /**
132  * Get the host cartography graph.
133  *
134  * @param graph an unallocated pointer to a graph.
135  * @param graph_type the type of nodes we want the returned
136  * graph will contain.
137  *
138  * @return int success or error
139  */
140 OPAL_DECLSPEC int opal_carto_base_graph_get_host_graph_fn(opal_carto_graph_t **graph, const char * graph_type);
141 
142 END_C_DECLS
143 
144 #endif
int opal_carto_base_get_nodes_distance_fn(opal_carto_graph_t *graph, opal_carto_base_node_t *reference_node, const char *node_type, opal_value_array_t *dist_array)
opal_carto_base_get_nodes_distance - returns the distance of all the nodes from the reference node...
Definition: carto_base_graph.c:287
The carto framework suplies an information of the the host structure and connection between the host ...
void opal_carto_base_graph_create_fn(opal_carto_graph_t **graph)
Create new carto graph.
Definition: carto_base_graph.c:158
uint32_t opal_carto_base_graph_spf_fn(opal_carto_graph_t *graph, opal_carto_base_node_t *node1, opal_carto_base_node_t *node2)
Find the shortest path between two nodes in the graph.
Definition: carto_base_graph.c:328
opal_carto_base_node_t * opal_carto_base_graph_find_node_fn(opal_carto_graph_t *graph, const char *node_name)
Find a node in the graph according to its name.
Definition: carto_base_graph.c:342
int opal_carto_base_connect_nodes_fn(opal_carto_graph_t *graph, opal_carto_base_node_t *start, opal_carto_base_node_t *end, uint32_t weight)
Connect two nodes by adding an edge to the graph.
Definition: carto_base_graph.c:222
A graph class.
Definition: opal_graph.h:165
void opal_carto_base_graph_add_node_fn(opal_carto_graph_t *graph, opal_carto_base_node_t *node)
Add a node to carto graph.
Definition: carto_base_graph.c:169
void opal_carto_base_free_graph_fn(opal_carto_graph_t *graph)
Free a carto graph.
Definition: carto_base_graph.c:189
int opal_carto_base_graph_get_host_graph_fn(opal_carto_graph_t **graph, const char *graph_type)
Get the host cartography graph.
Definition: carto_base_graph.c:374
Definition: carto.h:41
Definition: opal_value_array.h:38
void opal_carto_base_duplicate_graph_fn(opal_carto_graph_t **destination, const opal_carto_graph_t *source, const char *node_type)
Duplicate a carto graph and reduce the new graph to contain nodes from a ceratin type(s) ...
Definition: carto_base_graph.c:247