*comdeck,cmopt                                                          jss tpp

c         *** Copyright ANSYS.  All Rights Reserved.
c         *** ansys, inc.

c ----------------------------------------------------------------------
c --- programmers take note:
c ---    the file ansysdef.inc must preceed this include file
c ----------------------------------------------------------------------

      integer  MAXOPT,MAXSV,MAXDV,MAXTOT
      parameter  (MAXOPT=130,MAXSV=100,MAXDV=60)
      parameter  (MAXTOT = MAXSV + MAXDV + 1)

c     MAXOPT    - maximum number of optimization design sets active
c                    (must match mxopt in cmoptp)
c     MAXSV     - maximum number of state variables
c     MAXDV     - maximum number of design variables
c     MAXTOT    - total of MAXSV + MAXDV + 1

 
c     !!! sometime in the future remove:
c         nfiout

      integer  nsqv,iobjxp,isvxp,noqv,ntsv,nrandm,nobj,ntdv,koprds,
     x lopt,lopt1b,nstpsd,maxusr,loopct,kconv,fenew,numopt,feold,
     x nfiout,inopt,idvlim,isvlim,ninfes,kfit1,kfit2,kwght,koppr,kopusr,
     x ntmax,ntfdf,ntline,nbest1,nbest0,nalpha,mxpmrs,kdbug,nls,kpopt,
     x lopfst,maxrnd,maxfst,maxsub,maxflp,maxinf,maxfac,nmswps,swppnt,
     x nfeas,grdpnt,looptl,facexp,ilamda,icongr,swptyp,grdtyp,
     x bestsave,bestset,fstpnt,fstrst,optmsg,rdfrom,dvloop,svparm,nsets,
     x setnum,grdfst,grdlst,swpfst,swplst,facfst,faclst,fstfst,
     x iopexe,savoutunit,parallelrun,bad_sol,parmmax,pdOptVar,iopspr

      double precision
     x dv,objfnc,svfnc,optol,oplim,opdobj,sq,stpmax,scal,seed,
     x userp,pfact,opus,delgr,alphaq,psobjq,psobj0,psobj1,sizeq,sizerd,
     x dfmag,gradq,delfst,alplim,deldir,refobj,opdpf,factq,opam,
     x opTwait, opTabort, dopspr

      character*4  actopt


      common /cmopt/ dv(MAXDV),objfnc(MAXDV),svfnc(MAXSV,MAXOPT),
     x optol(MAXTOT),oplim(2,MAXTOT),
     x opdobj(MAXDV),sq(MAXDV),stpmax,scal,seed,userp(5),pfact,opus(8),
     x delgr,alphaq(4),psobjq(4),psobj0,psobj1,sizeq,sizerd,dfmag,
     x gradq(MAXDV),delfst,alplim,deldir,refobj,opdpf(MAXDV),factq,
     x opam(3), opTwait, opTabort,dopspr(94),
     x nsqv(MAXSV),iobjxp(MAXOPT),isvxp(MAXSV,MAXOPT),noqv,ntsv,
     x nrandm,nobj,ntdv,koprds,lopt,lopt1b,nstpsd,maxusr,loopct,
     x kconv,fenew,numopt,feold,nfiout,inopt,idvlim(MAXDV),
     x isvlim(MAXSV),ninfes,kfit1,kfit2,kwght,koppr,kopusr,ntmax,ntfdf,
     x ntline,nbest1,nbest0,nalpha,mxpmrs,kdbug(2),nls,kpopt,lopfst,
     x maxrnd,maxfst,maxsub,maxflp,maxinf,maxfac,nmswps,swppnt,nfeas,
     x grdpnt,looptl,facexp,ilamda,icongr,swptyp,grdtyp,
     x bestsave,bestset,fstpnt,fstrst,optmsg,rdfrom,dvloop,svparm,nsets,
     x setnum(MAXOPT),grdfst,grdlst,swpfst,swplst,facfst,faclst,fstfst,
     x iopexe(10),savoutunit,parallelrun,bad_sol,parmmax,pdOptVar,
     x iopspr(86)

      common /cmoptl/ actopt

