From d43116b7d609fa9cabae4068d037c1af3a20dae8 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Thu, 08 Aug 2019 17:42:46 +0000
Subject: [PATCH] An attempt to fix polymer error while recreating vesicle from vtu.

---
 src/poly.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/poly.c b/src/poly.c
index b91ff62..cf416b5 100644
--- a/src/poly.c
+++ b/src/poly.c
@@ -126,7 +126,6 @@
 							m++;
 							if(m>1000) {
 								k=9999; //break also ot of the outer loop
-								printf("was here\n");
 								break;
 							}
 						}
@@ -159,6 +158,7 @@
 	ts_uint gvtxi;
 	ts_bool retval;
 	ts_double dphi,dh;
+
 	cell_occupation(vesicle); //needed for evading the membrane
 	// Grafting polymers:
 	int tries=0;
@@ -242,9 +242,9 @@
 
 ts_bool poly_free(ts_poly *poly){
 
-	if (poly->grafted_vtx!=NULL){
-		poly->grafted_vtx->grafted_poly=NULL;
-	}
+//	if (poly->grafted_vtx!=NULL){
+//		poly->grafted_vtx->grafted_poly=NULL;
+//	}
 	vtx_list_free(poly->vlist);
 	bond_list_free(poly->blist);
 	free(poly);
@@ -254,8 +254,9 @@
 
 ts_bool poly_list_free(ts_poly_list *poly_list){
 	ts_uint i;
-
+	//fprintf(stderr,"no. of polys=%d\n", poly_list->n);
 	for(i=0;i<poly_list->n;i++){
+	//	fprintf(stderr,"%d poly address in mem=%ld\n",i+1,(long)&(poly_list->poly[i]));
 		poly_free(poly_list->poly[i]);
 	}
 	free(poly_list->poly);
@@ -302,3 +303,15 @@
 	return TS_SUCCESS;
 }
 
+
+
+ts_poly_list *init_empty_poly_list(ts_uint n_poly, ts_uint n_mono){
+	ts_poly_list *poly_list=(ts_poly_list *)calloc(1,sizeof(ts_poly_list));
+	poly_list->poly=(ts_poly **)calloc(n_poly,sizeof(ts_poly *));
+	ts_uint i;
+	for (i=0; i<n_poly;i++){
+		poly_list->poly[i]=init_poly(n_mono, NULL);
+	}
+	poly_list->n = n_poly;
+	return poly_list;
+}

--
Gitblit v1.9.3