source: branches/FACT++_part_filenames/pal/palmac.h@ 19157

Last change on this file since 19157 was 18347, checked in by tbretz, 9 years ago
File size: 4.1 KB
Line 
1#ifndef PALMACDEF
2#define PALMACDEF
3
4/*
5*+
6* Name:
7* palmac.h
8
9* Purpose:
10* Macros used by the PAL library
11
12* Language:
13* Starlink ANSI C
14
15* Type of Module:
16* Include file
17
18* Description:
19* A collection of useful macros provided and used by the PAL library
20
21* Authors:
22* TIMJ: Tim Jenness (JAC, Hawaii)
23* DSB: David Berry (JAC, Hawaii)
24* {enter_new_authors_here}
25
26* Notes:
27*
28
29* History:
30* 2012-02-08 (TIMJ):
31* Initial version.
32* Adapted with permission from the Fortran SLALIB library.
33* 2012-04-13 (DSB):
34* Added PAL__DR2H and PAL__DR2S
35* {enter_further_changes_here}
36
37* Copyright:
38* Copyright (C) 2012 Science and Technology Facilities Council.
39* All Rights Reserved.
40
41* Licence:
42* This program is free software: you can redistribute it and/or
43* modify it under the terms of the GNU Lesser General Public
44* License as published by the Free Software Foundation, either
45* version 3 of the License, or (at your option) any later
46* version.
47*
48* This program is distributed in the hope that it will be useful,
49* but WITHOUT ANY WARRANTY; without even the implied warranty of
50* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51* GNU Lesser General Public License for more details.
52*
53* You should have received a copy of the GNU Lesser General
54* License along with this program. If not, see
55* <http://www.gnu.org/licenses/>.
56
57* Bugs:
58* {note_any_bugs_here}
59*-
60*/
61
62/* Pi */
63static const double PAL__DPI = 3.1415926535897932384626433832795028841971693993751;
64
65/* 2Pi */
66static const double PAL__D2PI = 6.2831853071795864769252867665590057683943387987502;
67
68/* pi/2: 90 degrees in radians */
69static const double PAL__DPIBY2 = 1.5707963267948966192313216916397514420985846996876;
70
71/* pi/180: degrees to radians */
72static const double PAL__DD2R = 0.017453292519943295769236907684886127134428718885417;
73
74/* Radians to arcseconds */
75static const double PAL__DR2AS = 2.0626480624709635515647335733077861319665970087963e5;
76
77/* Arcseconds to radians */
78static const double PAL__DAS2R = 4.8481368110953599358991410235794797595635330237270e-6;
79
80/* Radians to degrees */
81static const double PAL__DR2D = 57.295779513082320876798154814105170332405472466564;
82
83/* Hours to radians */
84static const double PAL__DH2R = 0.26179938779914943653855361527329190701643078328126;
85
86/* Radians to hours */
87static const double PAL__DR2H = 3.8197186342054880584532103209403446888270314977709;
88
89/* Radians to seconds of time */
90static const double PAL__DR2S = 1.3750987083139757010431557155385240879777313391975e4;
91
92/* Seconds of time to radians */
93static const double PAL__DS2R = 7.272205216643039903848712e-5;
94
95/* Start of SLA modified Julian date epoch */
96static const double PAL__MJD0 = 2400000.5;
97
98/* Light time for 1 AU (sec) */
99static const double PAL__CR = 499.004782;
100
101/* Seconds per day */
102static const double PAL__SPD = 86400.0;
103
104/* Km per sec to AU per tropical century
105 = 86400 * 36524.2198782 / 149597870 */
106static const double PAL__VF = 21.095;
107
108/* Radians per year to arcsec per century. This needs to be a macro since it
109 is an expression including other constants. */
110#define PAL__PMF (100.0*60.0*60.0*360.0/PAL__D2PI);
111
112/* Mean sidereal rate - the rotational angular velocity of Earth
113 in radians/sec from IERS Conventions (2003). */
114static const double PAL__SR = 7.2921150e-5;
115
116/* Gaussian gravitational constant (exact) */
117static const double PAL__GCON = 0.01720209895;
118
119/* DINT(A) - truncate to nearest whole number towards zero (double) */
120#define DINT(A) ((A)<0.0?ceil(A):floor(A))
121
122/* DNINT(A) - round to nearest whole number (double) */
123#define DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5))
124
125/* DMAX(A,B) - return maximum value - evaluates arguments multiple times */
126#define DMAX(A,B) ((A) > (B) ? (A) : (B) )
127
128/* DMIN(A,B) - return minimum value - evaluates arguments multiple times */
129#define DMIN(A,B) ((A) < (B) ? (A) : (B) )
130
131/* We actually prefer to use C99 copysign() but we define this here as a backup
132 but it will not detect -0.0 so is not useful for palDfltin. */
133/* DSIGN(A,B) - magnitude of A with sign of B (double) */
134#define DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A))
135
136#endif
Note: See TracBrowser for help on using the repository browser.