void make_stress_on_cell_1_field(void)
{
SAF_Unit upascal; /* Handle to the units for the stress. */
/* Made up stresses. */
float stress_dof_tuple[] = {0.5, 0.25, 0.5,0.5, 0.25, 0.5,
0.5, 0.25, 0.5,0.5, 0.25, 0.5};
void *dofs = &stress_dof_tuple[0];
/*
---------------------------------------------------------------------------
* DECLARE FIELD TEMPLATES
---------------------------------------------------------------------------
*/
saf_declare_field_tmpl(SAF_ALL, db,"stress_on_cell_1_tmpl",
SAF_ALGTYPE_SCALAR, SAF_UNITY,
SAF_QNAME(db,"pressure"), 1, NULL,
&stress_ctmpl);
tmp_ftmpl[0] = stress_ctmpl;
tmp_ftmpl[1] = stress_ctmpl;
tmp_ftmpl[2] = stress_ctmpl;
saf_declare_field_tmpl(SAF_ALL, db,"stress_on_cell_1_tmpl",
SAF_ALGTYPE_SYMTENSOR, SAF_UPPERTRI,
SAF_QNAME(db,"pressure"), 3, tmp_ftmpl,
&stress_ftmpl);
/*
---------------------------------------------------------------------------
* DECLARE AND WRITE FIELDS
* (dofs specified in declare call)
---------------------------------------------------------------------------
*/
/* Get a handle to the units for this field. */
saf_find_one_unit(db, "pascal", &upascal);
/* Declare the field. */
saf_declare_field(SAF_ALL, db, &stress_ctmpl, "Sx", &cell_1, &upascal, SAF_SELF(db),
SAF_ZONAL(&elems), H5T_NATIVE_FLOAT, NULL,
SAF_INTERLEAVE_NONE, SAF_IDENTITY,
NULL, &(stress_compon[0]));
saf_declare_field(SAF_ALL, db, &stress_ctmpl, "Sy", &cell_1, &upascal, SAF_SELF(db),
SAF_ZONAL(&elems), H5T_NATIVE_FLOAT, NULL,
SAF_INTERLEAVE_NONE, SAF_IDENTITY,
NULL, &(stress_compon[1]));
saf_declare_field(SAF_ALL, db, &stress_ctmpl, "Sxy", &cell_1, &upascal, SAF_SELF(db),
SAF_ZONAL(&elems), H5T_NATIVE_FLOAT, NULL,
SAF_INTERLEAVE_NONE, SAF_IDENTITY,
NULL, &(stress_compon[2]));
saf_declare_field(SAF_ALL, db, &stress_ftmpl, "stress", &cell_1, &upascal, SAF_SELF(db),
SAF_ZONAL(&elems), H5T_NATIVE_FLOAT, stress_compon,
SAF_INTERLEAVE_VECTOR, SAF_IDENTITY,
&dofs, &stress);
/* Write the field. */
saf_write_field(SAF_ALL, &stress, SAF_WHOLE_FIELD, 0, H5I_INVALID_HID, NULL, saf_file);
return;
}