commit | author | age
|
d7639a
|
1 |
#include<stdlib.h> |
SP |
2 |
#include "general.h" |
|
3 |
#include<stdio.h> |
|
4 |
|
|
5 |
ts_bool init_bond_list(ts_bond_list *blist){ |
|
6 |
blist->n=0; |
|
7 |
blist->bond=NULL; |
|
8 |
return TS_SUCCESS; |
|
9 |
} |
|
10 |
|
|
11 |
ts_bool bond_add(ts_bond_list *blist, ts_vertex *vtx1, ts_vertex *vtx2){ |
|
12 |
blist->n++; |
|
13 |
blist->bond=realloc(blist->bond,blist->n*sizeof(ts_bond)); |
|
14 |
if(blist->bond==NULL) fatal("Cannot reallocate memory for additional *ts_bond.",5); |
|
15 |
//NOW insert vertices! |
|
16 |
blist->bond[blist->n - 1].vtx1=vtx1; |
|
17 |
blist->bond[blist->n - 1].vtx2=vtx2; |
|
18 |
return TS_SUCCESS; |
|
19 |
} |
|
20 |
|
|
21 |
ts_bool bond_list_free(ts_bond_list *blist){ |
|
22 |
free(blist->bond); |
|
23 |
return TS_SUCCESS; |
|
24 |
} |