commit | author | age
|
d7639a
|
1 |
#include<general.h> |
SP |
2 |
#include "vesicle.h" |
bb77ca
|
3 |
#include "vertex.h" |
SP |
4 |
#include "triangle.h" |
|
5 |
#include "bond.h" |
|
6 |
#include "cell.h" |
7958e9
|
7 |
#include "stdlib.h" |
bb77ca
|
8 |
|
SP |
9 |
ts_vesicle *init_vesicle(ts_uint N, ts_uint ncmax1, ts_uint ncmax2, ts_uint |
|
10 |
ncmax3, ts_double stepsize){ |
7958e9
|
11 |
ts_vesicle *vesicle=(ts_vesicle *)malloc(sizeof(ts_vesicle)); |
bb77ca
|
12 |
vesicle->vlist=init_vertex_list(N); |
SP |
13 |
vesicle->blist=init_bond_list(); |
|
14 |
vesicle->tlist=init_triangle_list(); |
|
15 |
vesicle->clist=init_cell_list(ncmax1, ncmax2, ncmax3, stepsize); |
7958e9
|
16 |
return vesicle; |
bb77ca
|
17 |
} |
SP |
18 |
|
d7639a
|
19 |
ts_bool vesicle_translate(ts_vesicle *vesicle,ts_double x, ts_double y, ts_double z){ |
SP |
20 |
ts_uint i; |
7958e9
|
21 |
ts_vertex **vtx=vesicle->vlist->vtx; |
bb77ca
|
22 |
ts_uint nn=vesicle->vlist->n; |
d7639a
|
23 |
for(i=0;i<nn;i++){ |
8f6a69
|
24 |
vtx[i]->x+=x; |
SP |
25 |
vtx[i]->y+=y; |
|
26 |
vtx[i]->z+=z; |
d7639a
|
27 |
} |
SP |
28 |
return TS_SUCCESS; |
|
29 |
} |
|
30 |
|
|
31 |
ts_bool vesicle_free(ts_vesicle *vesicle){ |
7958e9
|
32 |
vtx_list_free(vesicle->vlist); |
bb77ca
|
33 |
bond_list_free(vesicle->blist); |
SP |
34 |
triangle_list_free(vesicle->tlist); |
|
35 |
cell_list_free(vesicle->clist); |
7958e9
|
36 |
free(vesicle); |
d7639a
|
37 |
return TS_SUCCESS; |
SP |
38 |
} |
523bf1
|
39 |
|
SP |
40 |
ts_bool vesicle_volume(ts_vesicle *vesicle){ |
|
41 |
ts_double volume; |
|
42 |
ts_double vol; |
|
43 |
ts_uint i; |
|
44 |
ts_triangle **tria=vesicle->tlist->tria; |
|
45 |
volume=0; |
|
46 |
for(i=0; i<vesicle->tlist->n;i++){ |
|
47 |
vol=(tria[i]->vertex[0]->x+ tria[i]->vertex[1]->x + tria[i]->vertex[2]->x) * tria[i]->xnorm + |
|
48 |
(tria[i]->vertex[0]->y+ tria[i]->vertex[1]->y + tria[i]->vertex[2]->y) * tria[i]->ynorm + |
|
49 |
(tria[i]->vertex[0]->z+ tria[i]->vertex[1]->z + tria[i]->vertex[2]->z) * |
|
50 |
tria[i]->znorm; |
|
51 |
volume=volume-vol/18.0; |
|
52 |
} |
|
53 |
|
|
54 |
vesicle->volume=volume; |
|
55 |
return TS_SUCCESS; |
|
56 |
} |