Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

to_cod.C

Go to the documentation of this file.
00001 
00008 
00009 //   version 1:  Dec 1992   Simon Portegies Zwart (adusted from to_com) 
00010 
00011 #include "dyn.h"
00012 
00013 #ifdef TOOLBOX
00014 
00015 local void to_cod(dyn *b)
00016 {
00017     vector cod_pos;
00018     vector cod_vel;
00019 
00020     compute_max_cod(b, cod_pos, cod_vel);
00021 
00022 //    pos += cod_pos;   // Note: The position and velocity of the root node
00023 //    vel += cod_vel;   //       have no particular dynamical significance.
00024                         //       They are not integrated forward in time,
00025                         //       and play no role in any integrator.
00026 
00027     for_all_daughters(dyn, b, bj) {
00028         bj->inc_pos(-cod_pos);
00029         bj->inc_vel(-cod_vel);
00030     }   
00031 
00032     // Correct entries in top-level dyn story.
00033 
00034     cod_pos = vector(0,0,0);
00035     cod_vel = vector(0,0,0);
00036 
00037     putvq(b->get_dyn_story(), "density_center_pos", cod_pos);
00038     putvq(b->get_dyn_story(), "density_center_vel", cod_vel);
00039 }
00040 
00041 main(int argc, char ** argv)
00042 {
00043     bool  c_flag = FALSE;
00044     char  *comment;
00045 
00046     check_help();
00047 
00048     extern char *poptarg;
00049     int c;
00050     char* param_string = "c:";
00051 
00052     while ((c = pgetopt(argc, argv, param_string)) != -1)
00053         switch(c) {
00054 
00055             case 'c': c_flag = TRUE;
00056                       comment = poptarg;
00057                       break;
00058             case '?': params_to_usage(cerr, argv[0], param_string);
00059                       get_help();
00060                       exit(1);
00061         }            
00062 
00063     dyn *b;
00064 
00065     while (b = get_dyn(cin)) {
00066 
00067         if (c_flag == TRUE)
00068             b->log_comment(comment);
00069         b->log_history(argc, argv);
00070 
00071         to_cod(b);
00072         put_dyn(cout, *b);      
00073         delete b;
00074     }
00075 }
00076 
00077 #endif
00078 
00079 /* endof: to_cod */
00080 

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