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
ktotal

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Declarations
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version

Procedure

     KTOTAL ( Kernel Totals )

     ENTRY KTOTAL ( KIND, COUNT )

Abstract

     Return the number of kernels of a specified type that are
     currently loaded via the FURNSH interface.

Required_Reading

     KERNEL

Keywords

     KERNEL

Declarations

    CHARACTER*(*)         KIND
    INTEGER               COUNT

Brief_I/O

     VARIABLE  I/O  DESCRIPTION
     --------  ---  --------------------------------------------------
     KIND       I   A list of kinds of kernels to count.
     COUNT      O   The number of kernels of type KIND.

Detailed_Input

     KIND     is a list of types of kernels to count when computing
              loaded kernels. KIND should consist of a list of words of
              kernels to examine. Recognized types are

                 SPK  --- All SPK files are counted in the total.
                 CK   --- All CK files are counted in the total.
                 PCK  --- All binary PCK files are counted in the
                          total.
                 DSK  --- All DSK files are counted in the total.
                 EK   --- All EK files are counted in the total.
                 TEXT --- All text kernels that are not meta-text
                          kernels are included in the total.
                 META --- All meta-text kernels are counted in the
                          total.
                 ALL  --- Every type of kernel is counted in the
                          total.

              KIND is case insensitive. If a word appears in KIND
              that is not one of those listed above, it is ignored.

              When KIND consists of multiple words, the words must
              be separated by blanks. Examples of valid lists are the
              strings

                 'SPK CK TEXT'
                 'SPK CK text'
                 'PCK DSK'
                 'CK'
                 'ALL'

              See the $Examples section for illustrations of the
              use of KIND.

Detailed_Output

     COUNT    is the number of kernels loaded through FURNSH that
              belong to the list specified by KIND.

Parameters

     None.

Exceptions

     1)  If a word on the list specified by KIND is not recognized,
         it is ignored.

     2)  If KIND is blank, or none of the words in KIND is on the
         list specified above, COUNT will be returned as zero.

Files

     None.

Particulars

     KTOTAL allows you to easily determine the number of kernels
     loaded via the interface FURNSH that are of a type of interest.

Examples

     The numerical results shown for this example may differ across
     platforms. The results depend on the SPICE kernels used as
     input, the compiler and supporting libraries, and the machine
     specific arithmetic implementation.

     1) Load a meta-kernel with a PCK, an LSK and an SPK, and
        separately, a text kernel and a binary PCK. Show the
        total number of kernels and meta-kernels loaded. Determine the
        number of text kernels loaded, and the number of binary
        kernels.

        Unload all kernels and clear the kernel pool using
        KCLEAR, and check that no kernels are loaded.


        Use the meta-kernel shown below to load the required SPICE
        kernels.


           KPL/MK

           File name: ktotal_ex1.tm

           This meta-kernel is intended to support operation of SPICE
           example programs. The kernels shown here should not be
           assumed to contain adequate or correct versions of data
           required by SPICE-based user applications.

           In order for an application to use this meta-kernel, the
           kernels referenced here must be present in the user's
           current working directory.

           The names and contents of the kernels referenced
           by this meta-kernel are as follows:

              File name                     Contents
              ---------                     --------
              de421.bsp                     Planetary ephemeris
              pck00009.tpc                  Planet orientation and
                                            radii
              naif0012.tls                  Leapseconds

           \begindata

              KERNELS_TO_LOAD = ( 'de421.bsp',
                                  'naif0012.tls',
                                  'pck00009.tpc' )

           \begintext

           End of meta-kernel


        Use the PCK kernel below as the binary PCK required for the
        example.

           earth_latest_high_prec.bpc


        Use the FK kernel below as the text kernel required for the
        example.

           RSSD0002.TF


        Example code begins here.


              PROGRAM KTOTAL_EX1
              IMPLICIT NONE

        C
        C     Local variables.
        C
              INTEGER               COUNT

        C
        C     Load several kernel files.
        C
              CALL FURNSH ( 'ktotal_ex1.tm'              )
              CALL FURNSH ( 'RSSD0002.TF'                )
              CALL FURNSH ( 'earth_latest_high_prec.bpc' )

        C
        C     Count the number of loaded kernel files.
        C
              CALL KTOTAL ( 'ALL', COUNT )

              WRITE(*,'(A,I2)') 'The total number of kernels after '
             . //               'final FURNSH: ', COUNT

        C
        C     Count the number of meta-kernels.
        C
              CALL KTOTAL ( 'META', COUNT )

              WRITE(*,'(A,I2)') 'The total number of meta-kernels  '
             . //               '            : ', COUNT

        C
        C     Count the number of text kernels.
        C
              CALL KTOTAL ( 'TEXT', COUNT )

              WRITE(*,'(A,I2)') 'The total number of text kernels  '
             . //               '            : ', COUNT

        C
        C     Count the number of binary kernels. These kernels
        C     are of type CK, DSK, EK, PCK or SPK.
        C
              CALL KTOTAL ( 'CK DSK EK PCK SPK', COUNT )
              WRITE(*,'(A,I2)') 'The total number of binary kernels'
             . //               '            : ', COUNT

        C
        C     Clear the KEEPER system, retrieve the number of loaded
        C     after the clear.
        C
              CALL KCLEAR()

              CALL KTOTAL ( 'ALL', COUNT )

              WRITE(*,'(A,I2)') 'The total number of kernels after '
             . //               'KCLEAR      : ', COUNT

              END


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


        The total number of kernels after final FURNSH:  6
        The total number of meta-kernels              :  1
        The total number of text kernels              :  3
        The total number of binary kernels            :  2
        The total number of kernels after KCLEAR      :  0

Restrictions

     None.

Literature_References

     None.

Author_and_Institution

     N.J. Bachman       (JPL)
     J. Diaz del Rio    (ODC Space)
     B.V. Semenov       (JPL)
     W.L. Taber         (JPL)

Version

    SPICELIB Version 5.0.1, 25-OCT-2021 (JDR) (NJB)

        Edited the header to comply with NAIF standard.
        Created complete code example from existing code fragments.

        Updated $Detailed_Input description of input argument KIND to
        illustrate use of multi-word lists. Added KERNEL to the list
        of required readings.

    SPICELIB Version 5.0.0, 01-FEB-2017 (NJB) (BVS)

        Updated to support use of DSKs.

        Updated the $Author_and_Institution section.

    SPICELIB Version 1.1.0, 02-APR-2009 (NJB)

        Deleted reference to unneeded variable DOALL.

    SPICELIB Version 1.0.0, 01-JUL-1999 (WLT)
Fri Dec 31 18:36:30 2021