00001
00012
00013
00014
00015 #include "scatter.h"
00016
00017 #ifndef TOOLBOX
00018
00019
00020
00021 #define SOFTENING 0
00022 #define X_FLAG 1
00023 #define TIMESTEP_CRITERION "dynamic_timestep"
00024 #define S_FLAG 1
00025 #define N_ITER 1
00026 #define N_MAX -1
00027
00028 bool tree_evolve(sdyn * b,
00029 real delta_t,
00030 real dt_out,
00031 real dt_snap,
00032 real snap_cube_size,
00033 real eta,
00034 real cpu_time_check,
00035 real dt_print,
00036 sdyn_print_fp p)
00037 {
00038 b->flatten_node();
00039
00040 bool terminate = false;
00041
00042
00043
00044
00045 real t_offset = b->get_time();
00046
00047 b->begin_offset_time(t_offset);
00048 for_all_daughters(sdyn, b, bb) bb->begin_offset_time(t_offset);
00049
00050 terminate = low_n_evolve(b, delta_t, dt_out, dt_snap, snap_cube_size,
00051 SOFTENING, eta, X_FLAG, TIMESTEP_CRITERION,
00052 S_FLAG, N_ITER, N_MAX,
00053 cpu_time_check, dt_print, p);
00054
00055 b->end_offset_time();
00056 for_all_daughters(sdyn, b, bbb) bbb->end_offset_time();
00057
00058 return terminate;
00059 }
00060
00061 #else
00062
00063 main(int argc, char **argv)
00064 {
00065 sdyn* b;
00066
00067 real delta_t = 10;
00068 real eta = 0.02;
00069
00070
00071 real dt_out = VERY_LARGE_NUMBER;
00072
00073 real dt_snap = VERY_LARGE_NUMBER;
00074
00075 real snap_cube_size = 10;
00076
00077 real cpu_time_check = 3600;
00078
00079 bool a_flag = FALSE;
00080 bool d_flag = FALSE;
00081 bool D_flag = FALSE;
00082 bool q_flag = FALSE;
00083 bool t_flag = FALSE;
00084
00085 check_help();
00086
00087 extern char *poptarg;
00088 int c;
00089 char* param_string = "A:c:C:d:D:qt:";
00090
00091 while ((c = pgetopt(argc, argv, param_string)) != -1)
00092 switch(c)
00093 {
00094 case 'A': a_flag = TRUE;
00095 eta = atof(poptarg);
00096 break;
00097 case 'c': cpu_time_check = atof(poptarg);
00098 break;
00099 case 'C': snap_cube_size = atof(poptarg);
00100 break;
00101 case 'd': d_flag = TRUE;
00102 dt_out = atof(poptarg);
00103 break;
00104 case 'D': D_flag = TRUE;
00105 dt_snap = atof(poptarg);
00106 break;
00107 case 'q': q_flag = TRUE;
00108 break;
00109 case 't': t_flag = TRUE;
00110 delta_t = atof(poptarg);
00111 break;
00112 case '?': params_to_usage(cerr, argv[0], param_string);
00113 get_help();
00114 }
00115
00116 if (!q_flag) {
00117
00118
00119
00120 if (!t_flag) cerr << "default delta_t = " << delta_t << "\n";
00121 if (!a_flag) cerr << "default eta = " << eta << "\n";
00122 if (!d_flag) cerr << "default dt_out = " << dt_out << "\n";
00123 }
00124
00125 if (!D_flag) dt_snap = delta_t;
00126
00127 b = get_sdyn(cin);
00128 b->log_history(argc, argv);
00129 cpu_init();
00130
00131 tree_evolve(b, delta_t, dt_out, dt_snap, snap_cube_size, eta,
00132 cpu_time_check);
00133
00134 }
00135
00136 #endif