Manager Class

class plask.Manager(materials=None, draft=False)

Main input manager.

Object of this class provides methods to read the XML file and fetch geometry objects, paths, meshes, and generators by name. It also allows to access solvers defined in the XPL file.

Some global PLaSK function like loadxpl() or runxpl() create a default manager and use it to load the data from XPL into the global namespace.

Parameters:

draft (bool) – If True then partially incomplete XML is accepted (e.g. non-existent materials are allowed).

Methods

export(target)

Export loaded objects into a target dictionary.

load(source[, defs, sections])

Load data from source.

Attributes

defs

Local defines.

draft

Flag indicating draft mode.

errors

List of errors that occurred during loading in draft mode.

geo

Dictionary of all named geometries and geometry objects.

msg

Dictionary of all named meshes and generators.

msh

Dictionary of all named meshes and generators.

overrites

Overridden local defines.

pth

Dictionary of all named paths.

script

Script read from XML file.

solvers

Dictionary of all named solvers.

Descriptions

Method Details

Manager.export(target)

Export loaded objects into a target dictionary.

All the loaded solvers are exported with keys equal to their names and the other objects under the following keys:

  • geometries and geometry objects (geo): GEO,

  • paths to geometry objects (pth): PTH,

  • meshes and generators (msh): MSH,

  • custom defines (defs): DEF.

Manager.load(source, defs={}, sections=None)

Load data from source.

Parameters:
  • source (string or file) – File to read. The value of this argument can be either a file name, an open file object, or an XML string to read.

  • defs (dict) – Dictionary of user-defined variables (which string keys). The values of this dictionary overrides the ones given in the <defines> section of the XPL file.

  • sections (list) – List of section to read. If this parameter is given, only the listed sections of the XPL file are read and the other ones are skipped.

Attribute Details

Manager.defs = <property object>

Local defines.

This is a combination of the values specified in the <defines> section of the XPL file and the ones specified by the user in the load() method.

Manager.draft = <property object>

Flag indicating draft mode. If True then dummy material is created if the proper one cannot be found in the database. Also some objects do not need to have all the attributes set, which are then filled with some reasonable defaults.Otherwise an exception is raised.

Manager.errors = <property object>

List of errors that occurred during loading in draft mode.

Manager.geo = <property object>

Dictionary of all named geometries and geometry objects.

Manager.msg = <property object>

Dictionary of all named meshes and generators.

Manager.msh = <property object>

Dictionary of all named meshes and generators.

Manager.overrites = <property object>

Overridden local defines.

This is a list of local defines that have been overridden in a plask command line or specified as a vars argument to the load() method.

Manager.pth = <property object>

Dictionary of all named paths.

Manager.script = <property object>

Script read from XML file.

Manager.solvers = <property object>

Dictionary of all named solvers.