Printer-plotter routine

Printer-plotter routine

COMPUTER PHYSICS COMMUNICATIONS2 (1971) 55-56. NORTH-HOLLAND PUBLISHINGCOMPANY PRINTER-PLOTTER Centerfor Nuclear Studies, ROUTINE C. Fred MOORE U...

295KB Sizes 5 Downloads 47 Views

COMPUTER PHYSICS COMMUNICATIONS2 (1971) 55-56. NORTH-HOLLAND PUBLISHINGCOMPANY

PRINTER-PLOTTER

Centerfor

Nuclear Studies,

ROUTINE

C. Fred MOORE University of Texas, Austin,

Texas 70712, USA

Received 22 October 1970

PROGRAM

Title

of program

SUMMARY

(32 characters maximum): PLOTT

Catalogue number: ABOI

Computer for which the progmm is designed and others upon which it is operable Computer: CDC 6600. InstallaEon: Operating system Programming

is executed: UT1

languages used: FORTRAN IV

High speed store required: Is the pro-m

University of Texas

or monitor under which the progmm

overlaid?

1611 words. No. of bits in a word: 60 No

No. of magnetic tapes required: What other perifiherals

None

are used? Card reader ; Line printer

No. of cards in combtned progmm

and test deck: 446

Card punching code: CDC Keyword descriptionof

problem

and method of solution: General, GraphioaI Display, Printer Plotter

Nature of physical problem The purpose of this subroutine is to obtain directly on a line printer a crude plot. The subroutine will plot any number of arrays on a surface of variable size limited only by the printer capacity. The subroutine run time is less than one second. The subroutine does not disturb the arrays being plotted. Method of solution The maximum and minimum values of each coordinate are found. The data are then modified by an appropriate transformation such that the values range from 0 to “NCL” for the horizontal coordinate and from 0 to “NLS” for the vertical coordinate. These are rounded and truncated into integer values. The integer values are then used to locate the Hollerith symbol in memory. If this location is already occupied by a symbol, an equal sign is substituted for the symbol.

The entire Hollerith array then represents the plot itself and is consequently printed. The routine has been on the University of Texas systems tape library for four years [l]. Restrictions on the complexity of the problem This routine may be used to plot linear. semi-log and semi-square-root graphs. The routine checks input for obvious errors and informs the user. Typical running time -The typical%ming Unusual features None.

time is one second.

of the program

Reference [I] C. Fred Moore, 55 UTEX PLOTT, Computation Center, University of Texas (1967).

56

C. F. MOORE

LONG

WRITE-UP

1. INTRODUCTION Quite often a visual presentation of the computed results of a program gives the user a quick means of evaluating the calculation’s success. The subroutine “PLOTT” has been developed to be as versatile as possible, and easy to use. The code also has been written such that it can easily be adapted to computers with various size word lengths. Although a particular plot routine can usually be tailored to suit any one program better than this general subroutine, it is usually more prudent to not spend time and effort to write a specialized plotting subroutine. Moreover, if the subroutine is placed on the system tape at the computation center it does not absorb valuable space in each of the various program decks which call it. The purpose of the subroutine is to aid the physicist in writing codes for his special purposes, where a printer-plotter output is useful. 2. CODE DESCRIPTION A two dimensional array “AREA” is reserved by the code (see section 4 for details). This array is used to store Hollerith characters and is printed after the desired plot is mapped into its contents. The methods used to transform the (.“c,y) coordinates of each point and various reference lines, if used, onto the surface “AREA” are scaling and rounding operations. Masking operations locate each symbol in the proper cell of the appropriate word in this array. Multiple plotting is accomplished by using differing character designators. Redundancy is checked and an equal sign is injected when it occurs. The plotted function can be projected across or down the page. The scale may be chosen as linear, semi-log or semi-square root. The number of lines and columns is controlled by the user. Of course the number of columns is restricted by the line printer capacity. The number of arrays to be plotted at one time is limited only by the number of symbols on the line printer. Reference lines are optional and are particularly useful to fix plot boundaries. The dimension statement in the routine uses the standard unit size for arrays which are transferred from the calling program. Generality of using external dimensioning requires the addition of two elements to the call list (as noted in section 4).

