Swarm-NG  1.1
constants.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Mario Juric *
3  * mjuric@astro.Princeton.EDU *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
26 #ifndef _astro_constants_h
27 #define _astro_constants_h
28 
29 namespace peyton {
31 namespace constants {
32 
33  const double pi = 3.14159265358979323846264338;
34  const double pi2 = 2.*pi;
35  const double twopi = 2.*pi;
36  const double piby2 = pi/2.;
37  const double halfpi = pi/2.;
38  const double ln10 = 2.3025850929940456840; // ln(10)
39 
40  const double d2r = pi/180.0;
41  const double s2r = pi/(180.0*3600);
42 
43  // sunmass.h: Gaussian gravitational constant "k"
44  const double gk = 0.01720209895;
45  const double gms = gk*gk;
46  const double k2 = gms;
47 
48  // physical constants
49  const double c = 299792458;
50 
51  // unit conversion
52  const double years = 3600*24*365;
53 }
55 namespace ctn = constants;
56 }
57 
59 #define RAD(x) { x = x*peyton::ctn::d2r; }
60 #define DEG(x) { x = x/peyton::ctn::d2r; }
62 
63 #define __peyton_constants peyton::constants
64 
65 #endif