4.2. General Subroutines

4.2.1. Subroutine dptoch (Retrieve Eight Characters From a Double Precision Variable)

*deck,dptoch
      subroutine dptoch (dp8,ch8)
c *** primary function:    retreive 8 characters from a dp variable

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

c !!! NOTICE to progammers: this routine does not convert from a !!!
c !!! machine-independent format! Use dpexttoch if this dp word  !!!
c !!! came from a common or non-char database record             !!!

c  input arguments:
c     dp8      (dp,sc,in)        - dp variable containing characters

c  output arguments:
c     ch8      (ch*8,sc,out)     - characters retreived from the dp word


4.2.2. Function ppinqr (Obtain Information About Threads)

*deck,ppinqr           parallel
      function ppinqr (key)

c primary function:    Get information from pplib (parallel library)

c keywords:  subroutine to inquire from parallel library 

c object/library:
c         current - pplib 
                                       
c *** Notice - This file contains ANSYS Confidential information ***

c  input arguments:
c     key      (int,sc,in)       -  0, Get ppNprocs
c                                        (if >1, parallel allowed)
c                                   1, Get ppOff
c                                        (0,pp active 1, inactive)
c                                   2, Get ppMaxProc
c                                        (max processors to be used)
c                                   3, Get ppNumThreads
c                                        (number of threads in set)
c                                   4, Get ppThrStatus
c                                        1, parallel started
c                                        2, parallel not started
c                                   5, Get ppDebug
c                                        (debug level value)
c                                   7, Get ppThdRunning
c                                        (either 0 or the number of threads running)
c                                  10, Get ppNprocOrig
c                                  12, Get ppInitialize
c                                  13, Get ppRunLevel
c                                  22, Get ppLockCheck
c                                  23, Get ppHybrid

c  output arguments:
c     ppinqr   (int,sc,out)      - The value of the referenced variable


For information about using this function, see Sharing Data Between User Routines.

4.2.3. Function pplock (Locking a Thread in Shared Memory)

*deck,pplock           parallel
      subroutine pplock (ilock)
c **********  set the lock ilock **********

c  input arguments:
c    ilock    (int,sc,in)      - the index of the lock to be set

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


For information about using this function, see Sharing Data Between User Routines.

4.2.4. Function ppunlock (Unlocking a Thread in Shared Memory)

*deck,ppunlock           parallel
      subroutine ppunlock(ilock)
c **********  clear the lock ilock **********

c  input arguments:
c    ilock     (int,sc,in)         - The index of the lock to be cleared

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


For information about using this function, see Sharing Data Between User Routines.

4.2.5. Function ppproc (Get the Active Thread Index)

*deck,ppproc           parallel
      function ppproc ()
c *** primary function:    return unique thread number (0:ppNprocs-1)

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

c  output arguments:
c     ppproc   (int,sc,out)      - the thread number for this process


For information about using this function, see Sharing Data Between User Routines.

4.2.6. Function wrinqr (Obtain Information About Output)

*deck,wrinqr
      function wrinqr (key)
c *** primary function:   obtain information about output

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

c --- caution: the following variables are "saved/resumed".
c ---          key=WR_COLINTER thru WR_SUPCOLMAX in "wrinqr/wrinfo" 
c ---           (data for "/fmt,/page,/header" commands). 
c ---           note that the whole common cannot be "saved/resumed".  cwa

c     typ=int,dp,log,chr,dcp   siz=sc,ar(n),func    intent=in,out,inout

