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

chydro.h

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00012 //
00013 //  version 1:  Jan 1993   Piet Hut
00014 //  version 2:
00015 //
00016 //  This file includes:
00017 //  1) definition of class chydro
00018 
00019 #ifndef  STARLAB_CHYDRO_H
00020 #  define  STARLAB_CHYDRO_H
00021 
00022 #include  "starlab_vector.h"
00023 #include  "story.h"
00024 #include  "hydrobase.h"
00025 #include  "hydro.h"
00026 
00028 
00029 class  chydro : public hydro
00030     {
00031     protected:
00032 
00033         real  core_mass;
00034         real  core_radius;
00035 
00036     public:
00037 
00038         chydro(real r = 0, real core_m = 0, real core_r = 0,
00039                real mf = 1, real rf = 1, real tf = 1) : hydro(r, mf, rf, tf)
00040             {
00041             core_mass = core_m;
00042             core_radius = core_r;
00043             }
00044 
00045         real  get_core_mass()               {return core_mass;}
00046         real  get_core_radius()             {return core_radius;}
00047 
00048         void  set_core_mass(const real m)        {core_mass = m;}
00049         void  set_core_radius(const real r)      {core_radius=r;}
00050 
00051         virtual ostream & print_hydro_story(ostream&);
00052         virtual istream & scan_hydro_story(istream&);
00053     };
00054 
00055 inline  hydrobase * new_chydro()    {return (hydrobase *) new chydro;}
00056 
00057 // Shorthand for conversion from node pointer to chydro pointer:
00058 
00059 #define N_CH_PTR ((chydro *)n->get_hydrobase())
00060 
00061 inline  real get_core_radius(node * n)
00062     {return N_CH_PTR->get_r_conv_hydro_to_dyn() * N_CH_PTR->get_core_radius();}
00063     
00064 inline  void set_core_radius(node * n, const real r)
00065     {N_CH_PTR->set_core_radius( r / N_CH_PTR->get_r_conv_hydro_to_dyn());}
00066 
00067 inline  real get_core_mass(node * n)
00068     {return N_CH_PTR->get_m_conv_hydro_to_dyn() * N_CH_PTR->get_core_mass();}
00069     
00070 inline  void set_core_mass(node * n, const real m)
00071     {N_CH_PTR->set_core_mass( m / N_CH_PTR->get_m_conv_hydro_to_dyn());}
00072     
00073 void  addchydro(node *, real, real, real);
00074 
00075 #endif
00076  

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