Tape is in the dump and successfully restored.
| | |
| | | |
| | | ts_vesicle *create_vesicle_from_tape(ts_tape *tape){ |
| | | ts_vesicle *vesicle; |
| | | ts_vertex *vtx; |
| | | |
| | | vesicle=initial_distribution_dipyramid(tape->nshell,tape->ncxmax,tape->ncymax,tape->nczmax,tape->stepsize); |
| | | vesicle->tape=tape; |
| | | set_vesicle_values_from_tape(vesicle); |
| | | return vesicle; |
| | | } |
| | | |
| | | ts_bool set_vesicle_values_from_tape(ts_vesicle *vesicle){ |
| | | // Nucleus: |
| | | ts_vertex *vtx; |
| | | ts_tape *tape=vesicle->tape; |
| | | vesicle->R_nucleus=tape->R_nucleus*tape->R_nucleus; |
| | | |
| | | vesicle->clist->dmin_interspecies = tape->dmin_interspecies*tape->dmin_interspecies; |
| | |
| | | else { |
| | | vesicle->sphHarmonics=NULL; |
| | | } |
| | | return vesicle; |
| | | return TS_SUCCESS; |
| | | |
| | | } |
| | | |
| | |
| | | ts_vesicle *initial_distribution_dipyramid(ts_uint nshell, ts_uint ncmax1, ts_uint ncmax2, ts_uint ncmax3, ts_double stepsize); |
| | | |
| | | ts_vesicle *create_vesicle_from_tape(ts_tape *tape); |
| | | |
| | | ts_bool set_vesicle_values_from_tape(ts_vesicle *vesicle); |
| | | /** Sets the initial position of the vertexes to dipyramid |
| | | * |
| | | * @param *vlist is a pointer to list of vertices |
| | |
| | | |
| | | |
| | | ts_tape *parsetape(char *filename){ |
| | | FILE *fd = fopen (filename, "r"); |
| | | long length; |
| | | size_t size; |
| | | fseek (fd, 0, SEEK_END); |
| | | length = ftell (fd); |
| | | fseek (fd, 0, SEEK_SET); |
| | | size=fread (tapetxt, 1, length, fd); |
| | | fclose(fd); |
| | | if(size); |
| | | ts_tape *tape=parsetapebuffer(tapetxt); |
| | | return tape; |
| | | } |
| | | |
| | | ts_tape *parsetapebuffer(char *buffer){ |
| | | ts_tape *tape=(ts_tape *)calloc(1,sizeof(ts_tape)); |
| | | tape->multiprocessing=calloc(255,sizeof(char)); |
| | | |
| | |
| | | cfg_t *cfg; |
| | | ts_uint retval; |
| | | cfg = cfg_init(opts, 0); |
| | | retval=cfg_parse(cfg, filename); |
| | | retval=cfg_parse_buf(cfg, buffer); |
| | | if(retval==CFG_FILE_ERROR){ |
| | | fatal("No tape file.",100); |
| | | } |
| | |
| | | static ts_bool restore=0; |
| | | static char tape[1024]; */ |
| | | int force_from_tape; |
| | | |
| | | char tapetxt[128000]; //stores text file of the tape |
| | | typedef struct{ |
| | | ts_int force_from_tape; |
| | | ts_int reset_iteration_count; |
| | |
| | | ts_bool write_pov_file(ts_vesicle *vesicle, char *filename); |
| | | |
| | | ts_tape *parsetape(char *filename); |
| | | ts_tape *parsetapebuffer(char *buffer); |
| | | ts_bool tape_free(ts_tape *tape); |
| | | ts_bool getcmdline_tape(cfg_t *cfg, char *opts); |
| | | ts_bool cmdline_to_tape(cfg_t *cfg, char *key, char *val); |
| | |
| | | #include "energy.h" |
| | | #include "poly.h" |
| | | #include "initial_distribution.h" |
| | | #include "io.h" |
| | | |
| | | ts_bool parseDump(char *dumpfname) { |
| | | xmlDocPtr doc; |
| | | xmlNodePtr cur, cur1,cur2; |
| | | ts_vesicle *vesicle=NULL; |
| | | |
| | | doc = xmlParseFile(dumpfname); |
| | | |
| | | if (doc == NULL ) { |
| | |
| | | |
| | | cur = cur->xmlChildrenNode; |
| | | while (cur != NULL) { |
| | | |
| | | if ((!xmlStrcmp(cur->name, (const xmlChar *)"tape"))){ |
| | | setGlobalTapeTXTfromTapeTag(doc, cur); |
| | | } |
| | | |
| | | if ((!xmlStrcmp(cur->name, (const xmlChar *)"trisurf"))){ |
| | | vesicle=parseTrisurfTag(doc, cur); |
| | | } |
| | |
| | | return TS_SUCCESS; |
| | | } |
| | | |
| | | ts_bool setGlobalTapeTXTfromTapeTag(xmlDocPtr doc, xmlNodePtr cur){ |
| | | xmlChar *tape = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
| | | strcpy(tapetxt,(char *)tape); |
| | | xmlFree(tape); |
| | | return TS_SUCCESS; |
| | | } |
| | | |
| | | |
| | | /* this is a parser of additional data in xml */ |
| | |
| | | nvtx = xmlGetProp(cur, (xmlChar *)"nvtx"); |
| | | npoly=xmlGetProp(cur, (xmlChar *)"npoly"); |
| | | nfono=xmlGetProp(cur, (xmlChar *)"nfono"); |
| | | fprintf(stderr,"nvtx=%u\n",atoi((char *)nvtx)); |
| | | ts_vesicle *vesicle=init_vesicle(atoi((char *)nvtx),10,10,10,0.1); |
| | | ts_tape *tape=parsetapebuffer(tapetxt); |
| | | //fprintf(stderr,"nvtx=%u\n",atoi((char *)nvtx)); |
| | | //TODO: check if nvtx is in agreement with nshell from tape |
| | | ts_vesicle *vesicle=init_vesicle(atoi((char *)nvtx),tape->ncxmax,tape->ncymax,tape->nczmax,tape->stepsize); |
| | | //vesicle->poly_list=init_poly_list(atoi((char *)npoly),atoi((char *)nmono), vesicle->vlist, vesicle); |
| | | xmlFree(nvtx); |
| | | xmlFree(npoly); |
| | |
| | | } |
| | | |
| | | |
| | | vesicle->tape=tape; |
| | | set_vesicle_values_from_tape(vesicle); |
| | | |
| | | return vesicle; |
| | | } |
| | |
| | | |
| | | ts_bool parseDump(char *dumpfname); |
| | | ts_vesicle *parseTrisurfTag(xmlDocPtr doc, xmlNodePtr cur); |
| | | ts_bool setGlobalTapeTXTfromTapeTag(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); |
| | |
| | | #include<inttypes.h> |
| | | #include<config.h> |
| | | #include <time.h> |
| | | |
| | | #include "io.h" |
| | | /* a helper function that utilizes ts_string data structure and performs same as sprintf */ |
| | | ts_uint ts_sprintf(ts_string *str, char *fmt, ...){ |
| | | va_list ap; |
| | |
| | | fprintf(fh, "<dumpdate>%s</dumpdate>\n", c_time_string); |
| | | |
| | | fprintf(fh, "<tape>\n"); |
| | | |
| | | fprintf(fh,"%s",tapetxt); |
| | | fprintf(fh, "</tape>\n"); |
| | | if(vesicle->poly_list!=NULL){ |
| | | npoly=vesicle->poly_list->n; |
| | |
| | | npoly=0; |
| | | nfono=0; |
| | | } |
| | | fprintf(fh, "<trisurf nvtx=\"%u\" npoly=\"%u\" nfono=\"%u\">\n", vesicle->vlist->n, npoly, nfono); |
| | | fprintf(fh, "<trisurf nvtx=\"%u\" npoly=\"%u\" nfono=\"%u\" compressed=\"false\">\n", vesicle->vlist->n, npoly, nfono); |
| | | return TS_SUCCESS; |
| | | } |
| | | |