commit | author | age
|
7f6076
|
1 |
/* vim: set ts=4 sts=4 sw=4 noet : */ |
d7639a
|
2 |
#include<general.h> |
SP |
3 |
#include "vesicle.h" |
bb77ca
|
4 |
#include "vertex.h" |
SP |
5 |
#include "triangle.h" |
|
6 |
#include "bond.h" |
|
7 |
#include "cell.h" |
7958e9
|
8 |
#include "stdlib.h" |
a2db52
|
9 |
#include "poly.h" |
632960
|
10 |
#include "sh.h" |
459ff9
|
11 |
#include "shcomplex.h" |
8db569
|
12 |
|
bb77ca
|
13 |
ts_vesicle *init_vesicle(ts_uint N, ts_uint ncmax1, ts_uint ncmax2, ts_uint |
SP |
14 |
ncmax3, ts_double stepsize){ |
8db569
|
15 |
ts_vesicle *vesicle=(ts_vesicle *)calloc(1,sizeof(ts_vesicle)); |
bb77ca
|
16 |
vesicle->vlist=init_vertex_list(N); |
SP |
17 |
vesicle->blist=init_bond_list(); |
|
18 |
vesicle->tlist=init_triangle_list(); |
|
19 |
vesicle->clist=init_cell_list(ncmax1, ncmax2, ncmax3, stepsize); |
7958e9
|
20 |
return vesicle; |
bb77ca
|
21 |
} |
SP |
22 |
|
d7639a
|
23 |
ts_bool vesicle_translate(ts_vesicle *vesicle,ts_double x, ts_double y, ts_double z){ |
SP |
24 |
ts_uint i; |
7958e9
|
25 |
ts_vertex **vtx=vesicle->vlist->vtx; |
bb77ca
|
26 |
ts_uint nn=vesicle->vlist->n; |
d7639a
|
27 |
for(i=0;i<nn;i++){ |
8f6a69
|
28 |
vtx[i]->x+=x; |
SP |
29 |
vtx[i]->y+=y; |
|
30 |
vtx[i]->z+=z; |
d7639a
|
31 |
} |
SP |
32 |
return TS_SUCCESS; |
|
33 |
} |
|
34 |
|
|
35 |
ts_bool vesicle_free(ts_vesicle *vesicle){ |
7958e9
|
36 |
vtx_list_free(vesicle->vlist); |
bb77ca
|
37 |
bond_list_free(vesicle->blist); |
SP |
38 |
triangle_list_free(vesicle->tlist); |
|
39 |
cell_list_free(vesicle->clist); |
a2db52
|
40 |
poly_list_free(vesicle->poly_list); |
701026
|
41 |
poly_list_free(vesicle->filament_list); |
459ff9
|
42 |
complex_sph_free(vesicle->sphHarmonics); |
7958e9
|
43 |
free(vesicle); |
d7639a
|
44 |
return TS_SUCCESS; |
SP |
45 |
} |
523bf1
|
46 |
|
c9d07c
|
47 |
/* @brief Function makes a sum of partial volumes of each triangle. Volumes of |
SP |
48 |
* |
|
49 |
* Partial volumes are calculated when we calculate normals of triangles. It is |
|
50 |
* relatively easy to calculate the volume of vesicle if we take into account |
|
51 |
* that the volume of the whole vertex is simply sum of all partial volumes of |
|
52 |
* all the triangles. |
|
53 |
*/ |
523bf1
|
54 |
ts_bool vesicle_volume(ts_vesicle *vesicle){ |
SP |
55 |
ts_double volume; |
|
56 |
ts_uint i; |
|
57 |
ts_triangle **tria=vesicle->tlist->tria; |
|
58 |
volume=0; |
|
59 |
for(i=0; i<vesicle->tlist->n;i++){ |
c9d07c
|
60 |
volume=volume+tria[i]->volume; |
523bf1
|
61 |
} |
SP |
62 |
vesicle->volume=volume; |
|
63 |
return TS_SUCCESS; |
|
64 |
} |
c0ae90
|
65 |
|
SP |
66 |
/* @brief Function makes a sum of partial areas of each triangle. |
|
67 |
* |
|
68 |
* |
|
69 |
* |
|
70 |
*/ |
|
71 |
ts_bool vesicle_area(ts_vesicle *vesicle){ |
|
72 |
ts_double area; |
|
73 |
ts_uint i; |
|
74 |
ts_triangle **tria=vesicle->tlist->tria; |
|
75 |
area=0; |
|
76 |
for(i=0;i<vesicle->tlist->n;i++){ |
|
77 |
area=area+tria[i]->area; |
|
78 |
} |
|
79 |
vesicle->area=area; |
|
80 |
return TS_SUCCESS; |
|
81 |
} |
810894
|
82 |
|
M |
83 |
ts_double vesicle_meancurvature(ts_vesicle *vesicle){ |
|
84 |
// Integrates (H dA) over vesicle area A, where H=(C1+C2)/2. |
|
85 |
// (To be devided by A outside of function) |
|
86 |
ts_double mc; |
|
87 |
ts_uint i; |
|
88 |
mc=0; |
|
89 |
for(i=0;i<vesicle->vlist->n;i++){ |
|
90 |
mc=mc+vesicle->vlist->vtx[i]->curvature; |
|
91 |
} |
|
92 |
return mc/2.0; |
|
93 |
} |