PSCF v1.1
|
Class to parse a PSCF command script. More...
Public Member Functions | |
def | __init__ (self, filename=None) |
Constructor. More... | |
def | read (self, filename) |
Read and parse a command script. More... | |
def | __str__ (self) |
Return a string containing the command script. More... | |
def | __getitem__ (self, key) |
Get a Command by integer index or command name. More... | |
def | __len__ (self) |
Get the number of commands in the script. More... | |
Class to parse a PSCF command script.
The Script class can read a command script file and store its contents in a form that allows particular commands to be accessed and modified.
**Construction and Parsing:**a
The constructor can take the name of a command file or an open file object as a parameter, and will read, parse and store the contents of the specified file.
Example: To parse a command file named 'command', one could enter
Accessing individual commands:
A Script object is a container for a list of child Command objects. Each command corresponds to one line in the command script, in which the first field is the label. Individual Command objects within a Script object can be accessed in either of two ways:
String representation of individual Commands objects can be printed using the str() or print functions. Values of arguments of individual Command objects may then be accessed or modified using the param and setParam methods of class Command (see below).
Definition at line 44 of file command.py.
def pscfpp.command.Script.__init__ | ( | self, | |
filename = None |
|||
) |
Constructor.
If supplied with a parameter "in" that is an open file or a file name string, this function reads and parses that command file and stores the contents in the resulting object.
If the parameter "in" is absent or equal to None, an empty object is created and returned.
filename | file name or open file object for input command file |
Definition at line 58 of file command.py.
References pscfpp.command.Script._commands, pscfpp.command.Script._indices, Pscf::Pspc::BasisFieldState< D >.read(), Pscf::Pspg::BasisFieldState< D >.read(), pscfpp.output.Thermo.read(), pscfpp.param.Composite.read(), pscfpp.param.Array.read(), pscfpp.param.Matrix.read(), pscfpp.command.Script.read(), pscfpp.field.Field.read(), Util::Label.read(), Pscf::Fd1d::Mixture.read(), Pscf::AmIteratorTmpl< Iterator< D >, DArray< double > >.read(), Pscf::AmIteratorTmpl< Iterator, T >.read(), Pscf::AmIteratorTmpl< Iterator< D >, FieldCUDA >.read(), Pscf::AmIteratorTmpl< Iterator, DArray< double > >.read(), Pscf::Pspc::Domain< D >.read(), Pscf::Pspc::FilmIteratorBase< 2, IteratorType >.read(), Pscf::Pspc::FilmIteratorBase< 1, IteratorType >.read(), Pscf::Pspc::FilmIteratorBase< D, IteratorType >.read(), Pscf::Pspc::FilmIteratorBase< 3, IteratorType >.read(), Pscf::Pspc::Mixture< D >.read(), Pscf::Pspg::Mixture< D >.read(), and Util::ParamComposite.read().
def pscfpp.command.Script.read | ( | self, | |
filename | |||
) |
Read and parse a command script.
filename | file name string or open file for command file |
Definition at line 69 of file command.py.
References pscfpp.command.Script._commands, and pscfpp.command.Script._indices.
Referenced by pscfpp.param.Composite.__init__(), pscfpp.field.Field.__init__(), pscfpp.command.Script.__init__(), pscfpp.output.Thermo.__init__(), pscfpp.param.Matrix.__init__(), and pscfpp.param.Array.__init__().
def pscfpp.command.Script.__str__ | ( | self | ) |
Return a string containing the command script.
Definition at line 113 of file command.py.
References pscfpp.command.Script._commands.
Referenced by pscfpp.field.Field.write(), pscfpp.output.Thermo.write(), and pscfpp.output.State.write().
def pscfpp.command.Script.__getitem__ | ( | self, | |
key | |||
) |
Get a Command by integer index or command name.
key | integer index or command name string |
Definition at line 124 of file command.py.
References pscfpp.command.Script._commands, and pscfpp.command.Script._indices.
def pscfpp.command.Script.__len__ | ( | self | ) |
Get the number of commands in the script.
Definition at line 143 of file command.py.
References pscfpp.command.Script._commands.