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
 void make_distribution_factors_on_ss2_field(void)
 {
    /* Made up distribution factors. */
    float distfac_dof_tuple[]  = {4., 3., 2., 1., 0.};
    void *dofs = &distfac_dof_tuple[0];

    /*
     ---------------------------------------------------------------------------
     *                         DECLARE FIELD TEMPLATES
     ---------------------------------------------------------------------------
     */
    saf_declare_field_tmpl(SAF_ALL,  db,"distrib_factors_tmpl", SAF_ALGTYPE_SCALAR,
                           SAF_UNITY, SAF_NOT_APPLICABLE_QUANTITY, 1, NULL,
                           &distfac_ftmpl);

    /*
     ---------------------------------------------------------------------------
     *                         DECLARE AND WRITE FIELDS
     *                      (dofs specified in write call)
     ---------------------------------------------------------------------------
     */
    /* Declare the field. */
    saf_declare_field(SAF_ALL, db, &distfac_ftmpl, "distribution factors",
                      &ss2, SAF_NOT_APPLICABLE_UNIT, SAF_SELF(db),
                      SAF_NODAL(&nodes, &edges), H5T_NATIVE_FLOAT, NULL,
                      SAF_INTERLEAVE_NONE, SAF_IDENTITY, NULL, &distfac);

    /* Write the field. */
    saf_write_field(SAF_ALL, &distfac, SAF_WHOLE_FIELD, 1,
                    H5I_INVALID_HID, &dofs, saf_file);

    return;
 }