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
 int
 saf_describe_topo_relation(SAF_ParMode pmode,           /* The parallel mode. */
                            SAF_Rel *rel,                /* The relation to be described. */
                            SAF_Set *set,                /* [OUT] The containing set of the collection that is sewn together by the
                                                          * relation. */
                            SAF_Cat *pieces,             /* [OUT] The collection of members that are sewn together. */
                            SAF_Set *range_set,
                            SAF_Cat *range_cat,          /* [OUT] Together the RANGE_S and RANGE_C pair identifies the collection
                                                          * used to glue the pieces together. */
                            SAF_Cat *storage_decomp,     /* [OUT] The decomposition of SET upon which the relation is actually
                                                          * stored. */
                            SAF_RelRep *trtype,          /* [OUT] The topology relation type. */
                            hid_t *data_type             /* [OUT] The type of the data. */
                            )
 {
     SAF_ENTER(saf_describe_topo_relation, SAF_PRECONDITION_ERROR);
     hid_t       ftype=-1;

     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("REL must be a valid relation handle for all participating processes"));

     /* Return each of the desired values, a desired parameter is indicated by a non-null pointer. */
     if (set) *set = SS_REL(rel)->sub;
     if (pieces) *pieces = SS_REL(rel)->sub_cat;
     if (range_set) *range_set = SS_REL(rel)->sup;
     if (range_cat) *range_cat = SS_REL(rel)->sup_cat;
     if (storage_decomp) {
         if (!_saf_is_self_decomp(SS_REL_P(rel,sup_decomp_cat)) &&
             SAF_EQUIV(SS_REL_P(rel,sup_decomp_cat), SS_REL_P(rel,sub_decomp_cat))) {
             *storage_decomp = SS_REL(rel)->sup_decomp_cat;
         } else {
             *storage_decomp = *SAF_SELF(XXX);
         }
     }
     if (trtype) *trtype = SS_REL(rel)->rep_type;
     if (data_type) {
         if (SAF_STRUCTURED_ID==SS_RELREP(SS_REL_P(rel,rep_type))->id) {
             /* In the case of structured meshes, no topo relation data is written so we just return the following values to
              * indicate this. */
             *data_type = H5I_INVALID_HID;
         } else {
             /* The mesh is not structured so the topo relation data is written to the file and we must find the information
              * about the data_type. */
             if (SS_PERS_ISNULL(SS_REL_P(rel,r_blob)))
                 SAF_ERROR(SAF_CONSTRAINT_ERROR,_saf_errmsg("cannot return data_type and/or file prior to writing"));
             ss_blob_bound_f1(SS_REL_P(rel,r_blob), NULL, NULL, NULL, &ftype);
             *data_type = H5Tget_native_type(ftype, H5T_DIR_DEFAULT);
             H5Tclose(ftype); ftype=-1;
         }
     }

     SAF_LEAVE(SAF_SUCCESS);
 }