Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ThoHiller committed Jul 14, 2023
1 parent f066286 commit 27ead7b
Show file tree
Hide file tree
Showing 60 changed files with 12,519 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.asv
*.aux
*.log
*.toc
*.sty
*.mat
/output
/externals
6 changes: 6 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**GRAINPACKER** is developed by

* Thomas Hiller, [email protected]
* Jan Igel, [email protected]
* Stephan Schennen, [email protected]
* Sam Stadler, [email protected]
97 changes: 97 additions & 0 deletions GPRGRAVEL/GPRGRAVEL.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
function GPRGRAVEL
%GPRGRAVEL is a graphical user interface (GUI) to create "grain packings"
%(spheres or ellipsoids) for 3D GPR simulations based on grain size
% distributions (GSDs)
%
% Syntax:
% GPRGRAVEL
%
% Inputs:
% none
%
% Outputs:
% none
%
% Example:
% GPRGRAVEL
%
% Other m-files required:
%
% Subfunctions:
% none
%
% MAT-files required:
% none
%
% See also GPRGRAVEL
% Author(s): see AUTHORS.md
% License: GNU GPLv3 (at end)

%------------- BEGIN CODE --------------

%% GUI 'header' info and default GUI settings
myui.version = '0.1.0';
myui.date = '14.07.2023';
myui.author = 'Thomas Hiller';

myui.fontsize = 8;
myui.axfontsize = 10;
myui.linewidth = 2;
myui.color.domain = [141 211 199]./255;
myui.color.grains = [251 128 114]./255;
myui.color.params = [128 177 211]./255;
% 255 255 179
% 190 186 218

%% Default data settings
data = GPRGRAVEL_loadDefaults;
tmp = mfilename('fullpath');
idcs = strfind(tmp,filesep);
newdir = tmp(1:idcs(end-1)-1);
data.params.GPRGRAVELpath = newdir;

%% GUI initialization
gui.figh = figure('Name','GPRGRAVEL',...
'NumberTitle','off','Tag','GPRGRAVEL','ToolBar','none','MenuBar','none',...
'SizeChangedFcn',@onFigureSizeChange);

% position on screen
pos = GPRGRAVEL_setPositionOnScreen;
set(gui.figh,'Position',pos);

%% GUI data
gui.myui = myui;

% save the data struct within the GUI
setappdata(gui.figh,'data',data);
setappdata(gui.figh,'gui',gui);

%% Create GUI elements
GPRGRAVEL_createGUI(gui.figh,true);
% update status bar
updateStatusInformation(gui.figh);
% plot domain
plotDomaindata(gui.figh);

end

%------------- END OF CODE --------------

%% License:
% GNU GPLv3
%
% GPRGRAVEL
% Copyright (C) 2023 Thomas Hiller
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <https://www.gnu.org/licenses/>.
175 changes: 175 additions & 0 deletions GPRGRAVEL/GPRGRAVEL_createGUI.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
function GPRGRAVEL_createGUI(h,wbon)
%GPRGRAVEL_createGUI controls the creation of all GUI elements
%
% Syntax:
% GPRGRAVEL_createGUI(h)
%
% Inputs:
% h - figure handle
% wbon - show waitbar (yes=true, no=false)
%
% Outputs:
% none
%
% Example:
% GPRGRAVEL_createGUI(h,true)
%
% Other m-files required:
%
% Subfunctions:
% none
%
% MAT-files required:
% none
%
% See also GPRGRAVEL
% Author(s): see AUTHORS.md
% License: GNU GPLv3 (at end)

%------------- BEGIN CODE --------------

%% get GUI data
data = getappdata(h,'data');
gui = getappdata(h,'gui');
myui = gui.myui;

%% initialize wait bar
if wbon
hwb = waitbar(0,'loading ...','Name','GPRGRAVEL initialization','Visible','off');
steps = 6;
if ~isempty(h)
posf = get(h,'Position');
set(hwb,'Units','Pixel')
posw = get(hwb,'Position');
set(hwb,'Position',[posf(1)+posf(3)/2-posw(3)/2 posf(2)+posf(4)/2-posw(4)/2 posw(3:4)]);
end
set(hwb,'Visible','on');
end

%% uimenus
if wbon
waitbar(1/steps,hwb,'loading GUI elements - menus');
end
gui = GPRGRAVEL_createMenus(gui);

%% MAIN GUI "BOX"
gui.main = uix.VBox('Parent',gui.figh,'Visible','off');

