The primary objective is to allow the user to execute a sequence of commands from a Python script that implement the functionality of FieldConvert, thereby giving freedom to customise the order in which modules are used and which command line options are passed to them. One problem with FieldConvert is when the user wishes to perform the same task on many files; for example converting a number of .chk files to VTK format. To achieve this using FieldConvert, one must run a command like the following n times for each individual file.
1FieldConvert -m session.xml field_n.chk field_n.vtu
These .chk files represent the same fields, only at different moments in time, and so the mesh described in the session file is the same. For each file, an instance of Field is initialised and its member variables populated by the modules InputFld, ProcessCreateExp, and OutputVtk. This is clearly computationally inefficient. In the Python implementation, we are able to initialise instances of these classes only once, and then for each file populate and clear the variables that differ.
The bindings are stored within a directory named ’Python’ in the FieldUtils
directory.
FieldUtils.cpp
is responsible for exporting the FieldUtils Python library.
Field.cpp
contains bindings for the Field struct.
Module.cpp
contains bindings for Module, InputModule, and OutputModule.