From 4a35612678295c86677923de3fa5d43e90371667 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Wed, 16 Oct 2019 09:14:54 +0000
Subject: [PATCH] Removed obsolete dumpstate.c and dumpstate.h files.

---
 src/Makefile.am |    4 ++--
 /dev/null       |   35 -----------------------------------
 src/main.c      |    1 -
 src/restore.h   |    4 +++-
 4 files changed, 5 insertions(+), 39 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 3e55232..c72d0d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,7 +14,7 @@
 #------------- LIBS ----------
 
 lib_LTLIBRARIES= libtrisurf.la
-libtrisurf_la_SOURCES= general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c dumpstate.c frame.c energy.c timestep.c vertexmove.c bondflip.c poly.c stats.c sh.c shcomplex.c constvol.c snapshot.c restore.c cluster.c
+libtrisurf_la_SOURCES= general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c frame.c energy.c timestep.c vertexmove.c bondflip.c poly.c stats.c sh.c shcomplex.c constvol.c snapshot.c restore.c cluster.c
 #libtrisurf_la_CPPFLAGS = ${libxml2_CFLAGS}
 libtrisurf_la_LIBADD=${libxml2_LIBS}
-pkginclude_HEADERS=general.h vertex.h bond.h triangle.h cell.h vesicle.h initial_distribution.h io.h dumpstate.h frame.h energy.h timestep.h vertexmove.h bondflip.h poly.h stats.h sh.h shcomplex.h constvol.h snapshot.h restore.h cluster.h
+pkginclude_HEADERS=general.h vertex.h bond.h triangle.h cell.h vesicle.h initial_distribution.h io.h frame.h energy.h timestep.h vertexmove.h bondflip.h poly.h stats.h sh.h shcomplex.h constvol.h snapshot.h restore.h cluster.h
diff --git a/src/dumpstate.c b/src/dumpstate.c
deleted file mode 100644
index 4493f71..0000000
--- a/src/dumpstate.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* vim: set ts=4 sts=4 sw=4 noet : */
-#include <string.h>
-#include "general.h"
-#include <stdio.h>
-#include "initial_distribution.h"
-#include "vesicle.h"
-#include "dumpstate.h"
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include "vertex.h"
-#include "energy.h"
-
-ts_vesicle *vtk2vesicle(char *filename, ts_tape *tape){
-
-    ts_uint nshell=tape->nshell;
-    ts_uint ncmax1=tape->ncxmax;
-    ts_uint ncmax2=tape->ncymax;
-    ts_uint ncmax3=tape->nczmax;
-    ts_double stepsize=tape->stepsize;
-
-    ts_uint no_vertices=5*nshell*nshell+2;
-    ts_vesicle *vesicle=init_vesicle(no_vertices,ncmax1,ncmax2,ncmax3,stepsize);
-    vesicle->nshell=nshell;
-    parse_vtk(filename, vesicle);
-    exit(1);
-    return vesicle;
-}
-
-
-ts_bool parse_vtk(char *filename, ts_vesicle *vesicle){
-    xmlDoc *doc;
-    xmlNode *root_element=NULL;
-    xmlNode *cur_node = NULL;
-    doc = xmlReadFile(filename, NULL, 0);
-    root_element=xmlDocGetRootElement(doc);
-    cur_node=root_element->children;
-    while(cur_node!=NULL){
-//        fprintf(stderr,"Node name is: %s\n",cur_node->name);
-        if(strcmp((char *)cur_node->name,"UnstructuredGrid")==0) break;
-        cur_node=cur_node->next;
-    }
-
-    cur_node=cur_node->children;
-    while(cur_node!=NULL){
-//        fprintf(stderr,"Node name is: %s\n",cur_node->name);
-        cur_node=cur_node->next;
-        if(strcmp((char *)cur_node->name,"Piece")==0) break;
-    }
-
-    cur_node=cur_node->children;
-    while(cur_node!=NULL){
-        //fprintf(stderr,"Node name is: %s\n",cur_node->name);
-        cur_node=cur_node->next;
-        if(strcmp((char *)cur_node->name,"PointData")==0) vtk_index2vesicle(cur_node->children->next->children, vesicle);
-        if(strcmp((char *)cur_node->name,"Points")==0) vtk_coordinates(cur_node->children->next->children,vesicle);
-        if(strcmp((char *)cur_node->name,"Cells")==0) {
-		vtk_neighbours(cur_node->children->next->children,vesicle);
-        	break; //segfaults, because it finds another cells. Why?
-	}	
-    }
-	//we have vertices and neighbour relations all set, but unordered. Let's do bonds, ordering, triangles...
-	vesicle->vlist = vtk_sort_neighbours(vesicle->blist,vesicle->vlist);
-	init_triangles(vesicle);
-	init_triangle_neighbours(vesicle);
-	init_common_vertex_triangle_neighbours(vesicle);
-	init_normal_vectors(vesicle->tlist);
-	mean_curvature_and_energy(vesicle);
-	ts_fprintf(stdout,"restoring from vtk dump finished!\n");
-    return TS_SUCCESS;
-}
-
-
-ts_bool vtk_index2vesicle(xmlNode *node, ts_vesicle *vesicle){
-    //fprintf(stderr, "vsebina: %s\n",node->content);
-    ts_uint i;
-    char *token;
-    token = strtok((char *)node->content, " ");
-    for(i=0;i<vesicle->vlist->n;i++){
-        vesicle->vlist->vtx[i]->idx=atoi(token);
-        token=strtok(NULL," ");
-    }
-    //fprintf(stderr,"idx[11]=%d\n",vesicle->vlist->vtx[11]->idx);
-    return TS_SUCCESS;
-}
-
-ts_bool vtk_coordinates(xmlNode *node, ts_vesicle *vesicle){
-    //fprintf(stderr, "vsebina: %s\n",node->content);
-    ts_uint i;
-    char *token;
-    token = strtok((char *)node->content, " ");
-    for(i=0;i<vesicle->vlist->n;i++){
-        vesicle->vlist->vtx[i]->x=atof(token);
-//	fprintf(stderr,"%e, ",atof(token));
-        token=strtok(NULL," ");
-        vesicle->vlist->vtx[i]->y=atof(token);
-        token=strtok(NULL,"\n");
-        vesicle->vlist->vtx[i]->z=atof(token);
-        if(i>0) token=strtok(NULL," ");
-    }
-    return TS_SUCCESS;
-
-}
-
-ts_bool vtk_neighbours(xmlNode *node, ts_vesicle *vesicle){
- //	fprintf(stderr, "vsebina: %s\n",node->content);
-	ts_uint i;
-	ts_uint idx1, idx2;
-    char *token;
-    token = strtok((char *)node->content, " ");
-    for(i=0;i<3*(vesicle->vlist->n-2);i++){
-	idx1=atoi(token);
-        token=strtok(NULL,"\n");
-	idx2=atoi(token);
-        vtx_add_neighbour(vesicle->vlist->vtx[idx1], vesicle->vlist->vtx[idx2]);
-        vtx_add_neighbour(vesicle->vlist->vtx[idx2], vesicle->vlist->vtx[idx1]);
-	fprintf(stderr, "%d. povezujem %d in %d\n",i,idx1,idx2);
-        if(i>0) token=strtok(NULL," ");
-    }
-	return TS_SUCCESS;
-}
-
-/* this is almost exact copy of init_sort_neighbours */
-ts_vertex_list *vtk_sort_neighbours(ts_bond_list *blist,ts_vertex_list *vlist){
-	ts_vertex **vtx=vlist->vtx -1; // take a look at dipyramid function for comment.
-	ts_uint i,l,j,jj,jjj,k=0;   
-    ts_double eps=0.001; // Take a look if EPS from math.h can be used
-
-/*lets initialize memory for temporary vertex_list. Should we write a function instead */
-    ts_vertex_list *tvlist=vertex_list_copy(vlist);
-    ts_vertex **tvtx=tvlist->vtx -1;  /* again to compensate for 0-indexing */
-
-	ts_double dist2; // Square of distance of neighbours
-    ts_double direct; // Something, dont know what, but could be normal of some kind
-	for(i=1;i<=vlist->n;i++){
-		k++; // WHY i IS NOT GOOD??
-       	vtx_add_cneighbour(blist,tvtx[k], tvtx[vtx[i]->neigh[0]->idx+1]); //always add 1st
-       	jjj=1;
-       	jj=1;
-       	for(l=2;l<=vtx[i]->neigh_no;l++){
-           	for(j=2;j<=vtx[i]->neigh_no;j++){
-               	dist2=vtx_distance_sq(vtx[i]->neigh[j-1],vtx[i]->neigh[jj-1]);
-               	direct=vtx_direct(vtx[i],vtx[i]->neigh[j-1],vtx[i]->neigh[jj-1]);
-// TODO: check if fabs can be used with all floating point types!!
-               	if( (direct>0.0) && (j!=jjj) ){
-           			vtx_add_cneighbour(blist,tvtx[k],tvtx[vtx[i]->neigh[j-1]->idx+1]);
-           			jjj=jj;
-           			jj=j;
-           		//	break;
-           		}
-       		}
-       	}
-	if(vtx[i]->neigh_no!=tvtx[i]->neigh_no){
-		fprintf(stderr,"Hej! pri vtx=%d se razikuje stevilo sosedov (prej=%d, potem=%d)\n",i, vtx[i]->neigh_no, tvtx[i]->neigh_no);
-		}
-	}
-	if(eps>dist2);
-/* We use the temporary vertex for our main vertices and we abandon main
- * vertices, because their neighbours are not correctly ordered */
-   // tvtx=vlist->vtx;
-   // vlist->vtx=tvtx;
-   // tvlist->vtx=vtx;
-    vtx_list_free(vlist);
-/* Let's make a check if the number of bonds is correct */
-    if((blist->n)!=3*(tvlist->n-2)){
-        ts_fprintf(stderr,"Number of bonds is %u should be %u!\n", blist->n, 3*(tvlist->n-2));
-        fatal("Number of bonds is not 3*(no_vertex-2).",4);
-    }
-
-	return tvlist;
-}
-
-
diff --git a/src/dumpstate.h b/src/dumpstate.h
deleted file mode 100644
index de66b70..0000000
--- a/src/dumpstate.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* vim: set ts=4 sts=4 sw=4 noet : */
-#ifndef _H_DUMPSTATE
-#define _H_DUMPSTATE
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-
-
-typedef struct {
-	long int npoints;
-    long int ncells;
-    long int idx;
-    ts_double *x;
-    ts_double *y;
-    ts_double *z;
-
-    long int neigh_idx1;
-    long int neigh_idx2;
-} ts_vtk_data;
-
-
-
-
-
-ts_vesicle *vtk2vesicle(char *filename, ts_tape *tape);
-ts_bool parse_vtk(char *filename, ts_vesicle *vesicle);
-ts_bool vtk_index2vesicle(xmlNode *node, ts_vesicle *vesicle);
-ts_bool vtk_coordinates(xmlNode *node, ts_vesicle *vesicle);
-ts_bool vtk_neighbours(xmlNode *node, ts_vesicle *vesicle);
-
-ts_vertex_list *vtk_sort_neighbours(ts_bond_list *blist,ts_vertex_list *vlist);
-
-
-#endif
diff --git a/src/main.c b/src/main.c
index 47cf2a8..92df3d8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -15,7 +15,6 @@
 #include "poly.h"
 #include "sh.h"
 #include "shcomplex.h"
-#include "dumpstate.h"
 #include "restore.h"
 
 #include <fcntl.h>
diff --git a/src/restore.h b/src/restore.h
index b05c6a8..3cc9d4a 100644
--- a/src/restore.h
+++ b/src/restore.h
@@ -1,7 +1,9 @@
 /* vim: set ts=4 sts=4 sw=4 noet : */
 #ifndef _H_RESTORE
 #define _H_RESTORE
-
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include "general.h"
 ts_vesicle *parseDump(char *dumpfname);
 ts_vesicle *parseTrisurfTag(xmlDocPtr doc, xmlNodePtr cur);
 ts_bool setGlobalTapeTXTfromTapeTag(xmlDocPtr doc, xmlNodePtr cur);

--
Gitblit v1.9.3