For In-Form, the latest extension to the Power of PIL, click here.
Especially useful in this regard are the PIL statements:
A simple example is provided by core-library case 119, which is concerned with the calculation of the distance from the wall within an enclosure.
The parts of the Q1 file which are concerned with the menu will now be presented and explained.
** Declarations ** BOOLEAN(BLOCK) ** Settings ** BLOCK=F
XULAST=1.0; YVLAST=1.0; ZWLAST=1.0 CARTES=T; RINNER=YVLAST/2
** messages to screen ** LABEL DISPLAY
MESG(x, y & z dimensions are.. :xulast:, :yvlast:, :zwlast: IF(CARTES) THEN MESG(grid is cartesian ELSE MESG(grid is cylindrical polar ENDIF IF(BLOCK) THEN MESG(there is a central blockage ELSE S MESG(the box is empty ENDIF
** Questions ** MESG(Are data settings OK? (Y/n)
(Y/n) invites the answer Yes or no, the upper case of Y being a conventional indication that Yes is the default, which will be taken if any no other answer is given.
READVDU(ANS,CHAR,Y) IF(:ANS:.EQ.Y) THEN GOTO PROCEED
The next statements send control to the PROCEED label, to be seen below, if the answer is Y.
ELSE IF(CARTES) THEN + MESG(change to polar grid? (Y/n) + READVDU(ANS,CHAR,Y)
The + signs appear so as to indicate that what follows is to be read by SATELLITE, even though it does not start in the first or second column. This enables indentation to be used so as to clarify the nested logical structure.
+ IF(:ANS:.EQ.Y) THEN + CARTES=F + GOTO DISPLAY + ENDIF ENDIF
IF(.NOT.BLOCK) THEN + MESG(introduce blockage? (Y/n) + READVDU(ANS,CHAR,Y) + IF(:ANS:.EQ.Y) THEN + BLOCK=T + GOTO DISPLAY + ENDIF ENDIF
MESG(change dimensions of box? (Y/n) READVDU(ANS,CHAR,Y) IF(:ANS:.EQ.Y) THEN
+ MESG(x-dimension is :xulast: . New value? + MESG(in metres if cartesian, otherwise radians + READVDU(XULAST,REAL,XULAST)
+ MESG(y-dimension is :yvlast: . New value? + READVDU(YVLAST,REAL,YVLAST)
+ MESG(z-dimension is :zwlast: . New value? + READVDU(ZWLAST,REAL,ZWLAST) + GOTO DISPLAY
+ IF(.NOT.CARTES) THEN + MESG(Inner radius = :rinner: . New value?) + READVDU(RINNER,REAL,RINNER) + ENDIF
ENDIF ENDIF LABEL PROCEED
IF(BLOCK) THEN STORE(PRPS) PATCH(BLOCK,INIVAL,NX/4+1,3*NX/4,NY/4+1,3*NY/4,NZ/4+1,3*NZ/4,1,1) COVAL(BLOCK,PRPS,0.0,100.0) ENDIF
It should be remarked that no questions are asked about the size or
location of the blockage, which are therefore fixed by the PATCH arguments:
Of course, the menu options could easily be extended, by declaring integer variables indicating what cells of the grid the solid was to occupy, and providing appropriate question-and-answer sequences.
Whether a user prefers to make this extension, or simply to edit the default values, is a matter of choice, to be made by reference to:-
The setting of individual values may become rather tedious; it is therefore useful to point out that menus can be easily created for making several settings simultaneously, as in the following simple example,
** Declarations ** REAL(XLENGTH,YLENGTH,ZLENGTH) CHAR(SETNAME,BILLS,JANES,JOHNS,MARYS) ** Defaults ** XLENGTH=1.0; YLENGTH=1.0; ZLENGTH=1.0
MESG(Whose data set do you wish to use? Default is Bill's. MESG(Insert one of: BILLS, JANES, JOHNS or MARYS. MESG(You can use upper or lower case; but not an apostrophe. READVDU(SETNAME,CHAR,BILLS)
IF(:SETNAME:.EQ.BILLS) THEN XLENGTH=1.0; YLENGTH=2.0; ZLENGTH=3.0 ELSE IF(:SETNAME:.EQ.JANES) THEN + XLENGTH=3.5; YLENGTH=2.0; ZLENGTH=0.01 ELSE + IF(:SETNAME:.EQ.JOHNS) THEN + XLENGTH=0.5; YLENGTH=1.5; ZLENGTH=0.1 + ELSE + IF(:SETNAME:.EQ.MARYS) THEN + XLENGTH=3.5; YLENGTH=0.25; ZLENGTH=10.0 + ENDIF + ENDIF ENDIF ENDIF
XLENGTH YLENGTH ZLENGTH
Of course, as many entries as are desired can be included in the sections of the Q1 file devoted to Bill, Jane, etc. However, it is often convenient to keep large sets of data in individual files, which can be called in by use of the INTRPT statement, as shown here:
IF(:SETNAME:.EQ.BILLS) THEN INTRPT(R,billsfile) ELSE
A PIL "macro" is a set of PIL statements which can be invoked by way of the load, # or intrpt commands to permit re-use of previously-assembled sets of statements.
References to them can be found in section 5 of this encyclopaedia entry, in the article on In-Form, and elsewhere (for example the PHENC article on MAXABS).
Evidence is afforded by inspecting the files in the directory /phoenics/d_satell/d_men/ and below, namely:
These files are "PIL fragments" which interact with each other by way of LOAD statements.