From 063289f4f872d642078d70757685c728e3fdfc81 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Thu, 06 Mar 2014 07:48:56 +0000
Subject: [PATCH] Fixed a bug. added cells

---
 src/main.c |   10 ++++++----
 src/io.c   |   12 ++++++++++--
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/io.c b/src/io.c
index 262e482..b4e879f 100644
--- a/src/io.c
+++ b/src/io.c
@@ -127,6 +127,8 @@
         poly_list->poly->bond
 */
 
+	fwrite(vesicle->clist, sizeof(ts_cell_list),1,  fh);
+
     fclose(fh);
     return TS_SUCCESS;
 }
@@ -298,8 +300,14 @@
         }
     }
 
-  
-
+// recreating space for cells // 
+	vesicle->clist=(ts_cell_list *)malloc(sizeof(ts_cell_list));
+	retval=fread(vesicle->clist, sizeof(ts_cell_list), 1,fh); 
+	vesicle->clist->cell=(ts_cell **)malloc(sizeof(ts_cell *)*vesicle->clist->ncmax[0]*vesicle->clist->ncmax[1]*vesicle->clist->ncmax[2]);
+	for(i=0;i<vesicle->clist->ncmax[0]*vesicle->clist->ncmax[1]*vesicle->clist->ncmax[2];i++){
+        	vesicle->clist->cell[i]=(ts_cell *)calloc(1,sizeof(ts_cell));
+        	vesicle->clist->cell[i]->idx=i+1; // We enumerate cells! Probably never required!
+    	}
 
     if(retval); 
     fclose(fh);
diff --git a/src/main.c b/src/main.c
index 595e11d..2ebd7db 100644
--- a/src/main.c
+++ b/src/main.c
@@ -64,7 +64,7 @@
 vtx_list_free(vlist1);
 printf("Tests complete.\n");
 */
-//vesicle1=parsetape(&mcsweeps, &inititer, &iterations);
+vesicle1=parsetape(&mcsweeps, &inititer, &iterations);
 
 /*Testing */
 //vesicle->poly_list=init_poly_list(1400,20,vesicle->vlist);
@@ -74,14 +74,16 @@
 
 //write_vertex_xml_file(vesicle,0);
 //vesicle_free(vesicle);
+dump_state(vesicle1);
 vesicle=restore_state();
-write_vertex_xml_file(vesicle,1);
-write_master_xml_file("test.pvd");
+//write_vertex_xml_file(vesicle,1);
+//write_master_xml_file("test.pvd");
 //vesicle_free(vesicle1);
 //vesicle_free(vesicle);
-return 0;
 vesicle_free(vesicle1);
+fprintf(stderr,"Starting simulation...");
 run_simulation(vesicle, mcsweeps, inititer, iterations);
+return 0;
 
 write_master_xml_file("test.pvd");
 write_dout_fcompat_file(vesicle,"dout");

--
Gitblit v1.9.3