Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_wnvald

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_WNVALD forms a valid double precision window
   from the contents of a window array.

I/O


   Given:

      size     the size of the window to be validated.

               help, size
                  LONG = Scalar

               This is the maximum number of endpoints that the cell used to
               implement the window is capable of holding at any one time.

      n        the original number of endpoints in the input cell.

               help, n
                  LONG = Scalar

      window   on input is a (possibly uninitialized) cell array of maximum
               size `size' containing `n' endpoints of (possibly unordered
               and non-disjoint) intervals.

               help, window
                  STRUCT = cspice_celld(2*N)

   the call:

      cspice_wnvald, size, n, window

   returns:

      window   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.

               help, window
                  STRUCT = cspice_celld(2*N)

               `window' is ready for use with any of the window routines.

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   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.


      PRO wnvald_ex1

         ;;
         ;; Create a cell containing a double
         ;; precision 30-vector.
         ;;
         win1 = cspice_celld( 30 )

         ;;
         ;; Set up the input array.
         ;;
         darray = [ [ 0.d, 0.0], [ 10.0, 12.0 ], [ 2.0, 7.0], $
                    [13.0,15.0], [  1.0,  5.0 ], [23.0,29.0], $
                    [ 0.0, 0.0], [  0.0,  0.0 ], [ 0.0, 0.0], $
                    [ 0.0, 0.0] ]

         ;;
         ;; Fill in the window data.
         ;;
         in_start  = win1.data
         in_end    = in_start + n_elements( darray ) -1

         win1.base[in_start:in_end] = darray

         ;;
         ;; Validate window win1.
         ;;
         cspice_wnvald, 30, 20, win1

         ;;
         ;; Calculate the number of intervals in the
         ;; return window 'win1'.
         ;;
         no_intervals = cspice_wncard(win1)

         print, 'Current intervals: ', no_intervals
         print, 'Maximum intervals: ', cspice_size( win1 ) / 2

         ;;
         ;; Output the intervals.
         ;;
         print
         print, 'Intervals'
         for i= 0, (no_intervals -1 ) do begin

            cspice_wnfetd, win1, i, left, right
            print, left, right

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Current intervals:            5
      Maximum intervals:           15

      Intervals
             0.0000000       0.0000000
             1.0000000       7.0000000
             10.000000       12.000000
             13.000000       15.000000
             23.000000       29.000000


Particulars


   The user must create any needed window structures with
   cspice_celld prior to use regardless of whether the routine
   uses the window as input or returns it as output.

   This 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' 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 `window' is ready for use with
   any of the window routines.

   Because validation is done in place, there is no chance of
   overflow.

Exceptions


   1)  If the original number of endpoints `n' is odd, the error
       SPICE(UNMATCHENDPTS) is signaled by a routine in the call tree
       of this routine.

   2)  If the original number of endpoints of the window exceeds its
       size, the error SPICE(WINDOWTOOSMALL) is signaled by a routine
       in the call tree of this routine.

   3)  If the left endpoint is greater than the right endpoint, the
       error SPICE(BADENDPOINTS) is signaled by a routine in the call
       tree of this routine.

   4)  If any of the input arguments, `size', `n' or `window', is
       undefined, an error is signaled by the IDL error handling
       system.

   5)  If any of the input arguments, `size', `n' or `window', is not
       of the expected type, or it does not have the expected
       dimensions and size, an error is signaled by the Icy
       interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ
   CELLS.REQ
   WINDOWS.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.3, 01-JUN-2021 (JDR)

       Edited the header to comply with NAIF standard. Added
       example's problem statement and reformatted example's output
       (added information about current and maximum intervals).

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.2, 26-NOV-2007 (EDW)

       Implemented use of cspice_wncard function to return
       window cardinality.

   -Icy Version 1.0.1, 12-SEP-2006 (EDW)

       Correct Required Reading citation cell.req to cells.req.

   -Icy Version 1.0.0, 08-AUG-2004 (EDW)

Index_Entries


   validate a d.p. window



Fri Dec 31 18:43:09 2021