0001
0002
0003
0004 if strcmp(action,'lukestart'),
0005
0006 timedep = 1 - lukeobj.timedep.value;
0007
0008 if curtime > 0 || timedep,
0009 mdce_mode = 0;
0010 else
0011 mdce_mode = lukeobj.dist.select.value - 1;
0012 end
0013
0014 remnum = lukeobj.remote.select.value - 1;
0015
0016 if remnum > 0,
0017 returnmode = lukeobj.timeout.value;
0018 else
0019 returnmode = 0;
0020 end
0021
0022 if curtime > 0
0023 transpmode = transpfastes{curtime};
0024 elseif strcmp(lukeobj.transp.modify.state,'on'),
0025 transpmode = transpfastes{1};
0026 else
0027 transpmode = true;
0028 end
0029
0030 dkepath = lukeschedulerparam(dkepath,mdce_mode,remnum,returnmode,transpmode,false);
0031
0032 opt.backup = 1;
0033
0034 if curtime > 0,
0035
0036 opt.save = 0;
0037 opt.proc = [];
0038
0039 lukestructs = struct;
0040
0041 lukestructs.simul.id = lukeobj.lukeid.string;
0042 if remnum == 0 && mdce_mode <= 3,
0043 lukestructs.simul.path = workdir;
0044 else
0045 lukestructs.simul.path = './';
0046 end
0047
0048 if isfield(equils{curtime},'fluct') && exist([lukestructs.simul.path,'backup_',lukestructs.simul.id,'.mat'],'file'),
0049
0050 lukeobj = iluke_info(lukeobj,'');
0051
0052 if iselect_jd({'No','Yes'},'Do you want to load backup file and continue simulation ? ',lukeobj.infopanel.handle,style,1) == 2,
0053
0054 opt.backup = -2;
0055
0056 end
0057
0058 lukeobj = iluke_info(lukeobj,'luke');drawnow;
0059
0060 end
0061
0062 lukestructs.opt = opt;
0063 lukestructs.dkedisplay = dkedisplay;
0064
0065 lukestructs.dkeparam = dkeparams{curtime};
0066 lukestructs.equil = equils{curtime};
0067 lukestructs.ohm = ohms{curtime};
0068 lukestructs.transpfaste = transpfastes{curtime};
0069 lukestructs.ripple = ripples{curtime};
0070 lukestructs.waves = wavess{curtime};
0071
0072 else
0073
0074 opt.save = 1;
0075 opt.proc = struct;
0076
0077 if any(status.output == 1),
0078
0079 lukeobj = iluke_info(lukeobj,'');
0080
0081 job_mask = iselect_jd({},'LUKE already run for some times. Select time indides to calculate : ',lukeobj.infopanel.handle,style.editselectstyle,find(status.output == 0),'edit');
0082
0083 lukeobj = iluke_info(lukeobj,'luke');drawnow;
0084
0085 else
0086 job_mask = find(status.output == 0);
0087 end
0088
0089 nt = length(job_mask);
0090
0091 lukestructs = cell(1,nt);
0092
0093 for it = 1:nt,
0094 lukestructs{it}.simul.id = make_luke_simulid_jd(equils{job_mask(it)},ohms{job_mask(it)},transpfastes{job_mask(it)},ripples{job_mask(it)},wavess{job_mask(it)});
0095 if remnum == 0 && mdce_mode <= 3,
0096 lukestructs{it}.simul.path = workdir;
0097 end
0098
0099 lukestructs{it}.opt = opt;
0100 lukestructs{it}.dkedisplay = dkedisplay;
0101
0102 lukestructs{it}.dkeparam = dkeparams{job_mask(it)};
0103 lukestructs{it}.equil = equils{job_mask(it)};
0104 lukestructs{it}.ohm = ohms{job_mask(it)};
0105 lukestructs{it}.transpfaste = transpfastes{job_mask(it)};
0106 lukestructs{it}.ripple = ripples{job_mask(it)};
0107 lukestructs{it}.waves = wavess{job_mask(it)};
0108 end
0109 end
0110
0111 if returnmode == 0,
0112 lukeobj.lukechecktext.string = 'LUKE started. Please wait for result.';
0113 iluke_update_state(lukeobj);
0114 end
0115
0116 status.data = 2;
0117
0118 clear opt
0119
0120 elseif strcmp(action,'runcheck'),
0121
0122 if curtime > 0,
0123
0124 lukestructs = struct;
0125 lukestructs.job = jobs{curtime};
0126
0127
0128
0129 jobs{curtime} = [];
0130 status.job(curtime) = 0;
0131
0132 else
0133
0134 job_mask = find(status.job > 0);
0135 nt = length(job_mask);
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145 lukestructs = cell(1,nt);
0146
0147 for it = 1:nt,
0148 if ~isempty(jobs{job_mask(it)})
0149 lukestructs{it}.job = jobs{job_mask(it)};
0150
0151 jobs{job_mask(it)} = [];
0152 end
0153 status.job(job_mask(it)) = 0;
0154 end
0155
0156 end
0157
0158 returnmode = 1;
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175 timedep = [];
0176
0177
0178
0179
0180
0181 end
0182
0183
0184
0185 set(lukeobj.busy.handle,'Visible','on');drawnow;
0186
0187 lukestructs = run_lukert(lukestructs,dkepath,timedep);
0188
0189 set(lukeobj.busy.handle,'Visible','off');drawnow;
0190
0191
0192
0193 if curtime > 0,
0194 if isfield(lukestructs,'job'),
0195
0196 jobs{curtime} = lukestructs.job;
0197 status.job(curtime) = 1;
0198
0199 action = 'lukerun';iluke_callbacks;
0200
0201 elseif isfield(lukestructs,'err'),
0202
0203 lukeobj.infotext.string = {'Error running LUKE : ',lukestructs.err};
0204
0205 lukeobj = iluke_info(lukeobj,'text');
0206
0207 elseif isfield(lukestructs,'output'),
0208
0209 outputs{curtime} = iluke_output(lukestructs.output);
0210
0211 status.output(curtime) = 1;
0212 status.data = 2;
0213
0214 action = 'lukedisp';iluke_callbacks;
0215
0216 lukeobj = iluke_info(lukeobj,'text');
0217
0218 end
0219 else
0220 for it = 1:nt,
0221 if isfield(lukestructs{it},'job'),
0222
0223 jobs{job_mask(it)} = lukestructs{it}.job;
0224 status.job(job_mask(it)) = 1;
0225
0226 elseif isfield(lukestructs{it},'err'),
0227
0228 disp(' ')
0229 disp(['Error running LUKE for shot time ',num2str(shotimes(job_mask(it))),' s : ']);
0230 disperr_jd(lukestructs{it}.err);
0231
0232 elseif isfield(lukestructs{it},'output'),
0233
0234 outputs{job_mask(it)} = iluke_output(lukestructs{it}.output);
0235
0236 status.output(job_mask(it)) = 1;
0237 status.sdiag(:,job_mask(it)) = 1;
0238 status.data = 2;
0239
0240 elseif returnmode == 1 && isfield(lukestructs{1},'job'),
0241 status.job(job_mask(it)) = 1;
0242 end
0243 end
0244
0245 clear job_mask it nt
0246
0247 if any(status.job > 0),
0248 action = 'lukerun';iluke_callbacks;
0249 elseif any(status.output > 0),
0250 action = 'lukedisp';iluke_callbacks;
0251 else
0252 lukeobj = iluke_info(lukeobj,'text');
0253 end
0254
0255 end
0256
0257 clear lukestructs timedep mdce_mode remnum returnmode transpmode
0258
0259
0260
0261
0262
0263
0264
0265
0266