Changes in ts_bond data structure, bond.c added assign_triangles functions that is called in initial_distribution for each bond.
| | |
| | | blist->bond[blist->n - 1]->vtx2=vtx2; |
| | | blist->bond[blist->n - 1]->tainted=0; |
| | | //Should we calculate bond length NOW? |
| | | |
| | | |
| | | |
| | | |
| | | return blist->bond[blist->n-1]; |
| | | } |
| | | |
| | | |
| | | /* Two triangles are assigned to the bond. Bond must already be initialized. */ |
| | | ts_bool bond_assign_triangles(ts_bond *bond){ |
| | | ts_vertex *vtx1=bond->vtx1, *vtx2=bond->vtx2; |
| | | ts_uint i,j,k; |
| | | |
| | | for(i=0,k=0;i<vtx1->tristar_no;i++){ |
| | | for(j=0;j<3;j++){ |
| | | if(vtx1->tristar[i]->vertex[j]==vtx2){ |
| | | //triangle found; |
| | | bond->tria[k]=vtx1->tristar[i]; |
| | | k++; |
| | | } |
| | | } |
| | | } |
| | | if(k<2) return TS_FAIL; |
| | | else return TS_SUCCESS; |
| | | } |
| | | |
| | | ts_bool bond_list_free(ts_bond_list *blist){ |
| | | ts_uint i; |
| | | for(i=0;i<blist->n;i++){ |
| | |
| | | * system. |
| | | */ |
| | | ts_bond *bond_add(ts_bond_list *blist, ts_vertex *vtx1, ts_vertex *vtx2); |
| | | |
| | | ts_bool bond_assign_triangles(ts_bond *bond); |
| | | ts_bool bond_list_free(ts_bond_list *blist); |
| | | |
| | | |
| | |
| | | ts_uint idx; |
| | | ts_vertex *vtx1; |
| | | ts_vertex *vtx2; |
| | | struct ts_triangle *tria[2]; |
| | | ts_double bond_length; |
| | | ts_double bond_length_dual; |
| | | ts_bool tainted; |
| | |
| | | retval = init_triangle_neighbours(vesicle); |
| | | retval = init_common_vertex_triangle_neighbours(vesicle); |
| | | retval = init_normal_vectors(vesicle->tlist); |
| | | retval = init_bond_triangles(vesicle->blist); |
| | | retval = mean_curvature_and_energy(vesicle); |
| | | ts_fprintf(stderr,"initial_distribution finished!\n"); |
| | | if(retval); |
| | |
| | | } |
| | | return TS_SUCCESS; |
| | | } |
| | | |
| | | ts_bool init_bond_triangles(ts_bond_list *blist){ |
| | | |
| | | ts_uint i; |
| | | ts_bool retval; |
| | | for(i=0;i<blist->n;i++){ |
| | | retval=bond_assign_triangles(blist->bond[i]); |
| | | if(retval==TS_FAIL){ |
| | | fatal("Bond %u does not have 2 triangles. Possible error in structure.",156); |
| | | } |
| | | } |
| | | return TS_SUCCESS; |
| | | } |
| | |
| | | ts_bool init_triangle_neighbours(ts_vesicle *vesicle); |
| | | ts_bool init_common_vertex_triangle_neighbours(ts_vesicle *vesicle); |
| | | ts_bool init_normal_vectors(ts_triangle_list *tlist); |
| | | |
| | | ts_bool init_bond_triangles(ts_bond_list *blist); |