![]() |
IoProcess
The GeMA I/O Process Plugin
|
The available loading processes are very specific functions that can be called at the orchestration, mainly when iteratively exchanging data with external simulators. When called, the specified data will be loaded from the file and inserted into an empty mesh, whose data sets (state variables and Gauss attributes) will be created by the loading function. If the file contains data for several time steps, all the data will be imported using history values. An update process is also available for loading new data from a file that was loaded at the begining of the simulation and updated at each time step by an external simulator. The following code fragment illustrates how this can be done:
io.loadMeshFromFile(mesh, fileName, fileType, nodeValues, elementValues) | ||
---|---|---|
Description: | Loads the data from the given file into the specified mesh, returning a handle object that can be used in further calls to io .updateMeshFromFile() to read new data included in the source file by an external simulator. When loading the data, new state variables and Gauss attributes will be created by the function and associatd with the mesh to host the loaded data. Desired node and Gauss values are specified by the given tables and their names should match exactly the names saved on the file. Node coordinates and cell geometry will always be read. If the file stores multiple data values for several time steps, all the data will be read and stored in the new data sets as history values. If there is an error loading the data (an invalid file format or path, for example), a Lua error will be raised. | |
Parameters: | mesh | The mesh. Accepts either a mesh name or a mesh object. Should be an empty mesh whose structure will be updated to include the loaded data sets. |
fileName | The name of the file that will be read. The file name can include path macros. | |
fileType | A string defining the file format of the loaded file. | |
nodeValues | A string defining the name of the node state variables to be loaded, or a table with a name list. Names must be equal to the data names from the imported file. Can be nil. Optionally, value names can have a suffix surrounded by () specifying the unit in which the source data is given (ex: "T(K)" would ask for reading a temperature value named T, whose values are in Kelvin degrees). To choose the unit in which node coordinates are read, the name "coordinate" followed by a unit can be included as the first name on the list. | |
elementValues | A string defining the name of the Gauss attribute to be loaded or a table with a name list. Names must be equal to the data names from the imported file. Can be nil. Optionally, value names can have a suffix surrounded by () specifying the unit in which the source data is given (ex: "S(kPa)" would ask for reading a stress value named S, whose values are in kilopascal). | |
Returns: | The file handle object. |
io.updateMeshFromFile(fileHandle) | ||
---|---|---|
Description: | If the data on a file loaded by a call to io .loadMeshFromFile() has been externally updated, a call to this function will load the new data and insert it onto the same mesh where the original data was loaded. If more than one time step was added to the file, only the last one will be loaded. Data will be added to the current state of the mesh, replacing it. If the old value needs to be kept, a call to the mesh functions for saving node and Gauss attribute states should be made prior to calling this function. | |
Parameters: | fileHandle - The file handle returned by a previous call to io .loadMeshFromFile() . | |
Returns: | Nothing. |