Trisurf Monte Carlo simulator
Samo Penic
2018-06-27 6da644f98434d3eac8b4e19981754f6030a315a5
src/snapshot.c
@@ -22,9 +22,9 @@
/* outputs additional data into paraview xml file */
ts_bool xml_trisurf_data(FILE *fh, ts_vesicle *vesicle){
   ts_double cvol_write=0, carea_write=0;
   ts_string *data=(ts_string *)malloc(sizeof(ts_sprintf));
   data->string=(char *)malloc(512000*sizeof(char)); /*TODO: warning, can break if the string is to long */
   data->string=(char *)malloc(5120000*sizeof(char)); /*TODO: warning, can break if the string is to long */
   data->beg=0;
   
   xml_trisurf_header(fh, vesicle);
@@ -32,6 +32,16 @@
   xml_trisurf_tria_neigh(data,vesicle->tlist);
   xml_trisurf_vtx_neigh(data,vesicle->vlist);   
   xml_trisurf_vtx_tristar(data,vesicle->vlist);
   xml_trisurf_nucleus(data,vesicle);
   if(vesicle->tape->constvolswitch==0)
      cvol_write=vesicle->volume;
   else
      cvol_write=V0;
   if(vesicle->tape->constareaswitch==0)
      carea_write=vesicle->area;
   else
      carea_write=A0;
   xml_trisurf_constvolarea(data,cvol_write,carea_write);
#ifdef COMPRESSION
   char *compressed;
   ts_uint nbytes=ts_compress_string64(data->string, data->beg-1, &compressed); //suppress null character at the end with by substracting 1
@@ -124,7 +134,18 @@
   return TS_SUCCESS;
}
ts_bool xml_trisurf_nucleus(ts_string *data, ts_vesicle* vesicle){
   if(vesicle->R_nucleus>0.0 || (vesicle->R_nucleusX>0.0 && vesicle->R_nucleusY>0.0 && vesicle->R_nucleusZ>0.0)){
      ts_sprintf(data,"<nucleus>%.17e %.17e %.17e</nucleus>",vesicle->nucleus_center[0], vesicle->nucleus_center[1], vesicle->nucleus_center[2]);
   }
   return TS_SUCCESS;
}
ts_bool xml_trisurf_constvolarea(ts_string *data, ts_double volume, ts_double area){
   ts_sprintf(data,"<constant_volume>%.17e</constant_volume>",volume);
   ts_sprintf(data,"<constant_area>%.17e</constant_area>",area);
   return TS_SUCCESS;
}
/* UTILITIES */