1 /* gfevnt.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__8 = 8;
11 static integer c__10 = 10;
12 static integer c__7 = 7;
13
14 /* $Procedure GFEVNT ( GF, Geometric event finder ) */
gfevnt_(U_fp udstep,U_fp udrefn,char * gquant,integer * qnpars,char * qpnams,char * qcpars,doublereal * qdpars,integer * qipars,logical * qlpars,char * op,doublereal * refval,doublereal * tol,doublereal * adjust,doublereal * cnfine,logical * rpt,U_fp udrepi,U_fp udrepu,U_fp udrepf,integer * mw,integer * nw,doublereal * work,logical * bail,L_fp udbail,doublereal * result,ftnlen gquant_len,ftnlen qpnams_len,ftnlen qcpars_len,ftnlen op_len)15 /* Subroutine */ int gfevnt_(U_fp udstep, U_fp udrefn, char *gquant, integer *
16 qnpars, char *qpnams, char *qcpars, doublereal *qdpars, integer *
17 qipars, logical *qlpars, char *op, doublereal *refval, doublereal *
18 tol, doublereal *adjust, doublereal *cnfine, logical *rpt, U_fp
19 udrepi, U_fp udrepu, U_fp udrepf, integer *mw, integer *nw,
20 doublereal *work, logical *bail, L_fp udbail, doublereal *result,
21 ftnlen gquant_len, ftnlen qpnams_len, ftnlen qcpars_len, ftnlen
22 op_len)
23 {
24 /* Initialized data */
25
26 static char dref[80] = " "
27 " ";
28 static logical first = TRUE_;
29 static char qnames[80*8] = "ANGULAR SEPARATION "
30 " " "DISTANCE "
31 " " "COORDI"
32 "NATE "
33 " " "RANGE RATE "
34 " " "PHASE ANGLE "
35 " " "ILLUMINATION "
36 "ANGLE "
37 " " " "
38 " " " "
39 " ";
40 static char cnames[80*7] = "> "
41 " " "= "
42 " " "< "
43 " "
44 " " "ABSMAX "
45 " " "ABSMIN "
46 " " "LOCMAX "
47 " "
48 " " "LOCMIN "
49 " ";
50 static char qpars[80*10*8] = "TARGET1 "
51 " " "FRAME1 "
52 " " "SHAP"
53 "E1 "
54 " " "TARGET2 "
55 " " "FRAME2 "
56 " " "SHAPE2 "
57 " "
58 " " "OBSERVER "
59 " " "ABCORR "
60 " " " "
61 " "
62 " "
63 " " "TARGET "
64 " " "OBSERVER "
65 " " "ABCORR"
66 " "
67 " " " "
68 " " " "
69 " " " "
70 " "
71 " " " "
72 " " " "
73 " " " "
74 " "
75 " "
76 " " "TARGET "
77 " " "OBSERVER "
78 " " "ABCORR"
79 " "
80 " " "COORDINATE SYSTEM "
81 " " "COORDINATE "
82 " " "REFERENCE FRA"
83 "ME "
84 " " "VECTOR DEFINITION "
85 " " "METHOD "
86 " " "DVEC "
87 " "
88 "DREF "
89 " " "TARGET "
90 " " "OBSERVER "
91 " " "ABCORR"
92 " "
93 " " " "
94 " " " "
95 " " " "
96 " "
97 " " " "
98 " " " "
99 " " " "
100 " "
101 " "
102 " " "TARGET "
103 " " "OBSERVER "
104 " " "ILLUM "
105 " "
106 " " "ABCORR "
107 " " " "
108 " " " "
109 " "
110 " " " "
111 " " " "
112 " " " "
113 " "
114 " "
115 " " "TARGET "
116 " " "ILLUM "
117 " " "OBSERV"
118 "ER "
119 " " "ABCORR "
120 " " "REFERENCE FRAME "
121 " " "ANGTYP "
122 " "
123 " " "METHOD "
124 " " "SPOINT "
125 " " " "
126 " "
127 " "
128 " " "TARGET1 "
129 " " "TARGET2 "
130 " " "OBSERV"
131 "ER "
132 " " "ABCORR "
133 " " "REFERENCE FRAME "
134 " " " "
135 " "
136 " " " "
137 " " " "
138 " " " "
139 " "
140 " "
141 " " "TARGET "
142 " " "OBSERVER "
143 " " "ABCORR"
144 " "
145 " " "REFERENCE FRAME "
146 " " " "
147 " " " "
148 " "
149 " " " "
150 " " " "
151 " " " "
152 " "
153 " "
154 " ";
155
156 /* System generated locals */
157 integer work_dim1, work_offset, i__1, i__2, i__3;
158
159 /* Builtin functions */
160 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
161 integer s_rnge(char *, integer, char *, integer), s_cmp(char *, char *,
162 ftnlen, ftnlen);
163
164 /* Local variables */
165 doublereal dvec[3];
166 extern /* Subroutine */ int vequ_(doublereal *, doublereal *);
167 extern /* Subroutine */ int zzgfdidc_(), zzgfpadc_(), zzgfildc_();
168 extern /* Subroutine */ int zzgfdiin_(char *, char *, char *, ftnlen,
169 ftnlen, ftnlen);
170 extern /* Subroutine */ int zzgfdigq_();
171 extern /* Subroutine */ int zzgfpain_(char *, char *, char *, char *,
172 ftnlen, ftnlen, ftnlen, ftnlen);
173 extern /* Subroutine */ int zzgfpagq_(), zzgfspdc_(), zzgfrrdc_();
174 extern /* Subroutine */ int zzgfilin_(char *, char *, char *, char *,
175 char *, char *, char *, doublereal *, ftnlen, ftnlen, ftnlen,
176 ftnlen, ftnlen, ftnlen, ftnlen);
177 extern /* Subroutine */ int zzgfilgq_();
178 extern /* Subroutine */ int zzgfcslv_(char *, char *, char *, char *,
179 char *, char *, char *, doublereal *, char *, char *, char *,
180 doublereal *, doublereal *, doublereal *, U_fp, U_fp, logical *,
181 U_fp, U_fp, U_fp, logical *, L_fp, integer *, integer *,
182 doublereal *, doublereal *, doublereal *, ftnlen, ftnlen, ftnlen,
183 ftnlen, ftnlen, ftnlen, ftnlen, ftnlen, ftnlen, ftnlen);
184 extern /* Subroutine */ int zzgfudlt_();
185 extern /* Subroutine */ int zzgfspin_(char *, char *, char *, char *,
186 char *, ftnlen, ftnlen, ftnlen, ftnlen, ftnlen);
187 extern /* Subroutine */ int zzgfspgq_(), zzgfrrgq_();
188 extern /* Subroutine */ int zzgfrelx_(U_fp, U_fp, U_fp, U_fp, U_fp, char *
189 , doublereal *, doublereal *, doublereal *, doublereal *, integer
190 *, integer *, doublereal *, logical *, U_fp, U_fp, U_fp, char *,
191 char *, logical *, L_fp, doublereal *, ftnlen, ftnlen, ftnlen),
192 zzgfrrin_(char *, char *, char *, doublereal *, ftnlen, ftnlen,
193 ftnlen);
194 integer i__;
195 char frame[80*2];
196 extern /* Subroutine */ int chkin_(char *, ftnlen);
197 char shape[80*2];
198 extern /* Subroutine */ int ucase_(char *, char *, ftnlen, ftnlen),
199 errch_(char *, char *, ftnlen, ftnlen);
200 char cpars[80*10];
201 extern /* Subroutine */ int repmi_(char *, char *, integer *, char *,
202 ftnlen, ftnlen, ftnlen);
203 char illum[80], quant[80];
204 integer npass;
205 extern /* Subroutine */ int ljust_(char *, char *, ftnlen, ftnlen);
206 integer qtnum;
207 char of[80*2];
208 doublereal dt;
209 char vecdef[80];
210 extern integer isrchc_(char *, integer *, char *, ftnlen, ftnlen);
211 extern logical return_(void);
212 char abcorr[80], angtyp[80], cornam[80], corsys[80], method[80], obsrvr[
213 80], pnames[80*10], target[80], rptpre[55*2];
214 static char srcpre[55*2*8], srcsuf[13*2*8];
215 logical localx;
216 char ref[80];
217 integer loc;
218 logical noadjx;
219 doublereal spoint[3];
220 extern /* Subroutine */ int setmsg_(char *, ftnlen), sigerr_(char *,
221 ftnlen), chkout_(char *, ftnlen), errint_(char *, integer *,
222 ftnlen);
223 char uop[6];
224
225 /* $ Abstract */
226
227 /* Determine time intervals when a specified geometric quantity */
228 /* satisfies a specified mathematical condition. */
229
230 /* $ Disclaimer */
231
232 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
233 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
234 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
235 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
236 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
237 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
238 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
239 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
240 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
241 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
242
243 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
244 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
245 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
246 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
247 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
248 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
249
250 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
251 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
252 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
253 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
254
255 /* $ Required_Reading */
256
257 /* GF */
258 /* SPK */
259 /* TIME */
260 /* NAIF_IDS */
261 /* FRAMES */
262
263 /* $ Keywords */
264
265 /* EVENT */
266 /* EPHEMERIS */
267 /* GEOMETRY */
268 /* SEARCH */
269
270 /* $ Declarations */
271 /* $ Abstract */
272
273 /* This file contains public, global parameter declarations */
274 /* for the SPICELIB Geometry Finder (GF) subsystem. */
275
276 /* $ Disclaimer */
277
278 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
279 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
280 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
281 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
282 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
283 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
284 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
285 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
286 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
287 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
288
289 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
290 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
291 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
292 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
293 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
294 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
295
296 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
297 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
298 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
299 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
300
301 /* $ Required_Reading */
302
303 /* GF */
304
305 /* $ Keywords */
306
307 /* GEOMETRY */
308 /* ROOT */
309
310 /* $ Restrictions */
311
312 /* None. */
313
314 /* $ Author_and_Institution */
315
316 /* N.J. Bachman (JPL) */
317 /* L.E. Elson (JPL) */
318 /* E.D. Wright (JPL) */
319
320 /* $ Literature_References */
321
322 /* None. */
323
324 /* $ Version */
325
326 /* - SPICELIB Version 2.0.0 29-NOV-2016 (NJB) */
327
328 /* Upgraded to support surfaces represented by DSKs. */
329
330 /* Bug fix: removed declaration of NVRMAX parameter. */
331
332 /* - SPICELIB Version 1.3.0, 01-OCT-2011 (NJB) */
333
334 /* Added NWILUM parameter. */
335
336 /* - SPICELIB Version 1.2.0, 14-SEP-2010 (EDW) */
337
338 /* Added NWPA parameter. */
339
340 /* - SPICELIB Version 1.1.0, 08-SEP-2009 (EDW) */
341
342 /* Added NWRR parameter. */
343 /* Added NWUDS parameter. */
344
345 /* - SPICELIB Version 1.0.0, 21-FEB-2009 (NJB) (LSE) (EDW) */
346
347 /* -& */
348
349 /* Root finding parameters: */
350
351 /* CNVTOL is the default convergence tolerance used by the */
352 /* high-level GF search API routines. This tolerance is */
353 /* used to terminate searches for binary state transitions: */
354 /* when the time at which a transition occurs is bracketed */
355 /* by two times that differ by no more than CNVTOL, the */
356 /* transition time is considered to have been found. */
357
358 /* Units are TDB seconds. */
359
360
361 /* NWMAX is the maximum number of windows allowed for user-defined */
362 /* workspace array. */
363
364 /* DOUBLE PRECISION WORK ( LBCELL : MW, NWMAX ) */
365
366 /* Currently no more than twelve windows are required; the three */
367 /* extra windows are spares. */
368
369 /* Callers of GFEVNT can include this file and use the parameter */
370 /* NWMAX to declare the second dimension of the workspace array */
371 /* if necessary. */
372
373
374 /* Callers of GFIDST should declare their workspace window */
375 /* count using NWDIST. */
376
377
378 /* Callers of GFSEP should declare their workspace window */
379 /* count using NWSEP. */
380
381
382 /* Callers of GFRR should declare their workspace window */
383 /* count using NWRR. */
384
385
386 /* Callers of GFUDS should declare their workspace window */
387 /* count using NWUDS. */
388
389
390 /* Callers of GFPA should declare their workspace window */
391 /* count using NWPA. */
392
393
394 /* Callers of GFILUM should declare their workspace window */
395 /* count using NWILUM. */
396
397
398 /* ADDWIN is a parameter used to expand each interval of the search */
399 /* (confinement) window by a small amount at both ends in order to */
400 /* accommodate searches using equality constraints. The loaded */
401 /* kernel files must accommodate these expanded time intervals. */
402
403
404 /* FRMNLN is a string length for frame names. */
405
406
407 /* FOVTLN -- maximum length for FOV string. */
408
409
410 /* Specify the character strings that are allowed in the */
411 /* specification of field of view shapes. */
412
413
414 /* Character strings that are allowed in the */
415 /* specification of occultation types: */
416
417
418 /* Occultation target shape specifications: */
419
420
421 /* Specify the number of supported occultation types and occultation */
422 /* type string length: */
423
424
425 /* Instrument field-of-view (FOV) parameters */
426
427 /* Maximum number of FOV boundary vectors: */
428
429
430 /* FOV shape parameters: */
431
432 /* circle */
433 /* ellipse */
434 /* polygon */
435 /* rectangle */
436
437
438 /* End of file gf.inc. */
439
440 /* $ Abstract */
441
442 /* SPICE private include file intended solely for the support of */
443 /* SPICE routines. Users should not include this routine in their */
444 /* source code due to the volatile nature of this file. */
445
446 /* This file contains private, global parameter declarations */
447 /* for the SPICELIB Geometry Finder (GF) subsystem. */
448
449 /* $ Disclaimer */
450
451 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
452 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
453 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
454 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
455 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
456 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
457 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
458 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
459 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
460 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
461
462 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
463 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
464 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
465 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
466 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
467 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
468
469 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
470 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
471 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
472 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
473
474 /* $ Required_Reading */
475
476 /* GF */
477
478 /* $ Keywords */
479
480 /* GEOMETRY */
481 /* ROOT */
482
483 /* $ Restrictions */
484
485 /* None. */
486
487 /* $ Author_and_Institution */
488
489 /* N.J. Bachman (JPL) */
490 /* E.D. Wright (JPL) */
491
492 /* $ Literature_References */
493
494 /* None. */
495
496 /* $ Version */
497
498 /* - SPICELIB Version 1.0.0, 17-FEB-2009 (NJB) (EDW) */
499
500 /* -& */
501
502 /* The set of supported coordinate systems */
503
504 /* System Coordinates */
505 /* ---------- ----------- */
506 /* Rectangular X, Y, Z */
507 /* Latitudinal Radius, Longitude, Latitude */
508 /* Spherical Radius, Colatitude, Longitude */
509 /* RA/Dec Range, Right Ascension, Declination */
510 /* Cylindrical Radius, Longitude, Z */
511 /* Geodetic Longitude, Latitude, Altitude */
512 /* Planetographic Longitude, Latitude, Altitude */
513
514 /* Below we declare parameters for naming coordinate systems. */
515 /* User inputs naming coordinate systems must match these */
516 /* when compared using EQSTR. That is, user inputs must */
517 /* match after being left justified, converted to upper case, */
518 /* and having all embedded blanks removed. */
519
520
521 /* Below we declare names for coordinates. Again, user */
522 /* inputs naming coordinates must match these when */
523 /* compared using EQSTR. */
524
525
526 /* Note that the RA parameter value below matches */
527
528 /* 'RIGHT ASCENSION' */
529
530 /* when extra blanks are compressed out of the above value. */
531
532
533 /* Parameters specifying types of vector definitions */
534 /* used for GF coordinate searches: */
535
536 /* All string parameter values are left justified, upper */
537 /* case, with extra blanks compressed out. */
538
539 /* POSDEF indicates the vector is defined by the */
540 /* position of a target relative to an observer. */
541
542
543 /* SOBDEF indicates the vector points from the center */
544 /* of a target body to the sub-observer point on */
545 /* that body, for a given observer and target. */
546
547
548 /* SOBDEF indicates the vector points from the center */
549 /* of a target body to the surface intercept point on */
550 /* that body, for a given observer, ray, and target. */
551
552
553 /* Number of workspace windows used by ZZGFREL: */
554
555
556 /* Number of additional workspace windows used by ZZGFLONG: */
557
558
559 /* Index of "existence window" used by ZZGFCSLV: */
560
561
562 /* Progress report parameters: */
563
564 /* MXBEGM, */
565 /* MXENDM are, respectively, the maximum lengths of the progress */
566 /* report message prefix and suffix. */
567
568 /* Note: the sum of these lengths, plus the length of the */
569 /* "percent complete" substring, should not be long enough */
570 /* to cause wrap-around on any platform's terminal window. */
571
572
573 /* Total progress report message length upper bound: */
574
575
576 /* End of file zzgf.inc. */
577
578 /* $ Abstract */
579
580 /* Include file zzabcorr.inc */
581
582 /* SPICE private file intended solely for the support of SPICE */
583 /* routines. Users should not include this file directly due */
584 /* to the volatile nature of this file */
585
586 /* The parameters below define the structure of an aberration */
587 /* correction attribute block. */
588
589 /* $ Disclaimer */
590
591 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
592 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
593 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
594 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
595 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
596 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
597 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
598 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
599 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
600 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
601
602 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
603 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
604 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
605 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
606 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
607 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
608
609 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
610 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
611 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
612 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
613
614 /* $ Parameters */
615
616 /* An aberration correction attribute block is an array of logical */
617 /* flags indicating the attributes of the aberration correction */
618 /* specified by an aberration correction string. The attributes */
619 /* are: */
620
621 /* - Is the correction "geometric"? */
622
623 /* - Is light time correction indicated? */
624
625 /* - Is stellar aberration correction indicated? */
626
627 /* - Is the light time correction of the "converged */
628 /* Newtonian" variety? */
629
630 /* - Is the correction for the transmission case? */
631
632 /* - Is the correction relativistic? */
633
634 /* The parameters defining the structure of the block are as */
635 /* follows: */
636
637 /* NABCOR Number of aberration correction choices. */
638
639 /* ABATSZ Number of elements in the aberration correction */
640 /* block. */
641
642 /* GEOIDX Index in block of geometric correction flag. */
643
644 /* LTIDX Index of light time flag. */
645
646 /* STLIDX Index of stellar aberration flag. */
647
648 /* CNVIDX Index of converged Newtonian flag. */
649
650 /* XMTIDX Index of transmission flag. */
651
652 /* RELIDX Index of relativistic flag. */
653
654 /* The following parameter is not required to define the block */
655 /* structure, but it is convenient to include it here: */
656
657 /* CORLEN The maximum string length required by any aberration */
658 /* correction string */
659
660 /* $ Author_and_Institution */
661
662 /* N.J. Bachman (JPL) */
663
664 /* $ Literature_References */
665
666 /* None. */
667
668 /* $ Version */
669
670 /* - SPICELIB Version 1.0.0, 18-DEC-2004 (NJB) */
671
672 /* -& */
673 /* Number of aberration correction choices: */
674
675
676 /* Aberration correction attribute block size */
677 /* (number of aberration correction attributes): */
678
679
680 /* Indices of attributes within an aberration correction */
681 /* attribute block: */
682
683
684 /* Maximum length of an aberration correction string: */
685
686
687 /* End of include file zzabcorr.inc */
688
689 /* $ Brief_I/O */
690
691 /* VARIABLE I/O DESCRIPTION */
692 /* -------- --- -------------------------------------------------- */
693 /* UDSTEP I Name of the routine that computes and returns a */
694 /* time step. */
695 /* UDREFN I Name of the routine that computes a refined time. */
696 /* GQUANT I Type of geometric quantity. */
697 /* QNPARS I Number of quantity definition parameters. */
698 /* QPNAMS I Names of quantity definition parameters. */
699 /* QCPARS I Array of character quantity definition parameters. */
700 /* QDPARS I Array of double precision quantity definition */
701 /* parameters. */
702 /* QIPARS I Array of integer quantity definition parameters. */
703 /* QLPARS I Array of logical quantity definition parameters. */
704 /* OP I Operator that either looks for an extreme value */
705 /* (max, min, local, absolute) or compares the */
706 /* geometric quantity value and a number. */
707 /* REFVAL I Reference value. */
708 /* TOL I Convergence tolerance in seconds */
709 /* ADJUST I Absolute extremum adjustment value. */
710 /* CNFINE I SPICE window to which the search is restricted. */
711 /* RPT I Progress reporter on (.TRUE.) or off (.FALSE.) */
712 /* UDREPI I Function that initializes progress reporting. */
713 /* UDREPU I Function that updates the progress report. */
714 /* UDREPF I Function that finalizes progress reporting. */
715 /* MW I Size of workspace windows. */
716 /* NW I The number of workspace windows needed for the */
717 /* search. */
718 /* WORK I-O Array containing workspace windows. */
719 /* BAIL I Logical indicating program interrupt monitoring. */
720 /* UDBAIL I Name of a routine that signals a program interrupt. */
721 /* RESULT O SPICE window containing results. */
722
723
724 /* $ Detailed_Input */
725
726 /* UDSTEP the name of the user specified routine that computes */
727 /* a time step in an attempt to find a transition of the */
728 /* state of the specified coordinate. In the context */
729 /* of this routine's algorithm, a "state transition" */
730 /* occurs where the geometric state changes from being */
731 /* in the desired geometric condition event to not, */
732 /* or vice versa. */
733
734 /* This routine relies on UDSTEP returning step sizes */
735 /* small enough so that state transitions within the */
736 /* confinement window are not overlooked. There must */
737 /* never be two roots A and B separated by less than */
738 /* STEP, where STEP is the minimum step size returned by */
739 /* UDSTEP for any value of ET in the interval [A, B]. */
740
741 /* The calling sequence for UDSTEP is: */
742
743 /* CALL UDSTEP ( ET, STEP ) */
744
745 /* where: */
746
747 /* ET is the input start time from which the */
748 /* algorithm is to search forward for a state */
749 /* transition. ET is expressed as seconds past */
750 /* J2000 TDB. */
751
752 /* STEP is the output step size. STEP indicates */
753 /* how far to advance ET so that ET and */
754 /* ET+STEP may bracket a state transition and */
755 /* definitely do not bracket more than one */
756 /* state transition. Units are TDB seconds. */
757
758 /* If a constant step size is desired, the routine */
759
760 /* GFSTEP */
761
762 /* may be used. This is the default option. If using */
763 /* GFSTEP, the step size must be set by calling */
764
765 /* GFSSTP(STEP) */
766
767 /* prior to calling this routine. */
768
769 /* UDREFN the name of the user specified routine that computes */
770 /* a refinement in the times that bracket a transition */
771 /* point. In other words, once a pair of times have been */
772 /* detected such that the system is in different states at */
773 /* each of the two times, UDREFN selects an intermediate */
774 /* time which should be closer to the transition state */
775 /* than one of the two known times. */
776
777 /* The calling sequence for UDREFN is: */
778
779 /* CALL UDREFN ( T1, T2, S1, S2, T ) */
780
781 /* where the inputs are: */
782
783 /* T1 is a time when the system is in state S1. T1 */
784 /* is expressed as seconds past J2000 TDB. */
785
786 /* T2 is a time when the system is in state S2. T2 */
787 /* is expressed as seconds past J2000 TDB. T2 */
788 /* is assumed to be larger than T1. */
789
790 /* S1 is the state of the system at time T1. */
791 /* S1 is a LOGICAL value. */
792
793 /* S2 is the state of the system at time T2. */
794 /* S2 is a LOGICAL value. */
795
796 /* UDREFN may use or ignore the S1 and S2 values. */
797
798 /* The output is: */
799
800 /* T is next time to check for a state transition. */
801 /* T has value between T1 and T2. T is */
802 /* expressed as seconds past J2000 TDB. */
803
804 /* If a simple bisection method is desired, the routine */
805
806 /* GFREFN */
807
808 /* may be used. This is the default option. */
809
810 /* GQUANT is a string containing the name of a geometric */
811 /* quantity. The times when this quantity satisfies */
812 /* a condition specified by the arguments OP */
813 /* and ADJUST (described below) are to be found. */
814
815 /* Each quantity is specified by the quantity name */
816 /* given in argument GQUANT, and by a set of parameters */
817 /* specified by the arguments */
818
819 /* QNPARS */
820 /* QPNAMS */
821 /* QCPARS */
822 /* QDPARS */
823 /* QIPARS */
824 /* QLPARS */
825
826 /* For each quantity listed here, we also show how to */
827 /* set up the input arguments to define the quantity. */
828 /* See the detailed discussion of these arguments */
829 /* below for further information. */
830
831 /* GQUANT may be any of the strings: */
832
833 /* 'ANGULAR SEPARATION' */
834 /* 'COORDINATE' */
835 /* 'DISTANCE' */
836 /* 'ILLUMINATION ANGLE' */
837 /* 'PHASE ANGLE' */
838 /* 'RANGE RATE' */
839
840 /* GQUANT strings are case insensitive. Values, */
841 /* meanings, and associated parameters are discussed */
842 /* below. */
843
844 /* The aberration correction parameter indicates the */
845 /* aberration corrections to be applied to the state of */
846 /* the target body to account for one-way light time and */
847 /* stellar aberration. If relevant, it applies to the */
848 /* rotation of the target body as well. */
849
850 /* Supported aberration correction options for */
851 /* observation (case where radiation is received by */
852 /* observer at ET) are: */
853
854 /* 'NONE' No correction. */
855 /* 'LT' Light time only. */
856 /* 'LT+S' Light time and stellar aberration. */
857 /* 'CN' Converged Newtonian (CN) light time. */
858 /* 'CN+S' CN light time and stellar aberration. */
859
860 /* Supported aberration correction options for */
861 /* transmission (case where radiation is emitted from */
862 /* observer at ET) are: */
863
864 /* 'XLT' Light time only. */
865 /* 'XLT+S' Light time and stellar aberration. */
866 /* 'XCN' Converged Newtonian (CN) light time. */
867 /* 'XCN+S' CN light time and stellar aberration. */
868
869 /* For detailed information, see the geometry finder */
870 /* required reading, gf.req. */
871
872 /* Case, leading and trailing blanks are not significant */
873 /* in aberration correction parameter strings. */
874
875
876 /* ANGULAR SEPARATION */
877
878 /* is the apparent angular separation of two target */
879 /* bodies as seen from an observing body. */
880
881 /* Quantity Parameters: */
882
883 /* QNPARS = 8 */
884 /* QPNAMS(1) = 'TARGET1' */
885 /* QPNAMS(2) = 'FRAME1' */
886 /* QPNAMS(3) = 'SHAPE1' */
887 /* QPNAMS(4) = 'TARGET2' */
888 /* QPNAMS(5) = 'FRAME2' */
889 /* QPNAMS(6) = 'SHAPE2' */
890 /* QPNAMS(7) = 'OBSERVER' */
891 /* QPNAMS(8) = 'ABCORR' */
892
893 /* QCPARS(1) = <name of first target> */
894 /* QCPARS(2) = <name of body-fixed frame */
895 /* of first target> */
896 /* QCPARS(3) = <shape of first target> */
897 /* QCPARS(4) = <name of second target> */
898 /* QCPARS(5) = <name of body-fixed frame */
899 /* of second target> */
900 /* QCPARS(6) = <shape of second target> */
901 /* QCPARS(7) = <name of observer> */
902 /* QCPARS(8) = <aberration correction> */
903
904 /* The target shape model specifiers may be set to */
905 /* either of the values */
906
907 /* 'POINT' */
908 /* 'SPHERE' */
909
910 /* The shape models for the two bodies need not match. */
911
912 /* Spherical models have radii equal to the longest */
913 /* equatorial radius of the PCK-based tri-axial */
914 /* ellipsoids used to model the respective bodies. */
915 /* When both target bodies are modeled as spheres, the */
916 /* angular separation between the bodies is the angle */
917 /* between the closest points on the limbs of the */
918 /* spheres, as viewed from the vantage point of the */
919 /* observer. If the limbs overlap, the angular */
920 /* separation is negative. */
921
922 /* (In this case, the angular separation is the angle */
923 /* between the centers of the spheres minus the sum of */
924 /* the apparent angular radii of the spheres.) */
925
926
927 /* COORDINATE */
928
929 /* is a coordinate of a specified vector in a specified */
930 /* reference frame and coordinate system. For example, */
931 /* a coordinate can be the Z component of the earth-sun */
932 /* vector in the J2000 reference frame, or the latitude */
933 /* of the nearest point on Mars to an orbiting */
934 /* spacecraft, expressed relative to the IAU_MARS */
935 /* reference frame. */
936
937 /* The method by which the vector is defined is */
938 /* indicated by the */
939
940 /* 'VECTOR DEFINITION' */
941
942 /* parameter. Allowed values and meanings of this */
943 /* parameter are: */
944
945 /* 'POSITION' */
946
947 /* The vector is defined by the */
948 /* position of a target relative to */
949 /* an observer. */
950
951 /* 'SUB-OBSERVER POINT' */
952
953 /* The vector is the sub-observer point */
954 /* on a specified target body. */
955
956 /* 'SURFACE INTERCEPT POINT' */
957
958 /* The vector is defined as the */
959 /* intercept point of a vector from the */
960 /* observer to the target body. */
961
962 /* Some vector definitions such as the sub-observer */
963 /* point may be specified by a variety of methods, so */
964 /* a parameter is provided to select the computation */
965 /* method. The computation method parameter name is */
966
967 /* 'METHOD' */
968
969 /* If the vector definition is */
970
971 /* 'POSITION' */
972
973 /* the METHOD parameter must be set to blank: */
974
975 /* ' ' */
976
977 /* If the vector definition is */
978
979 /* 'SUB-OBSERVER POINT' */
980
981 /* the METHOD parameter must be set to either: */
982
983 /* 'Near point: ellipsoid' */
984 /* 'Intercept: ellipsoid' */
985
986 /* If the vector definition is */
987
988 /* 'SURFACE INTERCEPT POINT' */
989
990 /* the METHOD parameter must be set to: */
991
992 /* 'Ellipsoid' */
993
994 /* The intercept computation uses */
995 /* a triaxial ellipsoid to model */
996 /* the surface of the target body. */
997 /* The ellipsoid's radii must be */
998 /* available in the kernel pool. */
999
1000 /* The supported coordinate systems and coordinate */
1001 /* names: */
1002
1003 /* Coordinate System Coordinates Range */
1004
1005 /* 'RECTANGULAR' 'X' */
1006 /* 'Y' */
1007 /* 'Z' */
1008
1009 /* 'LATITUDINAL' 'RADIUS' */
1010 /* 'LONGITUDE' (-Pi,Pi] */
1011 /* 'LATITUDE' [-Pi/2,Pi/2] */
1012
1013 /* 'RA/DEC' 'RANGE' */
1014 /* 'RIGHT ASCENSION' [0,2Pi) */
1015 /* 'DECLINATION' [-Pi/2,Pi/2] */
1016
1017 /* 'SPHERICAL' 'RADIUS' */
1018 /* 'COLATITUDE' [0,Pi] */
1019 /* 'LONGITUDE' (-Pi,Pi] */
1020
1021 /* 'CYLINDRICAL' 'RADIUS' */
1022 /* 'LONGITUDE' [0,2Pi) */
1023 /* 'Z' */
1024
1025 /* 'GEODETIC' 'LONGITUDE' (-Pi,Pi] */
1026 /* 'LATITUDE' [-Pi/2,Pi/2] */
1027 /* 'ALTITUDE' */
1028
1029 /* 'PLANETOGRAPHIC' 'LONGITUDE' [0,2Pi) */
1030 /* 'LATITUDE' [-Pi/2,Pi/2] */
1031 /* 'ALTITUDE' */
1032
1033 /* When geodetic coordinates are selected, the radii */
1034 /* used are those of the central body associated with */
1035 /* the reference frame. For example, if IAU_MARS is the */
1036 /* reference frame, then geodetic coordinates are */
1037 /* calculated using the radii of Mars taken from a */
1038 /* SPICE planetary constants kernel. One cannot ask for */
1039 /* geodetic coordinates for a frame which doesn't have */
1040 /* an extended body as its center. */
1041
1042 /* Reference frame names must be recognized by the */
1043 /* SPICE frame subsystem. */
1044
1045 /* Quantity Parameters: */
1046
1047 /* QNPARS = 10 */
1048 /* QPNAMS(1) = 'TARGET' */
1049 /* QPNAMS(2) = 'OBSERVER' */
1050 /* QPNAMS(3) = 'ABCORR' */
1051 /* QPNAMS(4) = 'COORDINATE SYSTEM' */
1052 /* QPNAMS(5) = 'COORDINATE' */
1053 /* QPNAMS(6) = 'REFERENCE FRAME' */
1054 /* QPNAMS(7) = 'VECTOR DEFINITION' */
1055 /* QPNAMS(8) = 'METHOD' */
1056 /* QPNAMS(9) = 'DREF' */
1057 /* QPNAMS(10) = 'DVEC' */
1058
1059 /* Only 'SURFACE INTERCEPT POINT' searches make */
1060 /* use of the DREF and DVEC parameters. */
1061
1062 /* QCPARS(1) = <name of target> */
1063 /* QCPARS(2) = <name of observer> */
1064 /* QCPARS(3) = <aberration correction> */
1065 /* QCPARS(4) = <coordinate system name> */
1066 /* QCPARS(5) = <coordinate name> */
1067 /* QCPARS(6) = <body reference frame name> */
1068 /* QCPARS(7) = <vector definition> */
1069 /* QCPARS(8) = <computation method> */
1070 /* QCPARS(9) = <reference frame of DVEC pointing */
1071 /* vector, defined in QDPAR> */
1072
1073 /* QDPARS(1) = <DVEC pointing vector x component */
1074 /* from observer> */
1075 /* QDPARS(2) = <DVEC pointing vector y component */
1076 /* from observer> */
1077 /* QDPARS(3) = <DVEC pointing vector z component */
1078 /* from observer> */
1079
1080 /* DISTANCE */
1081
1082 /* is the apparent distance between a target body and */
1083 /* an observing body. Distances are always measured */
1084 /* between centers of mass. */
1085
1086 /* Quantity Parameters: */
1087
1088 /* QNPARS = 3 */
1089 /* QPNAMS(1) = 'TARGET' */
1090 /* QPNAMS(2) = 'OBSERVER' */
1091 /* QPNAMS(3) = 'ABCORR' */
1092
1093 /* QCPARS(1) = <name of target> */
1094 /* QCPARS(2) = <name of observer> */
1095 /* QCPARS(3) = <aberration correction> */
1096
1097
1098 /* ILLUMINATION ANGLE */
1099
1100 /* is any of the illumination angles */
1101
1102 /* emission */
1103 /* phase */
1104 /* solar incidence */
1105
1106 /* defined at a surface point on a target body. */
1107 /* These angles are defined as in the SPICELIB */
1108 /* routine ILUMIN. */
1109
1110 /* Quantity Parameters: */
1111
1112 /* QNPARS = 8 */
1113 /* QPNAMS(1) = 'TARGET' */
1114 /* QPNAMS(2) = 'ILLUM' */
1115 /* QPNAMS(3) = 'OBSERVER' */
1116 /* QPNAMS(4) = 'ABCORR' */
1117 /* QPNAMS(5) = 'FRAME' */
1118 /* QPNAMS(6) = 'ANGTYP' */
1119 /* QPNAMS(7) = 'METHOD' */
1120 /* QPNAMS(8) = 'SPOINT' */
1121
1122 /* QCPARS(1) = <name of target> */
1123 /* QCPARS(1) = <name of illumination source> */
1124 /* QCPARS(3) = <name of observer> */
1125 /* QCPARS(4) = <aberration correction> */
1126 /* QCPARS(5) = <target body-fixed frame> */
1127 /* QCPARS(6) = <type of illumination angle> */
1128 /* QCPARS(7) = <computation method> */
1129
1130 /* The surface point is specified using rectangular */
1131 /* coordinates in the specified body-fixed frame. */
1132
1133 /* QDPARS(1) = <X coordinate of surface point> */
1134 /* QDPARS(2) = <Y coordinate of surface point> */
1135 /* QDPARS(3) = <Z coordinate of surface point> */
1136
1137 /* PHASE ANGLE */
1138
1139 /* is the apparent phase angle between a target body */
1140 /* center and an illuminating body center as seen from */
1141 /* an observer. */
1142
1143 /* Quantity Parameters: */
1144
1145 /* QNPARS = 4 */
1146 /* QPNAMS(1) = 'TARGET' */
1147 /* QPNAMS(2) = 'OBSERVER' */
1148 /* QPNAMS(3) = 'ABCORR' */
1149 /* QPNAMS(4) = 'ILLUM' */
1150
1151 /* QCPARS(1) = <name of target> */
1152 /* QCPARS(2) = <name of observer> */
1153 /* QCPARS(3) = <aberration correction> */
1154 /* QCPARS(4) = <name of illuminating body> */
1155
1156
1157 /* RANGE RATE */
1158
1159 /* is the apparent range rate between a target body */
1160 /* and an observing body. */
1161
1162 /* Quantity Parameters: */
1163
1164 /* QNPARS = 3 */
1165 /* QPNAMS(1) = 'TARGET' */
1166 /* QPNAMS(2) = 'OBSERVER' */
1167 /* QPNAMS(3) = 'ABCORR' */
1168
1169 /* QCPARS(1) = <name of target> */
1170 /* QCPARS(2) = <name of observer> */
1171 /* QCPARS(3) = <aberration correction> */
1172
1173
1174
1175 /* QNPARS is the count of quantity parameter definition */
1176 /* parameters. These parameters supply the quantity- */
1177 /* specific information needed to fully define the */
1178 /* quantity used in the search performed by this routine. */
1179
1180 /* QPNAMS is an array of names of quantity definition parameters. */
1181 /* The names occupy elements 1:QNPARS of this array. */
1182 /* The value associated with the Ith element of QPNAMS */
1183 /* is located in element I of the parameter value argument */
1184 /* having data type appropriate for the parameter: */
1185
1186 /* Data Type Argument */
1187 /* --------- -------- */
1188 /* Character strings QCPARS */
1189 /* Double precision numbers QDPARS */
1190 /* Integers QIPARS */
1191 /* Logicals QLPARS */
1192
1193 /* The order in which the parameter names are listed */
1194 /* is unimportant, as long as the corresponding */
1195 /* parameter values are listed in the same order. */
1196
1197 /* The names in QPNAMS are case-insensitive. */
1198
1199 /* See the description of the input argument GQUANT */
1200 /* for a discussion of the parameter names and values */
1201 /* associated with a given quantity. */
1202
1203 /* QCPARS, */
1204 /* QDPARS, */
1205 /* QIPARS, */
1206 /* QLPARS are, respectively, parameter value arrays of types */
1207
1208 /* CHARACTER*(*) QCPARS */
1209 /* DOUBLE PRECISION QDPARS */
1210 /* INTEGER QIPARS */
1211 /* LOGICAL QLPARS */
1212
1213 /* The value associated with the Ith name in the array */
1214 /* QPNAMS resides in the Ith element of whichever of */
1215 /* these arrays has the appropriate data type. */
1216
1217 /* All of these arrays should be declared with dimension */
1218 /* at least QNPARS. */
1219
1220 /* The names in the array QCPARS are case-insensitive. */
1221
1222 /* Note that there is no required order for QPNAMS/Q*PARS */
1223 /* pairs. */
1224
1225 /* See the description of the input argument GQUANT */
1226 /* for a discussion of the parameter names and values */
1227 /* associated with a given quantity. */
1228
1229 /* OP is a scalar string comparison operator indicating */
1230 /* the numeric constraint of interest. Values are: */
1231
1232 /* '>' value of geometric quantity greater than some */
1233 /* reference (REFVAL). */
1234
1235 /* '=' value of geometric quantity equal to some */
1236 /* reference (REFVAL). */
1237
1238 /* '<' value of geometric quantity less than some */
1239 /* reference (REFVAL). */
1240
1241 /* 'ABSMAX' The geometric quantity is at an absolute */
1242 /* maximum. */
1243
1244 /* 'ABSMIN' The geometric quantity is at an absolute */
1245 /* minimum. */
1246
1247 /* 'LOCMAX' The geometric quantity is at a local */
1248 /* maximum. */
1249
1250 /* 'LOCMIN' The geometric quantity is at a local */
1251 /* minimum. */
1252
1253 /* The caller may indicate that the region of interest */
1254 /* is the set of time intervals where the quantity is */
1255 /* within a specified distance of an absolute extremum. */
1256 /* The argument ADJUST (described below) is used to */
1257 /* specified this distance. */
1258
1259 /* Local extrema are considered to exist only in the */
1260 /* interiors of the intervals comprising the confinement */
1261 /* window: a local extremum cannot exist at a boundary */
1262 /* point of the confinement window. */
1263
1264 /* Case is not significant in the string OP. */
1265
1266 /* REFVAL is the reference value used to define an equality or */
1267 /* inequality to be satisfied by the geometric quantity. */
1268 /* The units of REFVAL are radians, radians/sec, km, or */
1269 /* km/sec as appropriate. */
1270
1271 /* TOL is a tolerance value used to determine convergence of */
1272 /* root-finding operations. TOL is measured in ephemeris */
1273 /* seconds and must be greater than zero. */
1274
1275 /* ADJUST the amount by which the quantity is allowed to vary */
1276 /* from an absolute extremum. */
1277
1278 /* If the search is for an absolute minimum is performed, */
1279 /* the resulting window contains time intervals when the */
1280 /* geometric quantity 'gquant' has values between */
1281 /* ABSMIN and ABSMIN + 'adjust'. */
1282
1283 /* If the search is for an absolute maximum, the */
1284 /* corresponding range is between ABSMAX - 'adjust' and */
1285 /* ABSMAX. */
1286
1287 /* ADJUST is not used for searches for local extrema, */
1288 /* equality or inequality conditions and must have value */
1289 /* zero for such searches. ADJUST must not be */
1290 /* negative. */
1291
1292 /* CNFINE is a SPICE window that confines the time period over */
1293 /* which the specified search is conducted. CNFINE may */
1294 /* consist of a single interval or a collection of */
1295 /* intervals. */
1296
1297 /* In some cases the confinement window can be used to */
1298 /* greatly reduce the time period that must be searched */
1299 /* for the desired solution. See the Particulars section */
1300 /* below for further discussion. */
1301
1302 /* See the Examples section below for a code example */
1303 /* that shows how to create a confinement window. */
1304
1305 /* CNFINE must be initialized by the caller via the */
1306 /* SPICELIB routine SSIZED. */
1307
1308 /* RPT is a logical variable which controls whether the */
1309 /* progress reporter is enabled. When RPT is TRUE, */
1310 /* progress reporting is enabled and the routines */
1311 /* UDREPI, UDREPU, and UDREPF (see descriptions below) */
1312 /* are used to report progress. */
1313
1314 /* UDREPI the name of the user specified routine that initializes */
1315 /* a progress report. When progress reporting is */
1316 /* enabled, UDREPI is called at the start */
1317 /* of a search. The calling sequence of UDREPI is */
1318
1319 /* UDREPI ( CNFINE, SRCPRE, SRCSUF ) */
1320
1321 /* DOUBLE PRECISION CNFINE ( LBCELL : * ) */
1322 /* CHARACTER*(*) SRCPRE */
1323 /* CHARACTER*(*) SRCSUF */
1324
1325 /* where */
1326
1327 /* CNFINE */
1328
1329 /* is a confinement window specifying the time period */
1330 /* over which a search is conducted, and */
1331
1332 /* SRCPRE */
1333 /* SRCSUF */
1334
1335 /* are prefix and suffix strings used in the progress */
1336 /* report: these strings are intended to bracket a */
1337 /* representation of the fraction of work done. For */
1338 /* example, when the progress reporting functions */
1339 /* are used, if SRCPRE and SRCSUF are, respectively, */
1340
1341 /* 'Occultation/transit search' */
1342 /* 'done.' */
1343
1344 /* the progress report display at the end of */
1345 /* the search will be: */
1346
1347 /* Occultation/transit search 100.00% done. */
1348
1349 /* If the user doesn't wish to provide a custom set of */
1350 /* progress reporting functions, the routine */
1351
1352 /* GFREPI */
1353
1354 /* may be used. */
1355
1356 /* UDREPU the name of the user specified routine that updates */
1357 /* the progress report for a search. The calling sequence */
1358 /* of UDREPU is */
1359
1360 /* UDREPU (IVBEG, IVEND, ET ) */
1361
1362 /* DOUBLE PRECISION ET */
1363 /* DOUBLE PRECISION IVBEG */
1364 /* DOUBLE PRECISION IVEND */
1365
1366 /* where ET is an epoch belonging to the confinement */
1367 /* window, IVBEG and IVEND are the start and stop times, */
1368 /* respectively of the current confinement window */
1369 /* interval. The ratio of the measure of the portion */
1370 /* of CNFINE that precedes ET to the measure of CNFINE */
1371 /* would be a logical candidate for the searches */
1372 /* completion percentage; however the method of */
1373 /* measurement is up to the user. */
1374
1375 /* If the user doesn't wish to provide a custom set of */
1376 /* progress reporting functions, the routine */
1377
1378 /* GFREPU */
1379
1380 /* may be used. */
1381
1382 /* UDREPF the name of the user specified routine that finalizes */
1383 /* a progress report. UDREPF has no arguments. */
1384
1385 /* If the user doesn't wish to provide a custom set of */
1386 /* progress reporting functions, the routine */
1387
1388 /* GFREPF */
1389
1390 /* may be used. */
1391
1392 /* MW is a parameter specifying the length of the SPICE */
1393 /* windows in the workspace array WORK (see description */
1394 /* below) used by this routine. */
1395
1396 /* MW should be set to a number at least twice as large */
1397 /* as the maximum number of intervals required by any */
1398 /* workspace window. In many cases, it's not necessary to */
1399 /* compute an accurate estimate of how many intervals are */
1400 /* needed; rather, the user can pick a size considerably */
1401 /* larger than what's really required. */
1402
1403 /* However, since excessively large arrays can prevent */
1404 /* applications from compiling, linking, or running */
1405 /* properly, sometimes MW must be set according to */
1406 /* the actual workspace requirement. A rule of thumb */
1407 /* for the number of intervals NINTVLS needed is */
1408
1409 /* NINTVLS = 2*N + ( M / STEP ) */
1410
1411 /* where */
1412
1413 /* N is the number of intervals in the confinement */
1414 /* window */
1415
1416 /* M is the measure of the confinement window, in */
1417 /* units of seconds */
1418
1419 /* STEP is the search step size in seconds */
1420
1421 /* MW should then be set to */
1422
1423 /* 2 * NINTVLS */
1424
1425 /* NW is a parameter specifying the number of SPICE windows */
1426 /* in the workspace array WORK (see description below) */
1427 /* used by this routine. (The reason this dimension is */
1428 /* an input argument is that this allows run-time */
1429 /* error checking to be performed.) */
1430
1431 /* WORK is an array used to store workspace windows. This */
1432 /* array should be declared by the caller as shown: */
1433
1434 /* DOUBLE PRECISION WORK ( LBCELL : MW, NW ) */
1435
1436 /* WORK need not be initialized by the caller. */
1437
1438 /* BAIL is a logical indicating whether or not interrupt */
1439 /* signaling is enabled. When `bail' is set to TRUE, */
1440 /* the input function UDBAIL (see description below) */
1441 /* is used to determine whether an interrupt has been */
1442 /* issued. */
1443
1444 /* UDBAIL the name of the user specified routine that */
1445 /* indicates whether an interrupt signal has been */
1446 /* issued (for example, from the keyboard). UDBAIL */
1447 /* has no arguments and returns a LOGICAL value. */
1448 /* The return value is .TRUE. if an interrupt has */
1449 /* been issued; otherwise the value is .FALSE. */
1450
1451 /* GFEVNT uses UDBAIL only when BAIL (see above) is set */
1452 /* to .TRUE., indicating that interrupt handling is */
1453 /* enabled. When interrupt handling is enabled, GFEVNT */
1454 /* and routines in its call tree will call UDBAIL to */
1455 /* determine whether to terminate processing and return */
1456 /* immediately. */
1457
1458 /* If interrupt handing is not enabled, a logical */
1459 /* function must still be passed as an input argument. */
1460 /* The function */
1461
1462 /* GFBAIL */
1463
1464 /* may be used for this purpose. */
1465
1466 /* $ Detailed_Output */
1467
1468 /* WORK has undefined contents on output. */
1469
1470 /* RESULT is a SPICE window representing the set of time */
1471 /* intervals, within the confinement period, when the */
1472 /* specified geometric event occurs. */
1473
1474 /* If RESULT is non-empty on input, its contents */
1475 /* will be discarded before GFEVNT conducts its */
1476 /* search. */
1477
1478 /* RESULT must be initialized by the caller via the */
1479 /* SPICELIB routine SSIZED. */
1480
1481 /* $ Parameters */
1482
1483 /* LBCELL is the SPICELIB cell lower bound. */
1484
1485 /* $ Exceptions */
1486
1487 /* 1) There are varying requirements on how distinct the three */
1488 /* objects, QCPARS, must be. If the requirements are not met, */
1489 /* the error, SPICE(BODIESNOTDISTINCT) is signaled. */
1490
1491 /* When GQUANT has value 'ANGULAR SEPARATION' then all three */
1492 /* must be distinct. */
1493
1494 /* When GQUANT has value of either */
1495
1496 /* 'DISTANCE' */
1497 /* 'COORDINATE' */
1498 /* 'RANGE RATE' */
1499
1500 /* the QCPARS(1) and QCPARS(2) objects must be distinct. */
1501
1502 /* 2) If any of the bodies involved do not have NAIF ID codes, the */
1503 /* error SPICE(IDCODENOTFOUND) will be signaled. */
1504
1505 /* 3) If the value of GQUANT is not recognized as a valid value, */
1506 /* the error SPICE(NOTRECOGNIZED) will be signaled. */
1507
1508 /* 4) If the number of quantity definition parameters, QNPARS is */
1509 /* greater than the maximum allowed value, MAXPAR, the error */
1510 /* SPICE(INVALIDCOUNT) will be signaled. */
1511
1512 /* 5) If the proper required parameters, QPARS, are not supplied, */
1513 /* the error SPICE(MISSINGVALUE) will be signaled. */
1514
1515 /* 6) If the comparison operator, OP, is not recognized, the error */
1516 /* SPICE(NOTRECOGNIZED) is signaled. */
1517
1518 /* 7) If the sizes of the workspace windows are too small, */
1519 /* the error SPICE(ARRAYTOOSMALL) is signaled by routines */
1520 /* called by this routine. */
1521
1522 /* 8) If TOL is not greater than zero, the error */
1523 /* SPICE(INVALIDTOLERANCE) is signaled by routines called by */
1524 /* this routine. */
1525
1526 /* 9) If ADJUST is negative, the error SPICE(VALUEOUTOFRANGE) will */
1527 /* signal from a routine in the call tree of this routine. */
1528
1529 /* A non-zero value for ADJUST when OP has any value other than */
1530 /* "ABSMIN" or "ABSMAX" causes the error SPICE(INVALIDVALUE) to */
1531 /* signal from a routine in the call tree of this routine. */
1532
1533 /* 10) The user must take care when searching for an extremum */
1534 /* (ABSMAX, ABSMIN, LOCMAX, LOCMIN) of an angular quantity. */
1535 /* Problems are most common when using the COORDINATE value of */
1536 /* GQUANT with LONGITUDE or RIGHT ASCENSION values for the */
1537 /* coordinate name. Since these quantities are cyclical, rather */
1538 /* than monotonically increasing or decreasing, an extremum may */
1539 /* be hard to interpret. In particular, if an extremum is found */
1540 /* near the cycle boundary (- PI for longitude, 2 PI for */
1541 /* RIGHT ASCENSION) it may not be numerically reasonable. For */
1542 /* example, the search for times when a longitude coordinate is */
1543 /* at its absolute maximum may result in a time when the */
1544 /* longitude value is - PI, due to roundoff error. */
1545
1546 /* $ Files */
1547
1548 /* Appropriate SPK and PCK kernels must be loaded by the */
1549 /* calling program before this routine is called. */
1550
1551 /* The following data are required: */
1552
1553 /* - SPK data: ephemeris data for target, source and observer that */
1554 /* describes the ephemeris of these objects for the period */
1555 /* defined by the confinement window, CNFINE must be */
1556 /* loaded. If aberration corrections are used, the states of */
1557 /* target and observer relative to the solar system barycenter */
1558 /* must be calculable from the available ephemeris data. */
1559 /* Typically ephemeris data are made available by loading one */
1560 /* or more SPK files via FURNSH. */
1561
1562 /* - PCK data: bodies are assumed to be spherical and must have a */
1563 /* radius loaded from the kernel pool. Typically this is done by */
1564 /* loading a text PCK file via FURNSH. If the bodies are */
1565 /* triaxial, the largest radius is chosen as that of the */
1566 /* equivalent spherical body. */
1567
1568 /* In all cases, kernel data are normally loaded once per program */
1569 /* run, NOT every time this routine is called. */
1570
1571 /* $ Particulars */
1572
1573 /* This routine provides the SPICE GF subsystem's general interface */
1574 /* to determines time intervals when the value of some */
1575 /* geometric quantity related to one or more objects and an observer */
1576 /* satisfies a user specified constraint. It puts these times in a */
1577 /* result window called RESULT. It does this by first finding */
1578 /* windows when the quantity of interest is either monotonically */
1579 /* increasing or decreasing. These windows are then manipulated to */
1580 /* give the final result. */
1581
1582 /* Applications that require do not require support for progress */
1583 /* reporting, interrupt handling, non-default step or refinement */
1584 /* functions, or non-default convergence tolerance normally should */
1585 /* call a high level geometry quantity routine rather than */
1586 /* this routine. */
1587
1588 /* The Search Process */
1589 /* ================== */
1590
1591 /* Regardless of the type of constraint selected by the caller, this */
1592 /* routine starts the search for solutions by determining the time */
1593 /* periods, within the confinement window, over which the specified */
1594 /* geometric quantity function is monotone increasing and monotone */
1595 /* decreasing. Each of these time periods is represented by a SPICE */
1596 /* window. Having found these windows, all of the quantity */
1597 /* function's local extrema within the confinement window are known. */
1598 /* Absolute extrema then can be found very easily. */
1599
1600 /* Within any interval of these "monotone" windows, there will be at */
1601 /* most one solution of any equality constraint. Since the boundary */
1602 /* of the solution set for any inequality constraint is contained in */
1603 /* the union of */
1604
1605 /* - the set of points where an equality constraint is met */
1606 /* - the boundary points of the confinement window */
1607
1608 /* the solutions of both equality and inequality constraints can be */
1609 /* found easily once the monotone windows have been found. */
1610
1611
1612 /* Step Size */
1613 /* ========= */
1614
1615 /* The monotone windows (described above) are found using a two-step */
1616 /* search process. Each interval of the confinement window is */
1617 /* searched as follows: first, the input step size is used to */
1618 /* determine the time separation at which the sign of the rate of */
1619 /* change of quantity function will be sampled. Starting at */
1620 /* the left endpoint of an interval, samples will be taken at each */
1621 /* step. If a change of sign is found, a root has been bracketed; at */
1622 /* that point, the time at which the time derivative of the quantity */
1623 /* function is zero can be found by a refinement process, for */
1624 /* example, using a binary search. */
1625
1626 /* Note that the optimal choice of step size depends on the lengths */
1627 /* of the intervals over which the quantity function is monotone: */
1628 /* the step size should be shorter than the shortest of these */
1629 /* intervals (within the confinement window). */
1630
1631 /* The optimal step size is *not* necessarily related to the lengths */
1632 /* of the intervals comprising the result window. For example, if */
1633 /* the shortest monotone interval has length 10 days, and if the */
1634 /* shortest result window interval has length 5 minutes, a step size */
1635 /* of 9.9 days is still adequate to find all of the intervals in the */
1636 /* result window. In situations like this, the technique of using */
1637 /* monotone windows yields a dramatic efficiency improvement over a */
1638 /* state-based search that simply tests at each step whether the */
1639 /* specified constraint is satisfied. The latter type of search can */
1640 /* miss solution intervals if the step size is longer than the */
1641 /* shortest solution interval. */
1642
1643 /* Having some knowledge of the relative geometry of the targets and */
1644 /* observer can be a valuable aid in picking a reasonable step size. */
1645 /* In general, the user can compensate for lack of such knowledge by */
1646 /* picking a very short step size; the cost is increased computation */
1647 /* time. */
1648
1649 /* Note that the step size is not related to the precision with which */
1650 /* the endpoints of the intervals of the result window are computed. */
1651 /* That precision level is controlled by the convergence tolerance. */
1652
1653
1654 /* Convergence Tolerance */
1655 /* ===================== */
1656
1657 /* Once a root has been bracketed, a refinement process is used to */
1658 /* narrow down the time interval within which the root must lie. */
1659 /* This refinement process terminates when the location of the root */
1660 /* has been determined to within an error margin called the */
1661 /* "convergence tolerance," passed to this routine as 'tol'. */
1662
1663 /* The GF subsystem defines a parameter, CNVTOL (from gf.inc), as a */
1664 /* default tolerance. This represents a "tight" tolerance value */
1665 /* so that the tolerance doesn't become the limiting factor in the */
1666 /* accuracy of solutions found by this routine. In general the */
1667 /* accuracy of input data will be the limiting factor. */
1668
1669 /* Making the tolerance tighter than CNVTOL is unlikely to */
1670 /* be useful, since the results are unlikely to be more accurate. */
1671 /* Making the tolerance looser will speed up searches somewhat, */
1672 /* since a few convergence steps will be omitted. However, in most */
1673 /* cases, the step size is likely to have a much greater affect */
1674 /* on processing time than would the convergence tolerance. */
1675
1676
1677 /* The Confinement Window */
1678 /* ====================== */
1679
1680 /* The simplest use of the confinement window is to specify a time */
1681 /* interval within which a solution is sought. However, the */
1682 /* confinement window can, in some cases, be used to make searches */
1683 /* more efficient. Sometimes it's possible to do an efficient search */
1684 /* to reduce the size of the time period over which a relatively */
1685 /* slow search of interest must be performed. */
1686
1687 /* $ Examples */
1688
1689 /* The numerical results shown for these examples may differ across */
1690 /* platforms. The results depend on the SPICE kernels used as */
1691 /* input, the compiler and supporting libraries, and the machine */
1692 /* specific arithmetic implementation. */
1693
1694 /* Conduct a DISTANCE search using the default GF progress reporting */
1695 /* capability. */
1696
1697 /* The program will use console I/O to display a simple */
1698 /* ASCII-based progress report. */
1699
1700 /* The program will find local maximums of the distance from earth to */
1701 /* Moon with light time and stellar aberration corrections to model */
1702 /* the apparent positions of the Moon. */
1703
1704 /* Use the meta-kernel shown below to load the required SPICE */
1705 /* kernels. */
1706
1707 /* KPL/MK */
1708
1709 /* File name: standard.tm */
1710
1711 /* This meta-kernel is intended to support operation of SPICE */
1712 /* example programs. The kernels shown here should not be */
1713 /* assumed to contain adequate or correct versions of data */
1714 /* required by SPICE-based user applications. */
1715
1716 /* In order for an application to use this meta-kernel, the */
1717 /* kernels referenced here must be present in the user's */
1718 /* current working directory. */
1719
1720
1721 /* \begindata */
1722
1723 /* KERNELS_TO_LOAD = ( 'de414.bsp', */
1724 /* 'pck00008.tpc', */
1725 /* 'naif0009.tls' ) */
1726
1727 /* \begintext */
1728
1729 /* Code: */
1730
1731 /* PROGRAM GFEVNT_EX */
1732 /* IMPLICIT NONE */
1733
1734 /* C */
1735 /* C SPICELIB functions */
1736 /* C */
1737 /* DOUBLE PRECISION SPD */
1738 /* INTEGER WNCARD */
1739
1740 /* INCLUDE 'gf.inc' */
1741
1742 /* C */
1743 /* C Local variables and initial parameters. */
1744 /* C */
1745 /* INTEGER LBCELL */
1746 /* PARAMETER ( LBCELL = -5 ) */
1747
1748 /* INTEGER LNSIZE */
1749 /* PARAMETER ( LNSIZE = 80 ) */
1750
1751 /* INTEGER MAXPAR */
1752 /* PARAMETER ( MAXPAR = 8 ) */
1753
1754 /* INTEGER MAXVAL */
1755 /* PARAMETER ( MAXVAL = 20000 ) */
1756
1757
1758 /* INTEGER STRSIZ */
1759 /* PARAMETER ( STRSIZ = 40 ) */
1760
1761 /* INTEGER I */
1762
1763 /* C */
1764 /* C Confining window */
1765 /* C */
1766 /* DOUBLE PRECISION CNFINE ( LBCELL : MAXVAL ) */
1767
1768 /* C */
1769 /* C Confining window beginning and ending time strings. */
1770 /* C */
1771 /* CHARACTER*(STRSIZ) BEGSTR */
1772 /* CHARACTER*(STRSIZ) ENDSTR */
1773
1774 /* C */
1775 /* C Confining window beginning and ending times */
1776 /* C */
1777 /* DOUBLE PRECISION BEGTIM */
1778 /* DOUBLE PRECISION ENDTIM */
1779
1780 /* C */
1781 /* C Result window beginning and ending times for intervals. */
1782 /* C */
1783 /* DOUBLE PRECISION BEG */
1784 /* DOUBLE PRECISION END */
1785
1786 /* C */
1787 /* C Geometric quantity results window, work window, */
1788 /* C bail switch and progress reporter switch. */
1789 /* C */
1790 /* DOUBLE PRECISION RESULT ( LBCELL : MAXVAL ) */
1791 /* DOUBLE PRECISION WORK ( LBCELL : MAXVAL, NWDIST ) */
1792
1793 /* LOGICAL BAIL */
1794 /* LOGICAL GFBAIL */
1795 /* EXTERNAL GFBAIL */
1796 /* LOGICAL RPT */
1797
1798 /* C */
1799 /* C Step size. */
1800 /* C */
1801 /* DOUBLE PRECISION STEP */
1802
1803 /* C */
1804 /* C Geometric quantity name. */
1805 /* C */
1806 /* CHARACTER*(LNSIZE) EVENT */
1807
1808 /* C */
1809 /* C Relational string */
1810 /* C */
1811 /* CHARACTER*(STRSIZ) RELATE */
1812
1813 /* C */
1814 /* C Quantity definition parameter arrays: */
1815 /* C */
1816 /* INTEGER QNPARS */
1817 /* CHARACTER*(LNSIZE) QPNAMS ( MAXPAR ) */
1818 /* CHARACTER*(LNSIZE) QCPARS ( MAXPAR ) */
1819 /* DOUBLE PRECISION QDPARS ( MAXPAR ) */
1820 /* INTEGER QIPARS ( MAXPAR ) */
1821 /* LOGICAL QLPARS ( MAXPAR ) */
1822
1823 /* C */
1824 /* C Routines to set step size, refine transition times */
1825 /* C and report work. */
1826 /* C */
1827 /* EXTERNAL GFREFN */
1828 /* EXTERNAL GFREPI */
1829 /* EXTERNAL GFREPU */
1830 /* EXTERNAL GFREPF */
1831 /* EXTERNAL GFSTEP */
1832
1833
1834 /* C */
1835 /* C Reference and adjustment values. */
1836 /* C */
1837 /* DOUBLE PRECISION REFVAL */
1838 /* DOUBLE PRECISION ADJUST */
1839
1840 /* INTEGER COUNT */
1841
1842
1843 /* C Load leapsecond and spk kernels. The name of the */
1844 /* C meta kernel file shown here is fictitious; you */
1845 /* C must supply the name of a file available */
1846 /* C on your own computer system. */
1847
1848 /* CALL FURNSH ('standard.tm') */
1849
1850
1851 /* C */
1852 /* C Set a beginning and end time for confining window. */
1853 /* C */
1854 /* BEGSTR = '2001 jan 01 00:00:00.000' */
1855 /* ENDSTR = '2001 dec 31 00:00:00.000' */
1856
1857 /* CALL STR2ET ( BEGSTR, BEGTIM ) */
1858 /* CALL STR2ET ( ENDSTR, ENDTIM ) */
1859
1860 /* C */
1861 /* C Set condition for extremum. */
1862 /* C */
1863 /* RELATE = 'LOCMAX' */
1864
1865 /* C */
1866 /* C Set reference value (if needed) and absolute extremum */
1867 /* C adjustment (if needed). */
1868 /* C */
1869 /* REFVAL = 0.D0 */
1870 /* ADJUST = 0.D0 */
1871
1872 /* C */
1873 /* C Set quantity. */
1874 /* C */
1875 /* EVENT = 'DISTANCE' */
1876
1877 /* C */
1878 /* C Turn on progress reporter and initialize the windows. */
1879 /* C */
1880 /* RPT = .TRUE. */
1881 /* BAIL = .FALSE. */
1882
1883 /* CALL SSIZED ( MAXVAL, CNFINE ) */
1884 /* CALL SSIZED ( MAXVAL, RESULT ) */
1885
1886 /* C */
1887 /* C Add 2 points to the confinement interval window. */
1888 /* C */
1889 /* CALL WNINSD ( BEGTIM, ENDTIM, CNFINE ) */
1890
1891 /* C */
1892 /* C Define input quantities. */
1893 /* C */
1894 /* QPNAMS(1) = 'TARGET' */
1895 /* QCPARS(1) = 'MOON' */
1896
1897 /* QPNAMS(2) = 'OBSERVER' */
1898 /* QCPARS(2) = 'EARTH' */
1899
1900 /* QPNAMS(3) = 'ABCORR' */
1901 /* QCPARS(3) = 'LT+S' */
1902
1903 /* QNPARS =3 */
1904
1905 /* C */
1906 /* C Set the step size to 1 day and convert to seconds. */
1907 /* C */
1908 /* STEP = 1.D-3*SPD() */
1909
1910 /* CALL GFSSTP ( STEP ) */
1911
1912 /* C */
1913 /* C Look for solutions. */
1914 /* C */
1915 /* CALL GFEVNT ( GFSTEP, GFREFN, EVENT, */
1916 /* . QNPARS, QPNAMS, QCPARS, */
1917 /* . QDPARS, QIPARS, QLPARS, */
1918 /* . RELATE, REFVAL, CNVTOL, */
1919 /* . ADJUST, CNFINE, RPT, */
1920 /* . GFREPI, GFREPU, GFREPF, */
1921 /* . MAXVAL, NWDIST, WORK, */
1922 /* . BAIL, GFBAIL, RESULT ) */
1923
1924
1925 /* C */
1926 /* C Check the number of intervals in the result window. */
1927 /* C */
1928 /* COUNT = WNCARD(RESULT) */
1929
1930 /* WRITE (*,*) 'Found ', COUNT, ' intervals in RESULT' */
1931 /* WRITE (*,*) ' ' */
1932
1933 /* C */
1934 /* C List the beginning and ending points in each interval. */
1935 /* C */
1936 /* DO I = 1, COUNT */
1937
1938 /* CALL WNFETD ( RESULT, I, BEG, END ) */
1939
1940 /* CALL TIMOUT ( BEG, */
1941 /* . 'YYYY-MON-DD HR:MN:SC.###### ' */
1942 /* . // '(TDB) ::TDB ::RND', BEGSTR ) */
1943 /* CALL TIMOUT ( END, */
1944 /* . 'YYYY-MON-DD HR:MN:SC.###### ' */
1945 /* . // '(TDB) ::TDB ::RND', ENDSTR ) */
1946
1947 /* WRITE (*,*) 'Interval ', I */
1948 /* WRITE (*,*) 'Beginning TDB ', BEGSTR */
1949 /* WRITE (*,*) 'Ending TDB ', ENDSTR */
1950 /* WRITE (*,*) ' ' */
1951
1952 /* END DO */
1953
1954 /* END */
1955
1956 /* The program compiled on OS X with g77: */
1957
1958 /* The run output; the progress report had the format shown below: */
1959
1960 /* Distance pass 1 of 2 50.62% done. */
1961
1962 /* Found 13 intervals in RESULT */
1963
1964 /* Interval 1 */
1965 /* Beginning TDB 2001-JAN-24 19:22:01.436672 (TDB) */
1966 /* Ending TDB 2001-JAN-24 19:22:01.436672 (TDB) */
1967
1968 /* Interval 2 */
1969 /* Beginning TDB 2001-FEB-20 21:52:07.914964 (TDB) */
1970 /* Ending TDB 2001-FEB-20 21:52:07.914964 (TDB) */
1971 /* Interval 3 */
1972
1973 /* ... */
1974
1975 /* Interval 12 */
1976 /* Beginning TDB 2001-NOV-23 15:45:23.027511 (TDB) */
1977 /* Ending TDB 2001-NOV-23 15:45:23.027511 (TDB) */
1978
1979 /* Interval 13 */
1980 /* Beginning TDB 2001-DEC-21 13:04:47.124241 (TDB) */
1981 /* Ending TDB 2001-DEC-21 13:04:47.124241 (TDB) */
1982
1983 /* $ Restrictions */
1984
1985 /* 1) The kernel files to be used by GFEVNT must be loaded (normally */
1986 /* via the SPICELIB routine FURNSH) before GFEVNT is called. */
1987
1988 /* 2) If using the default, constant step size routine, GFSTEP, the */
1989 /* entry point GFSSTP must be called prior to calling this */
1990 /* routine. The call syntax for GFSSTP: */
1991
1992 /* CALL GFSSTP ( STEP ) */
1993
1994 /* $ Literature_References */
1995
1996 /* None. */
1997
1998 /* $ Author_and_Institution */
1999
2000 /* N.J. Bachman (JPL) */
2001 /* L.S. Elson (JPL) */
2002 /* W.L. Taber (JPL) */
2003 /* I.M. Underwood (JPL) */
2004 /* E.D. Wright (JPL) */
2005
2006 /* $ Version */
2007
2008 /* - SPICELIB Version 2.0.0, 05-SEP-2012 (EDW) (NJB) */
2009
2010 /* Edit to comments to correct search description. */
2011
2012 /* Edit to Index_Entries. */
2013
2014 /* Added geometric quantities: */
2015
2016 /* Phase Angle */
2017 /* Illumination Angle */
2018
2019 /* Code edits to implement use of ZZGFRELX in event calculations: */
2020
2021 /* Range rate */
2022 /* Separation angle */
2023 /* Distance */
2024 /* Coordinate */
2025
2026 /* The code changes for ZZGFRELX use should not affect the */
2027 /* numerical results of GF computations. */
2028
2029 /* - SPICELIB Version 1.1.0, 09-OCT-2009 (NJB) (EDW) */
2030
2031 /* Edits to argument descriptions. */
2032
2033 /* Added geometric quantities: */
2034
2035 /* Range Rate */
2036
2037 /* - SPICELIB Version 1.0.0, 19-MAR-2009 (NJB) (EDW) */
2038
2039 /* -& */
2040 /* $ Index_Entries */
2041
2042 /* GF mid-level geometric condition solver */
2043
2044 /* -& */
2045
2046 /* SPICELIB functions */
2047
2048
2049 /* Angular separation routines. */
2050
2051
2052 /* Distance routines. */
2053
2054
2055 /* Range rate routines. */
2056
2057
2058 /* Phase angle routines. */
2059
2060
2061 /* Illumination angle routines. */
2062
2063
2064 /* Event quantity codes: */
2065
2066
2067 /* Number of supported quantities: */
2068
2069
2070 /* Number of supported comparison operators: */
2071
2072
2073 /* Assorted string lengths: */
2074
2075
2076 /* MAXPAR is the maximum number of parameters required to define */
2077 /* any quantity. MAXPAR may grow if new quantities require */
2078 /* more parameters. */
2079
2080
2081 /* MAXOP is the maximum string length for comparison operators. */
2082 /* MAXOP may grow if new comparisons are added. */
2083
2084
2085 /* MAXCLN is the maximum character string length of the quantity */
2086 /* parameter names and character quantity parameters. */
2087
2088
2089 /* Local variables */
2090
2091
2092 /* Saved variables */
2093
2094
2095 /* Initial values */
2096
2097 /* Parameter adjustments */
2098 work_dim1 = *mw + 6;
2099 work_offset = work_dim1 - 5;
2100
2101 /* Function Body */
2102
2103 /* Below we initialize the list of quantity names. Restrict this list */
2104 /* to those events supported with test families. */
2105
2106
2107 /* Below we initialize the list of comparison operator names. */
2108
2109
2110 /* Below we initialize the list of quantity parameter names. */
2111 /* Each quantity has its own list of parameter names. */
2112
2113 /* NOTE: ALL of the initializers below must be updated when */
2114 /* the parameter MAXPAR is increased. The number blank string */
2115 /* initial values must be increased so that the total number */
2116 /* of values for each array is MAXPAR. */
2117
2118
2119 /* Standard SPICE error handling. */
2120
2121 if (return_()) {
2122 return 0;
2123 }
2124 chkin_("GFEVNT", (ftnlen)6);
2125 if (first) {
2126
2127 /* Set the progress report prefix and suffix strings for */
2128 /* each quantity. No need to set coordinate quantity strings. */
2129 /* The coordinate solver performs that function. */
2130
2131 first = FALSE_;
2132 s_copy(srcpre, "Angular separation pass 1 of #", (ftnlen)55, (ftnlen)
2133 30);
2134 s_copy(srcpre + 55, "Angular separation pass 2 of #", (ftnlen)55, (
2135 ftnlen)30);
2136 s_copy(srcpre + 110, "Distance pass 1 of # ", (ftnlen)55, (ftnlen)21);
2137 s_copy(srcpre + 165, "Distance pass 2 of # ", (ftnlen)55, (ftnlen)21);
2138 s_copy(srcpre + 660, "Angular Rate pass 1 of #", (ftnlen)55, (ftnlen)
2139 24);
2140 s_copy(srcpre + 715, "Angular Rate pass 2 of #", (ftnlen)55, (ftnlen)
2141 24);
2142 s_copy(srcpre + 330, "Range Rate pass 1 of #", (ftnlen)55, (ftnlen)22)
2143 ;
2144 s_copy(srcpre + 385, "Range Rate pass 2 of #", (ftnlen)55, (ftnlen)22)
2145 ;
2146 s_copy(srcpre + 440, "Phase angle search pass 1 of #", (ftnlen)55, (
2147 ftnlen)30);
2148 s_copy(srcpre + 495, "Phase angle search pass 2 of #", (ftnlen)55, (
2149 ftnlen)30);
2150 s_copy(srcpre + 770, "Diameter pass 1 of #", (ftnlen)55, (ftnlen)20);
2151 s_copy(srcpre + 825, "Diameter pass 2 of #", (ftnlen)55, (ftnlen)20);
2152 s_copy(srcpre + 550, "Illumination angle pass 1 of #", (ftnlen)55, (
2153 ftnlen)30);
2154 s_copy(srcpre + 605, "Illumination angle pass 2 of #", (ftnlen)55, (
2155 ftnlen)30);
2156 s_copy(srcsuf, "done.", (ftnlen)13, (ftnlen)5);
2157 s_copy(srcsuf + 13, "done.", (ftnlen)13, (ftnlen)5);
2158 s_copy(srcsuf + 26, "done.", (ftnlen)13, (ftnlen)5);
2159 s_copy(srcsuf + 39, "done.", (ftnlen)13, (ftnlen)5);
2160 s_copy(srcsuf + 156, "done.", (ftnlen)13, (ftnlen)5);
2161 s_copy(srcsuf + 169, "done.", (ftnlen)13, (ftnlen)5);
2162 s_copy(srcsuf + 78, "done.", (ftnlen)13, (ftnlen)5);
2163 s_copy(srcsuf + 91, "done.", (ftnlen)13, (ftnlen)5);
2164 s_copy(srcsuf + 104, "done.", (ftnlen)13, (ftnlen)5);
2165 s_copy(srcsuf + 117, "done.", (ftnlen)13, (ftnlen)5);
2166 s_copy(srcsuf + 182, "done.", (ftnlen)13, (ftnlen)5);
2167 s_copy(srcsuf + 195, "done.", (ftnlen)13, (ftnlen)5);
2168 s_copy(srcsuf + 130, "done.", (ftnlen)13, (ftnlen)5);
2169 s_copy(srcsuf + 143, "done.", (ftnlen)13, (ftnlen)5);
2170 }
2171
2172 /* Make sure the requested quantity is one we recognize. */
2173
2174 ljust_(gquant, quant, gquant_len, (ftnlen)80);
2175 ucase_(quant, quant, (ftnlen)80, (ftnlen)80);
2176 qtnum = isrchc_(quant, &c__8, qnames, (ftnlen)80, (ftnlen)80);
2177 if (qtnum == 0) {
2178 setmsg_("The geometric quantity, # is not recognized. Supported quan"
2179 "tities are: DISTANCE, PHASE ANGLE, COORDINATE, RANGE RATE, A"
2180 "NGULAR SEPARATION,ILLUMINATION ANGLE.", (ftnlen)156);
2181 errch_("#", gquant, (ftnlen)1, gquant_len);
2182 sigerr_("SPICE(NOTRECOGNIZED)", (ftnlen)20);
2183 chkout_("GFEVNT", (ftnlen)6);
2184 return 0;
2185 }
2186
2187 /* Check number of quantity definition parameters. */
2188
2189 if (*qnpars < 0 || *qnpars > 10) {
2190 setmsg_("Number of quantity definition parameters = #; must be in r"
2191 "ange 0:#.", (ftnlen)68);
2192 errint_("#", qnpars, (ftnlen)1);
2193 errint_("#", &c__10, (ftnlen)1);
2194 sigerr_("SPICE(INVALIDCOUNT)", (ftnlen)19);
2195 chkout_("GFEVNT", (ftnlen)6);
2196 return 0;
2197 }
2198
2199 /* Make left-justified, upper case copies of parameter names. */
2200
2201 i__1 = *qnpars;
2202 for (i__ = 1; i__ <= i__1; ++i__) {
2203 ljust_(qpnams + (i__ - 1) * qpnams_len, pnames + ((i__2 = i__ - 1) <
2204 10 && 0 <= i__2 ? i__2 : s_rnge("pnames", i__2, "gfevnt_", (
2205 ftnlen)1829)) * 80, qpnams_len, (ftnlen)80);
2206 ucase_(pnames + ((i__2 = i__ - 1) < 10 && 0 <= i__2 ? i__2 : s_rnge(
2207 "pnames", i__2, "gfevnt_", (ftnlen)1830)) * 80, pnames + ((
2208 i__3 = i__ - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge("pnames",
2209 i__3, "gfevnt_", (ftnlen)1830)) * 80, (ftnlen)80, (ftnlen)80);
2210 ljust_(qcpars + (i__ - 1) * qcpars_len, cpars + ((i__2 = i__ - 1) <
2211 10 && 0 <= i__2 ? i__2 : s_rnge("cpars", i__2, "gfevnt_", (
2212 ftnlen)1832)) * 80, qcpars_len, (ftnlen)80);
2213 ucase_(cpars + ((i__2 = i__ - 1) < 10 && 0 <= i__2 ? i__2 : s_rnge(
2214 "cpars", i__2, "gfevnt_", (ftnlen)1833)) * 80, cpars + ((i__3
2215 = i__ - 1) < 10 && 0 <= i__3 ? i__3 : s_rnge("cpars", i__3,
2216 "gfevnt_", (ftnlen)1833)) * 80, (ftnlen)80, (ftnlen)80);
2217 }
2218
2219 /* Make sure all parameters have been supplied for the requested */
2220 /* quantity. */
2221
2222 for (i__ = 1; i__ <= 10; ++i__) {
2223 if (s_cmp(qpars + ((i__1 = i__ + qtnum * 10 - 11) < 80 && 0 <= i__1 ?
2224 i__1 : s_rnge("qpars", i__1, "gfevnt_", (ftnlen)1843)) * 80,
2225 " ", (ftnlen)80, (ftnlen)1) != 0) {
2226
2227 /* The Ith parameter must be supplied by the caller. */
2228
2229 loc = isrchc_(qpars + ((i__1 = i__ + qtnum * 10 - 11) < 80 && 0 <=
2230 i__1 ? i__1 : s_rnge("qpars", i__1, "gfevnt_", (ftnlen)
2231 1847)) * 80, qnpars, pnames, (ftnlen)80, (ftnlen)80);
2232 if (loc == 0) {
2233 setmsg_("The parameter # is required in order to compute eve"
2234 "nts pertaining to the quantity #; this parameter was"
2235 " not supplied.", (ftnlen)117);
2236 errch_("#", qpars + ((i__1 = i__ + qtnum * 10 - 11) < 80 && 0
2237 <= i__1 ? i__1 : s_rnge("qpars", i__1, "gfevnt_", (
2238 ftnlen)1856)) * 80, (ftnlen)1, (ftnlen)80);
2239 errch_("#", qnames + ((i__1 = qtnum - 1) < 8 && 0 <= i__1 ?
2240 i__1 : s_rnge("qnames", i__1, "gfevnt_", (ftnlen)1857)
2241 ) * 80, (ftnlen)1, (ftnlen)80);
2242 sigerr_("SPICE(MISSINGVALUE)", (ftnlen)19);
2243 chkout_("GFEVNT", (ftnlen)6);
2244 return 0;
2245 }
2246 }
2247 }
2248
2249 /* Capture as local variables those parameters passed from the */
2250 /* callers. */
2251
2252 /* If the PNAMES array contains any of the parameters */
2253
2254 /* TARGET */
2255 /* OBSERVER */
2256 /* ILLUM */
2257 /* TARGET1 */
2258 /* FRAME1 */
2259 /* SHAPE1 */
2260 /* TARGET2 */
2261 /* FRAME2 */
2262 /* SHAPE2 */
2263 /* ABCORR */
2264 /* REFERENCE FRAME */
2265 /* DREF */
2266 /* DVEC */
2267
2268 /* copy the value corresponding to the parameter to a local variable. */
2269
2270 /* These operations demonstrate the need for associative arrays */
2271 /* as part of Fortran. */
2272
2273
2274 /* -TARGET- */
2275
2276 loc = isrchc_("TARGET", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2277 if (loc > 0) {
2278 s_copy(target, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2279 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1902)) * 80, (ftnlen)
2280 80, (ftnlen)80);
2281 }
2282
2283 /* -OBSERVER- */
2284
2285 loc = isrchc_("OBSERVER", qnpars, pnames, (ftnlen)8, (ftnlen)80);
2286 if (loc > 0) {
2287 s_copy(obsrvr, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2288 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1914)) * 80, (ftnlen)
2289 80, (ftnlen)80);
2290 }
2291
2292 /* -ILLUM- */
2293
2294 loc = isrchc_("ILLUM", qnpars, pnames, (ftnlen)5, (ftnlen)80);
2295 if (loc > 0) {
2296 s_copy(illum, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2297 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1926)) * 80, (ftnlen)
2298 80, (ftnlen)80);
2299 }
2300
2301 /* -TARGET1- */
2302
2303 loc = isrchc_("TARGET1", qnpars, pnames, (ftnlen)7, (ftnlen)80);
2304 if (loc > 0) {
2305 s_copy(of, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2306 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1938)) * 80, (ftnlen)
2307 80, (ftnlen)80);
2308 }
2309
2310 /* -TARGET2- */
2311
2312 loc = isrchc_("TARGET2", qnpars, pnames, (ftnlen)7, (ftnlen)80);
2313 if (loc > 0) {
2314 s_copy(of + 80, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2315 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1950)) * 80, (ftnlen)
2316 80, (ftnlen)80);
2317 }
2318
2319 /* -FRAME1- */
2320
2321 loc = isrchc_("FRAME1", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2322 if (loc > 0) {
2323 s_copy(frame, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2324 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1962)) * 80, (ftnlen)
2325 80, (ftnlen)80);
2326 }
2327
2328 /* -FRAME2- */
2329
2330 loc = isrchc_("FRAME2", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2331 if (loc > 0) {
2332 s_copy(frame + 80, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1
2333 : s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1973)) * 80, (
2334 ftnlen)80, (ftnlen)80);
2335 }
2336
2337 /* -SHAPE1- */
2338
2339 loc = isrchc_("SHAPE1", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2340 if (loc > 0) {
2341 s_copy(shape, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2342 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1985)) * 80, (ftnlen)
2343 80, (ftnlen)80);
2344 }
2345
2346 /* -SHAPE2- */
2347
2348 loc = isrchc_("SHAPE2", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2349 if (loc > 0) {
2350 s_copy(shape + 80, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1
2351 : s_rnge("cpars", i__1, "gfevnt_", (ftnlen)1997)) * 80, (
2352 ftnlen)80, (ftnlen)80);
2353 }
2354
2355 /* -ABCORR- */
2356
2357 loc = isrchc_("ABCORR", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2358 if (loc > 0) {
2359 s_copy(abcorr, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2360 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)2009)) * 80, (ftnlen)
2361 80, (ftnlen)80);
2362 }
2363
2364 /* -REFERENCE FRAME- */
2365
2366 loc = isrchc_("REFERENCE FRAME", qnpars, pnames, (ftnlen)15, (ftnlen)80);
2367 if (loc > 0) {
2368 s_copy(ref, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2369 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)2021)) * 80, (ftnlen)
2370 80, (ftnlen)80);
2371 }
2372
2373 /* -COORDINATE SYSTEM- */
2374
2375 loc = isrchc_("COORDINATE SYSTEM", qnpars, qpnams, (ftnlen)17, qpnams_len)
2376 ;
2377 if (loc > 0) {
2378 s_copy(corsys, qcpars + (loc - 1) * qcpars_len, (ftnlen)80,
2379 qcpars_len);
2380 }
2381
2382 /* -COORDINATE- */
2383
2384 loc = isrchc_("COORDINATE", qnpars, qpnams, (ftnlen)10, qpnams_len);
2385 if (loc > 0) {
2386 s_copy(cornam, qcpars + (loc - 1) * qcpars_len, (ftnlen)80,
2387 qcpars_len);
2388 }
2389
2390 /* -VECTOR DEFINITION- */
2391
2392 loc = isrchc_("VECTOR DEFINITION", qnpars, qpnams, (ftnlen)17, qpnams_len)
2393 ;
2394 if (loc > 0) {
2395 s_copy(vecdef, qcpars + (loc - 1) * qcpars_len, (ftnlen)80,
2396 qcpars_len);
2397 }
2398
2399 /* -DVEC- */
2400
2401 loc = isrchc_("DVEC", qnpars, pnames, (ftnlen)4, (ftnlen)80);
2402 if (loc > 0) {
2403 vequ_(qdpars, dvec);
2404 }
2405
2406 /* -METHOD- */
2407
2408 loc = isrchc_("METHOD", qnpars, qpnams, (ftnlen)6, qpnams_len);
2409 if (loc > 0) {
2410 s_copy(method, qcpars + (loc - 1) * qcpars_len, (ftnlen)80,
2411 qcpars_len);
2412 }
2413
2414 /* -DREF- */
2415
2416 loc = isrchc_("DREF", qnpars, pnames, (ftnlen)4, (ftnlen)80);
2417 if (loc > 0) {
2418 s_copy(dref, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2419 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)2092)) * 80, (ftnlen)
2420 80, (ftnlen)80);
2421 }
2422
2423 /* -ANGTYP- */
2424
2425 loc = isrchc_("ANGTYP", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2426 if (loc > 0) {
2427 s_copy(angtyp, cpars + ((i__1 = loc - 1) < 10 && 0 <= i__1 ? i__1 :
2428 s_rnge("cpars", i__1, "gfevnt_", (ftnlen)2103)) * 80, (ftnlen)
2429 80, (ftnlen)80);
2430 }
2431
2432 /* -SPOINT- */
2433
2434 loc = isrchc_("SPOINT", qnpars, pnames, (ftnlen)6, (ftnlen)80);
2435 if (loc > 0) {
2436 vequ_(qdpars, spoint);
2437 }
2438
2439 /* Make sure that the requested comparison operation is one we */
2440 /* recognize. */
2441
2442 ljust_(op, uop, op_len, (ftnlen)6);
2443 ucase_(uop, uop, (ftnlen)6, (ftnlen)6);
2444 loc = isrchc_(uop, &c__7, cnames, (ftnlen)6, (ftnlen)80);
2445 if (loc == 0) {
2446 setmsg_("The comparison operator, # is not recognized. Supported op"
2447 "erators are: >, =, <, ABSMAX, ABSMIN, LOCMAX, LOCMIN. ", (
2448 ftnlen)113);
2449 errch_("#", op, (ftnlen)1, op_len);
2450 sigerr_("SPICE(NOTRECOGNIZED)", (ftnlen)20);
2451 chkout_("GFEVNT", (ftnlen)6);
2452 return 0;
2453 }
2454
2455 /* If progress reporting is enabled, set the report prefix array */
2456 /* according to the quantity and the relational operator. */
2457
2458 if (*rpt) {
2459
2460 /* We'll use the logical flag LOCALX to indicate a local extremum */
2461 /* operator and the flag NOADJX to indicate an absolute extremum */
2462 /* operator with zero adjustment. */
2463
2464 localx = s_cmp(uop, "LOCMIN", (ftnlen)6, (ftnlen)6) == 0 || s_cmp(uop,
2465 "LOCMAX", (ftnlen)6, (ftnlen)6) == 0;
2466 noadjx = *adjust == 0. && (s_cmp(uop, "ABSMIN", (ftnlen)6, (ftnlen)6)
2467 == 0 || s_cmp(uop, "ABSMAX", (ftnlen)6, (ftnlen)6) == 0);
2468 if (localx || noadjx) {
2469
2470 /* These operators correspond to 1-pass searches. */
2471
2472 npass = 1;
2473 } else {
2474 npass = 2;
2475 }
2476
2477 /* Fill in the prefix strings. */
2478
2479 /* Note that we've already performed error checks on QTNUM. */
2480
2481 i__1 = npass;
2482 for (i__ = 1; i__ <= i__1; ++i__) {
2483 repmi_(srcpre + ((i__2 = i__ + (qtnum << 1) - 3) < 16 && 0 <=
2484 i__2 ? i__2 : s_rnge("srcpre", i__2, "gfevnt_", (ftnlen)
2485 2182)) * 55, "#", &npass, rptpre + ((i__3 = i__ - 1) < 2
2486 && 0 <= i__3 ? i__3 : s_rnge("rptpre", i__3, "gfevnt_", (
2487 ftnlen)2182)) * 55, (ftnlen)55, (ftnlen)1, (ftnlen)55);
2488 }
2489 }
2490
2491 /* Here's where the real work gets done: we solve for the */
2492 /* result window. The code below is quantity-specific. However, */
2493 /* in each case, we always initialize the utility routines for */
2494 /* the quantity of interest, then call the generic relation */
2495 /* pre-image solver ZZGFREL. */
2496
2497 if (qtnum == 1) {
2498
2499 /* Separation condition initializer. */
2500
2501 zzgfspin_(of, obsrvr, shape, frame, abcorr, (ftnlen)80, (ftnlen)80, (
2502 ftnlen)80, (ftnlen)80, (ftnlen)80);
2503 zzgfrelx_((U_fp)udstep, (U_fp)udrefn, (U_fp)zzgfspdc_, (U_fp)
2504 zzgfudlt_, (U_fp)zzgfspgq_, op, refval, tol, adjust, cnfine,
2505 mw, nw, work, rpt, (U_fp)udrepi, (U_fp)udrepu, (U_fp)udrepf,
2506 rptpre, srcsuf, bail, (L_fp)udbail, result, op_len, (ftnlen)
2507 55, (ftnlen)13);
2508 } else if (qtnum == 2) {
2509
2510 /* Distance condition initializer. */
2511
2512 zzgfdiin_(target, abcorr, obsrvr, (ftnlen)80, (ftnlen)80, (ftnlen)80);
2513 zzgfrelx_((U_fp)udstep, (U_fp)udrefn, (U_fp)zzgfdidc_, (U_fp)
2514 zzgfudlt_, (U_fp)zzgfdigq_, op, refval, tol, adjust, cnfine,
2515 mw, nw, work, rpt, (U_fp)udrepi, (U_fp)udrepu, (U_fp)udrepf,
2516 rptpre, srcsuf + 26, bail, (L_fp)udbail, result, op_len, (
2517 ftnlen)55, (ftnlen)13);
2518 } else if (qtnum == 3) {
2519
2520 /* Solve for a coordinate condition. ZZGFCSLV calls the coordinate */
2521 /* event initializer. */
2522
2523 zzgfcslv_(vecdef, method, target, ref, abcorr, obsrvr, dref, dvec,
2524 corsys, cornam, op, refval, tol, adjust, (U_fp)udstep, (U_fp)
2525 udrefn, rpt, (U_fp)udrepi, (U_fp)udrepu, (U_fp)udrepf, bail, (
2526 L_fp)udbail, mw, nw, work, cnfine, result, (ftnlen)80, (
2527 ftnlen)80, (ftnlen)80, (ftnlen)80, (ftnlen)80, (ftnlen)80, (
2528 ftnlen)80, (ftnlen)80, (ftnlen)80, op_len);
2529 } else if (qtnum == 7) {
2530
2531 /* d( sep ) */
2532 /* -------- ---Not yet implemented--- */
2533 /* dt */
2534
2535 } else if (qtnum == 4) {
2536
2537 /* Range rate condition initializer. */
2538
2539 /* Default the interval for the QDERIV call in ZZGFRRDC to one */
2540 /* TDB second. This should have a function interface to */
2541 /* reset. */
2542
2543 dt = 1.;
2544 zzgfrrin_(target, abcorr, obsrvr, &dt, (ftnlen)80, (ftnlen)80, (
2545 ftnlen)80);
2546 zzgfrelx_((U_fp)udstep, (U_fp)udrefn, (U_fp)zzgfrrdc_, (U_fp)
2547 zzgfudlt_, (U_fp)zzgfrrgq_, op, refval, tol, adjust, cnfine,
2548 mw, nw, work, rpt, (U_fp)udrepi, (U_fp)udrepu, (U_fp)udrepf,
2549 rptpre, srcsuf + 78, bail, (L_fp)udbail, result, op_len, (
2550 ftnlen)55, (ftnlen)13);
2551 } else if (qtnum == 5) {
2552
2553 /* Phase angle condition initializer. */
2554
2555 zzgfpain_(target, illum, abcorr, obsrvr, (ftnlen)80, (ftnlen)80, (
2556 ftnlen)80, (ftnlen)80);
2557 zzgfrelx_((U_fp)udstep, (U_fp)udrefn, (U_fp)zzgfpadc_, (U_fp)
2558 zzgfudlt_, (U_fp)zzgfpagq_, op, refval, tol, adjust, cnfine,
2559 mw, nw, work, rpt, (U_fp)udrepi, (U_fp)udrepu, (U_fp)udrepf,
2560 rptpre, srcsuf + 104, bail, (L_fp)udbail, result, op_len, (
2561 ftnlen)55, (ftnlen)13);
2562 } else if (qtnum == 8) {
2563
2564 /* ---Not yet implemented--- */
2565
2566 } else if (qtnum == 6) {
2567
2568 /* Illumination angle condition initializer. */
2569
2570 zzgfilin_(method, angtyp, target, illum, ref, abcorr, obsrvr, spoint,
2571 (ftnlen)80, (ftnlen)80, (ftnlen)80, (ftnlen)80, (ftnlen)80, (
2572 ftnlen)80, (ftnlen)80);
2573 zzgfrelx_((U_fp)udstep, (U_fp)udrefn, (U_fp)zzgfildc_, (U_fp)
2574 zzgfudlt_, (U_fp)zzgfilgq_, op, refval, tol, adjust, cnfine,
2575 mw, nw, work, rpt, (U_fp)udrepi, (U_fp)udrepu, (U_fp)udrepf,
2576 rptpre, srcsuf + 130, bail, (L_fp)udbail, result, op_len, (
2577 ftnlen)55, (ftnlen)13);
2578 } else {
2579
2580 /* QTNUM is not a recognized event code. This block should */
2581 /* never execute since we already checked the input quantity */
2582 /* name string. */
2583
2584 setmsg_("Unknown event '#'. This error indicates a bug. Please conta"
2585 "ct NAIF.", (ftnlen)67);
2586 errch_("#", gquant, (ftnlen)1, gquant_len);
2587 sigerr_("SPICE(BUG)", (ftnlen)10);
2588 chkout_("GFEVNT", (ftnlen)6);
2589 return 0;
2590 }
2591 chkout_("GFEVNT", (ftnlen)6);
2592 return 0;
2593 } /* gfevnt_ */
2594
2595