From 80ebbe388f3e945e62f47b0141c660ee6f05c8fc Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Thu, 17 Oct 2019 17:06:50 +0000
Subject: [PATCH] have some kind of memory allocation error :(

---
 src/io.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/io.c b/src/io.c
index 482c0a5..a2b50d9 100644
--- a/src/io.c
+++ b/src/io.c
@@ -254,17 +254,23 @@
 	xml_trisurf_data(fh,vesicle);
 	fprintf(fh, " <UnstructuredGrid>\n");
     fprintf(fh, "<Piece NumberOfPoints=\"%u\" NumberOfCells=\"%u\">\n",vlist->n+monono*polyno+fonono*filno, blist->n+monono*polyno+filno*(fonono-1)+vesicle->tlist->n);
-    fprintf(fh,"<PointData Scalars=\"vertices_idx\">\n<DataArray type=\"Int64\" Name=\"vertices_idx\" format=\"ascii\">");
+    fprintf(fh,"<PointData Scalars=\"vertices_idx\">\n<DataArray type=\"Int64\" Name=\"vertices_idx\" format=\"binary\">");
+	int *int_vector=(int *)malloc(vlist->n+monono*polyno+fonono*filno*sizeof(ts_uint));
+	int offset=0;
    	for(i=0;i<vlist->n;i++){
-		fprintf(fh,"%u ",vtx[i]->idx);
+	//	fprintf(fh,"%u ",vtx[i]->idx);
+		int_vector[i+offset]=vtx[i]->idx;
     }
 	//polymeres
 	if(poly){
 		poly_idx=vlist->n;
+		offset=offset+i;
 		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,"%u ", poly_idx);
+				//fprintf(fh,"%u ", poly_idx);
+				int_vector[j+offset]=poly_idx;
 			}
+			offset=offset+j;
 		}
 	}
 	//filaments
@@ -273,10 +279,15 @@
 		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,"%u ", poly_idx);
+				//fprintf(fh,"%u ", poly_idx);
+				int_vector[j+offset]=poly_idx;
 			}
+			offset=offset+j;
 		}
 	}
+	char *printout=ts_compress_intlist(int_vector,vlist->n+monono*polyno+fonono*filno*sizeof(ts_uint));
+	fprintf(fh,"%s",printout);
+	free(printout);
 
     	fprintf(fh,"</DataArray>\n");
 	if(cstlist!=NULL){

--
Gitblit v1.9.3