1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
 int
 saf_describe_alternate_indexspec(SAF_ParMode pmode,             /* The parallel mode*/
                                  SAF_AltIndexSpec *aspec,       /* The alternate index spec you want the description of. */
                                  SAF_Set *containing_set,       /* [OUT] The containing set of the collection.  Pass NULL if you do
                                                                  * not want this returned. */
                                  SAF_Cat *cat,                  /* [OUT] The collection category. Pass NULL if you do not want this
                                                                  * returned. */
                                  char **name,                   /* [OUT] The name of this alt index spec. */
                                  hid_t *data_type,              /* [OUT] The data type used to identify members of the collection.
                                                                  * Pass NULL if you do not want this returned. */
                                  hbool_t *is_explicit,          /* [OUT] Whether the indexing specification is explicit or
                                                                  * implicit. */
                                  SAF_IndexSpec *implicit_ispec, /* [OUT] The alternate indexing scheme of the collection. If the
                                                                  * index spec is explicit, then SAF_NA_INDEXSPEC will be
                                                                  * returned.  If the index spec is implicit, the implicit
                                                                  * index spec will be returned here. */
                                  hbool_t *is_compact,           /* [OUT] Whether the indexing specification is compact or not.
                                                                  * Ignored for implicit specs. */
                                  hbool_t *is_sorted             /* [OUT] Whether the indexing specification is sorted or not.
                                                                  * Ignored for implicit specs. */
                                  )
 {
     SAF_ENTER(saf_describe_alternate_indexspec, SAF_PRECONDITION_ERROR);
     ss_collection_t     coll=SS_COLLECTION_NULL;
     size_t              i;
     hid_t               ftype;

     SAF_REQUIRE(_saf_valid_pmode(pmode), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                 _saf_errmsg("PMODE must be valid"));
     if (!_saf_is_participating_proc(pmode)) SAF_RETURN(-1);

     SAF_REQUIRE(SS_INDEXSPEC(aspec), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                 _saf_errmsg("the ASPEC argument must be a valid handle"));


     /* Get the collection associated with the alt indexing spec. */
     coll = SS_INDEXSPEC(aspec)->coll;

     /* Now the we have the collection record, get the containing set. */
     if (containing_set)
         *containing_set = SS_COLLECTION(&coll)->containing_set;

     /* Also get the cat. */
     if (cat)
         *cat = SS_COLLECTION(&coll)->cat;

     /* Populate the data_type */
     if (data_type) {
         if (!SS_PERS_ISNULL(SS_INDEXSPEC_P(aspec,blob))) {
             ss_blob_bound_f1(SS_INDEXSPEC_P(aspec,blob), NULL, NULL, NULL, &ftype);
             *data_type = H5Tget_native_type(ftype, H5T_DIR_DEFAULT);
             H5Tclose(ftype);
         } else {
             *data_type = H5I_INVALID_HID;
         }
     }

     if (is_explicit)
         *is_explicit = SS_INDEXSPEC(aspec)->is_explicit;
     if (is_sorted)
         *is_sorted = SS_INDEXSPEC(aspec)->is_sorted;
     if (is_compact)
         *is_compact = SS_INDEXSPEC(aspec)->is_compact;

     if (implicit_ispec) {
         if (SS_INDEXSPEC(aspec)->is_explicit) {
             *implicit_ispec = SAF_NA_INDEXSPEC;
         } else {
             /* It is implicit, so return the regular implicit_ispec. */
             implicit_ispec->ndims = SS_INDEXSPEC(aspec)->ndims;
             for (i=0; i<SAF_MAX_NDIMS; i++) {
                 implicit_ispec->sizes[i]   = SS_INDEXSPEC(aspec)->sizes[i];
                 implicit_ispec->origins[i] = SS_INDEXSPEC(aspec)->origins[i];
                 implicit_ispec->order[i]   = SS_INDEXSPEC(aspec)->order[i];
             }
         }
     }

     /* return the name of the alt index spec */
     if (_saf_setupReturned_string(name, ss_string_ptr(SS_INDEXSPEC_P(aspec,name))) != SAF_SUCCESS)
         SAF_ERROR(SAF_MEMORY_ERROR, _saf_errmsg("unable to return alt index spec name for alt index spec %s\n",
                                                 ss_string_ptr(SS_INDEXSPEC_P(aspec,name))));

     SAF_LEAVE(SAF_SUCCESS);
 }