wnvald |
Table of contents
ProcedureWNVALD ( Validate a DP window ) SUBROUTINE WNVALD ( SIZE, N, WINDOW ) AbstractForm a valid double precision window from the contents of a window array. Required_ReadingWINDOWS KeywordsWINDOWS DeclarationsIMPLICIT NONE INTEGER LBCELL PARAMETER ( LBCELL = -5 ) INTEGER SIZE INTEGER N DOUBLE PRECISION WINDOW ( LBCELL:* ) Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- SIZE I Size of window. N I Original number of endpoints. WINDOW I-O Input, output window. Detailed_InputSIZE is the size of the window to be validated. This is the maximum number of endpoints that the cell used to implement the window is capable of holding at any one time. N is the original number of endpoints in the input cell. WINDOW on input is a (possibly uninitialized) cell array of maximum size SIZE containing N endpoints of (possibly unordered and non-disjoint) intervals. Detailed_OutputWINDOW on output is a validated window, in which any overlapping input intervals have been merged and the resulting set of intervals is arranged in increasing order. WINDOW is ready for use with any of the window routines. ParametersNone. Exceptions1) If the original number of endpoints N is odd, the error SPICE(UNMATCHENDPTS) is signaled. 2) If the original number of endpoints of the window exceeds its size, the error SPICE(WINDOWTOOSMALL) is signaled. 3) If the left endpoint is greater than the right endpoint, the error SPICE(BADENDPOINTS) is signaled. FilesNone. ParticularsThis routine takes as input a cell array containing pairs of endpoints and validates it to form a window. On input, WINDOW is a cell of size SIZE containing N endpoints. During validation, the intervals are ordered, and overlapping intervals are merged. On output, the cardinality of WINDOW is the number of endpoints remaining, and it is ready for use with any of the window routines. Because validation is done in place, there is no chance of overflow. Validation is primarily useful for ordering and merging intervals read from input files or initialized in DATA statements. ExamplesThe numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation. 1) Define an array containing a set of unordered and possibly overlapping intervals, and validate the array as a SPICE window. Example code begins here. PROGRAM WNVALD_EX1 IMPLICIT NONE C C SPICELIB functions. C INTEGER CARDD INTEGER SIZED C C Local parameters. C INTEGER LBCELL PARAMETER ( LBCELL = -5 ) INTEGER WINSIZ PARAMETER ( WINSIZ = 20 ) INTEGER DATSIZ PARAMETER ( DATSIZ = 16 ) C C Local variables C DOUBLE PRECISION WINDOW ( LBCELL : WINSIZ ) DOUBLE PRECISION WINDAT ( DATSIZ ) INTEGER I DATA WINDAT / 0, 0, . 10, 12, . 2, 7, . 13, 15, . 1, 5, . 23, 29, 4*0 / C C Insert the data into the SPICE cell array. C CALL MOVED ( WINDAT, WINSIZ, WINDOW(1) ) C C Validate the input WINDOW array as a SPICE window. C CALL WNVALD ( WINSIZ, DATSIZ, WINDOW ) WRITE (*,*) 'Current intervals: ', CARDD ( WINDOW ) / 2 WRITE (*,*) 'Maximum intervals: ', SIZED ( WINDOW ) / 2 WRITE (*,*) WRITE (*,*) 'Intervals:' WRITE (*,*) DO I = 1, CARDD ( WINDOW ), 2 WRITE (*,*) WINDOW(I), WINDOW(I+1) END DO END When this program was executed on a Mac/Intel/gfortran/64-bit platform, the output was: Current intervals: 5 Maximum intervals: 10 Intervals: 0.0000000000000000 0.0000000000000000 1.0000000000000000 7.0000000000000000 10.000000000000000 12.000000000000000 13.000000000000000 15.000000000000000 23.000000000000000 29.000000000000000 RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) H.A. Neilan (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) VersionSPICELIB Version 1.2.0, 16-MAR-2021 (JDR) Changed argument name A to WINDOW for consistency with other routines. Added IMPLICIT NONE statement. Edited the header to comply to NAIF standard. Created complete code example from code fragment and added example's problem statement. Improved description of argument WINDOW in $Detailed_Output. Removed unnecessary $Revisions section. SPICELIB Version 1.1.1, 30-JUL-2002 (NJB) Fixed bugs in example program. SPICELIB Version 1.1.0, 14-AUG-1995 (HAN) Fixed a character string that continued over two lines. The "//" characters were missing. The Alpha/OpenVMS compiler issued a warning regarding this incorrect statement syntax. SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) Comment section for permuted index source lines was added following the header. SPICELIB Version 1.0.0, 31-JAN-1990 (WLT) (IMU) |
Fri Dec 31 18:37:08 2021