Also, notes in the comment cards make obvious the changes needed for computers with maximum word sizes different from ten Hollerith characters. 3. PHYSICAL METHOD The code has no physical basis by itself. It has been written with the intention of being useful as a subroutine in programs used in physical sciences, e.g. when one wishes to compare experimental results to calculated predictions. 4. USAGE OF THE PROGRAM 1. Operational procedure: Usable as a subroutine 2. Input data: The calling sequence is: SUBROUTINE PLGTT (XX, YY, NDATA, NDMAX, ISYMBL, NF,XLINE, MX, YLINE, MY,NLS,NCL, MM, LL, AREA, YSCALE), where XX(J, I) and YY(J, I) are the coordinate vectors of the Jth point of the Zth array to be plotted. (e.g. Z = 1, to plot one array) NDATA(J) is the number of points in the Jth array. (e.g. NDATA(l) = 100, if there are one hundred points in the first array) NDMAX is the maximum number of points in the largest array to be plotted. In the dimension statement, XX(J, I) and YY(J, I), J must be the value NDMAX. (e.g. NDMAX = 100, see NDATA(J)) ISYMBL(J) is the symbol used in the Jth array. The ISYMBL array may be defined by a Hollerith statement (e.g. ISYMBL(1) = lH*), or a DATA block. NF is the number of arrays to be plotted. In the dimension statement one has XX(J, I), YY(J, I), NDATA(I), and ISYMBL(I), where Z should be equal to or greater than the value NF. (e.g. NF = 1, to plot one array) XLINE(1) is the value for the Zth x reference line. (e.g. leave undefined) MX is the number of x reference lines. In the dimension statement, XLKNE(I), Z should be equal to or greater than the value MX. (e.g. MX = 0, if no x reference lines are desired) YLINE(1) is the value for the Zth y reference line. (e.g. leave undefined) MY is the number of y reference lines. In the

PRINTER-PLOTTER

dimension statement, YLINE(1): Z should be equal to or greater than the value MY. (e.g. MY = 0, if no y reference lines are desired) NLS is the number of lines used in the plot. In the dimension statement, AREA(13, J) and YSCALE(J), J should be equal to or greater than the value NLS. (e.g. NI_S = 56, one page) NCL is the number of columns to be used in the plot. (e.g. NCL = 122, full width) MM control integer: MM = 1 plots across the page; MM = 2 plots down the page. LL control integer: LL = 1, linear; LL = 2, semi-log; LL = 3, semi-square root. AREA(13, J) is the vector which spans the plot surface. This vector is in the call list to satisfy the variable dimensioning requirements. YSCALE(J) is the scale scalar running down the page. This scalar is in the call list to satisfy the variable dimensioning requirements. 5. TEST RUN OUTPUT In order to facilitate the use of the subroutine “PLOTT” a short example driver program “POTE” has been written. Four functions are plotted:

ROUTINE

57

Function Symbol Y(J, I) = SIN(.IO*J) + I.1 ISYMBL(1) * Y(J, 2) = COS(.O8*J) + 1.1 ISYMBL(2) 0 Y(J, 3) = ARCTAN(.Og*J) + 0. I ISYMBL(3) x ISYMBL(4) + Y(J, 4) = EXP(-.l*J) + .0002*J*J where, J = 1 through 100 and X(J, I) = J for Z = 1 through 4. As well, three reference lines are used: YLINE(l) = 1.60 YLlNE(2) = 0.75 XLINE(1) = 5.0 , Other input parameters are: N=l number of (X, Y) points four plots NF=4 MY=2 number of Y reference lines MX=l number of X reference lines number of lines in plot NI.S=50 NCL = 100 number of columns in plot MM=1 plots across the page LL = 1 linear plot NDMAX = 100 agrees with XX and YY in dimension statement AREA &YSCALE appear only in the dimension statement. Since one normally likes to use a heading to identify one’s plot, the code begins without skipping to the top of form. Usually a print statement is inserted before each CALL PLOTT card with an appropriate title. In this test example the title used is, “THIS SHOULD BE A TITLE”.

+

‘;: 31

l

ix +

:::

0

0

Q’

+

*

i :

0 0 0 3

0

0 l l

I

*

I :

l

+

0

l

0

# 0

+

0

i :, 8 i

awi

lx:)

WODO

QLWO

o0

i-

l

l

:

x x

8 I