00001
00002
00003
00004
00005
00006
00007 #include "dyn.h"
00008
00009 #ifdef TOOLBOX
00010
00011
00012 local void addstoa(dyn * b, int m_flag)
00013 {
00014 real time;
00015 int ndim;
00016 int n;
00017 int n_stoa;
00018
00019
00020 n = 0;
00021 for_all_daughters(dyn, b, bi) n++;
00022
00023 PRL(n);
00024 cin >> n_stoa;
00025 cin >> ndim;
00026 cin >> time;
00027 PRC(n_stoa); PRC(ndim); PRL(time);
00028 if (n != n_stoa){
00029 err_exit("n and n_stoa must be equal");
00030 }
00031 for_all_daughters(dyn, b, bi) {
00032 real mass;
00033 cin >> mass;
00034 if(m_flag)bi->set_mass(mass);
00035 }
00036 for_all_daughters(dyn, b, bi) {
00037 vector p;
00038 cin >> p;
00039 bi->set_pos(p);
00040 }
00041 for_all_daughters(dyn, b, bi) {
00042 vector v;
00043 cin >> v;
00044 bi->set_vel(v);
00045 }
00046 }
00047
00048 main(int argc, char ** argv)
00049 {
00050 int m_flag = false;
00051 extern char *poptarg;
00052 int c;
00053 char* param_string = "m:";
00054
00055 while ((c = pgetopt(argc, argv, param_string)) != -1)
00056 switch(c) {
00057
00058 case 's': m_flag= true;
00059 break;
00060 case '?': params_to_usage(cerr, argv[0], param_string);
00061 exit(1);
00062 }
00063
00064 dyn *b;
00065 b = get_dyn(cin);
00066
00067 b->log_history(argc, argv);
00068
00069 addstoa(b, m_flag);
00070
00071 put_node(cout, *b);
00072 }
00073
00074 #endif