1 /* zzgfdiu.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* Table of constant values */
9
10 static integer c__0 = 0;
11
12 /* $Procedure ZZGFDIU ( Private --- GF, distance utilities ) */
zzgfdiu_0_(int n__,char * target,char * abcorr,char * obsrvr,U_fp udfunc,doublereal * et,logical * decres,doublereal * dist,ftnlen target_len,ftnlen abcorr_len,ftnlen obsrvr_len)13 /* Subroutine */ int zzgfdiu_0_(int n__, char *target, char *abcorr, char *
14 obsrvr, U_fp udfunc, doublereal *et, logical *decres, doublereal *
15 dist, ftnlen target_len, ftnlen abcorr_len, ftnlen obsrvr_len)
16 {
17 extern doublereal vdot_(doublereal *, doublereal *);
18 extern /* Subroutine */ int zzvalcor_(char *, logical *, ftnlen), chkin_(
19 char *, ftnlen), ucase_(char *, char *, ftnlen, ftnlen), errch_(
20 char *, char *, ftnlen, ftnlen);
21 logical found;
22 doublereal state[6];
23 static integer svobs;
24 extern /* Subroutine */ int spkez_(integer *, doublereal *, char *, char *
25 , integer *, doublereal *, doublereal *, ftnlen, ftnlen), bods2c_(
26 char *, integer *, logical *, ftnlen);
27 extern logical failed_(void);
28 doublereal lt;
29 logical attblk[15];
30 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
31 ftnlen), setmsg_(char *, ftnlen);
32 static integer svtarg;
33 extern /* Subroutine */ int cmprss_(char *, integer *, char *, char *,
34 ftnlen, ftnlen, ftnlen);
35 extern logical return_(void);
36 static char svcorr[5];
37 extern /* Subroutine */ int zzgfdiq_(integer *, doublereal *, char *,
38 integer *, doublereal *, ftnlen);
39
40 /* $ Abstract */
41
42 /* SPICE Private routine intended solely for the support of SPICE */
43 /* routines. Users should not call this routine directly due */
44 /* to the volatile nature of this routine. */
45
46 /* This is the umbrella routine for the entry points used by */
47 /* GFEVNT in order to find distance events. */
48
49 /* $ Disclaimer */
50
51 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
52 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
53 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
54 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
55 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
56 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
57 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
58 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
59 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
60 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
61
62 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
63 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
64 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
65 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
66 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
67 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
68
69 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
70 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
71 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
72 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
73
74 /* $ Required_Reading */
75
76 /* GF */
77 /* NAIF_IDS */
78 /* SPK */
79 /* TIME */
80
81 /* $ Keywords */
82
83 /* DISTANCE */
84 /* EPHEMERIS */
85 /* GEOMETRY */
86 /* SEARCH */
87
88 /* $ Declarations */
89 /* $ Abstract */
90
91 /* Include file zzabcorr.inc */
92
93 /* SPICE private file intended solely for the support of SPICE */
94 /* routines. Users should not include this file directly due */
95 /* to the volatile nature of this file */
96
97 /* The parameters below define the structure of an aberration */
98 /* correction attribute block. */
99
100 /* $ Disclaimer */
101
102 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
103 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
104 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
105 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
106 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
107 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
108 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
109 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
110 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
111 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
112
113 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
114 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
115 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
116 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
117 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
118 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
119
120 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
121 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
122 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
123 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
124
125 /* $ Parameters */
126
127 /* An aberration correction attribute block is an array of logical */
128 /* flags indicating the attributes of the aberration correction */
129 /* specified by an aberration correction string. The attributes */
130 /* are: */
131
132 /* - Is the correction "geometric"? */
133
134 /* - Is light time correction indicated? */
135
136 /* - Is stellar aberration correction indicated? */
137
138 /* - Is the light time correction of the "converged */
139 /* Newtonian" variety? */
140
141 /* - Is the correction for the transmission case? */
142
143 /* - Is the correction relativistic? */
144
145 /* The parameters defining the structure of the block are as */
146 /* follows: */
147
148 /* NABCOR Number of aberration correction choices. */
149
150 /* ABATSZ Number of elements in the aberration correction */
151 /* block. */
152
153 /* GEOIDX Index in block of geometric correction flag. */
154
155 /* LTIDX Index of light time flag. */
156
157 /* STLIDX Index of stellar aberration flag. */
158
159 /* CNVIDX Index of converged Newtonian flag. */
160
161 /* XMTIDX Index of transmission flag. */
162
163 /* RELIDX Index of relativistic flag. */
164
165 /* The following parameter is not required to define the block */
166 /* structure, but it is convenient to include it here: */
167
168 /* CORLEN The maximum string length required by any aberration */
169 /* correction string */
170
171 /* $ Author_and_Institution */
172
173 /* N.J. Bachman (JPL) */
174
175 /* $ Literature_References */
176
177 /* None. */
178
179 /* $ Version */
180
181 /* - SPICELIB Version 1.0.0, 18-DEC-2004 (NJB) */
182
183 /* -& */
184 /* Number of aberration correction choices: */
185
186
187 /* Aberration correction attribute block size */
188 /* (number of aberration correction attributes): */
189
190
191 /* Indices of attributes within an aberration correction */
192 /* attribute block: */
193
194
195 /* Maximum length of an aberration correction string: */
196
197
198 /* End of include file zzabcorr.inc */
199
200 /* $ Brief_I/O */
201
202 /* VARIABLE I/O Entry points */
203 /* -------- --- -------------------------------------------------- */
204 /* TARGID I ZZGFDIIN */
205 /* ABCORR I ZZGFDIIN */
206 /* OBSID I ZZGFDIIN */
207 /* ET I ZZGFDIDC, ZZGFDIGQ */
208 /* REF I ZZGFDIIN */
209 /* UDFUNC I ZZGFDIDC */
210 /* DECRES O ZZGFDIDC */
211 /* DIST O ZZGFDIGQ */
212
213 /* $ Detailed_Input */
214
215 /* See individual entry points. */
216
217 /* $ Detailed_Output */
218
219 /* See individual entry points. */
220
221 /* $ Parameters */
222
223 /* None. */
224
225 /* $ Exceptions */
226
227 /* See individual entry points. */
228
229 /* $ Files */
230
231 /* Appropriate kernels must be loaded by the calling program before */
232 /* this routine is called. */
233
234 /* The following data are required: */
235
236 /* - SPK data: ephemeris data for target and observer, for the */
237 /* times at which state or positions are computed, must be */
238 /* loaded. If aberration corrections are used, the states of */
239 /* target and observer relative to the solar system barycenter */
240 /* must be calculable from the available ephemeris data. */
241 /* Typically ephemeris data are made available by loading one */
242 /* or more SPK files via FURNSH. */
243
244 /* - If non-inertial reference frames are used, then PCK */
245 /* files, frame kernels, C-kernels, and SCLK kernels may be */
246 /* needed. */
247
248 /* In all cases, kernel data are normally loaded once per program */
249 /* run, NOT every time this routine is called. */
250
251 /* $ Particulars */
252
253 /* This is an umbrella for routines required by the GF scalar */
254 /* quantity search algorithm to support searches involving */
255 /* distance constraints. */
256
257 /* The entry points of this routine are: */
258
259 /* ZZGFDIIN Saves the user-supplied inputs defining the */
260 /* distance computation to be performed. Initializes */
261 /* the distance search. */
262
263 /* ZZGFDIDC Determines whether or not distance is decreasing */
264 /* at a specified epoch. */
265
266 /* ZZGFDIGQ Returns the distance between the observer and target */
267 /* at a specified epoch. */
268
269 /* $ Examples */
270
271 /* See GFEVNT. */
272
273 /* $ Restrictions */
274
275 /* This is a SPICELIB private routine; it should not be called by */
276 /* user applications. */
277
278 /* ZZGFDIIN must be called prior to use of any of the other */
279 /* entry points. */
280
281 /* $ Literature_References */
282
283 /* None. */
284
285 /* $ Author_and_Institution */
286
287 /* N.J. Bachman (JPL) */
288 /* L.S. Elson (JPL) */
289 /* W.L. Taber (JPL) */
290 /* I.M. Underwood (JPL) */
291 /* E.D. Wright (JPL) */
292
293 /* $ Version */
294
295 /* - SPICELIB version 2.0.0 18-FEB-2011 (EDW) */
296
297 /* Code edits to implement use of ZZGFRELX. */
298 /* These edits include removal of unneeded routines: */
299
300 /* ZZGFDIUR */
301 /* ZZGFDILT */
302
303 /* and corresponding unused variables. */
304
305 /* Update to header entries. */
306
307 /* - SPICELIB Version 1.0.0 05-MAR-2009 (NJB) (LSE) (WLT) (IMU) (EDW) */
308
309 /* -& */
310 /* $ Index_Entries */
311
312 /* umbrella routine for finding distance events */
313
314 /* -& */
315
316 /* SPICELIB functions */
317
318
319 /* Local parameters */
320
321
322 /* Local Variables */
323
324
325 /* Saved Variables */
326
327
328 /* This routine should never be called directly. */
329
330 switch(n__) {
331 case 1: goto L_zzgfdiin;
332 case 2: goto L_zzgfdidc;
333 case 3: goto L_zzgfdigq;
334 }
335
336 chkin_("ZZGFDIU", (ftnlen)7);
337 sigerr_("SPICE(BOGUSENTRY)", (ftnlen)17);
338 chkout_("ZZGFDIU", (ftnlen)7);
339 return 0;
340 /* $Procedure ZZGFDIIN ( Private --- GF, distance initialization ) */
341
342 L_zzgfdiin:
343 /* $ Abstract */
344
345 /* Initialize the GF distance constraint search utilities. */
346
347 /* $ Disclaimer */
348
349 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
350 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
351 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
352 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
353 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
354 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
355 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
356 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
357 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
358 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
359
360 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
361 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
362 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
363 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
364 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
365 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
366
367 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
368 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
369 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
370 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
371
372 /* $ Required_Reading */
373
374 /* GF */
375 /* NAIF_IDS */
376 /* SPK */
377 /* TIME */
378
379 /* $ Keywords */
380
381 /* DISTANCE */
382 /* EPHEMERIS */
383 /* GEOMETRY */
384 /* SEARCH */
385
386 /* $ Declarations */
387
388 /* CHARACTER*(*) TARGET */
389 /* CHARACTER*(*) ABCORR */
390 /* CHARACTER*(*) OBSRVR */
391
392 /* $ Brief_I/O */
393
394 /* VARIABLE I/O DESCRIPTION */
395 /* -------- --- -------------------------------------------------- */
396 /* TARGET I Target body name. */
397 /* ABCORR I Aberration correction specifier. */
398 /* OBSRVR I Observer name. */
399
400 /* $ Detailed_Input */
401
402 /* TARGET is the name of a target body. Optionally, you may */
403 /* supply the integer ID code for the object as */
404 /* an integer string. For example both 'MOON' and */
405 /* '301' are legitimate strings that indicate the */
406 /* moon is the target body. */
407
408 /* The target and observer define a position vector */
409 /* which points from the observer to the target. */
410
411 /* Case and leading or trailing blanks are not */
412 /* significant in the string TARGET. */
413
414
415 /* ABCORR indicates the aberration corrections to be applied */
416 /* when computing the target's position and orientation. */
417 /* Any value accepted by SPKEZR may be used. */
418
419 /* See the header of the SPICE routine SPKEZR for a */
420 /* detailed description of the aberration correction */
421 /* options. */
422
423 /* Case and embedded blanks are not significant in */
424 /* ABCORR. */
425
426
427 /* OBSRVR is the name of the body from which the occultation is */
428 /* observed. Optionally, you may supply the integer NAIF */
429 /* ID code for the body as a string. */
430
431 /* Case and leading or trailing blanks are not */
432 /* significant in the string OBSRVR. */
433
434 /* $ Detailed_Output */
435
436 /* None. */
437
438 /* $ Parameters */
439
440 /* None. */
441
442 /* $ Exceptions */
443
444 /* 1) If name of the target or the observer cannot be translated */
445 /* to a NAIF ID code, the error SPICE(IDCODENOTFOUND) is */
446 /* signaled. */
447
448 /* 2) If target body coincides with the observer body OBSRVR, the */
449 /* error SPICE(BODIESNOTDISTINCT) will be signaled. */
450
451 /* 3) If the aberration correction string is invalid, the error */
452 /* will be diagnosed by a routine in the call tree of this */
453 /* routine. */
454
455 /* $ Files */
456
457 /* See the header of the umbrella routine ZZGFDIU. */
458
459 /* $ Particulars */
460
461 /* This routine must be called once before each GF search for */
462 /* distance events. */
463
464 /* $ Examples */
465
466 /* See GFEVNT. */
467
468 /* $ Restrictions */
469
470 /* This is a SPICELIB private routine; it should not be called by */
471 /* user applications. */
472
473 /* $ Literature_References */
474
475 /* None. */
476
477 /* $ Author_and_Institution */
478
479 /* N.J. Bachman (JPL) */
480 /* L.S. Elson (JPL) */
481 /* W.L. Taber (JPL) */
482 /* I.M. Underwood (JPL) */
483 /* E.D. Wright (JPL) */
484
485 /* $ Version */
486
487 /* - SPICELIB version 2.0.0 18-FEB-2011 (EDW) */
488
489 /* REFVAL removed from routine argument list due to use */
490 /* of ZZGFRELX to calculate the events. */
491
492 /* - SPICELIB Version 1.0.0 05-MAR-2009 (NJB) (LSE) (WLT) (IMU) (EDW) */
493
494 /* -& */
495 /* $ Index_Entries */
496
497 /* distance initialization routine */
498
499 /* -& */
500 if (return_()) {
501 return 0;
502 }
503 chkin_("ZZGFDIIN", (ftnlen)8);
504
505 /* Find NAIF IDs for TARGET and OBSRVR. */
506
507 bods2c_(target, &svtarg, &found, target_len);
508 if (! found) {
509 setmsg_("The target object, '#', is not a recognized name for an eph"
510 "emeris object. The cause of this problem may be that you nee"
511 "d an updated version of the SPICE Toolkit. ", (ftnlen)162);
512 errch_("#", target, (ftnlen)1, target_len);
513 sigerr_("SPICE(IDCODENOTFOUND)", (ftnlen)21);
514 chkout_("ZZGFDIIN", (ftnlen)8);
515 return 0;
516 }
517 bods2c_(obsrvr, &svobs, &found, obsrvr_len);
518 if (! found) {
519 setmsg_("The observer, '#', is not a recognized name for an ephemeri"
520 "s object. The cause of this problem may be that you need an "
521 "updated version of the SPICE toolkit. ", (ftnlen)157);
522 errch_("#", obsrvr, (ftnlen)1, obsrvr_len);
523 sigerr_("SPICE(IDCODENOTFOUND)", (ftnlen)21);
524 chkout_("ZZGFDIIN", (ftnlen)8);
525 return 0;
526 }
527
528 /* Make sure the observer and target are distinct. */
529
530 if (svtarg == svobs) {
531 setmsg_("The observer and target must be distinct objects, but are n"
532 "ot: OBSRVR = #; TARGET = #.", (ftnlen)86);
533 errch_("#", obsrvr, (ftnlen)1, obsrvr_len);
534 errch_("#", target, (ftnlen)1, target_len);
535 sigerr_("SPICE(BODIESNOTDISTINCT)", (ftnlen)24);
536 chkout_("ZZGFDIIN", (ftnlen)8);
537 return 0;
538 }
539
540 /* Squeeze all blanks out of the aberration correction */
541 /* string; ensure the string is in upper case. */
542
543 cmprss_(" ", &c__0, abcorr, svcorr, (ftnlen)1, abcorr_len, (ftnlen)5);
544 ucase_(svcorr, svcorr, (ftnlen)5, (ftnlen)5);
545
546 /* Check the aberration correction. If SPKEZR can't handle it, */
547 /* neither can we. */
548
549 zzvalcor_(svcorr, attblk, (ftnlen)5);
550 if (failed_()) {
551 chkout_("ZZGFDIIN", (ftnlen)8);
552 return 0;
553 }
554 chkout_("ZZGFDIIN", (ftnlen)8);
555 return 0;
556 /* $Procedure ZZGFDIDC ( Private --- GF, is distance decreasing? ) */
557
558 L_zzgfdidc:
559 /* $ Abstract */
560
561 /* Indicate whether the observer-target distance is decreasing at a */
562 /* specified time. */
563
564 /* $ Disclaimer */
565
566 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
567 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
568 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
569 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
570 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
571 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
572 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
573 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
574 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
575 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
576
577 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
578 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
579 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
580 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
581 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
582 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
583
584 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
585 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
586 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
587 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
588
589 /* $ Required_Reading */
590
591 /* GF */
592 /* NAIF_IDS */
593 /* SPK */
594 /* TIME */
595
596 /* $ Keywords */
597
598 /* DISTANCE */
599 /* EPHEMERIS */
600 /* GEOMETRY */
601 /* SEARCH */
602
603 /* $ Declarations */
604
605 /* DOUBLE PRECISION ET */
606 /* LOGICAL DECRES */
607
608 /* $ Brief_I/O */
609
610 /* VARIABLE I/O DESCRIPTION */
611 /* -------- --- -------------------------------------------------- */
612 /* ET I Ephemeris seconds past J2000 TDB. */
613 /* DECRES O Flag indicating whether distance is decreasing. */
614
615 /* $ Detailed_Input */
616
617 /* ET is the time, expressed as seconds past J2000 TDB, at */
618 /* which to determine whether or not the distance between */
619 /* the observer and target is decreasing. */
620
621 /* $ Detailed_Output */
622
623 /* DECRES is a logical flag that indicates whether the */
624 /* observer-target distance is decreasing at ET. The */
625 /* observer, target, and aberration correction used to */
626 /* compute the distance are defined by the latest call to */
627 /* the initialization entry point ZZGFDIIN. */
628
629 /* DECRES is .TRUE. if and only if the observer-target */
630 /* distance is decreasing at ET. */
631
632 /* $ Parameters */
633
634 /* None. */
635
636 /* $ Exceptions */
637
638 /* 1) If the state of the target relative to the observer */
639 /* at ET can not be found due to an SPK lookup failure, */
640 /* the error will be diagnosed by routines in the call */
641 /* tree of this routine. */
642
643 /* $ Files */
644
645 /* See the header of the umbrella routine ZZGFDIU. */
646
647 /* $ Particulars */
648
649 /* A function f(x) is strictly decreasing at x0 if and only if there */
650 /* exists some delta > 0 such that for all dx satisfying */
651
652 /* 0 < dx < delta */
653
654 /* we have */
655
656 /* f(x0) < f(x0 + dx) */
657
658 /* and */
659
660 /* f(x0 - dx) < f(x) */
661
662 /* Note that a strictly decreasing function need not be */
663 /* differentiable in a neighborhood of x0; it can have jump */
664 /* discontinuities in any neighborhood of x0 and even at x0. */
665
666 /* $ Examples */
667
668 /* See GFREL. */
669
670 /* $ Restrictions */
671
672 /* This is a SPICELIB private routine; it should not be called by */
673 /* user applications. */
674
675 /* $ Literature_References */
676
677 /* None. */
678
679 /* $ Author_and_Institution */
680
681 /* N.J. Bachman (JPL) */
682 /* L.S. Elson (JPL) */
683 /* W.L. Taber (JPL) */
684 /* I.M. Underwood (JPL) */
685 /* E.D. Wright (JPL) */
686
687 /* $ Version */
688
689 /* - SPICELIB version 2.0.0 18-FEB-2011 (EDW) */
690
691 /* Added UDFUNC to argument list for use of ZZGFRELX when */
692 /* calculating the events. */
693
694 /* - SPICELIB Version 1.0.0 05-MAR-2009 (NJB) (LSE) (WLT) (IMU) (EDW) */
695
696 /* -& */
697 /* $ Index_Entries */
698
699 /* indicate whether distance is decreasing */
700
701 /* -& */
702
703 /* Standard SPICE error handling. */
704
705 if (return_()) {
706 return 0;
707 }
708 chkin_("ZZGFDIDC", (ftnlen)8);
709 spkez_(&svtarg, et, "J2000", svcorr, &svobs, state, <, (ftnlen)5, (
710 ftnlen)5);
711 if (failed_()) {
712 chkout_("ZZGFDIDC", (ftnlen)8);
713 return 0;
714 }
715
716 /* The observer-target distance is decreasing if and only */
717 /* if the dot product of the velocity and position is */
718 /* negative. */
719
720 *decres = vdot_(state, &state[3]) < 0.;
721 chkout_("ZZGFDIDC", (ftnlen)8);
722 return 0;
723 /* $Procedure ZZGFDIGQ ( Private --- GF, get observer-target distance ) */
724
725 L_zzgfdigq:
726 /* $ Abstract */
727
728 /* Return the distance between the target and observer */
729 /* at a specified epoch. */
730
731 /* $ Disclaimer */
732
733 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
734 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
735 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
736 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
737 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
738 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
739 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
740 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
741 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
742 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
743
744 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
745 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
746 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
747 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
748 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
749 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
750
751 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
752 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
753 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
754 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
755
756 /* $ Required_Reading */
757
758 /* GF */
759 /* NAIF_IDS */
760 /* SPK */
761 /* TIME */
762
763 /* $ Keywords */
764
765 /* DISTANCE */
766 /* EPHEMERIS */
767 /* GEOMETRY */
768 /* SEARCH */
769
770 /* $ Declarations */
771
772 /* DOUBLE PRECISION ET */
773 /* DOUBLE PRECISION DIST */
774
775 /* $ Brief_I/O */
776
777 /* VARIABLE I/O DESCRIPTION */
778 /* -------- --- -------------------------------------------------- */
779 /* ET I Ephemeris seconds past J2000 TDB. */
780 /* DIST O Distance at time ET. */
781
782 /* $ Detailed_Input */
783
784 /* ET is the time, expressed as seconds past J2000 TDB, at */
785 /* which the distance between the observer and target is */
786 /* to be computed. */
787
788 /* $ Detailed_Output */
789
790 /* DIST is the distance between the observer and target as */
791 /* seen by the observer at time ET. The observer, target, */
792 /* and aberration correction used to compute the distance */
793 /* are defined by the latest call to the initialization */
794 /* entry point ZZGFDIIN. */
795
796 /* Units are km. */
797
798 /* $ Parameters */
799
800 /* None. */
801
802 /* $ Exceptions */
803
804 /* 1) If the position of the target relative to the observer */
805 /* at ET can not be found due to an SPK lookup failure, */
806 /* the error will be diagnosed by routines in the call */
807 /* tree of this routine. */
808
809 /* $ Files */
810
811 /* See the header of the umbrella routine ZZGFDIU. */
812
813 /* $ Particulars */
814
815 /* This routine determines the apparent distance between the target */
816 /* and observer as seen from the observer at time ET. This */
817 /* functionality supports GFREL's comparisons of relative extrema in */
818 /* order to determine absolute extrema. */
819
820 /* $ Examples */
821
822 /* See GFREL. */
823
824 /* $ Restrictions */
825
826 /* This is a SPICELIB private routine; it should not be called by */
827 /* user applications. */
828
829 /* $ Literature_References */
830
831 /* None. */
832
833 /* $ Author_and_Institution */
834
835 /* N.J. Bachman (JPL) */
836 /* L.S. Elson (JPL) */
837 /* W.L. Taber (JPL) */
838 /* I.M. Underwood (JPL) */
839 /* E.D. Wright (JPL) */
840
841 /* $ Version */
842
843 /* - SPICELIB Version 1.0.0 05-MAR-2009 (NJB) (LSE) (WLT) (IMU) (EDW) */
844
845 /* -& */
846 /* $ Index_Entries */
847
848 /* return distance between two bodies */
849
850 /* -& */
851 if (return_()) {
852 return 0;
853 }
854 chkin_("ZZGFDIGQ", (ftnlen)8);
855 zzgfdiq_(&svtarg, et, svcorr, &svobs, dist, (ftnlen)5);
856 chkout_("ZZGFDIGQ", (ftnlen)8);
857 return 0;
858 } /* zzgfdiu_ */
859
zzgfdiu_(char * target,char * abcorr,char * obsrvr,U_fp udfunc,doublereal * et,logical * decres,doublereal * dist,ftnlen target_len,ftnlen abcorr_len,ftnlen obsrvr_len)860 /* Subroutine */ int zzgfdiu_(char *target, char *abcorr, char *obsrvr, U_fp
861 udfunc, doublereal *et, logical *decres, doublereal *dist, ftnlen
862 target_len, ftnlen abcorr_len, ftnlen obsrvr_len)
863 {
864 return zzgfdiu_0_(0, target, abcorr, obsrvr, udfunc, et, decres, dist,
865 target_len, abcorr_len, obsrvr_len);
866 }
867
zzgfdiin_(char * target,char * abcorr,char * obsrvr,ftnlen target_len,ftnlen abcorr_len,ftnlen obsrvr_len)868 /* Subroutine */ int zzgfdiin_(char *target, char *abcorr, char *obsrvr,
869 ftnlen target_len, ftnlen abcorr_len, ftnlen obsrvr_len)
870 {
871 return zzgfdiu_0_(1, target, abcorr, obsrvr, (U_fp)0, (doublereal *)0, (
872 logical *)0, (doublereal *)0, target_len, abcorr_len, obsrvr_len);
873 }
874
zzgfdidc_(U_fp udfunc,doublereal * et,logical * decres)875 /* Subroutine */ int zzgfdidc_(U_fp udfunc, doublereal *et, logical *decres)
876 {
877 return zzgfdiu_0_(2, (char *)0, (char *)0, (char *)0, udfunc, et, decres,
878 (doublereal *)0, (ftnint)0, (ftnint)0, (ftnint)0);
879 }
880
zzgfdigq_(doublereal * et,doublereal * dist)881 /* Subroutine */ int zzgfdigq_(doublereal *et, doublereal *dist)
882 {
883 return zzgfdiu_0_(3, (char *)0, (char *)0, (char *)0, (U_fp)0, et, (
884 logical *)0, dist, (ftnint)0, (ftnint)0, (ftnint)0);
885 }
886
887