All the rules that apply to filename.bas files are also valid for other files with the .bas extension. Thus, everything in this section will refer explicitly to the file filename.bas. Any information written to this file, apart from the commands given, is reproduced exactly in the output file (the data input file for the numerical solver). The commands are words that begin with the character *. (If you want to write an asterisk in the file you should write **.) The commands are inserted among the text to be literally translated. Every one of these commands returns one (see Single value return commands) or multiple (see Multiple values return commands) values obtained from the preprocessing component. Other commands mimic the traditional structures to do loops or conditionals (see Specific commands). It is also possible to create variables to manage some data. Comparing it to a classic programming language, the main differences will be the following:

  • The text is reproduced literally, without printing instructions, as it is write-oriented.
  • There are no indices in the loops. When the program begins a loop, it already knows the number of iterations to perform. Furthermore, the inner variables of the loop change their values automatically. All the commands can be divided into three types:
  • Commands that return one single value. This value can be an integer, a real number or a string. The value depends on certain values that are available to the command and on the position of the command within the loop or after setting some other parameters. These commands can be inserted within the text and write their value where it corresponds. They can also appear inside an expression, which would be the example of the conditionals. For this example, you can specify the type of the variable, integer or real, except when using strcmp or strcasecmp. If these commands are within an expression, no * should precede the command.
  • Commands that return more than one value. Their use is similar to that of the previously indicated commands, except for the fact that they cannot be used in other expressions. They can return different values, one after the other, depending on some values of the project.
  • Commands that perform loops or conditionals, create new variables, or define some specifications. The latter includes conditions or types of element chosen and also serves to prevent line-feeding. These commands must start at the beginning of the line and nothing will be written into the calculations file. After the command, in the same line, there can be other commands or words to complement the definitions, so, at the end of a loop or conditional, after the command you can write what loop or conditional was finished.

The arguments that appear in a command are written immediately after it and inside parenthesis. If there is more than one, they will be separated by commas. The parentheses might be inserted without any argument inside, which is useful for writing something just after the command without inserting any additonal spaces. The arguments can be real numbers or integers, meaning the word REAL or the word INT (both in upper- or lowercase) that the value to which it points has to be considered as real or integer, respectively. Other types of arguments are sometimes allowed, like the type of element, described by its name, in the command *set elem, or a chain of characters inserted between double quotes " for the C-instructions strcmp and strcasecmp. It is also sometimes possible to write the name of the field instead of its ordering number.

EXAMPLE:

Below is an example of what a .bas file can be. There are two commands (*nelem and *npoin) which return the total number of elements and nodes of a project.

%%%% Problem Size %%%%

Number of Elements & Nodes:

*nelem *npoin

This .bas file will be converted into a project_name.dat file by GiD. The contents of the project_name.dat file could be something like this:

%%%% Problem Size %%%%

Number of Elements & Nodes:

5379 4678

(5379 being the number of elements of the project, and 4678 the number of nodes).