Files
3D_EDFM_SIM-X/gui_support/app/EDFMSimulatorGuide.m
T

128 lines
4.8 KiB
Matlab

function varargout = EDFMSimulatorGuide(varargin)
%EDFMSIMULATORGUIDE GUIDE-compatible EDFM simulator GUI for MATLAB R2022a.
% APP = EDFMSIMULATORGUIDE launches the converted GUIDE/uicontrol version
% of the App Designer interface. The UI is built from standard figure,
% uitabgroup, uicontrol, uitable and axes objects so it can be inspected and
% adjusted with GUIDE-era tools in MATLAB R2022a.
if nargin > 0 && ischar(varargin{1})
feval(varargin{:});
return;
end
startup;
handles = createEDFMSimulatorGuideLayout();
fig = handles.UIFigure;
app = EDFMGuideApp(handles);
app.Controller = EDFMAppController(app);
handles.App = app;
guidata(fig, handles);
configureGuideCallbacks(app, fig);
app.Controller.startup();
if nargout > 0
varargout{1} = app;
end
end
function configureGuideCallbacks(app, fig)
app.NewConfigButton.ButtonPushedFcn = @(src, event) onNewConfig(fig);
app.LoadTemplateButton.ButtonPushedFcn = @(src, event) onLoadTemplate(fig);
app.ImportConfigButton.ButtonPushedFcn = @(src, event) onImportConfig(fig);
app.ExportConfigButton.ButtonPushedFcn = @(src, event) onExportConfig(fig);
app.RunButton.ButtonPushedFcn = @(src, event) onRun(fig);
app.ImportResultButton.ButtonPushedFcn = @(src, event) onImportResult(fig);
app.ExportResultButton.ButtonPushedFcn = @(src, event) onExportResult(fig);
app.PlotWellResponseButton.ButtonPushedFcn = @(src, event) onActivateCasePlot(fig, 'plot_well_response');
app.Plot2DLayerButton.ButtonPushedFcn = @(src, event) onActivateCasePlot(fig, 'plot_2d_layer');
app.Plot3DDistributionButton.ButtonPushedFcn = @(src, event) onRunCasePlot(fig, 'plot_3d_distribution');
app.PlotPermButton.ButtonPushedFcn = @(src, event) onRunCasePlot(fig, 'plot_perm');
app.PlotSPDPButton.ButtonPushedFcn = @(src, event) onRunCasePlot(fig, 'plot_sp_dp');
app.PlotLayerDropDown.ValueChangedFcn = @(src, event) onPlotOptionChanged(fig);
app.PlotPropertyDropDown.ValueChangedFcn = @(src, event) onPlotOptionChanged(fig);
app.PlotWellDropDown.ValueChangedFcn = @(src, event) onPlotOptionChanged(fig);
app.PlotMetricDropDown.ValueChangedFcn = @(src, event) onPlotOptionChanged(fig);
app.PlotTimeStepSlider.ValueChangedFcn = @(src, event) onPlotOptionChanged(fig);
app.AddWell1RowButton.ButtonPushedFcn = @(src, event) onAddTableRow(fig, 'Well1Table');
app.DeleteWell1RowButton.ButtonPushedFcn = @(src, event) onDeleteTableRow(fig, 'Well1Table');
app.AddWell2RowButton.ButtonPushedFcn = @(src, event) onAddTableRow(fig, 'Well2Table');
app.DeleteWell2RowButton.ButtonPushedFcn = @(src, event) onDeleteTableRow(fig, 'Well2Table');
app.AddFracLocRowButton.ButtonPushedFcn = @(src, event) onAddTableRow(fig, 'FractureWellLocationTable');
app.DeleteFracLocRowButton.ButtonPushedFcn = @(src, event) onDeleteTableRow(fig, 'FractureWellLocationTable');
app.AddScheduleRowButton.ButtonPushedFcn = @(src, event) onAddTableRow(fig, 'ScheduleTable');
app.DeleteScheduleRowButton.ButtonPushedFcn = @(src, event) onDeleteTableRow(fig, 'ScheduleTable');
app.Well1Table.CellSelectionCallback = @(src, event) onTableSelection(fig, 'Well1Table', event);
app.Well2Table.CellSelectionCallback = @(src, event) onTableSelection(fig, 'Well2Table', event);
app.FractureWellLocationTable.CellSelectionCallback = @(src, event) onTableSelection(fig, 'FractureWellLocationTable', event);
app.ScheduleTable.CellSelectionCallback = @(src, event) onTableSelection(fig, 'ScheduleTable', event);
end
function app = getGuideApp(fig)
handles = guidata(fig);
app = handles.App;
end
function onNewConfig(fig)
getGuideApp(fig).Controller.newConfig();
end
function onLoadTemplate(fig)
app = getGuideApp(fig);
app.Controller.loadTemplate(app.TemplateDropDown.Value);
end
function onImportConfig(fig)
getGuideApp(fig).Controller.importConfig();
end
function onExportConfig(fig)
getGuideApp(fig).Controller.exportConfig();
end
function onRun(fig)
getGuideApp(fig).Controller.runCurrentConfig();
end
function onImportResult(fig)
getGuideApp(fig).Controller.importResults();
end
function onExportResult(fig)
getGuideApp(fig).Controller.exportResults();
end
function onActivateCasePlot(fig, actionId)
getGuideApp(fig).Controller.activateCasePlot(actionId);
end
function onRunCasePlot(fig, actionId)
getGuideApp(fig).Controller.runCasePlot(actionId);
end
function onPlotOptionChanged(fig)
getGuideApp(fig).Controller.onPlotOptionChanged();
end
function onAddTableRow(fig, tableName)
getGuideApp(fig).Controller.addTableRow(tableName);
end
function onDeleteTableRow(fig, tableName)
getGuideApp(fig).Controller.deleteSelectedTableRow(tableName);
end
function onTableSelection(fig, tableName, event)
indices = [];
if nargin >= 3 && isstruct(event) && isfield(event, 'Indices')
indices = event.Indices;
elseif nargin >= 3
try
if isprop(event, 'Indices')
indices = event.Indices;
end
catch
end
end
getGuideApp(fig).Controller.onTableSelectionChanged(tableName, indices);
end