| 1 | function outoptions=process_qmu_options(options)
|
|---|
| 2 | %PROCESS_QMU_OPTIONS - set up default options for qmu phase
|
|---|
| 3 | %
|
|---|
| 4 | % Usage:
|
|---|
| 5 | % options=process_qmu_options(options)
|
|---|
| 6 | %
|
|---|
| 7 | % See also: QMU,RECOVER_QMU_OPTIONS
|
|---|
| 8 |
|
|---|
| 9 | %analysis_type: check on this option, error out otherwise
|
|---|
| 10 | found=0;
|
|---|
| 11 | for i=1:size(options,1),
|
|---|
| 12 | if strcmpi(options{i,1},'analysis_type'),
|
|---|
| 13 | analysis_type=options{i,2};
|
|---|
| 14 | found=1;
|
|---|
| 15 | end
|
|---|
| 16 | end
|
|---|
| 17 | if ~found,
|
|---|
| 18 | error('recover_qmu_options error message: no ''analysis_type'' was provided');
|
|---|
| 19 | end
|
|---|
| 20 |
|
|---|
| 21 | %package: is there one? default to ''JPL''
|
|---|
| 22 | found=0;
|
|---|
| 23 | for i=1:size(options,1),
|
|---|
| 24 | if strcmpi(options{i,1},'package'),
|
|---|
| 25 | package=options{i,2};
|
|---|
| 26 | found=1;
|
|---|
| 27 | end
|
|---|
| 28 | end
|
|---|
| 29 | if ~found,
|
|---|
| 30 | disp('recover_qmu_options info message: no ''package'' was provided, defaulting to ''JPL''');
|
|---|
| 31 | options(end+1,:)={'package' 'JPL'};
|
|---|
| 32 | package='JPL';
|
|---|
| 33 | end
|
|---|
| 34 |
|
|---|
| 35 | if ~ischar(package),
|
|---|
| 36 | error(['process_qmu_options error message: package ' package ' not supported yet']);
|
|---|
| 37 | end
|
|---|
| 38 |
|
|---|
| 39 | %check solution type is supported
|
|---|
| 40 | if ~(strcmpi(analysis_type,'control') | ...
|
|---|
| 41 | strcmpi(analysis_type,'diagnostic') | ...
|
|---|
| 42 | strcmpi(analysis_type,'prognostic') | ...
|
|---|
| 43 | strcmpi(analysis_type,'thermal') | ...
|
|---|
| 44 | strcmpi(analysis_type,'parameters') | ...
|
|---|
| 45 | strcmpi(analysis_type,'mesh') | ...
|
|---|
| 46 | strcmpi(analysis_type,'mesh2grid') | ...
|
|---|
| 47 | strcmpi(analysis_type,'transient') ),
|
|---|
| 48 | error(['process_qmu_options error message: analysis_type ' analysis_type ' not supported yet!']);
|
|---|
| 49 | end
|
|---|
| 50 |
|
|---|
| 51 | % process qmu arguments
|
|---|
| 52 |
|
|---|
| 53 | %first, the defaults
|
|---|
| 54 | qmudir ='qmu';% qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
|
|---|
| 55 | qmufile='qmu';
|
|---|
| 56 | ivar =1;
|
|---|
| 57 | iresp =1;
|
|---|
| 58 | imethod=1;
|
|---|
| 59 | iparams=1;
|
|---|
| 60 | runmpi =false;
|
|---|
| 61 |
|
|---|
| 62 | for i=1:size(options,1),
|
|---|
| 63 | switch options{i,1},
|
|---|
| 64 | case 'qmudir'
|
|---|
| 65 | qmudir=options{i,2};
|
|---|
| 66 | case 'qmufile'
|
|---|
| 67 | qmufile=options{i,2};
|
|---|
| 68 | case 'ivar'
|
|---|
| 69 | ivar=options{i,2};
|
|---|
| 70 | case 'iresp'
|
|---|
| 71 | iresp=options{i,2};
|
|---|
| 72 | case 'imethod'
|
|---|
| 73 | imethod=options{i,2};
|
|---|
| 74 | case 'iparams'
|
|---|
| 75 | iparams=options{i,2};
|
|---|
| 76 | case 'overwrite'
|
|---|
| 77 | outoptions.overwrite=options{i,2};
|
|---|
| 78 | case 'keep'
|
|---|
| 79 | outoptions.keep=options{i,2};
|
|---|
| 80 | case 'outfiles'
|
|---|
| 81 | outoptions.outfiles=options{i,2};
|
|---|
| 82 | case 'rstfile'
|
|---|
| 83 | outoptions.rstfile=options{i,2};
|
|---|
| 84 | case 'rundakota'
|
|---|
| 85 | outoptions.rundakota=options{i,2};
|
|---|
| 86 | case 'runmpi'
|
|---|
| 87 | runmpi=options{i,2};
|
|---|
| 88 | otherwise
|
|---|
| 89 | %nothing
|
|---|
| 90 | end
|
|---|
| 91 | end
|
|---|
| 92 |
|
|---|
| 93 | %setup final options structure
|
|---|
| 94 | outoptions.analysis_type=analysis_type;
|
|---|
| 95 | outoptions.package=package;
|
|---|
| 96 | outoptions.qmudir=qmudir;
|
|---|
| 97 | outoptions.qmufile=qmufile;
|
|---|
| 98 | outoptions.ivar=ivar;
|
|---|
| 99 | outoptions.iresp=iresp;
|
|---|
| 100 | outoptions.imethod=imethod;
|
|---|
| 101 | outoptions.iparams=iparams;
|
|---|
| 102 | outoptions.runmpi=runmpi;
|
|---|
| 103 |
|
|---|