% top part for settings and plots
gui.top = uix.HBox('Parent',gui.main);
% bottom part for the status bar
gui.bottom = uix.HBox('Parent',gui.main);
set(gui.main,'Heights',[-1 20]);

% top left contains the three main panels plus the control panel
gui.leftTop = uix.VBox('Parent',gui.top);
% all plots in a flexible grid on the right side
gui.right = uix.GridFlex('Parent',gui.top,'Spacing',7);
set(gui.top,'Widths',[300 -1]);
set(gui.top,'MinimumWidths',[300 200]);

% the three main panels are inside a vertically scrollable panel
gui.left = uix.ScrollingPanel('Parent',gui.leftTop);
% but the control panel is fixed to the bottom
gui.panels.Control.main = uix.BoxPanel('Parent',gui.leftTop,'Title','Control',...
'TitleColor',[164 164 164]./255,'ForegroundColor','k');
set(gui.leftTop,'Heights',[-1 53]);

%% A. settings column
gui.panels.main = uix.VBox('Parent',gui.left);
gui.panels.Grains.main = uix.BoxPanel('Parent',gui.panels.main,'Title','Grains',...
'TitleColor',myui.color.grains,'ForegroundColor','k','MinimizeFcn',@minimizePanel);
gui.panels.Domain.main = uix.BoxPanel('Parent',gui.panels.main,'Title','Domain',...
'TitleColor',myui.color.domain,'ForegroundColor','k','MinimizeFcn',@minimizePanel);
gui.panels.Params.main = uix.BoxPanel('Parent',gui.panels.main,'Title','Parameter',...
'TitleColor',myui.color.params,'ForegroundColor','k','MinimizeFcn',@minimizePanel);
uix.Empty('Parent',gui.panels.main);

% adjust the heights of all left-column-panels
% edit and popup elements are 24
edith = 22;
% panel header is always 22 high
headerh = 22;
% spacing is set to 3
spacing = 3;
% maximal height of each panel
grains_max = 6*edith+7*spacing+headerh;
% params_max = 8*edith+9*spacing+headerh-14;
params_max = 13*edith+14*spacing+headerh-5;
domain_max = 8*edith+9*spacing+headerh;
% save the heights information (needed for minimizing the panels)
myui.heights = [22 22 22 -1; grains_max domain_max params_max -1];
set(gui.panels.main,'Heights',myui.heights(2,:),...
'MinimumHeights',[22 22 22 0]);
% the 'MinimumHeights' guarantees that the three panels fit into the
% ScrollingPanel when the GUI becomes smaller
set(gui.left,'Heights',-1,'MinimumHeights',grains_max+domain_max+params_max);

if wbon
waitbar(2/steps,hwb,'loading GUI elements - Grains panel');
end
[gui,myui] = GPRGRAVEL_createPanelGrains(data,gui,myui);

if wbon
waitbar(3/steps,hwb,'loading GUI elements - Parameter panel');
end
[gui,myui] = GPRGRAVEL_createPanelParameter(data,gui,myui);

if wbon
waitbar(4/steps,hwb,'loading GUI elements - Domain panel');
end
[gui,myui] = GPRGRAVEL_createPanelDomain(data,gui,myui);

if wbon
waitbar(5/steps,hwb,'loading GUI elements - Control panel');
end
[gui,myui] = GPRGRAVEL_createPanelControl(gui,myui);

if wbon
waitbar(6/steps,hwb,'loading GUI elements - Plot panel');
end
[gui,myui] = GPRGRAVEL_createGridPlots(gui,myui);

% delete wait bar
if wbon
delete(hwb);
end

[gui,myui] = GPRGRAVEL_createStatusbar(gui,myui);

% make the main GUI visible
set(gui.main,'Visible','on');

%% enable all menus
set(gui.menu_handles.file,'Enable','on');
set(gui.menu_handles.view,'Enable','on');
set(gui.menu_handles.help,'Enable','on');

%% update the GUI data
gui.myui = myui;
setappdata(gui.figh,'gui',gui);
setappdata(gui.figh,'data',data);
set(gui.text_handles.Status,'String','GPRGRAVEL successfully started');

end

%------------- END OF CODE --------------

%% License:
% GNU GPLv3
%
% GPRGRAVEL
% Copyright (C) 2023 Thomas Hiller
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <https://www.gnu.org/licenses/>.
Loading

0 comments on commit 27ead7b

Please sign in to comment.