c  input arguments:
c     variable (typ,siz,intent)    description                        wrcom name
c     key      (int,sc,in) 
c                  = WR_PRINT       - print flag (kprint)                 prtkey
c                       wrinqr = 0 - no output
c                              = 1 - print
c                  = WR_OUTPUT      - current output unit number(iott) outfil
c                  = WR_MASTEROUT   - master output file               frstot
c                  = WR_COLINTER    - interactive columns per page     intcol
c                  = WR_COLBATCH    - batch columns per page           batcol
c                  = WR_LINEINTER   - interactive lines per page       intlin
c                  = WR_LINEBATCH   - batch lines per page             batlin
c                  = WR_COMMASEP    - 1 for comma separated output     CommaSep
c                  = WR_CHARITEM    - characters per output item       chrper
c                  = WR_CHARDECIMAL - characters past decimal          chrdec
c                  = WR_CHARINTEGER - characters in leading integer    chrint
c                  = WR_CHARTYPE    -                                  chrtyp
c                        wrinqr = 1 - using E format in output
c                               = 2 - using F format in output
c                               = 3 - using G format in output
c                  = WR_SUPTITLE    - tlabel supress key               keyhed
c                  = WR_SUPSUBTITLE - subtitle supress key             keytit
c                  = WR_SUPLSITER   - ls,iter id supress key           keyid
c                  = WR_NOTELINE    - note line supress key            keynot
c                  = WR_SUPCOLHEADER - column header supress key       keylab
c                  = WR_SUPCOLMAX   - column maximum supress key       keysum
c                  = WR_LISTOPT     - ListOpt from /output command     ListOpt

c  output arguments:
c     wrinqr   (int,func,out)      - the value corresponding to key


4.2.7. Subroutine erinqr (Obtaining Information from the Errors Common)

*deck,erinqr
      function erinqr (key)
