Write out a state

saf_write_state is a function defined in state.c.

Synopsis:

int saf_write_state(SAF_ParMode pmode, SAF_StateGrp *state_grp, int state_index, SAF_Set *mesh_space, hid_t coord_data_type, void *coord_data, SAF_Field *fields)

Formal Arguments:

  • pmode: The parallel mode.
  • state_grp: The state group into which this state will be inserted.
  • state_index: The index within the state group at which this state will be written. This index is 0-based.
  • mesh_space: The ID of the mesh associated with this state.
  • coord_data_type: The data type of COORD
  • coord_data: The coordinate of state_index within the state group. For instance, this is typically the time value of the state.
  • fields: The fields (the dependent variables) to be written to this state.

Description: Write out all the elements of a state. This includes the following:

  • ID of the computational mesh (i.e., a set ID) associated with this state;
  • ID of the default coordinate field of the mesh;
  • the parametric value (e.g., the time value) associated with this state;
  • IDs of all the fields (the dependent variables) attached to the mesh at this state.

The state is referenced by an index which is an index into each of the arrays that compose the state group. See the description of a state group.

Return Value: The constant SAF__SUCCESS is returned when this function is successful. Otherwise this function either returns an error number or throws an exception, depending on the value of the library’s error handling property.

Issues: This function does the following actions under the covers to implement the cross-product base space.

  • increments the “SAF__SPACE_SLICE” collection
  • adds a subset relation between the set identified by the MESH argument and the suite set

See Also:

  • States: Introduction for current chapter