-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsys.c
More file actions
36 lines (30 loc) · 693 Bytes
/
sys.c
File metadata and controls
36 lines (30 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "spinner.h"
spnr_sys_t *
spnr_sys_alloc (spnr_graph_t * graph, spnr_sys_kind_t const * kind, size_t param)
{
spnr_sys_t * sys = malloc (sizeof (spnr_sys_t));
sys->graph = graph;
sys->kind = kind;
sys->priv = kind->priv_alloc (graph->N, param);
return sys;
}
void
spnr_sys_free (spnr_sys_t * sys)
{
sys->kind->priv_free(sys->priv);
free (sys);
}
float
spnr_sys_spin_size (spnr_sys_t * sys)
{
return sys->kind->spin_size(sys->priv);
}
float spnr_sys_calc_h (spnr_sys_t * sys)
{
spnr_graph_t *g = sys->graph;
return g->kind->calc_h (g->priv, g->N, sys);
}
float spnr_sys_calc_phi (spnr_sys_t * sys)
{
return sys->kind->calc_phi (sys->priv, sys->graph->N);
}