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_size

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


Abstract


   CSPICE_SIZE returns the size (maximum cardinality) of a SPICE cell
   of any data type.

I/O


   Given:

      cell     a SPICE cell of any data type.

               help, cell
                  STRUCT = cspice_celld(N)   or   STRUCT = cspice_celli(N)

               `cell' must be declared as a double precision, or integer.

               The user must create `cell' using either cspice_celld or
               cspice_celli.

   the call:

      size = cspice_size( cell )

   returns:

      size     a scalar integer describing the size (maximum number of
               elements) of the input `cell'.

               help, size
                  LONG = Scalar

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) The cspice_size procedure is typically used in conjunction
      with the cspice_card procedure to predict (and subsequently
      avoid) overflows when manipulating cells. In the following
      example, cspice_card and cspice_size are used to determine whether
      the union of two sets is safe.


      Example code begins here.


      PRO size_ex1

         ;;
         ;; Local constants.
         ;;
         SETDIM =   5L

         ;;
         ;; Local variables.
         ;;
         ;; Declare two SPICE cells.
         ;;
         seta   = cspice_celli( SETDIM )
         setb   = cspice_celli( SETDIM )
         setc   = cspice_celli( SETDIM )

         even   = [ 0L,  2L,  4L,  4L,  8L ]

         items  = [ 0L,  1L,  1L,  2L,  8L ]

         ;;
         ;; Initialize the empty sets.
         ;;
         cspice_valid, SETDIM, 0L, seta
         cspice_valid, SETDIM, 0L, setb

         ;;
         ;; Insert `even' on `seta' and `items' on `setb'
         ;;
         for i=0L, SETDIM-1L do begin

            cspice_insrti, even[i], seta
            cspice_insrti, items[i], setb

         endfor

         ;;
         ;; Perform the union if possible.
         ;;
         if ( cspice_card( seta ) + cspice_card( setb ) le                   $
              cspice_size( setc ) ) then begin

            print, 'Union will not overflow the output set.'
            cspice_union, seta, setb, setc

         endif else begin

            print, 'Union may overflow...'
            cspice_inter, seta, setb, setc

            if ( cspice_card( seta ) +  cspice_card( setb ) -                $
                 cspice_card( setc ) le cspice_size( setc ) ) then begin

               print, '   ... but cspice_inter indicates it is safe!'
               cspice_union, seta, setb, setc

            endif else begin

               print, '  ... and cspice_inter confirms it!'

            endelse

         endelse

      END


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


      Union may overflow...
         ... but cspice_inter indicates it is safe!


Particulars


   None.

Exceptions


   1)  If the input `cell' has invalid cardinality, the error
       SPICE(INVALIDCARDINALITY) is signaled by a routine in the call
       tree of this routine. cspice_size returns an unspecified value in
       this case.

   2)  If the input `cell' has invalid size, the error
       SPICE(INVALIDSIZE) is signaled by a routine in the call tree
       of this routine. cspice_size returns an unspecified value in this
       case.

   3)  If the input argument `cell' is undefined, an error is
       signaled by the IDL error handling system.

   4)  If the input argument `cell' 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
   SETS.REQ

Literature_References


   None.

Author_and_Institution


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

Version


   -Icy Version 1.0.2, 26-AUG-2021 (JDR)

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

       Edited the header to comply with NAIF standard. Added complete
       code example based on existing example fragments.

       Added sets.req to the list of required readings.

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

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

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

       Corrections to English.
       Correct Required Reading citation cell.req to cells.req.
       Edit header to improve comprehension.

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

Index_Entries


   size of a cell



Fri Dec 31 18:43:07 2021