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

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_APPNDI appends an item or list of items to an integer cell 
   
   For important details concerning this module's function, please refer to
   the CSPICE routine appndi_c.

I/O

   
   Given:

      item   is a scalar integer or N-vector to append to 'cell'.

      cell   is an integer cell to which item will be
             appended.

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

   the call:

      cspice_appndi, item, cell

   returns:
   
      cell   is the input SpiceCell with 'item' appended.

             If 'cell' is actually a Icy set on input and ceases to
             qualify as a set as result of the requested append
             operation, the 'isSet' member of cell will be set to
             SPICEFALSE.

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.

      ;;
      ;; Create a cell for fifteen elements.
      ;;
      SIZE = 15

      cell = cspice_celli( SIZE )

      ;;
      ;; Add a single item to the new cell
      ;;
      cspice_appndi, 0L, cell

      ;;
      ;; Now insert a list of items.
      ;;
      items = [ 1L, 1, 2, 3, 5, 8, 13, 21, 34 ]

      cspice_appndi, items, cell

      ;;
      ;; Output the contents of 'set'. Recall
      ;; set data begins at 'set.base[ set.data + 0 ]'.
      ;;
      for i=0, cspice_card(cell)-1 do begin
         print, cell.base[ cell.data + i]
      endfor

      ;;
      ;; After the append, does the cell key as a set?
      ;;
      if(  cell.isset ) then print, "Cell is a set after first append"
      if( ~cell.isset ) then print, "Cell is not a set after first append"

      ;;
      ;; Validate the cell as a set.
      ;;
      cspice_valid, SIZE, SIZE, cell

      if(  cell.isset ) then print, "Cell is a set after cspice_valid"
      if( ~cell.isset ) then print, "Cell is not a set cspice_valid"

      ;;
      ;; Append a new value to the cell, the value being less than all
      ;; other set values.
      ;;
      cspice_appndi, -22L, cell

      for i=0, cspice_card(cell)-1 do begin
         print, cell.base[ cell.data + i]
      endfor

      ;;
      ;; The data array does not satisfy the requirements for a set,
      ;; check the 'isset' flag indicates the change.
      ;;
      if(  cell.isset ) then print, "Cell is a set after second append"
      if( ~cell.isset ) then print, "Cell is not a set after second append"

      ;;
      ;; Try to add to the cell, the number of total values
      ;; exceeding the declared size of the cell, 'SIZE'.
      ;; This action should cause an error. Catch that error.
      ;;
      catch, err
      if err eq 0 then begin
         cspice_appndi, items, cell
      endif else begin
         print, 'Error signaled during cspice_appndi:'
         print, !Error_State.Msg
      endelse

      catch, /cancel

   IDL outputs:

         The cell contents after the first cspice_appndi.

          0
          1
          1
          2
          3
          5
          8
          13
          21
          34

      Check the 'isset' flag, is the cell a set?

          Cell is not a set after first append

      Call cspice_valid to force the cell data to set, ordered, no
      duplicates, then retest.

          Cell is a set after cspice_valid

      Add a scalar to the set, -22

          0
          1
          2
          3
          5
          8
          13
          21
          34
         -22

      Check the 'isset' flag again, is the cell a set?

          Cell is not a set after second append

      confirming the append broke the set state.

      The cell can hold 15 values, current state uses 10. When trying
      to add more than 5 new elements, an error signals.

          Error signaled during cspice_appndi:
          CSPICE_APPNDI: SPICE(CELLTOOSMALL): [appndi_c] The cell cannot
                         accommodate the addition of the element 8
                         Failure occurred at input vector index 5.

Particulars


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

Required Reading


   ICY.REQ
   CELLS.REQ

Version


   -Icy Version 1.0.3, 13-JUN-2010, EDW (JPL)

      Minor edit to code comments eliminating typo.

   -Icy Version 1.0.2, 19-JAN-2009, EDW (JPL)

      Edits to header text and spelling correction.
      
   -Icy Version 1.0.0, 03-OCT-2006, EDW (JPL)   

Index_Entries

 
   append an item to an integer cell 
 



Wed Apr  5 17:57:59 2017