fix error

This commit is contained in:
kk
2026-03-23 22:50:00 +08:00
parent 03c7a1ab40
commit b92444ef57
10 changed files with 2621 additions and 10 deletions
+33 -5
View File
@@ -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))];