void make_displacement_field(void)
{
SAF_Unit umeter; /* Handle to the units for the coordinates. */
/* The displacement field dofs. */
float displacement_dof_tuple[] = {.25,.25, .25,.25, .25,.25, .25,.25,
.25,.25, .25,.25, .25,.25, .25,.25,
.25,.25, .25,.25, .25,.25, .25,.25,
.25,.25, .25,.25, .25,.25,
.25,.25, .25,.25, .25,.25};
void *dofs = &displacement_dof_tuple[0];
/*
---------------------------------------------------------------------------
* DECLARE AND WRITE FIELDS
* (dofs specified in write call)
---------------------------------------------------------------------------
*/
/* Get a handle to the units for this field. */
saf_find_one_unit(db, "meter", &umeter);
/* Declare the fields. */
saf_declare_field(SAF_ALL, db, &coords_ctmpl, "dX", &top, &umeter,
SAF_SELF(db), SAF_NODAL(&nodes, &elems), H5T_NATIVE_FLOAT,
NULL, SAF_INTERLEAVE_NONE, SAF_IDENTITY, NULL,
&(disp_compons[0]));
saf_declare_field(SAF_ALL, db, &coords_ctmpl, "dY", &top, &umeter,
SAF_SELF(db), SAF_NODAL(&nodes, &elems), H5T_NATIVE_FLOAT,
NULL, SAF_INTERLEAVE_NONE, SAF_IDENTITY, NULL,
&(disp_compons[1]));
saf_declare_field(SAF_ALL, db, &coords_ftmpl, "displacements", &top, &umeter,
SAF_SELF(db), SAF_NODAL(&nodes, &elems), H5T_NATIVE_FLOAT,
disp_compons, SAF_INTERLEAVE_VECTOR, SAF_IDENTITY, NULL,
&disps);
/* Write the field. */
saf_write_field(SAF_ALL, &disps, SAF_WHOLE_FIELD, 1,
H5I_INVALID_HID, &dofs, saf_file);
return;
}