[963] | 1 | function md=postqmu(md)
|
---|
| 2 |
|
---|
| 3 | %INPUT function md=postqmu(md,qmufile,qmudir)
|
---|
| 4 | %Deal with dakota output results in files.
|
---|
| 5 |
|
---|
| 6 | global ISSM_DIR;
|
---|
| 7 |
|
---|
| 8 | % check to see if dakota returned errors in the err file
|
---|
| 9 | qmuerrfile=[md.name '.qmu.err'];
|
---|
| 10 |
|
---|
| 11 | if exist(qmuerrfile,'file')
|
---|
| 12 | fide=fopen(qmuerrfile,'r');
|
---|
| 13 | fline=fgetl(fide);
|
---|
| 14 | if ischar(fline)
|
---|
| 15 | while ischar(fline)
|
---|
| 16 | disp(sprintf('%s',fline));
|
---|
| 17 | fline=fgetl(fide);
|
---|
| 18 | end
|
---|
| 19 | status=fclose(fide);
|
---|
| 20 | cd ../
|
---|
| 21 | error(['Dakota returned error in ''' qmuerrfile ' file. ''' qmudir ''' directory retained.'])
|
---|
| 22 | end
|
---|
| 23 | status=fclose(fide);
|
---|
| 24 | else
|
---|
| 25 | cd ../
|
---|
| 26 | error(['Dakota did not generate ''' qmuerrfile ' file. ''' qmudir ''' directory retained.'])
|
---|
| 27 | end
|
---|
| 28 |
|
---|
| 29 | %parse inputs and results from dakota
|
---|
| 30 | qmuinfile=[md.name '.qmu.in'];
|
---|
| 31 | qmuoutfile=[md.name '.qmu.out'];
|
---|
| 32 |
|
---|
[2087] | 33 | %[method,dvar,dresp_in]=dakota_in_parse(qmuinfile);
|
---|
| 34 | %dakotaresults.method =method;
|
---|
| 35 | %dakotaresults.dvar =dvar;
|
---|
| 36 | %dakotaresults.dresp_in =dresp_in;
|
---|
[963] | 37 |
|
---|
| 38 | [method,dresp_out,scm,pcm,srcm,prcm]=dakota_out_parse(qmuoutfile);
|
---|
[2051] | 39 | dakotaresults.dresp_out=dresp_out;
|
---|
| 40 | dakotaresults.scm =scm;
|
---|
| 41 | dakotaresults.pcm =pcm;
|
---|
| 42 | dakotaresults.srcm =srcm;
|
---|
| 43 | dakotaresults.prcm =prcm;
|
---|
[963] | 44 |
|
---|
| 45 | if exist('dakota_tabular.dat','file')
|
---|
| 46 | [method,dresp_dat ]=dakota_out_parse('dakota_tabular.dat');
|
---|
[2051] | 47 | dakotaresults.dresp_dat=dresp_dat;
|
---|
[963] | 48 | end
|
---|
| 49 |
|
---|
[5215] | 50 | %scale sensitivities by partitioned average of the input parameter
|
---|
| 51 | disp('Do this for god''s akes!');
|
---|
| 52 |
|
---|
| 53 |
|
---|
[2051] | 54 | %put dakotaresults in their right location.
|
---|
[3038] | 55 | md.results.dakota=dakotaresults;
|
---|
[2051] | 56 |
|
---|
[963] | 57 | %save input and output files into model
|
---|
| 58 | %md.dakotain =readfile([qmufile '.in']);
|
---|
[2087] | 59 | %md.dakotaout=readfile(qmuoutfile);
|
---|
[963] | 60 | %if exist('dakota_tabular.dat','file')
|
---|
| 61 | % md.dakotadat=readfile('dakota_tabular.dat');
|
---|
| 62 | %end
|
---|
| 63 |
|
---|
| 64 | % move all the individual function evalutations into zip files
|
---|
| 65 | if ~md.qmu_analysis,
|
---|
| 66 | system('zip -mq params.in.zip params.in.[1-9]*');
|
---|
| 67 | system('zip -mq results.out.zip results.out.[1-9]*');
|
---|
| 68 | system('zip -mq matlab.out.zip matlab*.out.[1-9]*');
|
---|
| 69 | end
|
---|