OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
Graph_api.cpp File Reference
#include "Graph.hpp"

Go to the source code of this file.

Macros

#define _FCALL

Functions

void graph_build_path_ (const int *, const int *, const int *, int *, Graph **)
void graph_get_sizes_ (Graph **, int *)
void graph_get_path_ (Graph **, int *)
void graph_free_memory_ (Graph **)
void graph_build_cycles_ (Graph **, int *)
void graph_get_nb_adj_ (Graph **, int *)
void graph_get_adj_ (Graph **, int *)
void _FCALL GRAPH_BUILD_PATH (const int *npts, const int *nconnect, const int *connection, int *nb_connected_comp, Graph **graph_ptr)
void _FCALL GRAPH_GET_SIZES (Graph **graph_ptr, int *sizes)
void _FCALL GRAPH_GET_PATH (Graph **graph_ptr, int *path)
void _FCALL GRAPH_GET_NB_ADJ (Graph **graph_ptr, int *nb_adj)
void _FCALL GRAPH_GET_ADJ (Graph **graph_ptr, int *adj)
void _FCALL GRAPH_FREE_MEMORY (Graph **graph_ptr)
void _FCALL GRAPH_BUILD_CYCLES (Graph **graph_ptr, int *cycles)

Macro Definition Documentation

◆ _FCALL

#define _FCALL

Definition at line 25 of file Graph_api.cpp.

Function Documentation

◆ GRAPH_BUILD_CYCLES()

void _FCALL GRAPH_BUILD_CYCLES ( Graph ** graph_ptr,
int * cycles )

Definition at line 65 of file Graph_api.cpp.

66 {
67 graph_build_cycles_(graph_ptr, cycles);
68 }
void graph_build_cycles_(Graph **, int *)

◆ graph_build_cycles_()

void graph_build_cycles_ ( Graph ** graph_ptr,
int * cycles )

Definition at line 117 of file Graph_api.cpp.

117 {
118 vector<bool> res((*graph_ptr)->build_cycle());
119
120 const int& nb_comp = (*graph_ptr)->getNbConnectedComponents();
121
122 for (int iconnect(0) ; iconnect < nb_comp ; iconnect++) {
123 cycles[iconnect] = res[iconnect] ? 1 : 0;
124 }
125}

◆ GRAPH_BUILD_PATH()

void _FCALL GRAPH_BUILD_PATH ( const int * npts,
const int * nconnect,
const int * connection,
int * nb_connected_comp,
Graph ** graph_ptr )

Definition at line 40 of file Graph_api.cpp.

42 {
43 graph_build_path_(npts, nconnect, connection, nb_connected_comp, graph_ptr);
44 }
void graph_build_path_(const int *, const int *, const int *, int *, Graph **)
Definition Graph_api.cpp:73

◆ graph_build_path_()

void graph_build_path_ ( const int * npts,
const int * nconnect,
const int * connection,
int * nb_connected_comp,
Graph ** graph_ptr )

Definition at line 73 of file Graph_api.cpp.

75{
76 vector<int> connect_list;
77 connect_list.reserve((*nconnect) * 2);
78 for (int i(0) ; i < *nconnect ; ++i) {
79 connect_list.push_back(connection[2 * i]);
80 connect_list.push_back(connection[2 * i + 1]);
81 }
82 *graph_ptr = new Graph (*npts, *nconnect, connect_list);
83 (*graph_ptr)->build_path();
84 *nb_connected_comp = (*graph_ptr)->getNbConnectedComponents();
85 vector<vector<int>> path = (*graph_ptr)->getPath();
86}

◆ GRAPH_FREE_MEMORY()

void _FCALL GRAPH_FREE_MEMORY ( Graph ** graph_ptr)

Definition at line 61 of file Graph_api.cpp.

62 {
63 graph_free_memory_(graph_ptr);
64 }
void graph_free_memory_(Graph **)

◆ graph_free_memory_()

void graph_free_memory_ ( Graph ** graph_ptr)

Definition at line 110 of file Graph_api.cpp.

110 {
111 delete(*graph_ptr);
112 *graph_ptr = nullptr;
113}

◆ GRAPH_GET_ADJ()

void _FCALL GRAPH_GET_ADJ ( Graph ** graph_ptr,
int * adj )

Definition at line 57 of file Graph_api.cpp.

58 {
59 graph_get_adj_(graph_ptr, adj);
60 }
void graph_get_adj_(Graph **, int *)

◆ graph_get_adj_()

void graph_get_adj_ ( Graph ** graph_ptr,
int * adj )

Definition at line 137 of file Graph_api.cpp.

137 {
138 int cpt = 0;
139 for (int i(0) ; i < (*graph_ptr)->getAdjList().size() ; ++i) {
140 for (int j(0) ; j < (*graph_ptr)->getAdjList().at(i).size() ; ++j) {
141 adj[cpt] = (*graph_ptr)->getAdjList().at(i).at(j);
142 cpt++;
143 }
144 }
145}

◆ GRAPH_GET_NB_ADJ()

void _FCALL GRAPH_GET_NB_ADJ ( Graph ** graph_ptr,
int * nb_adj )

Definition at line 53 of file Graph_api.cpp.

54 {
55 graph_get_nb_adj_(graph_ptr, nb_adj);
56 }
void graph_get_nb_adj_(Graph **, int *)

◆ graph_get_nb_adj_()

void graph_get_nb_adj_ ( Graph ** graph_ptr,
int * nb_adj )

Definition at line 129 of file Graph_api.cpp.

129 {
130 for (int i(0) ; i < (*graph_ptr)->getAdjList().size() ; ++i) {
131 nb_adj[i] = (*graph_ptr)->getAdjList().at(i).size();
132 }
133}

◆ GRAPH_GET_PATH()

void _FCALL GRAPH_GET_PATH ( Graph ** graph_ptr,
int * path )

Definition at line 49 of file Graph_api.cpp.

50 {
51 graph_get_path_(graph_ptr, path);
52 }
void graph_get_path_(Graph **, int *)
Definition Graph_api.cpp:98

◆ graph_get_path_()

void graph_get_path_ ( Graph ** graph_ptr,
int * path )

Definition at line 98 of file Graph_api.cpp.

98 {
99 int i = 0;
100 for (int iconnect(0) ; iconnect < (*graph_ptr)->getNbConnectedComponents() ; ++iconnect) {
101 for (int ipt(0) ; ipt < (*graph_ptr)->getPath()[iconnect].size() ; ++ipt) {
102 path[i] = (*graph_ptr)->getPath()[iconnect][ipt];
103 i++;
104 }
105 }
106}

◆ GRAPH_GET_SIZES()

void _FCALL GRAPH_GET_SIZES ( Graph ** graph_ptr,
int * sizes )

Definition at line 45 of file Graph_api.cpp.

46 {
47 graph_get_sizes_(graph_ptr, sizes);
48 }
void graph_get_sizes_(Graph **, int *)
Definition Graph_api.cpp:90

◆ graph_get_sizes_()

void graph_get_sizes_ ( Graph ** graph_ptr,
int * sizes )

Definition at line 90 of file Graph_api.cpp.

90 {
91 for (int i(0) ; i < (*graph_ptr)->getNbConnectedComponents() ; ++i) {
92 sizes[i] = (*graph_ptr)->getPath()[i].size();
93 }
94}