The Python interface allows the user to instantiate input, output, and process modules by calling the static Create method of the InputModule, ProcessModule, and OutputModule, register configuration options, and run them. For example, consider the command:
A Python script performing the same task is given below.
The key points are that the FieldConvert command line options, in this case
are passed to the constructor of Field. The configuration options for a given module
are passed to the static Create method of the InputModule, ProcessModule, and
OutputModule. This creates the corresponding module and the modules can be
run immediately after instantiation. Note that the first parameter of the Create
method has to be the key for a given module, the second is the field variable and for
input and output modules the remaining arguments may identify the input and
output files for a given module. Optionally we can explicitly specify the file type of
an input module using the "infile" keyword and the "outfile" keyword for output
It can also emulate the functionality of FieldConvert when using the
nparts option in the
following way. Here session_xml is a directory containing the mesh partitioned into
The number of partitions is looped over, with NewPartition called at the start of each. When using OutputModule, the info module must be used in order to obtain the correct result.