1 /*
2 
3 -Procedure      scpart_c ( Spacecraft Clock Partition Information )
4 
5 -Abstract
6 
7    Get spacecraft clock partition information from a spacecraft
8    clock kernel file.
9 
10 -Disclaimer
11 
12    THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
13    CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
14    GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
15    ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
16    PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
17    TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
18    WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
19    PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
20    SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
21    SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
22 
23    IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
24    BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
25    LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
26    INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
27    REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
28    REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
29 
30    RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
31    THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
32    CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
33    ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
34 
35 -Required_Reading
36 
37    SCLK
38 
39 -Keywords
40 
41    TIME
42 
43 */
44 
45    #include "SpiceUsr.h"
46    #include "SpiceZfc.h"
47    #include "SpiceZst.h"
48 
scpart_c(SpiceInt sc,SpiceInt * nparts,SpiceDouble * pstart,SpiceDouble * pstop)49    void scpart_c ( SpiceInt        sc,
50                    SpiceInt      * nparts,
51                    SpiceDouble   * pstart,
52                    SpiceDouble   * pstop  )
53 /*
54 
55 -Brief_I/O
56 
57    Variable  I/O  Description
58    --------  ---  --------------------------------------------------
59    sc         I   NAIF spacecraft identification code.
60    nparts     O   The number of spacecraft clock partitions.
61    pstart     O   Array of partition start times.
62    pstop      O   Array of partition stop times.
63    MXPART     P   Maximum number of partitions.
64 
65 -Detailed_Input
66 
67    sc         is the NAIF ID for the spacecraft whose clock partition
68               information is being requested.
69 
70 -Detailed_Output
71 
72    nparts     is the number of spacecraft clock time partitions
73               described in the kernel file for spacecraft SC.
74 
75    pstart     is an array containing nparts partition start times
76               represented as double precision, encoded SCLK ("ticks").
77               The values contained in pstart are whole numbers.
78 
79    pstop      is an array containing nparts partition end times
80               represented as double precision, encoded SCLK ("ticks").
81               The values contained in pstop are whole numbers.
82 
83 -Parameters
84 
85    MXPART     is the maximum number of partitions for any
86               spacecraft clock. MXPART is currently set to
87               9999.
88 
89 -Exceptions
90 
91    1)  If the kernel variables containing the spacecraft clock
92        partition start and stop times have not been loaded in the
93        kernel pool, the error will be diagnosed by routines called
94        by this routine.
95 
96    2)  If the number of start and stop times are different then
97        the error SPICE(NUMPARTSUNEQUAL) is signalled.
98 
99 -Files
100 
101    An SCLK kernel containing spacecraft clock partition start
102    and stop times for the spacecraft clock indicated by SC must
103    be loaded into the kernel pool before this routine may be called.
104 
105 -Particulars
106 
107    scpart_c looks for two variables in the kernel pool for each
108    spacecraft's partition information. If sc = -nn, then the names of
109    the variables are
110 
111       "SCLK_PARTITION_START_nn"
112       "SCLK_PARTITION_END_nn"
113 
114    The start and stop times returned are in units of "ticks."
115 
116 -Examples
117 
118    1)  The following program fragment finds and prints out partition
119        start and stop times in clock format for the Galileo mission.
120        In this example, Galileo partition times are assumed to be
121        in the kernel file sclk.ker.
122 
123           #include <stdio.h>
124           #include "SpiceUsr.h"
125 
126           void main()
127           {
128              #define   CLKLEN        30
129              #define   SC            -32
130              #define   MXPART        9999
131 
132              SpiceChar               start  [ CLKLEN ];
133              SpiceChar               stop   [ CLKLEN ];
134              SpiceDouble             pstart [ MXPART ];
135              SpiceDouble             pstop  [ MXPART ];
136 
137              SpiceInt                nparts;
138              SpiceInt                i;
139 
140 
141              furnsh_c ( "sclk.ker" );
142 
143              scpart_c ( SC, &nparts, pstart, pstop );
144 
145              for ( i = 0;  i < nparts;  i++ )
146              {
147                 scfmt_c ( SC, pstart[ i ], CLKLEN, start );
148                 scfmt_c ( SC, pstop [ i ], CLKLEN, stop  );
149 
150                 printf  ( "\n"
151                           "Partition %d:\n"
152                           "Start = %s\n"
153                           "Stop  = %s\n"
154                           "\n",
155                           i,
156                           start,
157                           stop                );
158              }
159           }
160 
161 
162 
163 -Restrictions
164 
165    1) This routine assumes that an SCLK kernel appropriate to the
166       spacecraft identified by SC has been loaded into the kernel
167       pool.
168 
169 -Literature_References
170 
171    None.
172 
173 -Author_and_Institution
174 
175    N.J. Bachman   (JPL)
176    J.M. Lynch     (JPL)
177    R.E. Thurman   (JPL)
178 
179 -Version
180 
181    -CSPICE Version 1.1.1, 19-MAR-2014   (NJB)
182 
183       Minor header comment updates were made.
184 
185    -CSPICE Version 1.1.0, 11-FEB-2008   (NJB)
186 
187       Definition of constant macro MXPART was deleted.
188       Documentation was updated to reflect current
189       MXPART value of 9999.
190 
191    -CSPICE Version 1.0.1, 14-AUG-2006   (EDW)
192 
193       Replace mention of ldpool_c with furnsh_c.
194 
195    -CSPICE Version 1.0.0, 08-FEB-1998 (NJB)
196 
197       Based on SPICELIB Version 1.1.0, 22-MAR-1993 (JML)
198 
199 -Index_Entries
200 
201    spacecraft_clock partition information
202 
203 -&
204 */
205 
206 { /* Begin scpart_c */
207 
208    /*
209    Participate in error handling
210    */
211    chkin_c ( "scpart_c");
212 
213    /*
214    Unlike most of the wrappers, this one reads the
215    partition data directly into the callers' buffers.
216 
217    We rely on the scpart_ to check for an excessive
218    partition count.
219    */
220 
221    scpart_ ( ( integer     * ) &sc,
222              ( integer     * ) nparts,
223              ( doublereal  * ) pstart,
224              ( doublereal  * ) pstop   );
225 
226 
227 
228 
229    chkout_c ( "scpart_c");
230 
231 
232 } /* End scpart_c */
233