18.2.4. Reading State Files

>readstate [mode=<overwrite | append>][filename=<filename>, load=<true | false>]

The >readstate command loads a CFD-Post state from a specified file.

If a DATA READER singleton has been stored in the state file, the load action will be invoked to load the contents of the results file.

If a state file contains BOUNDARY objects, and the state file is appended to the current state (with no new DATA READER object), some boundaries defined may not be valid for the loaded results. BOUNDARY objects that are not valid for the currently loaded results file will be culled.

>readstate supports the following options:

  • mode = <overwrite | append>

    If mode is set to overwrite, the executor deletes all the objects that currently exist in the system, and load the objects saved in the state file. Overwrite mode is the default mode if none is explicitly specified. If mode is set to append, the executor adds the objects saved in the state file to the objects that already exist in the system. If the mode is set to append and the state file contains objects that already exist in the system, the following logic will determine the final result:

    If the system has an equivalent object (the name and type), then the object already in the system will be modified with the parameters saved in the state file. If the system has an equivalent object in name only, then the object that already exists in the system will be deleted, and replaced with that in the state file.

  • filename = <filename>

    The path to the state file.

  • load = <true | false>

    If load is set to true and a DATA READER object is defined in the state file, then the results file will be loaded when the state file is read. If load is set to false, the results file will not be loaded, and the DATA READER object that currently is in the object database (if any) will not be updated.

18.2.4.1. readstate Option Actions

The following table describes the options, and what will happen based on the combination of options that are selected.

Mode Selection

Load Data Selection

What happens to the objects?

What happens to the Data Reader

Overwrite

True

All user objects (planes, and so on) get deleted. The loading of the new results file changes the default objects (boundaries, wireframe, and so on) including deletion of objects that are no longer relevant to the new results. Default objects that are not explicitly modified by object definitions in the state file will have all user modifiable values reset to default values.

It gets deleted and replaced.

Overwrite

False

All user objects get deleted. All default objects that exist in the state file updates the same objects in the current system state if they exist. Default objects in the state file that do not exist in the current state will not be created. All user objects in the state file will be created.

If it exists, it remains unchanged regardless of what is in the state file.

Append

True

No objects are initially deleted. The default objects in the state file replaces the existing default objects. User objects will:

  • Be created if they have a unique name.

  • Replace existing objects if they have the same name but different type.

  • Update existing objects if they have the same name and type.

It is modified with new value from the state file.

Append

False

No objects are initially deleted. Default objects in the state file will only overwrite those in the system if they already exist. User objects have the same behavior as the Append/True option above.

If it exists, it remains unchanged regardless of what is in the state file.

18.2.4.2. readstate Command Examples

The following are example >readstate commands and their expected results. If a STATE singleton exists, the values of the parameters listed after the >readstate command replace the values stored in the STATE singleton object. For this command, the filename command parameter value replaces the state filename parameter value in the STATE singleton, and the mode command parameter value replaces the readstate mode parameter value in the STATE singleton.

>readstate filename=mystate.cst

The readstate mode parameter in the STATE singleton determines if the current objects in the system are deleted before the objects defined in the mystate.cst file are loaded into the system. If the STATE singleton does not exist, then the system objects are deleted before loading the new state information.

>readstate mode=overwrite, filename=mystate.cst

Deletes all objects currently in the system, opens the mystate.cst file if it exists, and creates the objects as stored in the state file.

>readstate mode=append, filename=mystate.cst

Opens the mystate.cst file, if it exists, and adds the objects defined in the file to those already in the system following the rules specified in the previous table.

>readstate

Overwrites or appends to the objects in the system using the objects defined in the file referenced by the state filename parameter in the STATE singleton. If the STATE singleton does not exist, an error will be raised indicating that a filename must be specified.

>readstate mode=overwrite

Overwrites the objects in the system STATE using the objects defined in the file referenced by the state filename parameter in the STATE singleton. If the STATE singleton does not exist, an error will be raised indicating that a filename must be specified.

>readstate mode=append

Appends to the objects in the system using the objects defined in the file referenced by the state filename parameter in the STATE singleton. If the STATE singleton does not exist, an error will be raised indicating that a filename must be specified.