From 06afc729f9061c1cfa14c78728d61d518324c2f0 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Wed, 04 May 2022 05:46:43 +0000
Subject: [PATCH] Moved all global variables to separate file and defined extern keyword where appropriate

---
 src/snapshot.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/snapshot.c b/src/snapshot.c
index 8b71e83..81fb476 100644
--- a/src/snapshot.c
+++ b/src/snapshot.c
@@ -10,6 +10,8 @@
 #include<config.h>
 #include <time.h>
 #include "io.h"
+#include "globals.h"
+
 /* a helper function that utilizes ts_string data structure and performs same as sprintf */
 ts_uint ts_sprintf(ts_string *str, char *fmt, ...){
 	va_list ap;
@@ -23,8 +25,8 @@
 /* outputs additional data into paraview xml file */
 ts_bool xml_trisurf_data(FILE *fh, ts_vesicle *vesicle){
 
-	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 */
+	ts_string *data=(ts_string *)malloc(sizeof(ts_string));
+	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);
@@ -33,6 +35,7 @@
 	xml_trisurf_vtx_neigh(data,vesicle->vlist);	
 	xml_trisurf_vtx_tristar(data,vesicle->vlist);
 	xml_trisurf_nucleus(data,vesicle);
+	xml_trisurf_constvolarea(data,V0,A0);
 #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
@@ -127,10 +130,16 @@
 
 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 %.7e</nucleus>",vesicle->nucleus_center[0], vesicle->nucleus_center[1], vesicle->nucleus_center[2]);
+		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 */

--
Gitblit v1.9.3