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
 void make_pressure_on_ss1_field(void)
 {
    SAF_Unit upsi;             /* Handle to the units for the pressure. */
    /* Made up pressure. */
    float pressure_dof_tuple[] = {45., 55.};
    void *dofs = &pressure_dof_tuple[0];

    /*
     ---------------------------------------------------------------------------
     *                         DECLARE FIELD TEMPLATES
     ---------------------------------------------------------------------------
     */
    saf_declare_field_tmpl(SAF_ALL,  db,"pressure_on_ss1", SAF_ALGTYPE_SCALAR,
                           SAF_UNITY, SAF_QNAME(db,"pressure"), 1, NULL,
                           &press_ftmpl);

    /*
     ---------------------------------------------------------------------------
     *                         DECLARE AND WRITE FIELDS
     *                     (dofs specified in declare call)
     ---------------------------------------------------------------------------
     */
    /* Get a handle to the units for this field. */
    saf_find_one_unit(db, "psi", &upsi);

    /* Declare the field. */
    saf_declare_field(SAF_ALL, db, &press_ftmpl, "pressure", &ss1, &upsi, SAF_SELF(db),
                      SAF_ZONAL(&edges), H5T_NATIVE_FLOAT, NULL, SAF_INTERLEAVE_NONE,
                      SAF_IDENTITY, &dofs, &press);

    /* Write the field. */
    saf_write_field(SAF_ALL, &press, SAF_WHOLE_FIELD, 0, H5I_INVALID_HID, NULL, saf_file);

    return;
 }