void make_time_suite(void)
{
int index[1];
float time[1];
SAF_Unit usec;
/* SAF_Suite suite; */
SAF_StateTmpl st_tmpl;
SAF_FieldTmpl fld_tmpls[4];
SAF_StateGrp state_grp;
SAF_Field field_list[4];
saf_find_one_unit(db, "second", &usec);
/* create a suite for other states */
saf_declare_suite(SAF_ALL, db, "OTHER_SUITE", &top, NULL, &suite);
/* create a state template to define what types of fields will be stored at each state in this suite;
this is defined by a list of field templates */
fld_tmpls[0] = coords_ftmpl;
fld_tmpls[1] = stress_ftmpl;
fld_tmpls[2] = temp2_ftmpl;
fld_tmpls[3] = press_ftmpl;
saf_declare_state_tmpl (SAF_ALL, db, "OTHER_SUITE_STATE_TMPL", 4, fld_tmpls, &st_tmpl);
/* create a state field for this suite */
saf_declare_state_group(SAF_ALL, db, "OTHER_STATEGRP", &suite, &top, &st_tmpl, SAF_QTIME, &usec,
SAF_FLOAT, &state_grp);
/* insert the following fields into the states for time steps 0, 1, and 2:
* displacement vector on nodes of whole
* stress tensor on elements of cell_1
* temperature on nodes of cell_2
* pressure on elements of side_set_1
*/
index[0] = 0;
time[0] = 0.0;
field_list[0] = disps;
field_list[1] = stress;
field_list[2] = temps2;
field_list[3] = press;
saf_write_state (SAF_ALL, &state_grp, index[0], &top, SAF_FLOAT, time, field_list);
/* for this test, just write out the same fields (IDs) to the successive states;
* in actual simulations, new fields will be created for each time step
*/
index[0] = 1;
time[0] = 0.001;
field_list[0] = disps;
field_list[1] = stress;
field_list[2] = temps2;
field_list[3] = press;
saf_write_state (SAF_ALL, &state_grp, index[0], &top, SAF_FLOAT, time, field_list);
index[0] = 2;
time[0] = 0.002;
field_list[0] = disps;
field_list[1] = stress;
field_list[2] = temps2;
field_list[3] = press;
saf_write_state (SAF_ALL, &state_grp, index[0], &top, SAF_FLOAT, time, field_list);
return;
}