Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MicroCART
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Distributed Autonomous Networked Control Lab
MicroCART
Commits
6c39ab8b
Commit
6c39ab8b
authored
1 year ago
by
TJFriedl
Browse files
Options
Downloads
Patches
Plain Diff
Finished free_graph method, needs testing implementation
parent
b27a142b
No related branches found
No related tags found
3 merge requests
!104
adding cflib to this branch
,
!103
Updating develop to current state of master branch
,
!96
Finished free_graph method, needs testing implementation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
quad/src/computation_graph/computation_graph.c
+25
-0
25 additions, 0 deletions
quad/src/computation_graph/computation_graph.c
quad/src/computation_graph/computation_graph.h
+5
-0
5 additions, 0 deletions
quad/src/computation_graph/computation_graph.h
with
30 additions
and
0 deletions
quad/src/computation_graph/computation_graph.c
+
25
−
0
View file @
6c39ab8b
...
...
@@ -27,6 +27,31 @@ struct computation_graph *create_graph() {
return
the_graph
;
}
struct
computation_graph
free_graph
(
struct
computation_graph
*
graph
)
{
if
(
graph
==
NULL
)
return
;
// Do nothing if memory has already been cleared
for
(
int
i
=
0
;
i
<
graph
->
size
;
i
++
)
{
if
(
graph_node_exists
(
graph
,
i
))
{
struct
graph_node
*
node
=
&
graph
->
nodes
[
i
];
// THESE ARE SEPERATED TO TEST FOR NOW -> There's gotta be a more concise way to do this.
if
(
node
->
name
!=
NULL
)
free
(
node
->
name
);
if
(
node
->
state
!=
NULL
)
free
(
node
->
state
);
if
(
node
->
output_values
!=
NULL
)
free
(
node
->
output_values
);
if
(
node
->
param_values
!=
NULL
)
free
(
node
->
param_values
);
if
(
node
->
input_srcs
!=
NULL
)
free
(
node
->
input_srcs
);
}
}
// These need to be tested as well... should just be able to be grouped together... right?
if
(
graph
->
nodes
!=
NULL
)
free
(
graph
->
nodes
);
if
(
graph
->
node_existence
!=
NULL
)
free
(
graph
->
node_existence
);
// Finally...
free
(
graph
);
}
static
void
reset_node_rec
(
struct
computation_graph
*
graph
,
int
node_id
,
int
depth
)
{
if
(
depth
>
GRAPH_MAX_DEPTH
)
{
return
;
...
...
This diff is collapsed.
Click to expand it.
quad/src/computation_graph/computation_graph.h
+
5
−
0
View file @
6c39ab8b
...
...
@@ -67,6 +67,11 @@ struct graph_node {
*/
struct
computation_graph
*
create_graph
();
/**
* Frees memory allocated for computation graph
*/
struct
computation_graph
free_graph
(
struct
computation_graph
*
graph
);
/*
* Defines which node's output gets its value passed into the input of a different node.
* Will call reset for each node which was previously orphaned, but is now connected to the graph
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment