Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

dumbp.C

Go to the documentation of this file.
00001 
00007 
00008 #include "dyn.h"
00009 
00010 #ifdef TOOLBOX
00011 
00012 main(int argc, char** argv)
00013 {
00014     dyn *root, *ni;
00015 
00016     check_help();
00017 
00018     extern char *poptarg;
00019     int c;
00020     char* param_string = "p:t";
00021 
00022     int p = STD_PRECISION;
00023     bool time = false;
00024 
00025     while ((c = pgetopt(argc, argv, param_string)) != -1)
00026         switch(c)
00027             {
00028             case 'p': p = atoi(poptarg);
00029                       break;
00030             case 't': time = !time;
00031                       break;
00032             case '?': params_to_usage(cerr, argv[0], param_string);
00033                       get_help();
00034                       exit(1);
00035             }
00036 
00037 #ifdef BAD_GNU_IO
00038     char prec[32];
00039     sprintf(prec, "%%.%df ", p);
00040 #else
00041     cout.precision(p);
00042 #endif
00043 
00044     while (root = get_dyn(cin)) {
00045 
00046         for (ni = root->get_oldest_daughter(); ni != NULL;
00047              ni = ni->get_younger_sister()) {
00048 
00049             real t = getrq(ni->get_dyn_story(), "t");
00050 
00051 #ifdef BAD_GNU_IO
00052 
00053             if (time) printf(prec, t);
00054 
00055             printf(prec, ni->get_mass());
00056             vector temp;
00057             temp = ni->get_pos();
00058             int k;
00059             for (k = 0; k < 3; k++) printf(prec,temp[k]);
00060             temp = ni->get_vel();
00061             for (k = 0; k < 3; k++) printf(prec,temp[k]);
00062             printf("\n");
00063 
00064 #else
00065 
00066             if (time) cout << t << " ";
00067             cout << ni->get_mass() << " "
00068                  << ni->get_pos()  << " "
00069                  << ni->get_vel()
00070                  << endl;
00071 
00072 #endif
00073 
00074         }
00075 
00076         rmtree(root);
00077     }
00078 }
00079 
00080 #endif
00081 
00082 // end of: dumbp.C

Generated at Sun Feb 24 09:56:58 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001