File: palmac.h

package info (click to toggle)
starlink-pal 0.9.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,808 kB
  • sloc: ansic: 6,689; makefile: 128; sh: 81
file content (136 lines) | stat: -rw-r--r-- 4,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef PALMACDEF
#define PALMACDEF

/*
*+
*  Name:
*     palmac.h

*  Purpose:
*     Macros used by the PAL library

*  Language:
*     Starlink ANSI C

*  Type of Module:
*     Include file

*  Description:
*     A collection of useful macros provided and used by the PAL library

*  Authors:
*     TIMJ: Tim Jenness (JAC, Hawaii)
*     DSB: David Berry (JAC, Hawaii)
*     {enter_new_authors_here}

*  Notes:
*

*  History:
*     2012-02-08 (TIMJ):
*        Initial version.
*        Adapted with permission from the Fortran SLALIB library.
*     2012-04-13 (DSB):
*        Added PAL__DR2H and PAL__DR2S
*     {enter_further_changes_here}

*  Copyright:
*     Copyright (C) 2012 Science and Technology Facilities Council.
*     All Rights Reserved.

*  Licence:
*     This program is free software: you can redistribute it and/or
*     modify it under the terms of the GNU Lesser General Public
*     License as published by the Free Software Foundation, either
*     version 3 of the License, or (at your option) any later
*     version.
*
*     This program is distributed in the hope that it will be useful,
*     but WITHOUT ANY WARRANTY; without even the implied warranty of
*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*     GNU Lesser General Public License for more details.
*
*     You should have received a copy of the GNU Lesser General
*     License along with this program.  If not, see
*     <http://www.gnu.org/licenses/>.

*  Bugs:
*     {note_any_bugs_here}
*-
*/

/* Pi */
static const double PAL__DPI = 3.1415926535897932384626433832795028841971693993751;

/* 2Pi */
static const double PAL__D2PI = 6.2831853071795864769252867665590057683943387987502;

/* pi/2:  90 degrees in radians */
static const double PAL__DPIBY2 = 1.5707963267948966192313216916397514420985846996876;

/* pi/180:  degrees to radians */
static const double PAL__DD2R = 0.017453292519943295769236907684886127134428718885417;

/* Radians to arcseconds */
static const double PAL__DR2AS = 2.0626480624709635515647335733077861319665970087963e5;

/* Arcseconds to radians */
static const double PAL__DAS2R = 4.8481368110953599358991410235794797595635330237270e-6;

/* Radians to degrees */
static const double PAL__DR2D = 57.295779513082320876798154814105170332405472466564;

/* Hours to radians */
static const double PAL__DH2R = 0.26179938779914943653855361527329190701643078328126;

/* Radians to hours */
static const double PAL__DR2H = 3.8197186342054880584532103209403446888270314977709;

/* Radians to seconds of time */
static const double PAL__DR2S = 1.3750987083139757010431557155385240879777313391975e4;

/* Seconds of time to radians */
static const double PAL__DS2R = 7.272205216643039903848712e-5;

/* Start of SLA modified Julian date epoch */
static const double PAL__MJD0 = 2400000.5;

/* Light time for 1 AU (sec) */
static const double PAL__CR = 499.004782;

/* Seconds per day */
static const double PAL__SPD = 86400.0;

/* Km per sec to AU per tropical century
   = 86400 * 36524.2198782 / 149597870 */
static const double PAL__VF = 21.095;

/*  Radians per year to arcsec per century. This needs to be a macro since it
    is an expression including other constants. */
#define PAL__PMF (100.0*60.0*60.0*360.0/PAL__D2PI);

/* Mean sidereal rate - the rotational angular velocity of Earth
   in radians/sec from IERS Conventions (2003). */
static const double PAL__SR = 7.2921150e-5;

/*  Gaussian gravitational constant (exact) */
static const double PAL__GCON = 0.01720209895;

/* DINT(A) - truncate to nearest whole number towards zero (double) */
#define DINT(A) ((A)<0.0?ceil(A):floor(A))

/* DNINT(A) - round to nearest whole number (double) */
#define DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5))

/* DMAX(A,B) - return maximum value - evaluates arguments multiple times */
#define DMAX(A,B) ((A) > (B) ? (A) : (B) )

/* DMIN(A,B) - return minimum value - evaluates arguments multiple times */
#define DMIN(A,B) ((A) < (B) ? (A) : (B) )

/* We actually prefer to use C99 copysign() but we define this here as a backup
   but it will not detect -0.0 so is not useful for palDfltin. */
/* DSIGN(A,B) - magnitude of A with sign of B (double) */
#define DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A))

#endif