Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

hdyn_kepler.C

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00011 // hdyn_kepler.C:  kepler-specific hdyn functions.
00012 
00013 // Externally visible functions:
00014 //
00015 //      void hdyn::update_kepler_from_hdyn
00016 //      void hdyn::reinitialize_kepler_from_hdyn
00017 
00018 #include "hdyn.h"
00019 
00020 void new_kepler(hdyn * com)     // com is the center-of-mass hdyn
00021 {
00022     new_kepler((dyn *) com, com->get_time());
00023 }
00024 
00025 
00026 void hdyn_to_kepler(hdyn * com)
00027 {
00028     dyn_to_kepler(com, com->get_time());
00029 }
00030 
00031 
00032 void hdyn::update_kepler_from_hdyn()
00033 {
00034     set_kepler_tolerance(2);    // avoid termination on kepler error
00035 
00036     if (kep == NULL) kep = new kepler;
00037     hdyn *sister = get_binary_sister();
00038 
00039     kep->set_time(time);
00040     kep->set_total_mass(parent->get_mass());
00041     kep->set_rel_pos(pos - sister->pos);
00042     kep->set_rel_vel(vel - sister->vel);
00043     kep->initialize_from_pos_and_vel();
00044 
00045     sister->kep = kep;
00046     sister->unperturbed_timestep = unperturbed_timestep;
00047     sister->fully_unperturbed = fully_unperturbed;
00048 }
00049 
00050 
00051 void hdyn::reinitialize_kepler_from_hdyn()
00052 {
00053     update_kepler_from_hdyn();
00054 
00055     // This function is only called on restart -- from get_hdyn (hdyn.h)
00056     // and from correct_multiples (kira_init.C).  Since the unperturbed
00057     // timestep was OK when written out, and should have been picked up
00058     // from the input snapshot, there should be no need to change anything
00059     // here... (SLWM 3/98).  This function is now also called on system
00060     // reinitialization, for compatibility with restart.
00061 
00062 #if 0
00063 
00064     // Never advance unperturbed motion beyond parent's next step,
00065     // but be sure that the step doesn't end at a bad place..
00066 
00067     //int usteps = get_unperturbed_steps(true);
00068     real usteps = get_unperturbed_steps(true);
00069     //unsigned long usteps = get_unperturbed_steps(true);
00070 
00071     if (usteps > 0) {
00072         unperturbed_timestep = timestep*usteps;
00073         get_binary_sister()->unperturbed_timestep = unperturbed_timestep;
00074     }
00075 
00076 #endif
00077 
00078 }

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