10.08.2013 Views

Code Manual for CONTAIN 2.0 - Federation of American Scientists

Code Manual for CONTAIN 2.0 - Federation of American Scientists

Code Manual for CONTAIN 2.0 - Federation of American Scientists

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

POSTCON routine, and possibly writing a FORTRAN function to per<strong>for</strong>m the necessary<br />

calculations.<br />

16.7.4.1 Choosing a Function Name. Mix function names must be no more than eight characters<br />

starting with a 1$’. For example, $sin, $sqrt, $myfunct, and $min are all legal function names.<br />

16.7.4.2 Mod ifyirw POSTCON <strong>for</strong> Unary Functions. Provisions are made in POSTCON to process<br />

three different classes <strong>of</strong> mix functions: 1) unary functions, 2) binary functions where both<br />

arguments are vectors, and 3) binary functions where one argument is a constant.<br />

Unary functions are functions that have only one argument. Examples are sin, log, exp, and sqrt.<br />

These functions are handled by a subroutine called OPERU. To implement the function, the user<br />

simply needs to add an IF block to this routine. For example, to implement the square root function,<br />

the following code should be inserted be<strong>for</strong>e the write statement:<br />

if (oper .eq. ?$sqrt’) then<br />

do 10 i=l ,numpts<br />

ypts(i) = sqrt(ypts(i))<br />

10 continue<br />

endif<br />

16.7.4.3 Modifying POSTCON <strong>for</strong> Binary Functions. Binary functions are functions that have two<br />

arguments, such as rnin, max, and ~. If both arguments are vectors, then the subroutine OPERW<br />

needs to be modified. If only one <strong>of</strong> the arguments is a vector and one is a scalar, then the subroutine<br />

OPERSV needs to be modified. As an example, the following code could be inserted just be<strong>for</strong>e the<br />

END IF statement <strong>of</strong> subroutine OPERW:<br />

else if (oper .eq. ‘$ytox’) then<br />

do 50 i= 1,numpts<br />

ylpts(i) = ytox(ylpts(i),y2pts(i))<br />

50 continue<br />

Of course, in this example, the user would also have to supply the FORTRAN function YTOX.<br />

16.7.4.4 Exarrmles <strong>of</strong> Mix Exmessions with Functions. Following are legal mix expressions using<br />

the functions that could be easily added to POSTCON.<br />

VECTOR vecl = a+$sqrt(b)<br />

VECTOR vec2 = $min(a,b)<br />

16.7.5 Hints <strong>for</strong> Efficient Use<br />

Following are some suggestions <strong>for</strong> using the mix option efficiently.<br />

Rev O 16-33 6/30/97

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!