int
saf_write_subset_relation(SAF_ParMode pmode, /* The parallel mode. */
SAF_Rel *rel, /* The relation whose data is to be written. */
hid_t A_type, /* The type of A_BUF (if not already supplied through the
* saf_declare_subset_relation() call). */
void *A_buf, /* The data (if not already supplied through the
* saf_declare_subset_relation() call). */
hid_t B_type, /* The type of B_BUF (if not already supplied through the
* saf_declare_subset_relation() call. */
void *B_buf, /* The data (if not already supplied through the
* saf_declare_subset_relation() call). */
SAF_Db *file /* The optional destination file to write the data to. A null pointer for this
* argument indicates that the data is to be written to the same file as REL. */
)
{
SAF_ENTER(saf_write_subset_relation, SAF_PRECONDITION_ERROR);
double timer_start=0.0; /* Start time for calculating total write time. */
int retval;
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"));
SAF_REQUIRE(SAF_XOR(SS_REL(rel)->m.abuf, A_buf), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
_saf_errmsg("A_BUF should be specified either here or in the saf_declare_subset_relation() "
"call but not both"));
SAF_REQUIRE(!B_buf || !SS_REL(rel)->m.bbuf, SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
_saf_errmsg("B_BUF, if present, should be specified either here or in the "
"saf_declare_subset_relation() call but not both"));
if (_SAF_GLOBALS.p.TraceTimes)
timer_start = _saf_wall_clock(FALSE);
/* ok now make the actual call to write/update the relation data */
retval = _saf_write_subset_relation(pmode, rel, NULL, A_type, A_buf, B_type, B_buf, file);
if (_SAF_GLOBALS.p.TraceTimes)
_SAF_GLOBALS.CummWriteTime += _saf_wall_clock(false) - timer_start;
SAF_LEAVE(retval);
}