commit | author | age
|
d7639a
|
1 |
#include<stdlib.h> |
SP |
2 |
#include "general.h" |
|
3 |
#include "cell.h" |
|
4 |
|
|
5 |
ts_bool centermass(ts_vesicle *vesicle){ |
|
6 |
ts_uint i; |
|
7 |
vesicle->cm[0]=0; |
|
8 |
vesicle->cm[1]=0; |
|
9 |
vesicle->cm[2]=0; |
|
10 |
for(i=0;i<vesicle->vlist.n;i++){ |
|
11 |
vesicle->cm[0]+=vesicle->vlist.vertex[i].x; |
|
12 |
vesicle->cm[1]+=vesicle->vlist.vertex[i].y; |
|
13 |
vesicle->cm[2]+=vesicle->vlist.vertex[i].z; |
|
14 |
} |
|
15 |
vesicle->cm[0]/=(float)vesicle->vlist.n; |
|
16 |
vesicle->cm[1]/=(float)vesicle->vlist.n; |
|
17 |
vesicle->cm[2]/=(float)vesicle->vlist.n; |
|
18 |
return TS_SUCCESS; |
|
19 |
} |
|
20 |
|
|
21 |
ts_bool cell_ocupation(ts_vesicle *vesicle){ |
|
22 |
ts_uint i,j,cellidx; |
|
23 |
ts_double shift; |
|
24 |
ts_double dcell; |
|
25 |
shift=(ts_double) vesicle->clist.ncmax[0]/2; |
|
26 |
dcell=1.0/(1.0 + vesicle->stepsize); |
|
27 |
ts_uint ncx, ncy,ncz; |
|
28 |
|
|
29 |
cell_list_cell_ocupation_clear(&vesicle->clist); |
|
30 |
for(i=0;i<vesicle->vlist.n;i++){ |
|
31 |
|
|
32 |
cellidx=vertex_self_avoidance(vesicle, &vesicle->vlist.vertex[i]); |
|
33 |
vesicle->vlist.vertex[i].cell=&(vesicle->clist.cell[cellidx]); |
|
34 |
|
|
35 |
cell_add_vertex(&vesicle->clist.cell[cellidx],&vesicle->vlist.vertex[i]); |
|
36 |
|
|
37 |
// if(ncx > vesicle->clist.ncmax[0]) vesicle->clist.ncmax[0]=ncx; |
|
38 |
// if(ncy > vesicle->clist.ncmax[1]) vesicle->clist.ncmax[1]=ncy; |
|
39 |
// if(ncz > vesicle->clist.ncmax[2]) vesicle->clist.ncmax[2]=ncz; |
|
40 |
} |
|
41 |
|
|
42 |
|
|
43 |
/* This was already done in previous for loop.... Have I gained some time? |
|
44 |
|
|
45 |
|
|
46 |
for(i=0;i<vesicle->clist.ncmax[0]*vesicle->clist.ncmax[1]*vesicle->clist.ncmax[2];i++){ |
|
47 |
vesicle->clist.cell[i].nvertex=0; |
|
48 |
for(j=0;j<vesicle->vlist.n;j++){ |
|
49 |
//add_vertextocell; |
|
50 |
//add_vertextomonomer; |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
*/ |
|
55 |
return TS_SUCCESS; |
|
56 |
} |