c     -------- double precision
c     dv        - design vector
c     objfnc    -
c     svfnc     -
c     optol(i)  - tolerance of ith optimization parameter [opvar]
c                   (i = 1 to 160)
c                   the state variables are stored first, and then the
c                   design variables
c     oplim(j,i)- lower limit (j=1) and upper limit (j=2) of ith
c                 optimization parameter [opvar]  (i = 1 to 160)
c                 the state variables are stored first, then the
c                 design variables, and then the objective function
c     opdobj    - the gradient of the objective function (1st order opt)
c     sq        -
c     stpmax    -
c     scal      -
c     seed      -
c     userp     -
c     pfact     -
c     opus(i)   - user-specified, double precision parameters on the
c                   opuser command (i=1,8)
c     delgr     - forward difference for gradient opt tool (delta on opgrad)
c     gradq     -
c     alphaq    - line step parameters (history of) per line search step
c     psobjq    - unconstrained obj values along line search path
c     psobj1    - best unconstrianed obj value this line search
c     psobj0    - best unconstrianed obj value this 1st order evaluation
c     sizeq     - line search step size (undoc)
c     sizerd    - step size (undoc) for random walk
c     dfmag     -
c     gradq     - the gradient of the unconstrained objective fnc (1st order)
c     delfst    - forward difference for first order opt (delta on opfrst)
c                 unconstrained objective function in 1st order opt
c     alplim    - limit line search parameter (marker to edge of side constraint
c     deldir    - direction indicator for 1st order gradient (per dv)
c     refobj    - ref objective function for 1st order opt
c     opdpf     - the gradient of the penalty fuction terms (1st order opt)
c     factq     - factor applied to penalty functions (1st order opt only)
c     opam      - random settings (related to routine vrand)
c     opTwait   - Twait for MultiRun option
c     opTabort  - Tabort for MultiRun option
c     dopspr    - not used (spares)
c 
c     ------------- integer
c     nsqv      -
c     iobjxp    -
c     isvxp     -
c     noqv      -
c     ntsv      - total number of state variables
c     nrandm    -
c     nobj      - flag for objective function defined (0=no, 1=yes)
c     ntdv      - total number of design variables
c     koprds    -
c     lopt      - basic iteration counter (for all methods)
c     lopt1b    - saved value of lopt after each execution (opexe)
c     nstpsd    - key that indicates 1 extra iteration was attempted
c                 for 1st order opt if steepest descent was not used last
c     maxusr    - user-specified, maximum allowed optimization
c                   iterations on the opuser command
c     loopct    -
c     kconv     - convergence flag (kconv = 0 indicates convergence)
c     fenew     - key to indicate feasibility of current design (1st only)
c     numopt    - total number of design sets
c     feold     - key to indicate feasibility of current design (1st only)
c     nfiout    -
c     inopt     -
c     idvlim    -
c     isvlim    -
c     ninfes    - counter for sequential infeasible solutions (subp)
c     kfit21    -
c     kfit2     -
c     kwght     -
c     koppr     -
c     kopusr    - flag choosing optimizer (0 = ANSYS, 1 = user-supplied opt)
c                  (issuing the command optype, user sets kopusr = 1)
c     ntmax     - max number of parameters that have ever been defined
c     ntfdf     - finite difference counter for 1st order opt
c     ntline    - line search counter for 1st order opt
c     nbest1    - best design set this line search
c     nbest0    - best design set this 1st order evaluation
c     nalpha    - location of current line step in alphaq
c     mxpmrs    - used for restart purposed (to reset mxparm in parmcm)
c     kdbug     -
c     nls       -
c     kpopt     -
c     kiofst    -
c     maxrnd    - maximum allowed number of iterations for random opt
c     maxfst    - maximum allowed number of iterations for  1st order opt
c     maxsub    - maximum allowed number of iterations for  sub. prom .approx.
c     maxflp    - spare
c     maxinf    - maximum allowed seq. infeasible solutions (subp)
c     maxfac    - maximum allowed number of loops for factorial opt analysis
c     nmswps    - the number of sweep evaluations to be made in each dv dir.
c     swppnt    - the reference design set number for sweep evaluation
c     nfeas     - desired number of feasible solutions (rand)
c     grdpnt    - the reference design set number for gradient evaluation
c     looptl    - total number of opt loops executed (all methods)
c     icongr    - key for selection of conjugate direction method (undoc)
c     swptyp    - the reference design set type (best,last, or number) for sweep
c     grdtyp    - the reference design set type (best,last, or number) for grad
c     bestsave  - key to save the best database and results file
c     bestset   - the current best optimization set number
c     fstpnt    - the reference design set number for 1st order optimization
c     fstrst    - Initialized to zero and referenced in opfrex (unused) 
c     optmsg    - saved ui pop level so opt can avoid notes and warnings
c     rdfrom    - indicates where to begin read of analysis file
c                                                (0=top, 1=/prep7)
c     dvloop    - indicates how to treat dv on the loop file
c                                                (0=ignore, 1=process)
c     svparm    - indicates which type of parameters to save during looping
c     nsets     - current number of sets that were made 
c                                                    (highest design set number)
c     setnum    - unique set number assigned to every design set
c     grdfst    - first design set number in the range of gradient sets
c     grdlst    - last design set number in the range of gradient sets
c     swpfst    - first design set number in the range of sweep sets
c     swplst    - last design set number in the range of sweep sets
c     facfst    - first design set number in the range of factored sets
c     faclst    - last design set number in the range of factored sets
c     fstfst    - first design set number in the range of 1st order sets
c     iopexe    - executable keys (indicate which method/tool was run)
c     savoutunit- saved output unit number
c     parallelrun - 0, reloop in ANSYS for execution  1, spawn separate task(s)
c     bad_sol   - bad solution flag (used for line search )        
c     parmmax   - first dimension on optvar array
c     pdOptVar  - pointer to optvar array 
c                   optvar(i,j) - the ith parameter of the jth design set
c                   (i = 1 to maxpar, j = 1 to maxopt)
c                   the state variables are stored first, then the
c                   design variables, then the objective function,
c                   and then all remaining scalar parameter values
c     iopspr    - not used (spares)

c     -------- long integer
c     actopt    - active optimization method

