This is gid.info, produced by Makeinfo version 3.12h from gid.texinfo.

   This is the GiD manual

   Copyright 1997-2002 CIMNE


File: gid.info,  Node: Specific commands,  Prev: Multiple values return commands,  Up: Commands used in the .bas file

Specific commands
.................

   - *\ To avoid line-feeding, the user must write *\, so, the currently
     used line continues on the following line of the file `NAME.bas'.

   - *# Written at the beginning of the line, consider this line as a
     comment and does not write it.

   - *MessageBox. This command stops the execution of the `.bas' file
     and prints a message in a window; this command should be used only
     when a fatal error occurs.
     Example:
     `  *MessageBox error: Quadrilateral elements are not permitted.'
   - *WarningBox. is the same as `MessageBox' but without stoping the
     execution.
     Example:
     `WarningBox Warning: Exist Bad elements. A STL file is a
     collection of triangles bounding a volume.'

   The following commands must be written at the beginning of a line
and the rest of the line will serve for their modifiers. No additional
text should be written.

   * *loop, *end, *break. They are declared for the use of loops. A
     loop begins with a line that starts with `*loop' (no matter the
     letters case, as for the rest of commands) and contains another
     word to express the variable of the loop. There are some lines in
     the middle that will be repeated depending on the values of the
     variable and whose parameters will keep on changing through the
     iterations, if necessary. Finally, a loop will end with a line that
     finishes with `*end'. After `*end' the user may write any kind of
     comments in the same line. Command *break inside a loop, will
     finish the execution of the loop and will continue after the *end
     line.

     The variables that are available for `*loop' are the following:

        - elems, nodes, materials, layers, intervals, localaxes. They
          mean, respectively, that the loop will iterate over the
          elements, nodes, materials, layers, intervals or local axes
          systems. The loops can be nested among them. The loop over
          the materials will iterate only over the effectively assigned
          materials to an entity, in spite of the fact that more
          materials had been defined. The number of the materials will
          begin with number 1. If a command that depends on the loop is
          located outside it, the number also will take, by default,
          the value 1.

     After the command `*loop', if the variable is `elems' or `nodes',
     the user may include a modifier `*all', `*OnlyInCond' or
     `*OnlyInLayer' . The first one signifies that the iteration is
     going to be performed over all the entities; the `*OnlyInCond'
     modifier implies that the iteration will only take place over the
     entities that accomplish the concerned condition. This condition
     must have been previously defined with `*set cond'. `*OnlyInLayer'
     implies that the iteration will only take place  over the entities
     that are in the specified layer; layers must be specified with the
     command `*set Layer'. By default, it is assumed that the iteration
     will affect all the entities.
     Example 1:
          *set elems(all)
          *loop nodes
          *format "%5i%14.5e%14.5e"
          *NodesNum *NodesCoord(1,real) *NodesCoord(2,real)
          *end nodes
     This command effects a rundown of all the nodes of the mesh,
     listing their identifiers and coordinates (x and y coordinates).

     Example 2:
          *Set Cond Point-Weight *nodes
          *loop nodes *OnlyInCond
          *NodesNum     *cond(1)
          *end
     This effects a rundown of all the nodes assigned the condition
     "Point-Weight" and provides a list of their identifiers and the
     first "weight" field of the condition in each case.

     Example 3:
          *Loop Elems
          *ElemsNum *ElemsLayerNum
          *End Elems
     This effects a rundown of all the elements and provides a list of
     their identifier and the identifier of the layer to which they
     belong.

     Example 4:
          *Loop Layers
          *LayerNum *LayerName
          *End Layers
     This effects a rundown of all the layers and for each layer it
     lists its identifier and its name.

   * *if, *else, *elseif, *endif. These commands create the
     conditionals.  The format is a line which begins with `*if'
     followed by an expression between parenthesis. This expression
     will be written in C-language syntax, value return commands, will
     not begin with `*' and its variables must be defined as integers
     or reals (see `*format', `*intformat', `*realformat)', with the
     only exception of `strcmp' and `strcasecmp'. It can include
     relational as well as arithmetic operators inside the expressions.

     The following are valid examples of the use of the conditionals:

          *if((fabs(loopvar)/4)<1.e+2)
          *if((p3<p2)||p4)
          *if((strcasecmp(cond(1),"XLoad")==0)&&(cond(2)!=0))

     The first example is a numerical example where the condition is
     accomplished for the values of the loop under 400, while the other
     two are logical operators where the condition is accomplished when
     `p3<p2' or `p4' is different from 0 in the first case and when the
     first field of the condition is called `XLoad' (with this
     particular writing) and the second is not null in the second case.

     If the checked condition is true, GiD will write all the lines
     until finding the corresponding `*else', `*elseif' or `*endif'
     (`*end' is equivalent to `*endif' after `*if'). `*else' or
     `*elseif' are optional and require the writing of all the lines
     until the corresponding `*endif', but only when the condition
     given by `*if' is false. If `*else' or `*elseif' exist, it must be
     written between `*if' and `*endif'. The conditionals can be nested
     among them.

     The behavior of `*elseif' is identical to the behavior of `*else'
     with the addition of a new condition:

          *if(GenData(31,int)==1)
            ...(1)
          *elseif(GenData(31,int)==2)
            ...(2)
          *else
            ...(3)
          *endif

     In the previous example, the body of the first condition (written
     as `1') will be written into the data file if `GenData(31,int)' is
     1, the body of the second condition (written as `2') will be
     written into the data file if `GenData(31,int)' is 2 and if none
     of both is true, the body of the third condition (written as `3')
     will be written into the data file.

     *Note:* A conditional can also be written in the middle of a line.
     To do this, the user will begin another line to write the
     conditional by means of the command *\.

   * *for. The syntax of this command is equivalent to `*for' in
     C-language:

          *for(varname=expr.1;varname<=expr.2;varname=varname+1)

     The meaning of this statement is the execution of a controlled
     loop, since `varname' is equal to `expr.1' until it is equal to
     `expr.2', with an incremental value of 1 for each step. `varname'
     is any name and `expr.1' and `expr.2' are arithmetical expressions
     or numbers whose only restrictions are to express the range of the
     loop.

   * *set. This command has the following purposes:
        - `*set cond.' To set a condition.

        - `*set Layer "layer name" *elems|nodes.' To set a layer.

        - `*set elems.' To indicate the elements.

        - `*set var.' To indicate the variables to use.

     For all of them it is not binding the use of lower case, so `*Set'
     will also be valid in all the examples.  *set cond.: In the case
     of the conditions, GiD allows the combination of a group of them
     via the use of `*add cond.' When a specific condition is about to
     be used, it must be defined first and afterwards, this will be
     used until the definition of another one. If this feature is
     performed inside a loop over intervals, the corresponding entities
     will be chosen. Otherwise, the entities will be those referred to
     the first interval.
     This is done in this way because when the user indicates to the
     program that a condition is going to be used, GiD creates a table
     that allows to know the number of entities over which this
     condition has been applied. It is necessary to specify if the
     condition takes place over the nodes or over the elements to
     create the table.

     So, a first example to check the nodes where there displacement
     constraints exist can be:

          *Set Cond Volu-Cstrt *nodes
          *Add Cond Surf-Cstrt *nodes
          *Add Cond Line-Cstrt *nodes
          *Add Cond Poin-Cstrt *nodes

     that allows the user to apply the conditions directly over any
     geometric entity.

     *Set Layer "layer name" *elems|nodes
     *Add Layer "layer name"
     *Remove Layer "layer name"
     This command set a group of nodes. In the following loops over
     nodes/elements with the modifier `*OnlyInLayer' the iterations
     will only take place over the nodes/elements of that group.

     Example 1:
          *set Layer example_layer_1 *elems
          *loop elems *OnlyInLayer
              Nš:*ElemsNum Name of Layer:*ElemsLayerName Nš of Layer :*ElemsLayerNum
          *end elems

     Example 2:
          *loop layers
          *set Layer *LayerName *elems
          *loop elems *OnlyInLayer
              Nš:*ElemsNum Name of Layer:*ElemsLayerName Nš of Layer :*ElemsLayerNum
          *end elems
          *end layers

     In this example the command `*LayerName' is used to get the layer
     name.
     There are some modifiers available to point out particular
     specifications on the conditions.

     If command `*CanRepeat' is added after `*nodes' or `*elems' in
     `*Set cond', one entity can be several times in the entities list.
     If command `*NoCanRepeat' is used, entities will be just once in
     the entities list. By default, `*CanRepeat' is off except for the
     case of one condition that have the `*CanRepeat' flag already set.

     A typical case not to use `*CanRepeat' would be:

          *Set Cond Line-Constraints *nodes

     In this case, when two lines share one endpoint, instead of two
     nodes in the list, only one is written.

     A typical case to use `*CanRepeat' would be:

          *Set Cond Line-Preassure *elems *CanRepeat

     in this case, if one triangle of quadrilateral has more than one
     face in the marked boundary, we want this element to appear
     several times in the elements list, one for each face.

     Other modifiers are used to inform the program that there are nodes
     or elements that can satisfy one condition more than once (for
     instance, a node that belongs to a certain number of lines with
     different prescribed movements) and that have to appear unrepeated
     in the data input file, or, in the opposite case, that have to
     appear only if they satisfy more than one condition. These
     requirements are achieved with the commands `*or(i,type)' and
     `*and(i,type)', respectively, after the input of the condition,
     where `i' is the number of the condition to be considered and
     `type' is the type of the variable (integer or real).

     For the previous example there can be nodes or elements in the
     intersection of two lines or maybe belonging to different entities
     where the same condition had been applied. To avoid the repetition
     of these nodes or elements, GiD has the  modifier `*or', and in
     the case that two or more different values were applied over a
     node or element, GiD only would consider one, being this value
     different from zero. The reason for that can be easily understood
     looking at the following example. Considering the previous commands
     transformed as:

          *Set Cond Volu-Cstrt *nodes *or(1,int) *or(2,int)
          *Add Cond Surf-Cstrt *nodes *or(1,int) *or(2,int)
          *Add Cond Line-Cstrt *nodes *or(1,int) *or(2,int)
          *Add Cond Poin-Cstrt *nodes *or(1,int) *or(2,int)

     where `*or(1,int)' means the assignment of that node to the
     considered ones satisfying the condition if the integer value of
     the first condition's field is different from zero (`*or(2,int)'
     means the same assignment if the integer value of the second
     condition's field is different from zero).  Let us imagine that a
     zero in the first field implies a restricted movement in the
     direction of the X-axis and a zero in the second field implies a
     restricted movement in the direction of the Y-axis. If a point
     belongs at the same time to an entity whose movement in the
     direction of the X-axis is constrained, whereas its movement in
     the direction of the Y-axis is released and to an entity whose
     movement in the direction of the Y-axis is constrained, whereas
     its movement in the direction of the X-axis is released, GiD would
     join both conditions in that point, appearing as a fixed point in
     both directions and as a node satisfying the four expressed
     conditions would be counted only once.

     The same considerations explained for adding conditions through
     the use of `*add cond' apply to the elements with the only change
     of putting `*add elems.' Moreover, sometimes it can be of interest
     to remove sets of elements from the assigned ones to the specific
     conditions. This can be done with the command `*remove elems.' So,
     for instance, GiD allows combinations of the type:

          *Set Cond Dummy *elems
          *Set elems(All)
          *Remove elems(Linear)

     to indicate that all dummy elements apart from the linear ones
     will be considered, as well as:

          *Set Cond Dummy *elems
          *Set elems(Hexahedra)
          *Add elems(Tetrahedra)
          *Add elems(Quadrilateral)
          *Add elems(Triangle)

     The format for `*set var' differs from the syntax for the other two
     `*set' commands. Its syntax is as follows:
          *Set var varname = expression

     where `varname' is any name and `expression' is any arithmetical
     expression, number or command, having the latter to be written
     without * and having to be defined as `Int' or `Real'.

     The following are valid examples for these assignments:

          *Set var ko1=cond(1,real)
          *Set var ko2=2
          *Set var S1=CondNumEntities
          *Set var p1=elemsnum()

   * *intformat, *realformat,*format. These commands explain how the
     output of different mathematical expressions will be written into
     the analysis file. The use of this command consist in a line which
     begins with the corresponding version, `*intformat', `*realformat'
     or `*format', (independently of the use of capital letters) and
     continues with the desired writing format, expressed in C-language
     syntax argument, between double quotes (").

     The integer definition of `*intformat' and the real of
     `*realformat' remain unchanged until another definition via
     `*intformat' and `*realformat', respectively, is provided.  The
     argument of these two commands is composed by an unique field.
     This is the reason why the `*intformat' and `*realformat' commands
     are usually invoked at the initial stages of the `.bas' file, to
     set the format configuration of the integer or real numbers to be
     output during the rest of the process.

     The `*format' command can include several fields definitions in
     its argument, mixing integer and real definitions, but it will only
     affect the line that follows the command's instance one. Hence, the
     `*format' command is typically  used when outputing a listing, to
     set a temporary configuration.

     In the next paragraphs, there is an explanation of the C format
     specification, refered to the fields specification to be included
     into the argument of these commands. Keep in mind that the type of
     argument that the `*format' command expects may be composed by
     several fields, and the `*intformat' and `*realformat' commands'
     arguments are composed by an unique field, declared as integer and
     real, respectively, all inside double quotes:

     The start of a field is signaled by the percentage symbol (%). for
     Each field specification is composed by the width of the integer
     field, and, in the case when the type is a float one, a separator
     point type(.) and the precision width of the field. This is
     followed by a letter which specifies the type of the data to be
     represented.

     You are allowed to add text between columns, just writting it
     after the field specification block, before the next `%' sign.
     Note that it is not possible to use the `%' character into this
     text, neither with the c format specification `%%'.

     The most usual representations are integers and floats. For the
     integers there are available the `d' and `i' letters, that force
     to read the data as signed decimal integer and `u' for unsigned
     decimal integer.

     For floating point representation, there are the `e', `f' and `g'
     letters, being used then a decimal point to separate the magnitude
     of the number and the precision.   The number of digits before the
     decimal point depends on the magnitude of the number, and the
     number of digits after the decimal point depends on the requested
     precision.

     The following are valid examples of the use of format:

          *Intformat "%5i"
     With this sentence, usually located on the start of the file, the
     output of an integer quantity is forced to be left alingned on the
     fifth column of the text format on the right side. This means that
     if the number of digits exceeds five, the representation of the
     number will be truncated.  on its left part.

          *Realformat "%10.3e"

     This sentence, that also is located frequently at the first lines
     of the template file, sets the output format for the real numbers
     as ten digits for the integer part, and three for the real part of
     the number. On that case, the truncation will be of the rightest
     digits for the real part of the number and the left part for the
     integer part.

          *format "%10i%10.3e%10i%15.6e"

     This complex command will specify a multiple assignment of formats
     to some output columns. These columns are generated with the line
     command that will follow the format line. The subsequent lines
     will not use this format, and will follow the general settings of
     the template file or the general formats: *IntFormat, *RealFormat.

   * *tcl

     This command permmits to print information using the TCL extension
     language. The argument of this command must be a valid TCL command
     or expression that must return the string that will be printed.
     Typically, the TCL command is defined in the TCL file (.tcl). (see
     *note TCL-TK extension::. for details).
     Example: in this example the *tcl command is used to call a tcl
     function defined in the problem's type .tcl file.  That function
     receives an argument; we use the variable `num'.
     In the .bas file:
          *set var num=1
          *tcl(WriteSurfaceInfo *num)

     In the .tcl file:
          proc WriteSurfaceInfo { num } {
             return [.central.s info list_entities surfaces $num]
          }


