Trisurf Monte Carlo simulator
Samo Penic
2016-02-15 383644169457b45c9c6bc047c469c8e1ca1d2562
commit | author | age
854cb6 1 #include<stdio.h>
SP 2 #include<general.h>
3 #include<snapshot.h>
4 ts_bool xml_trisurf_data(FILE *fh, ts_vesicle *vesicle){
5     xml_trisurf_header(fh, vesicle);
6     xml_trisurf_tria(fh,vesicle->tlist);
7     xml_trisurf_tria_neigh(fh,vesicle->tlist);
8     xml_trisurf_vtx_neigh(fh,vesicle->vlist);
9     xml_trisurf_vtx_tristar(fh,vesicle->vlist);
10     xml_trisurf_footer(fh);
11     return TS_SUCCESS;
12 }
13
14 ts_bool xml_trisurf_header(FILE *fh, ts_vesicle *vesicle){
15     fprintf(fh, "<trisurf nvtx=\"%u\" npoly=\"%u\" nfono=\"%u\">\n", vesicle->vlist->n, vesicle->poly_list->n, vesicle->poly_list->poly[0]->vlist->n);
16     return TS_SUCCESS;
17 }
18
19 ts_bool xml_trisurf_footer(FILE *fh){
20     fprintf(fh, "</trisurf>\n");
21     return TS_SUCCESS;
22 }
23
24 ts_bool xml_trisurf_tria(FILE *fh, ts_triangle_list *tlist){
25     ts_uint i;
26     fprintf(fh,"<tria>\n");
27     for(i=0; i<tlist->n;i++){
28         fprintf(fh,"%u %u %u\n",tlist->tria[i]->vertex[0]->idx, tlist->tria[i]->vertex[1]->idx, tlist->tria[i]->vertex[2]->idx);
29     }
30     fprintf(fh,"</tria>\n");
31     return TS_SUCCESS;
32 }
33
34 ts_bool xml_trisurf_tria_neigh(FILE *fh, ts_triangle_list *tlist){
35     ts_uint i;
36     fprintf(fh,"<trianeigh>\n");
37     for(i=0; i<tlist->n;i++){
38         fprintf(fh,"%u %u %u\n",tlist->tria[i]->neigh[0]->idx, tlist->tria[i]->neigh[1]->idx, tlist->tria[i]->neigh[2]->idx);
39     }
40     fprintf(fh,"</trianeigh>\n");
41     return TS_SUCCESS;
42 }
43
44 ts_bool xml_trisurf_vtx_neigh(FILE *fh, ts_vertex_list *vlist){
45     ts_uint i,j;
46     for(i=0;i<vlist->n;i++){
47         fprintf(fh,"<vtxn idx=\"%u\">",vlist->vtx[i]->idx);
48         for(j=0;j<vlist->vtx[i]->neigh_no;j++){
49             fprintf(fh,"%u ",vlist->vtx[i]->neigh[j]->idx);
50         }
51         fprintf(fh, "</vtxn>\n");
52     }
53     return TS_SUCCESS;
54 }
55
56 ts_bool xml_trisurf_vtx_tristar(FILE *fh, ts_vertex_list *vlist){
57     ts_uint i,j;
58     for(i=0;i<vlist->n;i++){
59         fprintf(fh,"<tristar idx=\"%u\">",vlist->vtx[i]->idx);
60         for(j=0;j<vlist->vtx[i]->tristar_no;j++){
61             fprintf(fh,"%u ",vlist->vtx[i]->tristar[j]->idx);
62         }
63         fprintf(fh, "</tristar>\n");
64     }
65     return TS_SUCCESS;
66 }
67