int
saf_describe_subset_relation(SAF_ParMode pmode, /* The parallel mode. */
SAF_Rel *rel, /* The relation handle. */
SAF_Set *sup, /* [OUT] The superset. Pass NULL if you do not want this value returned. */
SAF_Set *sub, /* [OUT] The subset. Pass NULL if you do not want this value returned. */
SAF_Cat *sup_cat, /* [OUT] The collection category on the SUP set upon which the subset
* relation is defined. Note that collections of this category must
* have already been defined on SUP. Otherwise, an error is generated.
* Note that the four args SUP_CAT, SUB_CAT, SBMODE, and CBMODE are
* typically passed using one of the macros described in the
* saf_declare_subset_relation() call, SAF_COMMON(), SAF_BOUNDARY(),
* SAF_EMBEDBND() or SAF_GENERAL(). Pass NULL if you do not want this
* value returned. */
SAF_Cat *sub_cat, /* [OUT] The collection category on the SUB set upon which the subset
* relation is defined. Again, pass NULL if you do not want this value
* returned. */
SAF_BoundMode *sbmode, /* [OUT] Indicates whether SUB is the boundary of SUP. A value of
* SAF_BOUNDARY_TRUE, indicates that the SUB is a boundary of SUP. A
* value of SAF_BOUNDARY_FALSE indicates SUB is *not* a boundary of
* SUP. Pass NULL if you do not want this value returned. */
SAF_BoundMode *cbmode, /* [OUT] Indicates whether *members* of collection on SUB are *on* the
* boundaries of members of the collection on SUP. A value of
* SAF_BOUNDARY_TRUE indicates they are. A value of SAF_BOUNDARY_FALSE
* indicates they are not. Pass NULL if you do not want this value
* returned. */
SAF_RelRep *srtype, /* [OUT] The representation specification. Pass NULL if you do not want
* this handle returned. See saf_declare_subset_relation() for the
* meaning of values of this argument. */
hid_t *data_type /* [OUT] The data-type of the data stored with the relation. Pass NULL
* if you do not want this value returned. */
)
{
SAF_ENTER(saf_describe_subset_relation, SAF_PRECONDITION_ERROR);
hid_t ftype=-1; /* File datatype */
ss_collection_t sub_coll; /* Collection on relation's subset */
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_REL(rel), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
_saf_errmsg("the REL argument must be a valid handle"));
/* Return desired params. */
if (sup) *sup = SS_REL(rel)->sup;
if (sub) *sub = SS_REL(rel)->sub;
if (sup_cat) *sup_cat = SS_REL(rel)->sup_cat;
if (sub_cat) *sub_cat = SS_REL(rel)->sub_cat;
if (cbmode) *cbmode = SS_REL(rel)->kind==SAF_RELKIND_BOUND ? SAF_BOUNDARY_TRUE : SAF_BOUNDARY_FALSE;
if (sbmode) {
if (SS_REL(rel)->kind == SAF_RELKIND_BOUND) {
/* This subset relation is SOME kind of boundary relation. The subset MAY be the boundary of the superset. Look
* at the superset record to find out if it is. */
*sbmode = SAF_EQUIV(SS_SET_P(SS_REL_P(rel,sup),bnd_set), SS_REL_P(rel,sub)) ? SAF_BOUNDARY_TRUE : SAF_BOUNDARY_FALSE;
} else {
*sbmode = SAF_BOUNDARY_FALSE;
}
}
if (srtype) *srtype = SS_REL(rel)->rep_type;
if (data_type) {
if (!SS_PERS_ISNULL(SS_REL_P(rel,r_blob))) {
ss_blob_bound_f(SS_REL_P(rel,r_blob), NULL, NULL, NULL, NULL, &ftype);
*data_type = H5Tget_native_type(ftype, H5T_DIR_DEFAULT);
H5Tclose(ftype); ftype=-1;
} else {
/* Checking for the special case, where the subset collection has a count of 1, is of type SET and is a
* decomposition. */
_saf_getCollection_set(SS_REL_P(rel,sub), SS_REL_P(rel,sub_cat), &sub_coll);
if (SS_COLLECTION(&sub_coll)->count<=1 &&
SS_COLLECTION(&sub_coll)->cell_type==SAF_CELLTYPE_SET &&
SS_COLLECTION(&sub_coll)->is_decomp) {
if (data_type) *data_type = H5Tcopy(ss_pers_tm);
} else {
SAF_ERROR(SAF_CONSTRAINT_ERROR,_saf_errmsg("cannot return data_type and/or file prior to writing"));
}
}
}
SAF_LEAVE(SAF_SUCCESS);
}