esys.escriptcore.datamanager Package

Classes

class esys.escriptcore.datamanager.DataManager(formats=[0], work_dir='.', restart_prefix='restart', do_restart=True)

Bases: object

Escript data import/export manager.

Example:

dm=DataManager(formats=[DataManager.RESTART,DataManager.VTK])
if dm.hasData():
    dom = dm.getDomain()
    time = dm.getValue("time")
    dt = dm.getValue("dt")
    T = dm.getValue("T")
    u = dm.getValue("u")
else:
    T = ...
    u = ...
dm.addData(time=time,dt=dt,T=T,u=u) # add data and variables
dm.setTime(time)                    # set the simulation timestamp
dm.export()                         # write out data
RESTART = 0
SILO = 1
VISIT = 2
VTK = 3
addData(**data)

Adds ‘escript.Data’ objects and other data to be exported to this manager.

Note:This method does not make copies of Data objects so any modifications will be carried over until export() is called.
export()

Executes the actual data export. Depending on the formats parameter used in the constructor all data added by addData() is written to disk (RESTART,SILO,VTK) or made available through the VisIt simulation interface (VISIT).

getCycle()

Returns the export cycle (=number of times export() has been called)

getDomain()

Returns the domain as recovered from restart files.

getValue(value_name)

Returns an ‘escript.Data’ object or other value that has been loaded from restart files.

hasData()

Returns True if the manager holds data for restart

setCheckpointFrequency(freq)

Sets the number of calls to export() before new restart files are generated.

setDomain(domain)

Sets the domain without adding data.

setMeshLabels(x, y, z='')

Sets labels for the mesh axes. These are currently only used by the Silo exporter.

setMeshUnits(x, y, z='')

Sets units for the mesh axes. These are currently only used by the Silo exporter.

setMetadataSchemaString(schema, metadata='')

Sets metadata namespaces and the corresponding metadata. Only used for the VTK file format at the moment.

Parameters:
  • schema – A dictionary that maps namespace prefixes to namespace names, e.g. {‘gml’:’http://www.opengis.net/gml‘}
  • metadata – The actual metadata string which will be enclosed in ‘<MetaData>’ tags.
setTime(time)

Sets the simulation timestamp.

Functions

Others

  • __author__
  • __builtins__
  • __copyright__
  • __doc__
  • __file__
  • __license__
  • __name__
  • __package__
  • __url__