I.1.8 “Gmsh” methods
The “writeGmsh” method defined in generic “DataBase” class is used to create a Gmsh result file in
which parts of the model and of the Results are saved for later visualization. The purpose of the
method is to allow the user to visualize parts of the model and Results. An example of use of the
method is as follows:
db.writeGmsh("brol.gmsh",0,[[res,"stress","ElemCenters"],'
[displ,"displ","Nodes"]],'
[[skelGrp,"mesh slat"]],'
[[skelGrp,"skel slat"]])
The method has six parameters:
-
1.
- A string containing the name of the file in which the model and Results will be output.
-
2.
- An integer corresponding to the id of a coordinate system in which the positions are
located and in which the components of Result values are expressed. The coordinate
system must be defined in the dataBase db and must be a rectangular one.
-
3.
- An Array containing the Results to be stored in Gmsh file. Each element of the Array is An
Array of three elements:
- A Result object.
- A String corresponding to the name with which the Result shall be referenced in
Gmsh.
- A String that can have five values: “ElemCenters”, “ElemCorners”, “Elements”, “Nodes”
and “ElemCenterPoints”. It corresponds to the location of values that are extracted from
the Result object to be printed in the Gmsh file. Note:
- “ElemCenterPoints” prints the values at center of elements but on a point, no
matter the topology of the element. This may be handy for the visualization of
Results on zero length elements.
- “Elements” output location combines the outputs at “ElemCorners” and
“ElemCenters”. If no value is found at a corner, the algorithm checks whether
an output is found at center of element, and uses that value if it is found.
-
4.
- An Array containing the Meshes to be stored in Gmsh file. Each element of the Array is An
Array of two elements:
- A Group object. The elements contained in the Group will be output in the Gmsh
file.
- A String corresponding to the name with which the mesh shall be referenced in
Gmsh.
-
5.
- An Array containing the parts of the model for which a “skeleton” shall be saved in the Gmsh
file. (A skeleton is a representation of the mesh with only a few edges.)
- A Group object. The elements contained in the Group will be output in the Gmsh
file.
- A String corresponding to the name with which the skeleton shall be referenced in
Gmsh.
-
6.
- A logical parameter specifying whether a binary output is requested. If the parameter is “true” a
binary output is done, otherwise, the output is an ASCII one. The parameter is optional and
binary output is the default. A binary output is significantly faster than an ASCII
one.
Parameters 3, 4 and 5 are optional. They can be a void Array or replaced by nil argument. All the last nil
parameters may be omitted. Parameter 6 is optional too. If no pair of key-values is found for a Result
to be printed. Nothing is output in the gmsh file.
It is the responsibility of the user to provide Results that associate values to a single valid key.
Otherwise, an error message is issued and exception is thrown. In particular, as Results
written in GMSH files are not layered, the user should be careful not to output multi-layered
Results. The details in error message output are controlled by the debugging verbosity level.
(See I.6.6.)
Note also that if the values that the user try to output are not correct, a substitution is done: Inifinite
float values are replaced by MAXFLOAT value, NaN values are replaced by MINFLOAT value. (Of
course it is advised to output Result objects with valid values.)
The “writeGmshMesh” method defined in generic “DataBase” class saves a Gmsh mesh file. The
method has up to four arguments (last argument is optional):
-
1.
- A String containing the name of the file in which the mesh is output.
-
2.
- An integer argument corresponding to the coordinate system in which the nodes are
expressed.
-
3.
- A Group corresponding to the entities to be saved in the mesh file.
-
4.
- An optional Boolean argument specifying whether the mesh is output in binary format.
The default value of the argument is “true” and corresponds to a binary output.
An example of use follows:
db.writeGmshMesh("brol.msh",0,skelGrp,false)