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
 void make_temperature_on_cell_2_field(void)
 {
    SAF_Unit ukelvin;          /* Handle to the units for the temperature. */
    /* Made up temperatures. */
    float temp2_dof_tuple[] = {75., 95., 120., 80., 115., 85., 110.};
    void *dofs = &temp2_dof_tuple[0];

    /*
     ---------------------------------------------------------------------------
     *                         DECLARE FIELD TEMPLATES
     ---------------------------------------------------------------------------
     */
    saf_declare_field_tmpl(SAF_ALL,  db,"temp_on_cell_2_tmpl", SAF_ALGTYPE_SCALAR,
                           SAF_UNITY, SAF_QTEMP, 1, NULL, &temp2_ftmpl);

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

    /* Declare the field. */
    saf_declare_field(SAF_ALL, db, &temp2_ftmpl, "temperature", &cell_2, &ukelvin,
                      SAF_SELF(db), SAF_NODAL(&nodes, &elems), H5T_NATIVE_FLOAT,
                      NULL, SAF_INTERLEAVE_NONE, SAF_IDENTITY, &dofs, &temps2);

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

    return;
 }