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
 void make_indirect_coord_field(void)
 {
    SAF_FieldTmpl coord_mesh_ftmpl; /* Handle to the coordinate field template
                                     * on the mesh. */
    SAF_Field coords_mesh,          /* Handle to the coordinate field on the
                                     * mesh. */
              buf[2];
    void *pbuf = &buf[0];

    /*
     ---------------------------------------------------------------------------
     *                         DECLARE FIELD TEMPLATES
     ---------------------------------------------------------------------------
     */
     saf_declare_field_tmpl(SAF_ALL, db, "coords_on_mesh_tmpl", SAF_ALGTYPE_FIELD,
                            NULL, SAF_NOT_APPLICABLE_QUANTITY, SAF_NOT_APPLICABLE_INT,
                            NULL, &coord_mesh_ftmpl);

    /*
     ---------------------------------------------------------------------------
     *                         DECLARE AND WRITE FIELDS
     ---------------------------------------------------------------------------
     */

    /* the coordinate field on the mesh */
    saf_declare_field(SAF_ALL, db, &coord_mesh_ftmpl, "coords", &mesh, SAF_NOT_APPLICABLE_UNIT, &domains,
                      SAF_NODAL(&nodes, &zones), SAF_HANDLE,
                      NULL, SAF_INTERLEAVE_VECTOR, SAF_IDENTITY,
                      NULL, &coords_mesh);
    buf[0] = coords_d0;
    buf[1] = coords_d1;
    saf_write_field(SAF_ALL, &coords_mesh,          SAF_WHOLE_FIELD, 1, H5I_INVALID_HID,
                    &pbuf, db);

    /* specify that it is a coordinate field */
    saf_declare_coords(SAF_ALL, &coords_mesh);
    saf_declare_default_coords(SAF_ALL,&mesh,&coords_mesh);
 }