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