From b14a8d3d373ab1682a8a713e4f2a3795934d6b26 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sun, 20 Oct 2013 13:36:53 +0000
Subject: [PATCH] Program parameters are finally read from tape. Initial tests are removed

---
 src/main.c |   15 +++++++++------
 src/io.c   |   24 +++++++++++++++---------
 aclocal.m4 |   10 +++++-----
 src/io.h   |    2 +-
 4 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index da06da5..3094178 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
@@ -14,8 +14,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -38,7 +38,7 @@
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.3], [],
+m4_if([$1], [1.11.6], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -54,7 +54,7 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.3])dnl
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/src/io.c b/src/io.c
index f993e72..2127796 100644
--- a/src/io.c
+++ b/src/io.c
@@ -8,7 +8,7 @@
 #include<stdlib.h>
 #include <sys/types.h>
 #include <dirent.h>
-
+#include "initial_distribution.h"
 
 ts_bool print_vertex_list(ts_vertex_list *vlist){
 	ts_uint i;
@@ -294,10 +294,12 @@
 
 
 
-ts_bool parsetape(ts_vesicle *vesicle,ts_uint *iterations){
+ts_vesicle *parsetape(ts_uint *iterations){
     long int nshell=17,ncxmax=60, ncymax=60, nczmax=60;  // THIS IS DUE TO CONFUSE BUG!
-    char buf[255];
-    long int brezveze=1;
+    char *buf=malloc(255*sizeof(char));
+    long int brezveze0=1;
+    long int brezveze1=1;
+    long int brezveze2=1;
     ts_double xk0=25.0, dmax=1.67,stepsize=0.15;
     *iterations=1000;
     cfg_opt_t opts[] = {
@@ -311,9 +313,9 @@
         CFG_SIMPLE_INT("iterations",iterations),
         CFG_SIMPLE_BOOL("quiet",&quiet),
         CFG_SIMPLE_STR("multiprocessing",buf),
-        CFG_SIMPLE_INT("smp_cores",&brezveze),
-        CFG_SIMPLE_INT("cluster_nodes",&brezveze),
-        CFG_SIMPLE_INT("distributed_processes",&brezveze),
+        CFG_SIMPLE_INT("smp_cores",&brezveze0),
+        CFG_SIMPLE_INT("cluster_nodes",&brezveze1),
+        CFG_SIMPLE_INT("distributed_processes",&brezveze2),
         CFG_END()
     };
     cfg_t *cfg;    
@@ -326,6 +328,8 @@
     else if(retval==CFG_PARSE_ERROR){
 	fatal("Invalid tape!",100);
 	}
+	ts_vesicle *vesicle;
+	vesicle=initial_distribution_dipyramid(nshell,ncxmax,ncymax,nczmax,stepsize);
     vesicle->nshell=nshell;
     vesicle->dmax=dmax*dmax;
     vesicle->bending_rigidity=xk0;
@@ -334,9 +338,11 @@
     vesicle->clist->ncmax[1]=ncymax;
     vesicle->clist->ncmax[2]=nczmax;
     vesicle->clist->max_occupancy=8;
+
     cfg_free(cfg);
-//    fprintf(stderr,"NSHELL=%u\n",vesicle->nshell);
-    return TS_SUCCESS;
+	free(buf);
+  //  fprintf(stderr,"NSHELL=%u\n",vesicle->nshell);
+    return vesicle;
 
 }
 
diff --git a/src/io.h b/src/io.h
index 0dab974..2f3f19a 100644
--- a/src/io.h
+++ b/src/io.h
@@ -48,7 +48,7 @@
 ts_bool write_vertex_vtk_file(ts_vesicle *vesicle,ts_char *filename, ts_char *text);
 ts_bool write_vertex_xml_file(ts_vesicle *vesicle, ts_uint timestepno);
 ts_bool write_master_xml_file(ts_char *filename);
-ts_bool parsetape(ts_vesicle *vesicle,ts_uint *iterations);
+ts_vesicle *parsetape(ts_uint *iterations);
 
 
 #endif
diff --git a/src/main.c b/src/main.c
index d84b611..c651382 100644
--- a/src/main.c
+++ b/src/main.c
@@ -18,14 +18,15 @@
 */
 
 int main(int argv, char *argc[]){
+ts_uint i,n;
+ts_vesicle *vesicle;
+/* THIS SHOULD GO INTO UNIT TEST
 ts_bool retval;
-ts_uint i;
     ts_vertex_list *vlist=init_vertex_list(5);
 ts_vertex_list *vlist1;
 ts_bond_list *blist=init_bond_list();
 ts_triangle_list *tlist=init_triangle_list();
 ts_cell_list *clist=init_cell_list(3,3,3,0.3);
-ts_vesicle *vesicle;
 
 retval=vtx_add_cneighbour(blist,vlist->vtx[1],vlist->vtx[0]);
 if(retval==TS_FAIL) printf("1. already a member or vertex is null!\n");
@@ -61,19 +62,21 @@
 
 vtx_list_free(vlist1);
 printf("Tests complete.\n");
-vesicle=initial_distribution_dipyramid(17,60,60,60,0.15);
-//parsetape(vesicle,&i);
+*/
+vesicle=parsetape(&n);
 
 //these four must come from parsetype!
+/*
 vesicle->dmax=1.67*1.67;
 vesicle->stepsize=0.15;
 vesicle->clist->max_occupancy=8;
 vesicle->bending_rigidity=25.0;
-fprintf(stderr,"xk=%f",vesicle->bending_rigidity);
+*/
+// fprintf(stderr,"xk=%f\n",vesicle->bending_rigidity);
 
 centermass(vesicle);
 cell_occupation(vesicle);
-for(i=0;i<100;i++){
+for(i=0;i<n;i++){
 single_timestep(vesicle);
 if(i%100==0){
 write_vertex_xml_file(vesicle,i/100);

--
Gitblit v1.9.3