Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

tdyn.h

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00012 //
00013 //  version 1:  Sep 2000   Steve McMillan
00014 //  version 2:
00015 //
00016 //  This file includes:
00017 //  1) definition of class tdyn
00018 
00019 #ifndef  STARLAB_TDYN_H
00020 #  define  STARLAB_TDYN_H
00021 
00022 #include "pdyn.h"
00023 
00026 
00027 class  tdyn : public _pdyn_     // base class is _pdyn_, not pdyn, note...
00028 {
00029     protected:
00030 
00031         xreal   time;
00032         vec  jerk;           // (d/dt) acc
00033 
00034         // Locators in the 4D hierarchy:
00035 
00036         tdyn *prev;             
00037         tdyn *next;             
00038 
00039         bool defunct;           
00040 
00041     public:
00042 
00043         tdyn(hbpfp the_hbpfp = new_hydrobase, sbpfp the_sbpfp = new_starbase,
00044              bool use_stories = true)
00045            : _pdyn_(the_hbpfp, the_sbpfp, use_stories) {
00046 
00047             time = 0;
00048             jerk = 0;
00049 
00050             prev = next = NULL;
00051             defunct = false;
00052         }
00053 
00054         virtual ~tdyn() {}
00055 
00056         inline void set_time(const xreal t)     {time = t;}
00057         inline xreal get_time()                 {return time;}
00058 
00059         inline void clear_jerk()                {jerk = 0;}
00060         inline void set_jerk(const vec& j)      {jerk = j;}
00061         inline vec get_jerk()                {return jerk;}
00062 
00063         inline void set_prev(tdyn *p)           {prev = p;}
00064         inline tdyn * get_prev()                {return prev;}
00065 
00066         inline void set_next(tdyn *p)           {next = p;}
00067         inline tdyn * get_next()                {return next;}
00068 
00069         inline bool is_defunct()                {return defunct;}
00070 
00071         // Convenient:
00072 
00073         inline tdyn * get_parent()
00074             {return (tdyn*) node::get_parent();}
00075         inline tdyn * get_oldest_daughter()
00076             {return (tdyn*)node::get_oldest_daughter();}
00077         inline tdyn * get_younger_sister()
00078             {return (tdyn*) node::get_younger_sister();}
00079         inline tdyn * get_elder_sister()
00080             {return (tdyn*) node::get_elder_sister();}
00081 
00083 
00084         inline tdyn * get_root()
00085             {return (tdyn*) node::get_root();}
00086 
00088 
00089         inline tdyn * get_top_level_node()
00090             {return (tdyn*) node::get_top_level_node();}
00091 
00093 
00094         inline tdyn * get_binary_sister()
00095             {return (tdyn*) node::get_binary_sister();}
00096 
00097         // Necessary virtual functions:
00098 
00099         // virtual istream& scan_star_story(istream&, int level = 0);
00100         virtual istream& scan_dyn_story(istream&);
00101         virtual bool check_and_correct_node(bool verbose = true);
00102 
00103         virtual ostream& print_dyn_story(ostream &s,
00104                                          bool print_xreal = true,
00105                                          int short_output = 0);
00106 };
00107 
00108 typedef tdyn *tdynptr;     // to enable dynamic array declarations
00109 
00110 inline  node * new_tdyn(hbpfp the_hbpfp, sbpfp the_sbpfp,
00111                         bool use_stories = true)
00112     {return (node *) new tdyn(the_hbpfp, the_sbpfp, use_stories);}
00113 
00114 inline  tdyn * get_tdyn(istream & s = cin,
00115                         hbpfp the_hbpfp = new_hydrobase,
00116                         sbpfp the_sbpfp = new_starbase, bool use_stories = true)
00117     {return  (tdyn *) get_node(s, new_tdyn, the_hbpfp, the_sbpfp, use_stories);}
00118 
00119 #define  put_tdyn  put_node
00120 
00121 #endif

Generated on Wed Jul 20 12:43:37 2005 for Starlab by  doxygen 1.4.3