From e9ac7bb212f9909ff228708d97878fee5eac8ba6 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Mon, 29 Feb 2016 07:30:10 +0000
Subject: [PATCH] Found bug. Tria j==1

---
 src/restore.h |    2 ++
 src/restore.c |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/restore.c b/src/restore.c
index 94e2621..0ca42ec 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -139,6 +139,9 @@
 		if ((!xmlStrcmp(child->name, (const xmlChar *)"tria"))){
 			parseTrisurfTria(vesicle, doc, child);
 		}
+		if ((!xmlStrcmp(child->name, (const xmlChar *)"trianeigh"))){
+			parseTrisurfTriaNeigh(vesicle, doc, child);
+		}
 		 if ((!xmlStrcmp(child->name, (const xmlChar *)"tristar"))){
 			parseTrisurfTristar(vesicle, doc, child);
 		}
@@ -201,6 +204,29 @@
 }
 
 
+ts_bool parseTrisurfTriaNeigh(ts_vesicle *vesicle, xmlDocPtr doc, xmlNodePtr cur){
+	xmlChar *triangles;
+	char *tria;
+	char *ntria[3];
+	ts_uint i,j;
+	triangles = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
+	tria=(char *)triangles;
+	for(i=0;i<3;i++)	ntria[i]=strtok(tria," ");
+	j=0;
+	while(ntria[2]!=NULL){
+		triangle_add_neighbour(vesicle->tlist->tria[j],vesicle->tlist->tria[atoi(ntria[0])]);
+		triangle_add_neighbour(vesicle->tlist->tria[j],vesicle->tlist->tria[atoi(ntria[1])]);
+		triangle_add_neighbour(vesicle->tlist->tria[j],vesicle->tlist->tria[atoi(ntria[2])]);
+		j++;
+		for(i=0;i<3;i++)	ntria[i]=strtok(NULL," ");
+	}	
+	fprintf(stderr,"Parsing triangle neighbors j=%d\n",j);	
+
+	xmlFree(triangles);
+	return TS_SUCCESS;
+}
+
+
 ts_bool parseTrisurfTristar(ts_vesicle *vesicle, xmlDocPtr doc, xmlNodePtr cur){
 
 	xmlChar *chari;
diff --git a/src/restore.h b/src/restore.h
index 414bb62..16efff2 100644
--- a/src/restore.h
+++ b/src/restore.h
@@ -5,7 +5,9 @@
 ts_vesicle *parseTrisurfTag(xmlDocPtr doc, xmlNodePtr cur);
 ts_bool parseTrisurfVtxn(ts_vertex_list *vlist, xmlDocPtr doc, xmlNodePtr cur);
 ts_bool parseTrisurfTria(ts_vesicle *vesicle, xmlDocPtr doc, xmlNodePtr cur);
+ts_bool parseTrisurfTriaNeigh(ts_vesicle *vesicle, xmlDocPtr doc, xmlNodePtr cur);
 ts_bool parseTrisurfTristar(ts_vesicle *vesicle, xmlDocPtr doc, xmlNodePtr cur);
 ts_bool parseXMLVertexPosition(ts_vesicle *vesicle,xmlDocPtr doc, xmlNodePtr cur);
 ts_bool parseXMLBonds(ts_vesicle *vesicle,xmlDocPtr doc, xmlNodePtr cur);
+
 #endif

--
Gitblit v1.9.3