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
39
40
41
42
43
44
45
46
 void make_init_suite(void)
 {
    int index[1];
    float time[1];
    SAF_Unit usec;
    SAF_StateTmpl st_tmpl;
    SAF_FieldTmpl fld_tmpls[3];
    SAF_StateGrp state_grp;
    SAF_Field field_list[3];

    saf_find_one_unit(db, "second", &usec);

    /* create a suite for initial state (time step 0) */
    saf_declare_suite(SAF_ALL, db, "INIT_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] = distfac_ftmpl;
    fld_tmpls[2] = temp1_ftmpl;

    saf_declare_state_tmpl (SAF_ALL, db, "INIT_SUITE_STATE_TMPL", 3, fld_tmpls, &st_tmpl);

    /* create a state group for this suite */
    saf_declare_state_group(SAF_ALL, db, "INIT_STATEGRP", &suite, &top, &st_tmpl, SAF_QTIME, &usec,
                            SAF_FLOAT, &state_grp);

    /* insert the following fields into the state for time step 0:
     *   coordinates on nodes of whole
     *   distribution factors on nodes of side_set_2
     *   temperature on nodes of node_set_1
     */

    index[0] = 0;

    time[0] = 0.0;

    field_list[0] = coords;
    field_list[1] = distfac;
    field_list[2] = temps1;

    saf_write_state (SAF_ALL, &state_grp, index[0], &top, SAF_FLOAT, time, field_list);

    return;
 }