Civil Engineering Reference
In-Depth Information
2.2.4
Control
Various features which can be used to control the flow of the program have been
improved and new ones added. With these new features it should no longer be necessary
to have GOTO statements and statement numbers, features which sometimes made
programs very difficult to read. A new feature is the SELECT CASE which replaces
the computed GOTO . This feature allows us to control which parts of the code are
executed under certain conditions.
For example the coding
SELECT CASE (NUMBER_OF_FREEDOMS)
CASE (1)
Coding for one degree of freedom
CASE( 2)
Coding for two degrees of freedom
CASE DEFAULT
Error message
END SELECT
would execute two different types of instructions, depending on the degrees of freedom
per node (i.e., potential vs. elasticity problems) and would issue an error message if
another value is encountered.
The IF statement is mainly used for controlling execution. It has been improved in
that symbols which are familiar to engineers can be used.
For example the operators :
.NE. can be written as
/=
.EQ.
==
.GT.
>
.GE.
>=
.LT.
<
.LE.
<=
The DO loop has also been improved. It is possible to give each DO loop a name
which enhances readability. Also, there is an easier possibility of exiting a loop when a
certain condition is reached. For example, in an iteration loop the condition for exiting
may be that a convergence has been achieved. The code
Iteration_loop:
&
DO ITER=1,NITERS
Statements
IF (CONVERGED) EXIT
Statements
END DO &
Iteration_loop
Search WWH ::




Custom Search