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
 int
 saf_target_field(SAF_FieldTarget *target,       /* [OUT] The target information that will be initialized by this call. */
                  SAF_Unit *targ_units,          /* The new units. This parameter is ignored at this time. */
                  SAF_Cat *targ_storage_decomp,  /* The new storage decomposition. */
                  SAF_Cat *targ_coeff_assoc,     /* This parameter is ignored at this time. */
                  int targ_assoc_ratio,          /* This parameter is ignored at this time. */
                  SAF_Cat *targ_eval_coll,       /* This parameter is ignored at this time. */
                  SAF_Eval *targ_func,           /* This parameter is ignored at this time. */
                  hid_t targ_data_type,          /* The new destination data type. When the saf_write_field() function is called
                                                  * the datatype of the dataset produced is determined by this parameter.  When
                                                  * the saf_read_field() function is called, the datatype of the values placed in
                                                  * the caller's memory is determined by this parameter. If a value of
                                                  * H5I_INVALID_HID is passed for this parameter then datatype targeting is
                                                  * turned off and the default mechanism for determining the destination
                                                  * datatype is used. */
                  SAF_Interleave comp_intlv,     /* The particular fashion in which components are interleaved.  Currently
                                                  * there are really only two: SAF_INTERLEAVE_VECTOR and SAF_INTERLEAVE_COMPONENT.
                                                  * These represent the XYZXYZ...XYZ and the XXX...XYYY...YZZZ...Z cases.  Note that
                                                  * interleave really only deals with a single blob of storage.  In the case of a
                                                  * composite field whose coefficients are stored independently on the component
                                                  * fields then interleave really has no meaning (use SAF_INTERLEAVE_INDEPENDENT).
                                                  * Interleave only has meaning on fields with storage.  In the case of a scalar
                                                  * field interleave is also meaningless, both cases degenerate to the same layout:
                                                  * XXX...X (use SAF_INTERLEAVE_NONE). This parameter is ignored at this time. */
                  int *comp_order                /* Only relevant for fields with component fields.  This value indicates the order
                                                  * of the field IDs in the COMP_FLDS relative to the registered order. Pass NULL
                                                  * if the permutation is the identity. This parameter is ignored at this time. */

                  )
 {
    SAF_ENTER(saf_target_field, SAF_PRECONDITION_ERROR);

    SAF_REQUIRE(!targ_storage_decomp || SS_CAT(targ_storage_decomp), SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                _saf_errmsg("STORAGE_DECOMP must be either NOT_SET, SELF_DECOMP or a valid cat handle"));
    SAF_REQUIRE(target, SAF_LOW_CHK_COST, SAF_PRECONDITION_ERROR,
                _saf_errmsg("TARGET must be non-null"));

    memset(target, 0, sizeof *target);
    target->is_set = TRUE;
    if (targ_units) target->units = *targ_units;
    if (targ_storage_decomp) target->decomp = *targ_storage_decomp;
    if (targ_coeff_assoc) target->coeff_assoc = *targ_coeff_assoc;
    target->assoc_ratio = targ_assoc_ratio;
    if (targ_eval_coll) target->eval_coll = *targ_eval_coll;
    if (targ_func) target->func = *targ_func;
    target->data_type = targ_data_type;
    target->comp_intlv = comp_intlv;
    target->comp_order = comp_order;

    SAF_LEAVE(SAF_SUCCESS);
 }