union_c |

Table of contents## Procedureunion_c ( Union of two sets ) void union_c ( SpiceCell * a, SpiceCell * b, SpiceCell * c ) ## AbstractCompute the union of two sets of any data type to form a third set. ## Required_ReadingSETS ## KeywordsCELLS SETS ## Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- a I First input set. b I Second input set. c O Union of `a' and `b'. ## Detailed_Inputa is a SPICE set. `a' must be declared as a character, double precision or integer SpiceCell. CSPICE provides the following macros, which declare and initialize the cell SPICECHAR_CELL ( a, ASZ, AMLEN ); SPICEDOUBLE_CELL ( a, ASZ ); SPICEINT_CELL ( a, ASZ ); where ASZ is the maximum capacity of `a' and AMLEN is the maximum length of any member in the character cell. b is a SPICE set, distinct from `a'. `b' must be declared as a SpiceCell of the same data type as `a'. CSPICE provides the following macros, which declare and initialize the cell SPICECHAR_CELL ( b, BSZ, BMLEN ); SPICEDOUBLE_CELL ( b, BSZ ); SPICEINT_CELL ( b, BSZ ); where BSZ is the maximum capacity of `b' and BMLEN is the maximum length of any member in the character cell. ## Detailed_Outputc is a SPICE set, distinct from sets `a' and `b', which contains the union of `a' and `b' (that is, all of the elements which are in `a' or `b' or both). When comparing elements of character sets, this routine ignores trailing blanks. Trailing blanks will be trimmed from the members of the output set `c'. `c' must be declared as a SpiceCell of the same data type as `a' and `b'. CSPICE provides the following macros, which declare and initialize the cell SPICECHAR_CELL ( c, CSZ, CMLEN ); SPICEDOUBLE_CELL ( c, CSZ ); SPICEINT_CELL ( c, CSZ ); where CSZ is the maximum capacity of `c' and CMLEN is the maximum length of any member in the character cell. ## ParametersNone. ## Exceptions1) If the union of the two input sets contains more elements than can be contained in the output set, the error SPICE(SETEXCESS) is signaled by a routine in the call tree of this routine. 2) If the `a', `b' and `c' cell arguments are of type SpiceChar and the length of the elements of the output set is less than the maximum of the lengths of the elements of the input sets, the error SPICE(ELEMENTSTOOSHORT) is signaled by a routine in the call tree of this routine. 3) If the `a', `b' and `c' cell arguments do not have identical data types, the error SPICE(TYPEMISMATCH) is signaled. 4) If any of the `a', `b' or `c' cell arguments does not qualify as a SPICE set, the error SPICE(NOTASET) is signaled. SPICE sets have their data elements stored in increasing order and contain no duplicate elements. 5) If any of the `a', `b' or `c' cell arguments does not have a recognized data type, the error SPICE(NOTSUPPORTED) is signaled. 6) If the cell arguments are of type SpiceChar and the string length associated with any of them is non-positive or too short to be usable when constructing the equivalent SPICE character cells required by the wrapped SPICELIB routine, an error is signaled by a routine in the call tree of this routine. ## FilesNone. ## ParticularsThis is a generic SPICE set routine; it operates on sets of any supported data type. The union of two sets contains every element which is in the first set, or in the second set, or in both sets. {a,b} union {c,d} = {a,b,c,d} {a,b,c} {b,c,d} {a,b,c,d} {a,b,c,d} {} {a,b,c,d} {} {a,b,c,d} {a,b,c,d} {} {} {} ## Examples1) The following code fragment places the union of the character sets planets and asteroids into the character set result. #include "SpiceUsr.h" . . . /. Declare the sets with string length NAMLEN and with maximum number of elements MAXSIZ. ./ SPICECHAR_CELL ( planets, MAXSIZ, NAMLEN ); SPICECHAR_CELL ( asteroids, MAXSIZ, NAMLEN ); SPICECHAR_CELL ( result, MAXSIZ, NAMLEN ); . . . /. Compute the union. ./ ## Restrictions1) The output set must be distinct from both of the input sets. For example, the following calls are invalid. ## Literature_ReferencesNone. ## Author_and_InstitutionN.J. Bachman (JPL) C.A. Curzon (JPL) J. Diaz del Rio (ODC Space) W.L. Taber (JPL) I.M. Underwood (JPL) ## Version-CSPICE Version 1.1.1, 29-OCT-2021 (JDR) Edited the header to comply with NAIF standard. Extended description of arguments "a", "b" and "c" to include type and preferred declaration method. Added entries #5 and #6 in -Exceptions section. -CSPICE Version 1.1.0, 15-FEB-2005 (NJB) Bug fix: loop bound changed from 2 to 3 in loop used to free dynamically allocated arrays. -CSPICE Version 1.0.0, 08-AUG-2002 (NJB) (CAC) (WLT) (IMU) ## Index_Entriesunion of two sets |

Fri Dec 31 18:41:14 2021