1*   _______________________________________________________________________
2*
3*   DAKOTA: Design Analysis Kit for Optimization and Terascale Applications
4*   Copyright 2014-2020 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
5*   This software is distributed under the GNU Lesser General Public License.
6*   For more information, see the README file in the top Dakota directory.
7*   _______________________________________________________________________
8*
9      program container
10c*****************************************************************
11c*****************************************************************
12      integer num_fns,num_vars,req(1:2)
13      double precision fval(1:2),D,H
14      character*80 infile,outfile,instr
15      character*25 valtag(1:2)
16      double precision PI /3.14159265358979/
17
18c     get the input and output file names from the command line
19c     using the fortran 77 library routine getarg
20      call getarg(1,infile)
21      call getarg(2,outfile)
22
23c*************************************
24c     read the input data from DAKOTA
25c*************************************
26      open(11,FILE=infile,STATUS='OLD')
27
28c     get the number of variables
29      read(11,*)num_vars,instr
30
31c     get the values of the variables and the associated tag names
32      read(11,*)H,instr
33      read(11,*)D,instr
34
35c     get the number of functions
36      read(11,*)num_fns,instr
37
38c     get the evaluation type request for the associated function number
39      do 10 i=1,num_fns
40        read(11,*)req(i),instr
41 10   continue
42
43      close(11)
44
45
46c**********************************************************
47c     compute the objective function and constraint values
48c**********************************************************
49      if(req(1).eq.1) fval(1)=0.644*PI*D**2+1.05*PI*D*H
50      if(req(2).eq.1) fval(2)=0.25*PI*H*D**2-63.525
51
52c******************************************
53c     write the response output for DAKOTA
54c******************************************
55      valtag(1)='area'
56      valtag(2)='volume_constraint'
57
58      open(11,FILE=outfile,STATUS='UNKNOWN')
59
60      do 20 i=1,num_fns
61        if(req(i).eq.1) then
62          write(11,'(E22.15,1X,A)'),fval(i),valtag(i)
63        endif
64 20   continue
65
66      close(11)
67
68      end
69
70
71