Retrieve a state

saf_read_state is a function defined in state.c.

Synopsis:

int saf_read_state(SAF_ParMode pmode, SAF_StateGrp *state_grp, int state_index, SAF_Set *mesh, SAF_Field *deflt_coords, void *coord_data, SAF_Field **fields)

Formal Arguments:

  • pmode: The parallel mode
  • state_grp: The state group from which this state will be read.
  • state_index: An index that specifies which state within the state group will be read. This index is 0-based.
  • mesh: [OUT] Returned ID of the mesh associated with this state.
  • deflt_coords: [OUT] Returned ID of the default coordinate field of mesh; we may want to delete this argument since the client can call saf_find_default_coords for mesh.
  • coord_data: [OUT] Returned coordinate of state_index within the state group. For instance, this is typically the time value of the state.
  • fields: The IDs of the fields (the dependent variables) to be read from this state. The caller may supply a pointer to a value of NULL if this function is to allocate a buffer. If the caller supplies a pointer to a non-nil pointer, then it is the responsibility of the caller to ensure that the buffer is of sufficient size to contain the coordinates. This size (NUM_FIELDS) is the number of field templates (NUM_FTMPLS) obtained by a call to saf_describe_state_tmpl.

Description: Read 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.

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.

See Also: