Table of contents
CSPICE_SCARD sets the cardinality of a SPICE cell of any data type.
Given:
card the cardinality (number of elements) to assign to `cell'.
help, card
LONG = Scalar
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:
cspice_scard, card, cell
returns:
cell on output, the cardinality of the `cell' is `card'.
help, cell
STRUCT = cspice_celld(N) or STRUCT = cspice_celli(N)
The data portion of `cell' remains unchanged.
If the cardinality is set to zero, the cell becomes a
SPICE set: the cell's "is a set?" attribute becomes True.
None.
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) Create a double precision SPICE cell of ten elements. Add three
intervals to it, and then reset it. Output the cardinality of
the cell after each operation.
Example code begins here.
PRO scard_ex1
;;
;; Set a size for the cell.
;;
SIZE = 10
;;
;; Create a double precision cell of SIZE
;;
cell = cspice_celld( SIZE )
;;
;; Output the cardinality of a new cell.
;;
print, "Cardinality of cell, initial: ", cspice_card( cell )
;;
;; Define an array of intervals.
;;
array = [ [ 1.d, 3.0], [ 7.0, 11.0], [23.0, 27.0] ]
;;
;; Insert data into the cell, creating a window.
;;
for i=0,2 do begin
cspice_wninsd, array[0,i], array[1,i], cell
endfor
print, "Cardinality of cell, filled : ", cspice_card( cell )
;;
;; Reset the cardinality to zero to free the SIZE elements.
;;
cspice_scard, 0, cell
print, "Cardinality of cell, reset : ", cspice_card( cell )
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Cardinality of cell, initial: 0
Cardinality of cell, filled : 6
Cardinality of cell, reset : 0
None.
1) If the cardinality value supplied is less than 0 or greater
than the cell size, the error SPICE(INVALIDCARDINALITY) is
signaled by a routine in the call tree of this routine.
2) If any of the input arguments, `card' or `cell', is undefined,
an error is signaled by the IDL error handling system.
3) If any of the input arguments, `card' or `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.
None.
None.
ICY.REQ
CELLS.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.4, 26-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added example's
problem statement.
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.3, 08-AUG-2008 (EDW)
Minor edits to header text.
-Icy Version 1.0.2, 28-SEP-2006 (EDW)
Corrections to English.
Correct Required Reading citation cell.req to cells.req.
-Icy Version 1.0.1, 29-MAR-2006 (EDW)
Minor edits to -I/O section for clarity and consistency with
cspice_ssize descriptions.
-Icy Version 1.0.0, 12-SEP-2004 (EDW)
set the cardinality of an integer cell
|