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

hydro.h

Go to the documentation of this file.
00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00011 
00013 //
00014 //  version 1:  Jan 1993   Piet Hut
00015 //  version 2:
00016 //
00017 //  This file includes:
00018 //  1) definition of class hydro
00019 
00020 #ifndef  STARLAB_HYDRO_H
00021 #  define  STARLAB_HYDRO_H
00022 
00023 #include  "starlab_vector.h"
00024 #include  "story.h"
00025 #include  "hydrobase.h"
00026 #include  "node.h"       // needed in functions such as get_effective_radius().
00027                          // It cannot be included in  hydrobase.h  since 
00028                          // node.h contains  hydrobase.h  and this would
00029                          // lead to a vicious circle
00030 
00032 
00033 class  hydro : public hydrobase
00034     {
00035     protected:
00036 
00037         real  effective_radius;
00038 
00039         real  m_conv_hydro_to_dyn;   
00040         real  r_conv_hydro_to_dyn;   
00041         real  t_conv_hydro_to_dyn;   
00042 
00043     public:
00044 
00045         hydro(real r = 0, real mf = 1, real rf = 1, real tf = 1) {
00046             effective_radius = r;
00047             m_conv_hydro_to_dyn = mf;
00048             r_conv_hydro_to_dyn = rf;
00049             t_conv_hydro_to_dyn = tf;
00050         }
00051 
00052 //      To convert an internal hydro mass variable m_hydro into the units used
00053 //      by the dyn part, you can use:
00054 //
00055 //          a_dyn_particle->set_mass( m_hydro * get_m_conv_hydro_to_dyn() );
00056 
00057         real  get_m_conv_hydro_to_dyn()      {return m_conv_hydro_to_dyn;}
00058         real  get_r_conv_hydro_to_dyn()      {return r_conv_hydro_to_dyn;}
00059         real  get_t_conv_hydro_to_dyn()      {return t_conv_hydro_to_dyn;}
00060 
00061         real  get_effective_radius()         {return effective_radius;}
00062 
00063         void  set_m_conv_hydro_to_dyn(const real mf)
00064             {m_conv_hydro_to_dyn = mf;}
00065         void  set_r_conv_hydro_to_dyn(const real rf)
00066             {r_conv_hydro_to_dyn = rf;}
00067         void  set_t_conv_hydro_to_dyn(const real tf)
00068             {t_conv_hydro_to_dyn = tf;}
00069 
00070         void  set_effective_radius(const real r)  {effective_radius=r;}
00071 
00072         virtual ostream & print_hydro_story(ostream&);
00073         virtual istream & scan_hydro_story(istream&);
00074     };
00075 
00076 inline  hydrobase * new_hydro()    {return (hydrobase *) new hydro;}
00077 
00078 // Shorthand for conversion from node pointer to hydro pointer:
00079 
00080 #define N_H_PTR ((hydro *)n->get_hydrobase())
00081 
00082 // note: automatic conversion from hydro to dyn scaling
00083 
00084 inline  real get_effective_radius(node * n)
00085     {return N_H_PTR->get_r_conv_hydro_to_dyn() *
00086             N_H_PTR->get_effective_radius();}
00087     
00088 inline  real get_m_conv_hydro_to_dyn(node * n)
00089     {return N_H_PTR->get_m_conv_hydro_to_dyn();}
00090 inline  real get_r_conv_hydro_to_dyn(node * n)
00091     {return N_H_PTR->get_r_conv_hydro_to_dyn();}
00092 inline  real get_t_conv_hydro_to_dyn(node * n)
00093     {return N_H_PTR->get_t_conv_hydro_to_dyn();}
00094 
00095 // note: automatic conversion from dyn to hydro scaling
00096 
00097 inline  void set_effective_radius(node * n, const real r)
00098     {N_H_PTR->set_effective_radius( r / N_H_PTR->get_r_conv_hydro_to_dyn());}
00099     
00100 inline  void set_m_conv_hydro_to_dyn(node * n, const real r)
00101     {N_H_PTR->set_m_conv_hydro_to_dyn(r);}
00102 inline  void set_r_conv_hydro_to_dyn(node * n, const real r)
00103     {N_H_PTR->set_r_conv_hydro_to_dyn(r);}
00104 inline  void set_t_conv_hydro_to_dyn(node * n, const real r)
00105     {N_H_PTR->set_t_conv_hydro_to_dyn(r);}
00106     
00107 void  addhydro(node *, real);
00108 
00109 #endif
00110  

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