Table of contents
CSPICE_KCLEAR clears the KEEPER system: unload all kernels, clears
the kernel pool, and re-initialize the system.
The call:
cspice_kclear
Re-initialize the KEEPER system.
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) Load a meta-kernel containing three kernels, and count the
number of files in the kernel pool before and after calling
cspice_kclear.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: kclear_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
pck00008.tpc Planet orientation and
radii
naif0009.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de421.bsp',
'pck00008.tpc',
'naif0009.tls' )
\begintext
End of meta-kernel
Example code begins here.
function kclear_ex1()
%
% Load the standard meta kernel, retrieve the number of
% loaded kernels.
%
cspice_furnsh( 'kclear_ex1.tm' )
n = cspice_ktotal( 'ALL' );
txt = sprintf(['Count of loaded kernels before ', ...
'cspice_kclear call: %d'], n );
disp( txt )
%
% Clear the KEEPER system, retrieve the number of loaded
% after the clear.
%
cspice_kclear
n = cspice_ktotal( 'ALL' );
txt = sprintf(['Count of loaded kernels after ', ...
'cspice_kclear call: %d'], n );
disp( txt )
When this program was executed on a Mac/Intel/Octave6.x/64-bit
platform, the output was:
Count of loaded kernels before cspice_kclear call: 4
Count of loaded kernels after cspice_kclear call: 0
This routine allows you re-initialize the KEEPER system with
a single call. The KEEPER system is the kernel management system
underlying the set of Mice APIs
cspice_furnsh
cspice_ktotal
cspice_kdata
cspice_kinfo
cspice_kclear
cspice_unload
This routine unloads all kernels from their kernel-type-specific
kernel management subsystems (SPKBSR, CKBSR, etc.), clears the
kernel pool, clears KEEPER's internal file database, and re-sets
the watch status for the kernel variables used to load kernels
via meta-kernels.
This capability, though implemented in Fortran, is particularly
relevant to SPICE implementations such as Mice, for which the
state of the KEEPER system persists after any Mice-based MATLAB
script is run. Successive runs of Mice-based scripts may perform
in unexpected ways when scripts access data loaded during runs of
previous scripts.
Cleaning up after such programs using explicit unload_c commands is
tedious and error-prone. One call to this routine sets the
KEEPER system to its initial state, preventing unintentional
interaction between scripts via KEEPER's state.
1) If an error occurs when setting a kernel pool watch or
checking watched variables, the error is signaled by a routine
in the call tree of this routine.
See -Particulars.
1) Calling this routine will wipe out any kernel pool data
inserted via the Mice API routines to put data into the
kernel pool (cspice_pcpool, cspice_pdpool and cspice_pipool).
MICE.REQ
KERNEL.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Mice Version 1.1.0, 13-AUG-2021 (EDW) (JDR)
Edited the -Examples section to comply with NAIF standard. Added
example's problem statement and meta-kernel. Merged the existing
code fragments into a complete example.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Eliminated use of "lasterror" in rethrow.
Removed reference to the function's corresponding CSPICE header from
-Required_Reading section.
-Mice Version 1.0.0, 01-DEC-2006 (EDW)
Re-initialize the keeper system
Clear the keeper system
Unload all kernels
|