fix error
This commit is contained in:
@@ -88,21 +88,20 @@ classdef EDFMAppController < handle
|
||||
drawnow;
|
||||
|
||||
try
|
||||
logText = evalc('[r, Times, OutputRs, Wellpara, trun] = run_case(obj.Config);');
|
||||
progress_callback = @(message, meta) obj.onRunProgress(message, meta);
|
||||
[r, Times, OutputRs, Wellpara, trun] = run_case(obj.Config, progress_callback);
|
||||
obj.Results = struct( ...
|
||||
'r', r, ...
|
||||
'Times', Times, ...
|
||||
'OutputRs', {OutputRs}, ...
|
||||
'Wellpara', {Wellpara}, ...
|
||||
'trun', trun, ...
|
||||
'captured_log', logText);
|
||||
if ~isempty(strtrim(logText))
|
||||
obj.appendLog(logText);
|
||||
end
|
||||
'captured_log', '');
|
||||
obj.refreshResults();
|
||||
if strlength(obj.CurrentPlotAction) ~= 0
|
||||
obj.refreshCasePlotControls(obj.CurrentPlotAction);
|
||||
end
|
||||
obj.appendLog('Run completed.');
|
||||
obj.setRunProgress('Completed');
|
||||
obj.setStatus('Run completed');
|
||||
catch ME
|
||||
@@ -690,6 +689,35 @@ classdef EDFMAppController < handle
|
||||
drawnow limitrate;
|
||||
end
|
||||
|
||||
function onRunProgress(obj, message, meta)
|
||||
if nargin < 3 || ~isstruct(meta)
|
||||
meta = struct();
|
||||
end
|
||||
|
||||
if nargin >= 2 && strlength(strtrim(string(message))) ~= 0
|
||||
obj.appendLog(message);
|
||||
end
|
||||
|
||||
if isfield(meta, 'status') && ~isempty(meta.status)
|
||||
obj.setRunProgress(meta.status);
|
||||
end
|
||||
|
||||
if isfield(meta, 'step') || isfield(meta, 'time') || isfield(meta, 'dt')
|
||||
stageText = obj.getMetaText(meta, 'step', '-');
|
||||
timeText = obj.getMetaText(meta, 'time', '-');
|
||||
dtText = obj.getMetaText(meta, 'dt', '-');
|
||||
obj.setRunHeader(stageText, timeText, dtText);
|
||||
end
|
||||
end
|
||||
|
||||
function textValue = getMetaText(obj, meta, fieldName, fallback)
|
||||
if isfield(meta, fieldName) && ~isempty(meta.(fieldName))
|
||||
textValue = obj.valueToShortText(meta.(fieldName));
|
||||
else
|
||||
textValue = fallback;
|
||||
end
|
||||
end
|
||||
|
||||
function setRunProgress(obj, textValue)
|
||||
if isprop(obj.App, 'RunProgressLabel')
|
||||
obj.App.RunProgressLabel.Text = ['RunProgress: ', char(string(textValue))];
|
||||
|
||||
Reference in New Issue
Block a user