void make_time_base_field(void)
{
SAF_FieldTmpl time_ftmpl; /* Handle to the time field template. */
SAF_Field time_fld; /* Handle to the time field. */
SAF_Unit usec;
/* Made up times. */
float time_dof_tuple[] = {0.0, 1.4, 1.8, 2.35,
3.0, 3.01, 5.25, 6.1,
6.75, 8.0, 11.0};
void *dofs = &time_dof_tuple[0];
int members[3] = {0,0,1};
/*
---------------------------------------------------------------------------
* DECLARE FIELD TEMPLATES
---------------------------------------------------------------------------
*/
saf_declare_field_tmpl(SAF_ALL, db,"time_on_time_base", SAF_ALGTYPE_SCALAR,
SAF_UNITY, SAF_QTIME, 1, NULL, &time_ftmpl);
/*
---------------------------------------------------------------------------
* DECLARE AND WRITE FIELDS
* (dofs specified in write call)
---------------------------------------------------------------------------
*/
/* Get a handle to the units for this field. */
saf_find_one_unit(db, "second", &usec);
/* Declare the field. */
saf_declare_field(SAF_ALL, db, &time_ftmpl, "times", &time_base, &usec, SAF_SELF(db),
SAF_NODAL(&nodes, &nodes), H5T_NATIVE_FLOAT, NULL,
SAF_INTERLEAVE_NONE, SAF_IDENTITY, NULL, &time_fld);
/* indicate this is a coordinate field for the time base */
saf_declare_coords(SAF_ALL, &time_fld);
saf_declare_default_coords(SAF_ALL, &time_base, &time_fld);
/* Write part of the field--dofs on nodes 0-4. */
members[0] = 0; /* start at 0 */
members[1] = 5; /* count of 5 */
saf_write_field(SAF_ALL, &time_fld, 5, SAF_HSLAB, members, 1,
H5I_INVALID_HID, &dofs, saf_file);
/* Write the remainder of the field--dofs on nodes 5-10. */
members[0] = 5; /* start at 5 */
members[1] = 6; /* count of 6 */
saf_write_field(SAF_ALL, &time_fld, 6, SAF_HSLAB, members, 1,
H5I_INVALID_HID, &dofs, saf_file);
return;
}