From 487968538b6902a8c102531f5ee60db1c757c219 Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@fe.uni-lj.si> Date: Wed, 24 Feb 2016 08:52:40 +0000 Subject: [PATCH] Restoration of vertex neighbors completed. --- /dev/null | 0 src/restore.h | 2 +- src/restore.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/snapshot.h | 2 +- 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/python/.parse_vtu.py.swp b/python/.parse_vtu.py.swp deleted file mode 100644 index 044a6da..0000000 --- a/python/.parse_vtu.py.swp +++ /dev/null Binary files differ diff --git a/src/restore.c b/src/restore.c index 7ab9bc3..647b871 100644 --- a/src/restore.c +++ b/src/restore.c @@ -8,6 +8,7 @@ #include <snapshot.h> #include <zlib.h> #include "vesicle.h" +#include "vertex.h" ts_bool parseDump(char *dumpfname) { xmlDocPtr doc; xmlNodePtr cur; @@ -47,6 +48,9 @@ ts_vesicle *parseTrisurfTag(xmlDocPtr doc, xmlNodePtr cur){ fprintf(stderr,"Parsing trisurf tag\n"); + xmlNodePtr child; + +#ifdef COMPRESS /* base64decode */ size_t cLen; /*size_t tLen; @@ -78,6 +82,7 @@ fprintf(stderr,"%s\n",subtree); free(subtree); +#endif /*parse xml subtree */ xmlChar *nvtx, *npoly, *nfono; nvtx = xmlGetProp(cur, (xmlChar *)"nvtx"); @@ -89,5 +94,45 @@ xmlFree(nvtx); xmlFree(npoly); xmlFree(nfono); + + child = cur->xmlChildrenNode; + while (child != NULL) { + if ((!xmlStrcmp(child->name, (const xmlChar *)"vtxn"))){ + parseTrisurfVtxn(vesicle->vlist, doc, child); + } + + child = child->next; + } + + + return vesicle; } + +ts_bool *parseTrisurfVtxn(ts_vertex_list *vlist, xmlDocPtr doc, xmlNodePtr cur){ + + xmlChar *chari; + xmlChar *neighs; + char *n; + char *token; + ts_uint neighi; + ts_uint i; + chari = xmlGetProp(cur, (xmlChar *)"idx"); + i=atoi((char *)chari); + xmlFree(chari); + ts_vertex *vtx=vlist->vtx[i]; + neighs = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + //fprintf(stderr,"Found neigh for vtx %u that seems to have index %u with neighs=%s\n",i,vtx->idx,neighs); + + n=(char *)neighs; + token=strtok(n," "); + while(token!=NULL){ + neighi=atoi(token); + //fprintf(stderr,"%u", neighi); + vtx_add_neighbour(vtx,vlist->vtx[neighi]); + token=strtok(NULL," "); + } + xmlFree(neighs); + return TS_SUCCESS; +} + diff --git a/src/restore.h b/src/restore.h index 9118568..8e60140 100644 --- a/src/restore.h +++ b/src/restore.h @@ -3,5 +3,5 @@ ts_bool parseDump(char *dumpfname); ts_vesicle *parseTrisurfTag(xmlDocPtr doc, xmlNodePtr cur); - +ts_bool *parseTrisurfVtxn(ts_vertex_list *vlist, xmlDocPtr doc, xmlNodePtr cur); #endif diff --git a/src/snapshot.h b/src/snapshot.h index 662c97a..c6d7186 100644 --- a/src/snapshot.h +++ b/src/snapshot.h @@ -8,7 +8,7 @@ ts_uint beg; } ts_string; -#define COMPRESSION +//#define COMPRESSION ts_bool xml_trisurf_data(FILE *fh, ts_vesicle *vesicle); ts_bool xml_trisurf_header(FILE *fh, ts_vesicle *vesicle); -- Gitblit v1.9.3