Index Page
cspice_appndd
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_APPNDD appends an item or list of items to a double precision cell

   For important details concerning this module's function, please refer to
   the CSPICE routine appndd_c.

I/O


   Given:

      item   is double precision scalar or N-vector to append to
             'cell'

      cell    is a double precision Icy cell to which item will be
              appended

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

   the call:

      cspice_appndd, item, cell

   returns:

      cell   is the input Icy cell 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_celld( SIZE )

      ;;
      ;; Add a single item to the new cell
      ;;
      cspice_appndd, 0.d, cell

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

      cspice_appndd, 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"

      ;;
      ;; Force a set. 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_appndd, -22.d, 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"

      catch, err
      if err eq 0 then begin
         cspice_appndd, items, cell
      endif else begin
         print, 'Error signaled during cspice_appndd:'
         print, !Error_State.Msg
      endelse

   IDL outputs:

      The cell contents after the first cspice_appndd.

         0.0000000
         1.0000000
         1.0000000
         2.0000000
         3.0000000
         5.0000000
         8.0000000
         13.000000
         21.000000
         34.000000

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

         0.0000000
         1.0000000
         2.0000000
         3.0000000
         5.0000000
         8.0000000
         13.000000
         21.000000
         34.000000
        -22.000000

      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_appndd:
         CSPICE_APPNDD: SPICE(CELLTOOSMALL): [appndd_c] The cell cannot
                        accommodate the addition of the element
                        8.0000000000000E+00 Failure occurred at input
                        vector index 5.

Particulars


   The user must create any needed cell structures with cspice_celld,
   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.0, 03-OCT-2006, EDW (JPL)


Index_Entries


   append an item to a d.p. cell



Wed Apr  5 17:57:59 2017