Declare a subset relation¶
saf_declare_subset_relation is a function defined in rel.c.
Synopsis:
-
SAF_Rel *
saf_declare_subset_relation(SAF_ParMode pmode, SAF_Db *db, SAF_Set *sup, SAF_Set *sub, SAF_Cat *sup_cat, SAF_Cat *sub_cat, SAF_BoundMode sbmode, SAF_BoundMode cbmode, SAF_RelRep *srtype, hid_t A_type, void *A_buf, hid_t B_type, void *B_buf, SAF_Rel *rel)¶
Formal Arguments:
pmode: The parallel mode.db: The database in which to place the new relation.sup: The superset. InSAF__ONEparallel mode, all processors except the one identified by theSAF__ONEargument should pass the null set of the database by using theSAF__NULLmacro.sub: The subset. InSAF__ONEparallel mode, all processors except the one identified by theSAF__ONEargument should pass the null set of the database by using theSAF__NULLmacro.sup_cat: The collection category on thesupset upon which the subset relation is being defined. Note that collections of this category must have already been defined onsup. Otherwise, an error is generated. Note, the four args,sup_cat,sub_cat,sbmode,cbmode, are typically passed using one of the macros described above,SAF__COMMON``(C), ``SAF__BOUNDARY``(``P,``B``),SAF__EMBEDBND``(``P,``B``) orSAF__GENERAL``(``BND)sub_cat: The collection category on thesubset upon which the subset relation is being defined. Note that collections of this category must have already been defined onsub. Otherwise an error is generated.sbmode: Indicates whethersubis the boundary ofsup. Pass eitherSAF__BOUNDARY_TRUEorSAF__BOUNDARY_FALSEcbmode: Indicates whether members of collection onsubare on the boundary of members of the collection onsup. Pass eitherSAF__BOUNDARY_TRUEorSAF__BOUNDARY_FALSEsrtype: Subset relation types. This argument describes how the data inABUFrepresents the subset. Valid values areSAF__HSLABmeaning thatABUFpoints to a hyperslab specification andSAF__TUPLESmeaning thatABUFpoints to a list ofN-tuples.A_type: The type of the data inA_bufA_buf: This buffer contains references, one for each member of the domain collection (onsub), to members of the range collection (onsup). The client may passNULLhere meaning that the raw data will be bound to the object during write, rather than declaration.B_type: The type of the data inB_bufB_buf: This buffer is valid only when the members of the domain collection (onsub) are on the boundaries of the members of the range collection (onsup). In this case, the data contained in this buffer identifies “which piece” of the boundary each member of the domain collection is. Otherwise, the client should passNULLhere. As withABUF, the client may pass alsoNULLhere meaning the raw data will be bound to the object during write, rather than declaration.rel: [OUT] Optional returned relation handle.
Description: This call is used to declare a subset relation between two sets. The relation is specified in terms of
collections on both sets. The subset, sub, can be either a boundary of sup or not. Which case is indicated
by the sbmode argument which can be either SAF__BOUNDARY_TRUE or SAF__BOUNDARY_FALSE.
In addition, The members of the collection on the sub set are either on the boundary of the
members of the collection on the sup set or not (the only other acceptable case is one in which the members
of the collection on the sub are equal to the members of the collection on sup). Which case is indicated by
the value of the cbmode argument, can be either SAF__BOUNDARY_TRUE or SAF__BOUNDARY_FALSE.
Thus, there are two statements made about boundary information. One about the sets, sup and sub and one
about the members of the collections on sup and sub. Furthermore, the statement about the sets, indicated
by sbmode, is that sub is the boundary of sup or it is not. The statement about the collections,
indicated by cbmode, is that the members of the sub collection are on the boundary of the members of
the sup collection or not.
The values in ABUF enumerate the members of the collection on sub that are either on the boundaries of or
equal to the members of the collection on sup. In the on the boundary of case (e.g. cbmode``==``SAF__BOUNDARY_TRUE)
the values in BBUF, if non-NULL, indicate “which” piece of the sup collection member’s boundary each member
of sub collection is. For example, if the sub collection is faces and the sup collection is a bunch of hexes,
BBUF can be used to identify which of the 6 faces each member of sub collection is. This information is
optional.
The group of four formal arguments sup_cat, sub_cat, sbmode, cbmode select from the various cases described
above. For convenience, we provide a number of macros for these four arguments for the common cases…
:ref:`SAF_COMMON <SAF_COMMON>`(C) : a subset relationship in which the subset is specified by enumerating those members of the superset that are in the subset. This is the most common case. Argument C is the collection category both sets have in common.
SAF_BOUNDARY <SAF_BOUNDARY>`(``P`,``B``) : a subset relationship in which sub is the boundary of sup and the
members of B on sub are on the boundaries of the members of P on sup.
SAF_EMBEDBND <SAF_EMBEDBND>`(``P`,``B``) : a subset relationship in which sub is some embedded boundary in sup and
members of the collection B on sub are on the boundaries of the members of collection P on sup.
SAF_GENERAL <SAF_GENERAL>`(``BND`) : a subset relationship in which all that is known is that sub is indeed a subset of sup
The details of the relationships are not known. In this case, the BND is a boolean indicating
if sub is the boundary of sup.
Finally, there is the subset relation representation type, srtype…
By and large, the details of the relation data can be derived from knowledge of the indexing schemes used in
the domain and range collections of the relation. For example, if the range is indexed using some N
dimensional indexing scheme, then the relation will either be an N dimensional hyperslab or a list of N-tuples.
In the case of SAF__HSLAB, it is assumed the memory pointed to by ABUF contains 3 N-tuples of the form (starts,
counts, strides) where starts, counts, and strides indicate the starting point of the hyperslab in N
dimensions, the number of items in each dimension and the stride (through the range collection) in each
dimension respectively. The order of dimensional axes in each of these arrays is assumed to match the terms in
which the range collection’s indexing is specified.
In the case of SAF__TUPLES, it is assumed the memory pointed to by ABUF contains a list of N-tuples where each N
tuple identifies one member of the range collection. The offsets argument to SAF__TUPLES, if present, indicates
a fixed N-tuple offset to be associated with each N-tuple in ABUF.
There are two ways the client may pass the data buffer holding the relation data; either here as the ABUF
argument of the declare call or later as the ABUF argument of the write call. The client cannot do both. It
must choose. This flexibility was provided to aim the API for in-memory communications as well as persistent
file writes. By and large, the client should pass NULL for the ABUF arg here and pass the buffer in the write
call whenever it is writing persistent data to the file. However, whenever the client is planning to do
in-memory communication, it should specify ABUF here.
Preconditions:
pmodemust be valid. (low-cost)supmust be a valid set handle. (low-cost)submust be a valid set handle. (low-cost)sbmodemust be eitherSAF__BOUNDARY_TRUEorSAF__BOUNDARY_FALSE. (low-cost)cbmodemust be eitherSAF__BOUNDARY_TRUEorSAF__BOUNDARY_FALSE. (low-cost)cbmodemust beSAF__BOUNDARY_TRUEifsbmodeisSAF__BOUNDARY_TRUEfor all participating processes. (low-cost)- Either
A_bufis null and bothsup_catandsub_catare not valid cat handles or. (low-cost) B_bufcan be non-NULLonly whencbmodeisSAF__BOUNDARY_TRUE. (low-cost)- On the reserved, “self” collection,
cbmodeandsbmodemust beSAF__BOUNDARY_FALSE. (low-cost) srtypemust be a valid relation representation handle. (low-cost)srtypemust be eitherSAF__HSLABorSAF__TUPLES. (low-cost)relmust be non-NULL. (low-cost)A_typemust be an integer type if supplied. (low-cost)B_typemust be an integer type if supplied. (low-cost)
Return Value: On success returns either the supplied rel argument or a pointer to a newly allocated relation link. Returns
the null pointer on failure.
Issues: We may want to have separate datatypes for ABUF and BBUF as BBUF’s values are likely to always fit in
a byte though I don’t know any clients that actually store them that way.
At present, we assert that for any boundary case, the range collection (on sup) must be of a primitive
type (e.g. not SAF__CELLTYPE_SET). However, this really need not be the case. Any set which has a boundary set
can then have “pieces” of that boundary that could be referred to use the local address space of that
boundary. It just so happens that the most common case for this is when we are referring to cell-types.
If we could guarantee all processors’ is_top member were identical, we could wrap this call so that we don’t try
to put the set record if its already NOT a top set.
See Also:
- Subset Relations: Introduction for current chapter