/*setinp sets input lines to feed into cloudy in optimization runs */ #include "cddefines.h" #include "input.h" #include "varypar.h" #include "setinp.h" void setinp(int *lgLimOK) { long int i, np; # ifdef DEBUG_FUN fputs( "<+>setinp()\n", debug_fp ); # endif /* set up chCardSav(n) array like Gary's input file, using input * variable parameters p(i), and format information held in * the common block /parmv/. Results written to common /kardsv/. */ fprintf( ioQQQ, " **************************************************\n" ); /* will be set false if limit to a variable exceeded * this is returned to calling code as problem indication*/ *lgLimOK = TRUE; /* echo the variable input lines for this run */ for( i=0; i < VaryPar.nvary; i++ ) { np = VaryPar.nvfpnt[i]; /* write formatted to the character string chCardSav(np), * using the format held in chVarFmt(np) */ VaryPar.vpused[i] = (float)MIN2(VaryPar.vparm[0][i],VaryPar.varang[i][1]); VaryPar.vpused[i] = (float)MAX2(VaryPar.vpused[i],VaryPar.varang[i][0]); /* now generate the actual command with parameter, * there will be from 1 to 3 numbers on the line */ if( VaryPar.nvarxt[i] == 1 ) { /* case with 1 parameter */ sprintf( input.chCardSav[np] , chVaryPar.chVarFmt[i], VaryPar.vparm[0][i] ); } else if( VaryPar.nvarxt[i] == 2 ) { /* case with 1 parameter */ sprintf( input.chCardSav[np] , chVaryPar.chVarFmt[i], VaryPar.vparm[0][i], VaryPar.vparm[1][i]); } else if( VaryPar.nvarxt[i] == 3 ) { /* case with 1 parameter */ sprintf( input.chCardSav[np] , chVaryPar.chVarFmt[i], VaryPar.vparm[0][i], VaryPar.vparm[1][i] , VaryPar.vparm[2][i] ); } else { fprintf(ioQQQ,"the number of variable options on this line makes no sense to me\n"); puts( "[Stop in setinp]" ); exit(1); } fprintf( ioQQQ, " %s\n", input.chCardSav[np] ); if( VaryPar.vpused[i] == VaryPar.varang[i][1] || VaryPar.vpused[i] == VaryPar.varang[i][0] ) { *lgLimOK = FALSE; fprintf( ioQQQ, " Limit to variable exceeded.\n" ); } } # ifdef DEBUG_FUN fputs( " <->setinp()\n", debug_fp ); # endif return; }