SECTION 1.3 CONTOUR PLOTTING

A call to subroutine CNTR provides a contour plot of any function. This function must be supplied by the user in the standard form. He/she must also designate the two variables which will be varied and must assign fixed values for the remaining NP-2 variables. The two variables that are to be varied must be assigned lowest and highest values. The function will be evaluated repeatedly over a grid of variable values in the selected ranges and the resulting values will be assigned to one of ten levels of magnitude. The assignments are identified by the digits 0 (lowest) to 9 (highest) and the full array of these digits is printed in an X-Y plot, in which every digit rep- resents a function value corresponding to the pair of variable values given by the horizontal and vertical coordinates of the digit. The maximum and minimum values will be indicated by + and - respectively, if IOPT(1) is zero or if the calculated function value exactly matches ZMAX or ZMIN. The SUBROUTINE CNTR2 calls the default initializer DFLT which is part of the file OPT. Hence OPT.OBJ must be linked to use CNTR2, which will happen automatically if the user employs the GQOPT Library. (Alternatively, the user could just copy SUBROUTINE DFLT from OPT.FOR to the end of his/her MAIN program; in that case OPT. need not be linked. The test problem GQT13.FOR assumes that this has been done.) The call for contour plotting is

      CALL CNTR(X,NP,I1,I2,XMIN,XMAX,YMIN,YMAX,ZMIN,ZMAX,IOPT,ZINT,*,
     1 FUNC,XLABEL,YLABEL)

where

X = The vector of variables
NP = The number of variables
I1 = Index of the variable to be plotted on the X-axis
I2 = Index of the variable to be plotted on the Y-axis
XMIN = Smallest value plotted on the X-axis
XMAX = Largest value plotted on the X-axis
YMIN = Smallest value plotted on the Y-axis
YMAX = Largest value plotted on the Y-axis
ZMIN = Smallest function value plotted (see also IOPT(1))
ZMAX = Largest function value plotted (see also IOPT(1))
ZINT = Increment in the distance between pairs of consecutive contour values (see also IOPT(2))
IOPT = an integer array of length 3
IOPT(1) = 0 All function values encountered will result in a digit being plotted. ZMIN and ZMAX are irrelevant.
IOPT(1) = 1 You must specify a smallest and largest function value (ZMIN,ZMAX). Digits will be plotted only for function values in this range. For function values outside the range, blanks are plotted.
IOPT(2) = 0 The entire range of function values encountered will be divided into ten equal intervals: successive contours correspond to equal function differences. ZINT is irrelevant.
IOPT(2) = 1 ZINT must be specified and successively higher contours correspond to larger and larger (smaller and smaller) function differences if ZINT is positive (negative). ZINT is the value by which the difference in function values corresponding to successive contours increases (decreases). This works as follows: Let the lowest interval have the width ZD, the second ZD+ZINT, and the last ZD + 9*ZINT. Then

                        10*ZD + 45*ZINT = ZMAX - ZMIN

(where ZMAX and ZMIN are either determined by the program (IOPT(1)=0) or are specified by the user). If ZINT > 0, then it must be chosen so that

                        ZMAX - ZMIN - 45*ZINT = 10*ZD

is positive. If ZINT < 0, then ZD + 9*ZINT must be positive. If these fail to be the case, IOPT(2) is overridden and the program proceeds as if IOPT(2)=0 had been specified. The user may need to run the plot first with IOPT(2)=0 to find out what ZMIN and ZMAX are before he can select an appropriate value of ZINT.
IOPT(3)=An integer from 10 to 100 which gives the resolution of the plot. Grid size is the square of IOPT(3). If IOPT(3) is not a multiple of 10, it will be truncated to the next lower multiple. Thus, if IOPT(3)=67, plot size will contain 60*60=3600 digits corresponding to 3600 function evaluations. Warning: the largest grid size is 100 by 100, and is likely to be expensive since it will require 10000 function evaluations.
XLABEL,YLABEL=Names of the variables (CHARACTER*8).
FUNC=Name of function subroutine in standard format (See Section 1.1)

Return to
|Sect. 1.10|Beginning|