c *** primary function:    obtain information from errors common
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c  input arguments:
c     key      (int,sc,in)       - item to be returned
c                                  1=keyerr, 2=errfil,    3=numnot, 4=numwrn,
c                                  5=numerr, 6=numfat,    7=maxmsg, 8=lvlerr,
c                                  9=mxpcmd, 10=nercmd,  11=nertim,12=nomore,
c                                  13=eropen,14=ikserr,  15=kystat,16=mxr4r5,
c                                  17=mshkey,            19=opterr,20=flowrn,
c                                            22=noreport,23=pdserr,24=mxpcmdw
c                                  25=kystop,26=icloads, 27=ifkey,
c                                  28=intrupt
c
c ---- below definitions copied from errcom 7/92 for user information
c
c                            *** key number= ..........................
c                    (see ansysdef for parameter definitions)          |
c                                                                      \/
c
co keyerr - master error flag                                    (ER_ERRORFLAG)
co errfil - errors file unit number                              (ER_ERRORFILE)
co numnot - total number of notes displayed                      (ER_NUMNOTE)
co numwrn - total number of warnings displayed                   (ER_NUMWARNING)
co numerr - total number of errors displayed                     (ER_NUMERROR)
co numfat - total number of fatals displayed                     (ER_NUMFATAL)
co maxmsg - max allowed number of displayed messages before abort(ER_MAXMESSAGE)
co lvlerr - used basicly in solution (from cnvr command.)        (ER_ERRORLEVEL)
co           -1=do not set keyerr for notes/errors/warnings.
co           -2=same as -1 but do not display message either.
co mxpcmd - maximum number of messages allowed per command       (ER_MAXCOMMAND)
co nercmd - number of messages displayed for any one command     (ER_NUMCOMMAND)
co nertim - key as to how message cleared from u/i pop-up        (ER_UICLEAR)
co          (as per rsg/pft 5/1/92 - only for "info" calls
co           -1=message is timed before removal
co            0=message needs pick or keyboard before removal
co            1=message stays up untill replaced by another message
co nomore   display any more messages                            (ER_NOMOREMSG)
co           0=display messages
co           1=display discontinue message and stop displaying
co eropen - 0=errors file is closed                              (ER_FILEOPEN)
co          1=errors file is opened
co ikserr - 0=if interactive do not set keyerr                   (ER_INTERERROR)
c         - 1=if interactive set keyerr (used by mesher and tessalation)
co kystat - flag to bypass keyopt tests in the elcxx routines    (ER_KEYOPTTEST)
c           associated with status/panel info  inquiries.
c            0=do not bypass keyopt tests
c            1=perform all keyopt tests
c           also flag to bypass setting of _STATUS upon resume
co mxr4r5 - mixed rev4-rev5 input logic (*do,*if,*go,*if-go)     (ER_MIXEDREV)
c            (used in chkmix called from rdmac)
c            1=rev5 found (*do,*fi-then-*endif)
c            2=rev4 found (*go,:xxx,*if,....,:xxx)
c            3=warning printed. do not issue any more.
co mshkey - cpu intensive meshing etc. this will cause           (ER_MESHING)
c           "nertim (11)" to be set to -1 for "notes", 1 for "warnings",
c           and 0 for "errors". checking of this key is done in "anserr".
c            0=not meshing or cpu intensive
c            1=yes, meshing or cpu intensive
co syerro - systop error code. read by anserr if set.            (18)
co opterr - 0=no error in main ansys during opt looping          (ER_OPTLOOPING)
c           1=an error has happened in main ansys during opt looping
co flowrn - flag used by "floqa" as to list floqa.ans            (20)
c           0=list "floqa.ans"
c           1="floqa.ans" has been listed. do not list again.
co noreport- used in GUI for turning off errors due to strsub calls (22)
c           0=process errors as usual
c           1=do NOT report errors
co pdserr - 0=no error in main ansys during pds looping          (ER_PDSLOOPING)
c           1=an error has happened in main ansys during pds looping
co mxpcmdw- number of messages written to file.err for any one   (24)
co          command
c           0=write all errors to file.err
c           1=only write displayed errors to file.err
co icloads - key to forbid the iclist command from listing solution    (26)
c            data instead of the input data.
c           0=iclist is OK
c           1=do not permit iclist
co ifkey   - key on whether or not to abort during /input on error     (27)
c           0=do not abort
c           1=abort
co intrupt - interrupt button, so executable returns no error    (ER_INTERRUPT)
c
co mwwrnkey- key to switch off display of warnings generated           (29)
c            in other worlds
c             0  = show warnings (default)
c            -1 = do not show warnings
co espare - spare integer variables
c
c  --- end of information from errcom
c
c  output arguments:
c     erinqr   (int,sc,out)      - value corresponding to key
c

4.2.8. Subroutine erhandler (Displaying Program Errors)

*deck,erhandler
      subroutine erhandler  (filein,msgid,msglvl,lngstrng,dperr,cherr)

c *** primary function:    Display ANSYS error messages

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

c  input arguments:
c
c               In order to make life for vismg easier,
c               do NOT use variables for the first four arguments
c
c     filein   (ch*40,sc,in)     - Filename used for character portion of
c                                  message ID (this is the file name of the
c                                  file which contains the source for this
c                                  routine)
c
c                                  if 'ErrorMessageProbe', then error was
c                                    generated on another processor (distributed
c                                    ANSYS). In that case, dperr contains the
c                                    message already made ASCII and expanded
c
c     msgid    (int,sc,in)       - Numeric portion of the message ID
c                                  1 - 9999, unique for each erhandler
c                                  call in the FILE.  Recommend using
c                                  a sequence, similar to format conventions,
c                                  i.e., 5000, 5010, 5020
c                                  if filein='ErrorMessageProbe', this is the 
c                                    CPU # that originally generated the error
c     msglvl   (int,sc,in)       - level of error (same as lngerr)
c                                  0=no label (used for u/i pop-ups)
c                                 -1=no label (used for u/i pop-ups) timed
c                                    as a note message
c                                  1=note, 2=warning, 3=error, 4=fatal
c                                                    -3=error w/tech supp note
c                                                    -4=fatal w/tech supp note
c                                     (see lngerr.F for text of tech supp note)
c     lngstrng (ch*(*),sc,in)    - error message to display. use keywords
c                                  of %i %g %c %/ for formating (same as
c                                  lngerr)
c     dperr    (dp,ar(*),in)     - vector of data to display. contains both
c                                  integer and double precision data.
c                                  (same as lngerr)
c                                    if filein='ErrorMessageProbe', dperr
c                                    contains the unpacked message and lngstrng
c                                    and cherr are ignored
c     cherr    (ch*(*),ar(*),in) - vector of character data to display
c                                  max length of character data is 32
c                                  characters


4.2.9. Subroutine intrp (Doing Single Interpolation)

*deck,intrp
      subroutine intrp (klog,kppx,kstpz,xval,ax,ay,yval,nmax,kyoff)
c *** primary function: **** subroutine for single interpolation ****
c                       (if double interpolation is needed, see intrpt)
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c     typ=int,dp,log,chr,dcp   siz=sc,ar(n),func    intent=in,out,inout
c
c  input arguments:
c  variable (typ,siz,intent)      description
c     klog      (int,sc,in)       - interpolation type
c                                   = 0 - use linear interpolation
c                                   = 1 - use log-log interpolation
c                                     -- note:  there is no option yet for 
c                                               lin-log or log-lin
c     kppx      (int,sc,in)       - X value end of table signal
c                                   = 0 - a repeated x-value will signal the end
c                                         of the table
c                                   = 1 - a repeated x-value will not signal the
c                                         end of the table
c                                         (only known use = c evaluation)
c     kstpz     (int,sc,in)       - Y value end of table signal
c                                   = 0 - a yval of zero will not signal the end
c                                         of the table (e.g. stress fitting)
c                                   = 1 - a yval of zero will signal the end of
c                                         the table (in general, material 
c                                         properties (exception: alpx))
c
c                         NOTE: the end of the table will be signaled thru 
c                               either of the above conditions, or more 
c                               commonly, that nmax values have been processed,
c                               or that the present x table entry is less than 
c                               the previous one (ax(i) .lt. ax(i-1)).  
c                               evaluations done after the end of the table are
c                               evaluated as if they were at the end of the 
c                               table. similarly, evaluations done before the 
c                               beginning of the table are done as if they were
c                               done at the beginning of the table.
c
c     xval     (dp,sc,in)         - value of x with which to go into the table
c     ax       (dp,ar(*),in)      - table of x values, in ascending order
c     ay       (dp,ar(*),in)      - table of y values
c     nmax     (int,sc,in)        - maximum table size allowed
c
c  output arguments:
c     yval     (dp,sc,out)        - value of y which comes back from the table
c     kyoff    (int,sc,out)       - xval status flag 
c                                   = 0 - xval in x range
c                                   = 1 - xval less than minimum x
c                                   = 2 - xval greater than maximum x
c

4.2.10. Subroutine tranx3 (Processing Geometry for 3D Line Elements)

*deck,tranx3
      subroutine tranx3 (nnod,xyz,nx,tr)
c *** primary function: geometric processor for 3-d line elements
c                       with or without a 3rd node
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c  input arguments:
c     nnod     (int,sc,in)       - number of nodes (2 or 3)
c     xyz      (dp,ar(nx,*),in)  - coordinates (x,y,z down)
c     nx       (int,sc,in)       - row dimension of xyz array
c
c  output arguments:
c     tr       (dp,ar(3,3),in)   - transformation matrix
c

4.2.11. Subroutine systop (Stopping a Program Run)

*deck,systop
      subroutine systop (icode)
c *** primary function:    stop an ansys run
c *** secondary functions: pass an error code to the system
c
c *** Notice - This file contains ANSYS Confidential information ***
c
c  input arguments:
c     icode    (int,sc,in)       - stop error code (0<icode<127)
c                                   0 - normal exit
c                                   1 - indicated error
c                                   2 - unused
c                                   3 - unused
c                                   4 - unused
c                                   5 - command line argument error
c                                   6 - unused
c                                   7 - licensing failure
c                                   8 - end-of-run
c                                   9 - unused
c                                  10 - unused
c                                  11 - error in user routine
c                                  12 - macro stop command
c                                  13 - unused
c                                  14 - untrapped xox error
c                                  15 - anserr fatal error
c                                  16 - possible full disk
c                                  17 - possible corrupted or missing file
c                                  18 - Error in VM routines (corrupt db?)
c                                  19 - unused
c                                  20 - unused
c                                  21 - unauthorized code section entered
c                                  22 - unused
c                                  23 - unused
c                                  24 - unused
c                                  25 - unable to open x11 server
c                                  26 - unused
c                                  27 - unused
c                                  28 - unused
c                                  29 - unused
c                                  30 - quit signal
c                                  31 - failure to get signal in max time (syhold)
c                                  32 - unused
c                                  33 - crash signal (bus error, seg vi, FPE, etc.)
c                                  34 - unused
c                                  35 - fatal error on another MPI process (DMP)
c                                 100 - job already running (.lock file error)
c
c  output arguments:  none