commit | author | age
|
d7639a
|
1 |
#include<stdio.h> |
SP |
2 |
#include<math.h> |
|
3 |
#include "general.h" |
|
4 |
#include "vertex.h" |
a10dd5
|
5 |
#include "bond.h" |
a2a676
|
6 |
#include "triangle.h" |
bb77ca
|
7 |
#include "cell.h" |
7958e9
|
8 |
#include "vesicle.h" |
a6b1b5
|
9 |
#include "io.h" |
7958e9
|
10 |
#include "initial_distribution.h" |
dac2e5
|
11 |
#include "frame.h" |
aec47d
|
12 |
#include "timestep.h" |
8db569
|
13 |
#include "poly.h" |
dc77e8
|
14 |
#include "sh.h" |
d7639a
|
15 |
|
SP |
16 |
/** Entrance function to the program |
|
17 |
* @param argv is a number of parameters used in program call (including the program name |
|
18 |
* @param argc is a pointer to strings (character arrays) which holds the arguments |
|
19 |
* @returns returns 0 on success, any other number on fail. |
|
20 |
*/ |
|
21 |
|
|
22 |
int main(int argv, char *argc[]){ |
1ab449
|
23 |
ts_vesicle *vesicle; |
SP |
24 |
ts_tape *tape; |
8a6614
|
25 |
ts_uint start_iteration=0; |
152052
|
26 |
force_from_tape=0; |
8a6614
|
27 |
parse_args(argv,argc); // sets global variable command_line_args (defined in io.h) |
SP |
28 |
ts_fprintf(stdout,"Starting program...\n\n"); |
152052
|
29 |
if(command_line_args.force_from_tape){ |
8a6614
|
30 |
ts_fprintf(stdout,"************************************************\n"); |
SP |
31 |
ts_fprintf(stdout,"**** Generating initial geometry from tape *****\n"); |
|
32 |
ts_fprintf(stdout,"************************************************\n\n"); |
|
33 |
tape=parsetape("tape"); |
|
34 |
vesicle=create_vesicle_from_tape(tape); |
|
35 |
} else { |
083e03
|
36 |
|
8a6614
|
37 |
ts_fprintf(stdout,"**********************************************************************\n"); |
SP |
38 |
ts_fprintf(stdout,"**** Recreating vesicle from dump file and continuing simulation *****\n"); |
|
39 |
ts_fprintf(stdout,"**********************************************************************\n\n"); |
|
40 |
tape=parsetape("tape"); |
|
41 |
vesicle=restore_state(&start_iteration); |
3f5c83
|
42 |
if(vesicle==NULL){ |
SP |
43 |
ts_fprintf(stderr, "Dump file does not exist or is not a regular file! Did you mean to invoke trisurf with --force-from-tape option?\n\n"); |
|
44 |
return 1; |
|
45 |
} |
152052
|
46 |
// nove vrednosti iz tapea... |
d9cb01
|
47 |
vesicle->bending_rigidity=tape->xk0; |
M |
48 |
vtx_set_global_values(vesicle); |
bc9583
|
49 |
vesicle->pswitch =tape->pswitch; |
152052
|
50 |
vesicle->pressure=tape->pressure; |
2dcc65
|
51 |
vesicle->dmax=tape->dmax*tape->dmax; |
bcf455
|
52 |
poly_assign_filament_xi(vesicle,tape); |
ea1cce
|
53 |
vesicle->clist->dmin_interspecies = tape->dmin_interspecies*tape->dmin_interspecies; |
dc77e8
|
54 |
vesicle->sphHarmonics=sph_init(vesicle->vlist,tape->shc); |
d9cb01
|
55 |
|
144784
|
56 |
if(command_line_args.reset_iteration_count) start_iteration=tape->inititer; |
8a6614
|
57 |
else start_iteration++; |
083e03
|
58 |
|
8a6614
|
59 |
if(start_iteration>=tape->iterations){ |
SP |
60 |
ts_fprintf(stdout, "Simulation already completed. if you want to rerun it try with --force-from-tape or --reset-iteration-count\n\n"); |
|
61 |
return 0; |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
run_simulation(vesicle, tape->mcsweeps, tape->inititer, tape->iterations, start_iteration); |
|
66 |
write_master_xml_file("test.pvd"); |
|
67 |
write_dout_fcompat_file(vesicle,"dout"); |
|
68 |
vesicle_free(vesicle); |
|
69 |
tape_free(tape); |
|
70 |
return 0; //program finished perfectly ok. We return 0. |
d7639a
|
71 |
} |