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 | %sub_analysis_type: check on it, not mandatory
|
---|
40 | found=0;
|
---|
41 | for i=1:size(options,1),
|
---|
42 | if strcmpi(options{i,1},'sub_analysis_type'),
|
---|
43 | sub_analysis_type=options{i,2};
|
---|
44 | found=1;
|
---|
45 | end
|
---|
46 | end
|
---|
47 | if ~found
|
---|
48 | if ~strcmpi(analysis_type,'thermal'),
|
---|
49 | sub_analysis_type='none';
|
---|
50 | else
|
---|
51 | disp('recover_qmu_options info message: no ''sub_analysis_type'' was provided, defaulting to ''steady''');
|
---|
52 | sub_analysis_type='steady';
|
---|
53 | end
|
---|
54 | end
|
---|
55 |
|
---|
56 | %check solution type is supported
|
---|
57 | if ~(strcmpi(analysis_type,'control') | ...
|
---|
58 | strcmpi(analysis_type,'diagnostic') | ...
|
---|
59 | strcmpi(analysis_type,'prognostic') | ...
|
---|
60 | strcmpi(analysis_type,'thermal') | ...
|
---|
61 | strcmpi(analysis_type,'parameters') | ...
|
---|
62 | strcmpi(analysis_type,'mesh') | ...
|
---|
63 | strcmpi(analysis_type,'mesh2grid') | ...
|
---|
64 | strcmpi(analysis_type,'transient') ),
|
---|
65 | error(['process_qmu_options error message: analysis_type ' analysis_type ' not supported yet!']);
|
---|
66 | end
|
---|
67 | if ~(strcmpi(sub_analysis_type,'none') | ...
|
---|
68 | strcmpi(sub_analysis_type,'steady') | ...
|
---|
69 | strcmpi(sub_analysis_type,'horiz') | ...
|
---|
70 | strcmpi(sub_analysis_type,'vert') | ...
|
---|
71 | strcmpi(sub_analysis_type,'') | ...
|
---|
72 | strcmpi(sub_analysis_type,'transient') ),
|
---|
73 | error(['process_qmu_options error message: sub_analysis_type ' sub_analysis_type ' not supported yet!']);
|
---|
74 | end
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 | % process qmu arguments
|
---|
79 |
|
---|
80 | %first, the defaults
|
---|
81 | qmudir ='qmu';% qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
|
---|
82 | qmufile='qmu';
|
---|
83 | ivar =1;
|
---|
84 | iresp =1;
|
---|
85 | imethod=1;
|
---|
86 | iparams=1;
|
---|
87 | runmpi =false;
|
---|
88 |
|
---|
89 | for i=1:size(options,1),
|
---|
90 | switch options{i,1},
|
---|
91 | case 'qmudir'
|
---|
92 | qmudir=options{i,2};
|
---|
93 | case 'qmufile'
|
---|
94 | qmufile=options{i,2};
|
---|
95 | case 'ivar'
|
---|
96 | ivar=options{i,2};
|
---|
97 | case 'iresp'
|
---|
98 | iresp=options{i,2};
|
---|
99 | case 'imethod'
|
---|
100 | imethod=options{i,2};
|
---|
101 | case 'iparams'
|
---|
102 | iparams=options{i,2};
|
---|
103 | case 'overwrite'
|
---|
104 | outoptions.overwrite=options{i,2};
|
---|
105 | case 'keep'
|
---|
106 | outoptions.keep=options{i,2};
|
---|
107 | case 'outfiles'
|
---|
108 | outoptions.outfiles=options{i,2};
|
---|
109 | case 'rstfile'
|
---|
110 | outoptions.rstfile=options{i,2};
|
---|
111 | case 'rundakota'
|
---|
112 | outoptions.rundakota=options{i,2};
|
---|
113 | case 'runmpi'
|
---|
114 | runmpi=options{i,2};
|
---|
115 | otherwise
|
---|
116 | %nothing
|
---|
117 | end
|
---|
118 | end
|
---|
119 |
|
---|
120 | %setup final options structure
|
---|
121 | outoptions.analysis_type=analysis_type;
|
---|
122 | outoptions.package=package;
|
---|
123 | outoptions.sub_analysis_type=sub_analysis_type;
|
---|
124 | outoptions.qmudir=qmudir;
|
---|
125 | outoptions.qmufile=qmufile;
|
---|
126 | outoptions.ivar=ivar;
|
---|
127 | outoptions.iresp=iresp;
|
---|
128 | outoptions.imethod=imethod;
|
---|
129 | outoptions.iparams=iparams;
|
---|
130 | outoptions.runmpi=runmpi;
|
---|
131 |
|
---|