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,'transient') ),
|
---|
46 | error(['process_qmu_options error message: analysis_type ' analysis_type ' not supported yet!']);
|
---|
47 | end
|
---|
48 |
|
---|
49 | % process qmu arguments
|
---|
50 |
|
---|
51 | %first, the defaults
|
---|
52 | qmudir ='qmu';% qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
|
---|
53 | qmufile='qmu';
|
---|
54 | ivar =1;
|
---|
55 | iresp =1;
|
---|
56 | imethod=1;
|
---|
57 | iparams=1;
|
---|
58 | runmpi =false;
|
---|
59 |
|
---|
60 | for i=1:size(options,1),
|
---|
61 | switch options{i,1},
|
---|
62 | case 'qmudir'
|
---|
63 | qmudir=options{i,2};
|
---|
64 | case 'qmufile'
|
---|
65 | qmufile=options{i,2};
|
---|
66 | case 'ivar'
|
---|
67 | ivar=options{i,2};
|
---|
68 | case 'iresp'
|
---|
69 | iresp=options{i,2};
|
---|
70 | case 'imethod'
|
---|
71 | imethod=options{i,2};
|
---|
72 | case 'iparams'
|
---|
73 | iparams=options{i,2};
|
---|
74 | case 'overwrite'
|
---|
75 | outoptions.overwrite=options{i,2};
|
---|
76 | case 'keep'
|
---|
77 | outoptions.keep=options{i,2};
|
---|
78 | case 'outfiles'
|
---|
79 | outoptions.outfiles=options{i,2};
|
---|
80 | case 'rstfile'
|
---|
81 | outoptions.rstfile=options{i,2};
|
---|
82 | case 'rundakota'
|
---|
83 | outoptions.rundakota=options{i,2};
|
---|
84 | case 'runmpi'
|
---|
85 | runmpi=options{i,2};
|
---|
86 | otherwise
|
---|
87 | %nothing
|
---|
88 | end
|
---|
89 | end
|
---|
90 |
|
---|
91 | %setup final options structure
|
---|
92 | outoptions.analysis_type=analysis_type;
|
---|
93 | outoptions.package=package;
|
---|
94 | outoptions.qmudir=qmudir;
|
---|
95 | outoptions.qmufile=qmufile;
|
---|
96 | outoptions.ivar=ivar;
|
---|
97 | outoptions.iresp=iresp;
|
---|
98 | outoptions.imethod=imethod;
|
---|
99 | outoptions.iparams=iparams;
|
---|
100 | outoptions.runmpi=runmpi;
|
---|