IoProcess
The GeMA I/O Process Plugin
Loading...
Searching...
No Matches
GmpIoProcess Class Reference

Basic class for the I/O Process plugin object. More...

#include <gmpIoProcess.h>

Inheritance diagram for GmpIoProcess:
Collaboration diagram for GmpIoProcess:

Public Member Functions

 GmpIoProcess (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. Will be called by the plugin loading code.
 
virtual ~GmpIoProcess ()
 Destructor.
 
virtual const char * pluginName () const
 
virtual const char * pluginType () const
 
virtual void loadFunctions (LuaTable &table)
 
virtual QStringList functionList () const
 
- Public Member Functions inherited from GmProcess
 GmProcess (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 
virtual const char * pluginCategory () const
 
virtual bool loadPrivateData (LuaTable &table)
 
virtual void printParameters (const GmLogCategory &logger)
 
int createProgressStatsItem (GmRunProgressStats *ps, const char *name)
 
- Public Member Functions inherited from GmPluginObject
 GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 
QString id () const
 
QString description () const
 
QString pluginTypeName () const
 

Private Member Functions

GmProcessMethodRedirector< GmpIoProcess >::MethodRegistry * processMethodTable () const
 Returns the table storing the process exported function names / methods.
 
int print (lua_State *L)
 The io.print() process implementation.
 
int printMesh (lua_State *L)
 The io.printMesh() process implementation.
 
int printMeshInfo (lua_State *L)
 The io.printMeshInfo() process implementation.
 
int printMeshNodeData (lua_State *L)
 The io.printMeshNodeData() process implementation.
 
int printMeshCellData (lua_State *L)
 The io.printMeshCellData() process implementation.
 
int printMeshGaussData (lua_State *L)
 The io.printMeshGaussData() process implementation.
 
int printMeshMemoryInfo (lua_State *L)
 The io.printMeshMemoryInfo() process implementation.
 
int printMeshTopology (lua_State *L)
 The io.printMeshTopology() process implementation.
 
int saveMeshFile (lua_State *L)
 The io.saveMeshFile() process implementation.
 
int prepareMeshFile (lua_State *L)
 The io.prepareMeshFile() process implementation.
 
int addResultToMeshFile (lua_State *L)
 Adds the current state to the result file returned by prepareMeshFile(). Gets as parameters the io object + current time + two optional booleans that should be set to true if the mesh geometry (first) or discontinuity set (second) has changed. Assumes that the time unit is the SAME as the one configured in the simulation by a call to setCurrentTimeUnit()
 
int closeMeshFile (lua_State *L)
 Closes the result file returned by prepareMeshFile()
 
int tempMeshFile (lua_State *L)
 Given the file returned by prepareMeshFile(), returns the name of the associated temp file or nil if there is none.
 
int loadMeshFromFile (lua_State *L)
 The utils.loadMeshFromFile() process implementation.
 
int updateMeshFromFile (lua_State *L)
 The utils.updateMeshFromFile() process implementation.
 
int saveToHdf5ModelFile (lua_State *L)
 The io.saveToHdf5ModelFile() process implementation.
 
GmFileIOparseIoParameters (lua_State *L, QString fname, bool writeMode, GmMesh **mesh, const GmCellGroupSet **group, QString &fileName, QVariantMap &options)
 Aux function used by both saveMeshFile(), prepareMeshFile() and loadMeshFromFile() to parse input parameters and create the FileIO object. On errors, calls luaL_error(). See saveMeshFile() docs for the expected parameters on the Lua stack.
 
int oldLoadMeshFromFile (lua_State *L)
 The utils.loadMeshFromFile() process implementation.
 
int oldUpdateMeshFromFile (lua_State *L)
 The utils.updateMeshFromFile() process implementation.
 
void parseSerializerParameters (lua_State *L, QString fname, GmMesh **mesh, QStringList &nodeValues, QList< Unit > &nodeUnits, Unit &coordUnit, QStringList &elementValues, QList< Unit > &elementUnits, QString &fileName, QString &fileType, QVariantMap &options)
 Aux function used by both saveMeshFile(), prepareMeshFile() and loadMeshFromFile() to parse their parameters.
 

Additional Inherited Members

- Protected Member Functions inherited from GmProcess
void registerFunctions (LuaTable &table, typename GmProcessMethodRedirector< T >::MethodRegistry *methods, bool noProgressStats=false)
 
QStringList buildFunctionList (typename GmProcessMethodRedirector< T >::MethodRegistry *methods) const
 
- Protected Member Functions inherited from GmPluginObject
virtual const GmLogCategorylogger () const
 
GmSimulationDatasimulationData () const
 

Detailed Description

Basic class for the I/O Process plugin object.

Member Function Documentation

◆ functionList()

virtual QStringList GmpIoProcess::functionList ( ) const
inlinevirtual

Implements GmProcess.

◆ loadFunctions()

virtual void GmpIoProcess::loadFunctions ( LuaTable & table)
inlinevirtual

Implements GmProcess.

◆ pluginName()

virtual const char * GmpIoProcess::pluginName ( ) const
inlinevirtual

Implements GmPluginObject.

◆ pluginType()

virtual const char * GmpIoProcess::pluginType ( ) const
inlinevirtual

Implements GmPluginObject.

◆ prepareMeshFile()

int GmpIoProcess::prepareMeshFile ( lua_State * L)
private

The io.prepareMeshFile() process implementation.

Expects the same parameters in the Lua stack as saveMeshFile().

Intended use:

local file = io.prepareMeshFile('mesh', 'filename.nf', {nodeData = {node_values}, cellData = {cell_values}, gaussData = {gauss_values}}, {options})
while ... do
...
io.addResultToMeshFile(file, time)
end
io.closeMeshFile(file)

Returns the io object.

◆ printMeshCellData()

int GmpIoProcess::printMeshCellData ( lua_State * L)
private

The io.printMeshCellData() process implementation.

Expects to receive as parameters on the Lua stack: 1 - A string with the mesh name or a Lua cell mesh object 2 - A string or a table with cell attributes / property names The strings 'id', 'intid', 'type', 'nodes', 'active', 'properties' and 'points' can be included in the table to request that, respectively, cell ids, cell internal ids (1-based), cell types, cell nodes, active flag, cell property names and cell function evaluation points should also be printed. If present, those should be the first entries of the table. If empty, all data will be printed, except for 'intid' that must alway be explicitly asked (to avoid massive breaks in regression tests). Optionally, value names can have a suffix surrounded by () with the desired unit (ex: T(K) would ask for a temperature value named T and with values converted, if needed, to Kelvin degrees). 3 - An optional table with print options. Each option is a boolean flag or numeric value associated to a table field. Available options are: 'state' – The state number used to find values when the attribute/ state var has an associated history. Default = 0 (present state) If the state is invalid for an accessor, the default will be used for it. 'units' – Should we print units in column title? Default = true 'unit_line' – Should we print units in the header in a separate line? Default = false 'eval_functions' – Should we evaluate functions or do we print its name? Default = false 'def_nil' – Should we print default values as 'nil'? Default = false 'const_map' – Should we try to translate values back to strings when a scalar data column has an associated const map? Default = false 'line_numbers' – Should we print line numbers on the left margin? Default = true 'active_only' – Should we print only active cells? Default = true 'node_geometry' – Should we print common geometry nodes if cell nodes column is included? Default = true 'node_ghost' – Should we print ghost nodes (if they exist) if cell nodes column is included? Default = true 'mark_ghost' – Should we add a '|' between geometry and ghost node numbers if cell nodes column is included? Default = false 'clip_title' – Should we clip column titles when the user gave us a width and the title is bigger than that? Default = true 'header_title' – Should we print a title in the header, for the entire table? Default = false 'trailler' – Should we add a closing trailler line to the table? Default = false 'int_order' – Should we order the rows in the table according to the internal id (instead of the model id)? Default = false When filling this table, keep in mind that only options different from the default are needed. When an option is not present in the table its default value will be used. 4 - An optional parameter with the desired integration point index used when evaluating functions. When missing or 0, the centroid will be used. 5 - An optional table with column widths. If present, entry 'i' will define the column width for the attribute at entry 'i' in the attributes table (skipping special columns like those given by 'type', 'nodes', 'properties' and 'points' which currently can't have their sizes specified)

◆ printMeshGaussData()

int GmpIoProcess::printMeshGaussData ( lua_State * L)
private

The io.printMeshGaussData() process implementation.

Expects to receive as parameters on the Lua stack: 1 - A string with the mesh name or a Lua element mesh object 2 - A string or a table with Gauss attributes. The strings 'intid', 'type', 'points' and 'active' can be included in the table to request that, respectively, cell internal ids, cell types, cell Gauss points and the active flag should also be printed. If present, those should be the first entries of the table. If empty, all data will be printed, except for 'intid' that must alway be explicitly asked (to avoid massive breaks in regression tests). Optionally, value names can have a suffix surrounded by () with the desired unit (ex: T(K) would ask for a temperature value named T and with values converted, if needed, to Kelvin degrees). 3 - An optional table with print options. Each option is a boolean flag or numeric value associated to a table field. Available options are: 'state' – The state number used to find values when the attribute/ state var has an associated history. Default = 0 (present state) If the state is invalid for an accessor, the default will be used for it. 'units' – Should we print units in column title? Default = true 'unit_line' – Should we print units in the header in a separate line? Default = false 'eval_functions' – Should we evaluate functions or do we print its name? Default = false 'def_nil' – Should we print default values as 'nil'? Default = false 'const_map' – Should we try to translate values back to strings when a scalar data column has an associated const map? Default = false 'line_numbers' – Should we print line numbers on the left margin? Default = true 'active_only' – Should we print only active cells? Default = true 'clip_title' – Should we clip column titles when the user gave us a width and the title is bigger than that? Default = true 'header_title' – Should we print a title in the header, for the entire table? Default = false 'trailler' – Should we add a closing trailler line to the table? Default = false 'int_order' – Should we order the rows in the table according to the internal id (instead of the model id)? Default = false When filling this table, keep in mind that only options different from the default are needed. When an option is not present in the table its default value will be used. 4 - An optional table with column widths. If present, entry 'i' will define the column width for the attribute at entry 'i' in the attributes table (skipping special columns like those given by 'type' and 'points' which currently can't have their sizes specified)

◆ printMeshMemoryInfo()

int GmpIoProcess::printMeshMemoryInfo ( lua_State * L)
private

The io.printMeshMemoryInfo() process implementation.

Expects to receive as parameters on the Lua stack: 1 - A string with the mesh name or a Lua element mesh object

◆ printMeshNodeData()

int GmpIoProcess::printMeshNodeData ( lua_State * L)
private

The io.printMeshNodeData() process implementation.

Expects to receive as parameters on the Lua stack: 1 - A string with the mesh name or a Lua mesh object 2 - A string or a table with node attributes / state var names The strings 'coordinate', 'id' and 'intid' can be included in the table to request that, respectively, node coordinates, node ids and internal node ids (1-based) should also be printed. If empty, all data will be printed, except for 'intid' that must alway be explicitly asked (to avoid massive breaks in regression tests). Optionally, value names can have a suffix surrounded by () with the desired unit (ex: T(K) would ask for a temperature value named T and with values converted, if needed, to Kelvin degrees). 3 - An optional table with print options. Each option is a boolean flag or numeric value associated to a table field. Available options are: 'state' – The state number used to find values when the attribute/ state var has an associated history. Default = 0 (present state) If the state is invalid for an accessor, the default will be used for it. 'units' – Should we print units in column title? Default = true 'unit_line' – Should we print units in the header in a separate line? Default = false 'eval_functions' – Should we evaluate functions or do we print its name? Default = false 'def_nil' – Should we print default values as 'nil'? Default = false 'const_map' – Should we try to translate values back to strings when a scalar data column has an associated const map? Default = false 'line_numbers' – Should we print line numbers on the left margin? Default = true 'node_geometry' – Should we print lines for common geometry nodes? Default = true 'node_ghost' – Should we print lines for ghost nodes (if they exist)? Default = true 'mark_ghost' – Should we restart numbering and add a '|' prefix to ghost node numbers? Default = false 'clip_title' – Should we clip column titles when the user gave us a width and the title is bigger than that? Default = true 'header_title' – Should we print a title in the header, for the entire table? Default = false 'trailler' – Should we add a closing trailler line to the table? Default = false 'int_order' – Should we order the rows in the table according to the internal id (instead of the model id)? Default = false When filling this table, keep in mind that only options different from the default are needed. When an option is not present in the table its default value will be used. 4 - An optional table with column widths. If present, entry 'i' will define the column width for the attribute at entry 'i' in the attributes table.

◆ printMeshTopology()

int GmpIoProcess::printMeshTopology ( lua_State * L)
private

The io.printMeshTopology() process implementation.

Expects to receive as parameters on the Lua stack: 1 - A string with the mesh name or a Lua element mesh object

◆ saveMeshFile()

int GmpIoProcess::saveMeshFile ( lua_State * L)
private

The io.saveMeshFile() process implementation.

Expects to receive as parameters: 1 - The mesh name or a Lua mesh object or a Cell group set object. 2 - The file name with extension, used to discover the desired file type. 3 - A table with the definition of the data to be saved. Uses the "result rules" style. Can contain 3 optional sub tables: nodeData, cellData and gaussData. Each table contains a list of the data items of that kind that should be exported. cellData can contain both cell attributes and properties. Each entry is either a string (in the "id[dim](unit) as alias" format) or another sub-table as defined by the "result rules syntax". 4 - Table with optional parameters. This include options dependent of the file type and some general options supported by all files. See the comments on the GmFileIO class.


The documentation for this class was generated from the following files: