Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

snap2speck.C

Go to the documentation of this file.
00001 
00006 
00007 #include "dyn.h"
00008 
00009 #ifdef TOOLBOX
00010 
00011 main(int argc, char** argv)
00012 {
00013     dyn *root;
00014 
00015     check_help();
00016 
00017     extern char *poptarg;
00018     int c;
00019     char* param_string = "p:";
00020 
00021     int p = STD_PRECISION;
00022 
00023     while ((c = pgetopt(argc, argv, param_string)) != -1)
00024         switch(c)
00025             {
00026             case 'p': p = atoi(poptarg);
00027                       break;
00028             case '?': params_to_usage(cerr, argv[0], param_string);
00029                       get_help();
00030                       exit(1);
00031             }
00032 
00033     cout.precision(p);
00034 
00035     while (root = get_dyn(cin)) {
00036 
00037         real n = 0;
00038         for_all_daughters(dyn, root, ni) n += 1;
00039 
00040         cout << "datavar 0 colorb_v" << endl;
00041         cout << "datavar 1 lum" << endl;
00042 
00043         for_all_daughters(dyn, root, ni)
00044 
00045             cout << ni->get_pos() << " "
00046                  << ni->get_index()/n << " "    // colors 0 to 1
00047                  << ni->get_mass()
00048                  << endl;
00049 
00050         rmtree(root);
00051     }
00052 }
00053 
00054 #endif

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