[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.7 General commands
The following commands can be used anywhere in a Gmsh script:
-
string = expression;
Creates a new expression identifier string, or affects expression to an existing expression identifier. Thirteen expression identifiers are predefined (hardcoded in Gmsh's parser):
-
Pi
Returns 3.1415926535897932.
-
GMSH_MAJOR_VERSION
Returns Gmsh's major version number.
-
GMSH_MINOR_VERSION
Returns Gmsh's minor version number.
-
GMSH_PATCH_VERSION
Returns Gmsh's patch version number.
-
MPI_Size
Returns the number of processors on which Gmsh is running (always 1, except if you compiled Gmsh's parallel extensions).
-
MPI_Rank
Returns the rank of the current processor.
-
newp
Returns the next available point number. As explained in Geometry module, a unique number must be associated with every geometrical point:
newp
permits to know the highest number already attributed (plus one). This is mostly useful when writing user-defined functions (see section User-defined functions) or general geometric primitives, when one does not know a priori which numbers are already attributed, and which ones are still available.-
newl
Returns the next available line number.
-
news
Returns the next available surface number.
-
newv
Returns the next available volume number.
-
newll
Returns the next available line loop number.
-
newsl
Returns the next available surface loop number.
-
newreg
Returns the next available region number. That is,
newreg
returns the maximum ofnewp
,newl
,news
,newv
,newll
,newsl
and all physical entity numbers(6).
-
-
string [ ] = { };
Creates a new expression list identifier
string[]
with an empty list.-
string [ ] = { expression-list };
Creates a new expression list identifier
string[]
with the list expression-list, or affects expression-list to an existing expression list identifier. (Remember the remark we made when we defined expression-lists: the braces enclosing an expression-list are optional if the list only contains a single item.)-
string [ { expression-list } ] = { expression-list };
Affects each item in the right hand side expression-list to the elements (indexed by the left hand side expression-list) of an existing expression list identifier. The two expression-lists must contain the same number of items.
-
real-option = expression;
Affects expression to a real option.
-
char-option = char-expression;
Affects char-expression to a character option.
-
color-option = color-expression;
Affects color-expression to a color option.
-
string | real-option += expression;
Adds and affects expression to an existing expression identifier or to a real option.
-
string | real-option -= expression;
Subtracts and affects expression to an existing expression identifier or to a real option.
-
string | real-option *= expression;
Multiplies and affects expression to an existing expression identifier or to a real option.
-
string | real-option /= expression;
Divides and affects expression to an existing expression identifier or to a real option.
-
string [ ] += { expression-list };
Appends expression-list to an existing expression list or creates a new expression list with expression-list).
-
string [ { expression-list } ] += { expression-list };
Adds and affects, item per item, the right hand side expression-list to an existing expression list identifier.
-
string [ { expression-list } ] -= { expression-list };
Subtracts and affects, item per item, the right hand side expression-list to an existing expression list identifier.
-
string [ { expression-list } ] *= { expression-list };
Multiplies and affects, item per item, the right hand side expression-list to an existing expression list identifier.
-
string [ { expression-list } ] /= { expression-list };
Divides and affects, item per item, the right hand side expression-list to an existing expression list identifier.
-
Exit;
Aborts the current script.
-
Printf ( char-expression , expression-list );
Prints a character expression in the information window and/or on the terminal.
Printf
is equivalent to theprintf
C function: char-expression is a format string that can contain formatting characters (%f
,%e
, etc.). Note that all expressions are evaluated as floating point values in Gmsh (see section Expressions), so that only valid floating point formatting characters make sense in char-expression. See ‘t5.geo’, for an example of the use ofPrintf
.-
Printf ( char-expression , expression-list ) > char-expression;
Same as
Printf
above, but output the expression in a file.-
Printf ( char-expression , expression-list ) >> char-expression;
Same as
Printf
above, but appends the expression at the end of the file.-
Merge char-expression;
Merges a file named char-expression. This command is equivalent to the `File->Merge' menu in the GUI. If the path in char-expression is not absolute, char-expression is appended to the path of the current file.
-
Draw;
Redraws the scene.
-
BoundingBox;
Recomputes the bounding box of the scene (which is normally computed only after new geometrical entities are added or after files are included or merged). The bounding box is computed as follows:
- If there is a mesh (i.e., at least one mesh vertex), the bounding box is taken as the box enclosing all the mesh vertices;
- If there is no mesh but there is a geometry (i.e., at least one geometrical point), the bounding box is taken as the box enclosing all the geometrical points;
- If there is no mesh and no geometry, but there are some post-processing views, the bounding box is taken as the box enclosing all the primitives in the views.
-
BoundingBox { expression, expression, expression, expression, expression, expression };
Forces the bounding box of the scene to the given expressions (X min, X max, Y min, Y max, Z min, Z max).
-
Delete Model;
Deletes the current model (all geometrical entities and their associated meshes).
-
Delete Physicals;
Deletes all physical groups.
-
Delete Variables;
Deletes all the expressions.
-
Delete string;
Deletes the expression string.
-
Mesh expression;
Generate expression-D mesh.
-
Print char-expression;
Prints the graphic window in a file named char-expression, using the current
Print.Format
(see section General options list). If the path in char-expression is not absolute, char-expression is appended to the path of the current file.-
Sleep expression;
Suspends the execution of Gmsh during expression seconds.
-
System char-expression;
Executes a system call.
-
SyncModel;
Forces an immediate transfer from the old geometrical database into the new one (this transfer normally occurs right after a file is read).
-
Include char-expression;
Includes the file named char-expression at the current position in the input file. The include command should be given on a line of its own. If the path in char-expression is not absolute, char-expression is appended to the path of the current file.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |