2.13. Parameter-Processing Subroutines

The product distribution medium contains three subroutines that you can use for parameter processing: pardim, parevl, and pardef.

2.13.1. Subroutine pardim (Creating a Dimensioned Parameter)

*deck,pardim
      subroutine pardim (cName,labl4,nDim,nxyz,cLabels)
c *** primary function:    create a dimensioned parameter

c       *dim,parm32,type,d1,d2,d3,cName1,cName2,cName3
c       *dim,parm32,type,d1,cName1
c       *dim,parm32,type,d1,d2,d3,d4,d5,cName1,cName2,cName3,cName4,cName5

c *** Notice - This file contains ANSYS Confidential information ***

c  input arguments:
c     cName    (chr*32,sc,in)    - the name of the parameter to create
c     labl4    (chr*4,sc,in)     - 'TABL' or 'ARRA' or 'CHAR' or 'STRI'
c     nDim     (int,sc,in)       - Dimension of array
c     nxyz     (int,ar(nDim),in) - the dimensions of the array
c     cLabels  (chr*32,ar(nDim),in) - Names for the directions in table

c  output arguments:  none


2.13.2. Subroutine parevl (Finding and Evaluating a Parameter)

*deck,parevl
      subroutine parevl (ParName,nDim,subc,lvl,dpValue,chValue,kerr)
c *** primary function:    find and evaluate a parameter

c *** Notice - This file contains ANSYS Confidential information ***

c  input arguments:
c     ParName  (chr*(PARMSIZE),sc,in) - the name of the parameter
c                                       (must be upper case, left justified)
c     nDim     (int,sc,in)            - the number of subscripts (0,scaler)
c     subc     (dp,ar(*),in)          - values for the subscripts (if any)
c     lvl      (int,sc,in)            - 0,1  no error output  2, report error
c                                       -1, set kerr flag with no anserr call

c  output arguments:
c     dpValue  (dp,sc,out)            - the value of the parameter (may be a
c                                       packed character*8
c     chValue  (chr*(STRING_MAX_LENG),sc,out) - character output 
c     kerr     (int,sc,out)           - error flag  (0,ok  -1,output is packed
c                                       0=ok,  1=error,  2=error but TINY is used
c                                        -2, output is string in chValue


2.13.3. Subroutine pardef (Adding a Parameter)

*deck,pardef
      subroutine pardef (cNameIn,ctype,nval,subc,valuein,kerr,string)
c *** primary function:    add a parameter to parameter list
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c  input arguments:
c     cNameIn (chr*(PARMSIZE),sc,in) - name of parameter
c                             cNameIn is a character variable that
c                             contains the name of the parameter that
c                             is to be defined. (Length = PARMSIZE characters)
c
c     ctype  (int,sc,in)   - 0, dp   1,character  2,string
c                             ctype is an integer key which describes
c                             the type of data that the parameter data
c                             holds.  This would also indicate the
c                             contents of "value" (arg 5).
c                             0=double precision data
c                             1=character data packed in value
c                             2=character data in string
c
c     nval   (int,sc,in)   - number of subscripts
c                             nval is the number of subscripts that the
c                             "cNameIn" (arg 1) contains.
c                             1=single dimensioned variable (ex. x(10))
c                             2=double dimensioned variable (ex. y(10,3))
c                             3=triple dimensioned variable (ex. z(10,3,2))
c                             -1=delete this parameter from the internal
c                             tables.
c
c     subc (dp,ar(*),in)   - values of subscripts
c                             subc is a double precision vector that
c                             contains the subscripts of "cNameIn" (arg 1).
c                             There should be enough values defined to
c                             match "nval" (arg 3).  For example if "x"
c                             was dimensioned as "x(10,3,2)" and you wanted
c                             to set "x(5,1,1)=123.0", then "nval" (arg 3)
c                             should be set to 3, and "subc" should be set
c                             to 5.0, 1.0, 1.0, and "value" (arg 5) should
c                             be 123.0.  Another example is if "y" was
c                             dimensioned to as "y(20,20)" and you were
c                             setting "y(5,8)=987", then "nval" (arg 3) should
c                             be set to 2 and "subc" should be set to 5.0,
c                             8.0, 0.0, and "value" (arg 5) should be 987.0.
c
c                             Remember subroutine "pardef" is only storing
c                             a data value of "cNameIn" or "cNameIn(x,y,z)". The
c                             proper dimensions were set by a "*dim" command.
c
c                             Please note that although the values of "subc"
c                             should be double precision, subroutine "pardef"
c                             uses the intrinsic "nint" (nearest integer)
c                             function to get and use the integer equivalent.
c
c                             You should also note the "nval" (arg 3) and
c                           "subc" (arg 4) must fall within the range that was
c                             set with a "*dim" or "*set" command or an error
c                             will occur.
c
c     valuein(dp,sc,in)    - the value for this parameter
c                             (should be a packed character*8 if
c                             ctype=1. To pack a char into a dp
c                             variable use "call chtodp(ch8,dp)".
c                             To unpack a dp variable into a char
c                             use "call dptoch(dp,ch8)" )
c                             Value is the data value that is to be stored for
c                             "cNameIn" (arg 1). If "ctype=1" (arg 2) then this
c                             value would be a "packed character" data from the
c                             "chtodp" Ansys function.
c
c  output arguments:
c     kerr   (int,sc,out)  - error flag (0=ok, 1=error)
c                             kerr is an integer error flag that is
c                             returned to the calling subroutine.  Any
c                             non zero number would indicate an error
c                             was detected in subroutine "pardef"
c