From 0a2c81d28b72c6ab68ad418130148b144da90309 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@fe.uni-lj.si> Date: Tue, 05 Jul 2016 14:50:38 +0000 Subject: [PATCH] Some minor changes --- src/timestep.c | 2 +- src/io.c | 37 +++++++++++++++++++++++++++++++++++-- src/tspoststat.c | 5 ++++- src/io.h | 2 +- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/io.c b/src/io.c index 7066657..f82aa7a 100644 --- a/src/io.c +++ b/src/io.c @@ -820,7 +820,7 @@ return TS_SUCCESS; } -ts_bool write_vertex_xml_file(ts_vesicle *vesicle, ts_uint timestepno){ +ts_bool write_vertex_xml_file(ts_vesicle *vesicle, ts_uint timestepno, ts_cluster_list *cstlist){ ts_vertex_list *vlist=vesicle->vlist; ts_bond_list *blist=vesicle->blist; ts_vertex **vtx=vlist->vtx; @@ -887,7 +887,40 @@ } fprintf(fh,"</DataArray>\n"); - + if(cstlist!=NULL){ + fprintf(fh,"<DataArray type=\"Int64\" Name=\"vertices_in_cluster\" format=\"ascii\">"); + for(i=0;i<vlist->n;i++){ + if(vtx[i]->cluster!=NULL){ + fprintf(fh,"%u ",vtx[i]->cluster->nvtx); + } else { + fprintf(fh,"-1 "); + } + } + //polymeres + if(poly){ + poly_idx=vlist->n; + for(i=0;i<vesicle->poly_list->n;i++){ + for(j=0;j<vesicle->poly_list->poly[i]->vlist->n;j++,poly_idx++){ + fprintf(fh,"-1 "); + } + } + } + //filaments + if(fil){ + poly_idx=vlist->n+monono*polyno; + for(i=0;i<vesicle->filament_list->n;i++){ + for(j=0;j<vesicle->filament_list->poly[i]->vlist->n;j++,poly_idx++){ + // fprintf(stderr,"was here\n"); + fprintf(fh,"-1 "); + } + } + } + + fprintf(fh,"</DataArray>\n"); + + + } + //here comes additional data as needed. Currently only spontaneous curvature fprintf(fh,"<DataArray type=\"Float64\" Name=\"spontaneous_curvature\" format=\"ascii\">"); for(i=0;i<vlist->n;i++){ diff --git a/src/io.h b/src/io.h index 2243555..6ca8331 100644 --- a/src/io.h +++ b/src/io.h @@ -72,7 +72,7 @@ * @param *text is a description line (max. 255 characters) to be included in the file */ ts_bool write_vertex_vtk_file(ts_vesicle *vesicle,ts_char *filename, ts_char *text); -ts_bool write_vertex_xml_file(ts_vesicle *vesicle, ts_uint timestepno); +ts_bool write_vertex_xml_file(ts_vesicle *vesicle, ts_uint timestepno, ts_cluster_list *cstlist); ts_bool write_master_xml_file(ts_char *filename); ts_bool write_pov_file(ts_vesicle *vesicle, char *filename); diff --git a/src/timestep.c b/src/timestep.c index be14619..f7cb5dd 100644 --- a/src/timestep.c +++ b/src/timestep.c @@ -93,7 +93,7 @@ cell_occupation(vesicle); dump_state(vesicle,i); if(i>=inititer){ - write_vertex_xml_file(vesicle,i-inititer); + write_vertex_xml_file(vesicle,i-inititer,NULL); write_master_xml_file(command_line_args.output_fullfilename); epochtime=get_epoch(); gyration_eigen(vesicle, &l1, &l2, &l3); diff --git a/src/tspoststat.c b/src/tspoststat.c index 5ac1c4e..6a4b8fb 100644 --- a/src/tspoststat.c +++ b/src/tspoststat.c @@ -70,7 +70,7 @@ ts_cluster_list *cstlist=init_cluster_list(); clusterize_vesicle(vesicle,cstlist); //printf("No clusters=%d\n",cstlist->n); - int k,i,cnt; + int k,i,cnt, test=0; int max_nvtx=0; char filename[255]; sprintf(filename,"histogram_%.6u.csv",timestep_no); @@ -84,12 +84,15 @@ for(k=0;k<cstlist->n;k++) if(cstlist->cluster[k]->nvtx==i) cnt++; fprintf(fd,"%d %d\n",i,cnt); + test+=cnt*i; } //for(k=0;k<cstlist->n;k++){ // printf("*Cluster %d has %d vertices\n",k,cstlist->cluster[k]->nvtx); // } fclose(fd); +// printf("*Sum of all vertices in clusters: %d\n", test); +// write_vertex_xml_file(vesicle,timestep_no,cstlist); cluster_list_free(cstlist); return TS_SUCCESS; -- Gitblit v1.9.3