diff --git a/.gitignore b/.gitignore
index 0e98375..9f3036e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@ _trash_output/Path Plots/Load Path Model 2 - X Path.bmp
_trash_output
Define_Waitbar.m
*.MATLABDriveTag
+*.DS_Store
+
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/data_Load_Path_Model_1_-_X_Path.mat b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/data_Load_Path_Model_1_-_X_Path.mat
index 586ba7c..a6192e6 100644
Binary files a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/data_Load_Path_Model_1_-_X_Path.mat and b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/data_Load_Path_Model_1_-_X_Path.mat differ
diff --git a/Load-Path-Plotter/Path Data/data_Load_Path_Model_1_-_X_Path.mat b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/data_Load_Path_Model_1_-_Z_Path.mat
similarity index 99%
rename from Load-Path-Plotter/Path Data/data_Load_Path_Model_1_-_X_Path.mat
rename to Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/data_Load_Path_Model_1_-_Z_Path.mat
index 26d48ef..171dcbc 100644
Binary files a/Load-Path-Plotter/Path Data/data_Load_Path_Model_1_-_X_Path.mat and b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/data_Load_Path_Model_1_-_Z_Path.mat differ
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/pathdata_Load_Path_Model_1_-_X_Path.mat b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/pathdata_Load_Path_Model_1_-_X_Path.mat
new file mode 100644
index 0000000..b842781
Binary files /dev/null and b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/pathdata_Load_Path_Model_1_-_X_Path.mat differ
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/pathdata_Load_Path_Model_1_-_Z_Path.mat b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/pathdata_Load_Path_Model_1_-_Z_Path.mat
new file mode 100644
index 0000000..37415e9
Binary files /dev/null and b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Data/pathdata_Load_Path_Model_1_-_Z_Path.mat differ
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - X Path.bmp b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - X Path.bmp
new file mode 100644
index 0000000..07da9df
Binary files /dev/null and b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - X Path.bmp differ
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - X Path_.pdf b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - X Path_.pdf
new file mode 100644
index 0000000..54249a4
Binary files /dev/null and b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - X Path_.pdf differ
diff --git a/Load-Path-Plotter/Path Plots/Load Path Model 1 - X Path.bmp b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - Z Path.bmp
similarity index 63%
rename from Load-Path-Plotter/Path Plots/Load Path Model 1 - X Path.bmp
rename to Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - Z Path.bmp
index 9e40f85..fa47d28 100644
Binary files a/Load-Path-Plotter/Path Plots/Load Path Model 1 - X Path.bmp and b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - Z Path.bmp differ
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - Z Path_.pdf b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Path Plots/Load Path Model 1 - Z Path_.pdf
new file mode 100644
index 0000000..e69de29
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/X-Seeds.txt b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/X-Seeds.txt
index 8888a7b..4292273 100755
--- a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/X-Seeds.txt
+++ b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/X-Seeds.txt
@@ -1,6 +1,6 @@
--19, 03, -11
--19, 03, -04
--19, 03, 04
--19, 03, 11
+-19, 0, -11
+-19, 0, -04
+-19, 0, 04
+-19, 0, 11
diff --git a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Z-Seeds.txt b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Z-Seeds.txt
index b8b51da..84ba48d 100755
--- a/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Z-Seeds.txt
+++ b/Load-Path-Plotter/Examples/Example10 - Notched Plate Coarse/Z-Seeds.txt
@@ -1,6 +1,6 @@
- 01, 03, 01
- 04, 03, 01
- 11, 03, 01
--01, 03, 01
--04, 03, 01
--11, 03, 01
\ No newline at end of file
+ 01, 0, 01
+ 04, 0, 01
+ 11, 0, 01
+-01, 0, 01
+-04, 0, 01
+-11, 0, 01
\ No newline at end of file
diff --git a/Load-Path-Plotter/Input_NodeDatRead.m b/Load-Path-Plotter/Input_NodeDatRead.m
index 28dcd8a..d53e7ec 100644
--- a/Load-Path-Plotter/Input_NodeDatRead.m
+++ b/Load-Path-Plotter/Input_NodeDatRead.m
@@ -6,7 +6,7 @@
% when ANSYS would delete midside nodes, hence not storing their stress
% values, but keeping the numbering system. I built this as a workaround.
%
-% Since then however, I cam up with a better way of doing this which I am
+% Since then however, I came up with a better way of doing this which I am
% yet to implement for nodes, but implemented for elements.
clear nodes
diff --git a/Load-Path-Plotter/Input_nodeDat.m b/Load-Path-Plotter/Input_nodeDat.m
index 0734c1c..b92add0 100644
--- a/Load-Path-Plotter/Input_nodeDat.m
+++ b/Load-Path-Plotter/Input_nodeDat.m
@@ -13,22 +13,22 @@
if ispc
path_separator = '\';
end
- numOfResults = 7;
+ N_RESULTS = 7;
filePath = strjoin([filePath path_separator 'nodalSolution.txt'],'');
- datafile = fopen(filePath);
+ dataFile = fopen(filePath);
%Scans until the start of the file is found. Trash data is a temp variable
%to test and advance the reading function.
trashdata = 'a';
startelements = ' NODE';
while ~strncmpi(trashdata,startelements, length(startelements))
- trashdata = fgetl(datafile);
+ trashdata = fgetl(dataFile);
end
- StressData = nan(numOfResults,numNodes);
+ StressData = nan(N_RESULTS,numNodes);
count = 1;
for i = 1:numNodes
- linetest = strtrim(fgetl(datafile));
+ linetest = strtrim(fgetl(dataFile));
if isempty(linetest)
break
@@ -40,5 +40,5 @@
count = count+1;
end
count=count-1;
- fclose(datafile);
+ fclose(dataFile);
end
diff --git a/Load-Path-Plotter/Path Data/data_Load_Path_Model_1_-_Z_Path.mat b/Load-Path-Plotter/Path Data/data_Load_Path_Model_1_-_Z_Path.mat
deleted file mode 100644
index 4c838bd..0000000
Binary files a/Load-Path-Plotter/Path Data/data_Load_Path_Model_1_-_Z_Path.mat and /dev/null differ
diff --git a/Load-Path-Plotter/Path Data/pathdata_Load_Path_Model_1_-_X_Path.mat b/Load-Path-Plotter/Path Data/pathdata_Load_Path_Model_1_-_X_Path.mat
deleted file mode 100644
index ed95aa4..0000000
Binary files a/Load-Path-Plotter/Path Data/pathdata_Load_Path_Model_1_-_X_Path.mat and /dev/null differ
diff --git a/Load-Path-Plotter/Path Data/pathdata_Load_Path_Model_1_-_Z_Path.mat b/Load-Path-Plotter/Path Data/pathdata_Load_Path_Model_1_-_Z_Path.mat
deleted file mode 100644
index d73fae2..0000000
Binary files a/Load-Path-Plotter/Path Data/pathdata_Load_Path_Model_1_-_Z_Path.mat and /dev/null differ
diff --git a/Load-Path-Plotter/Path Plots/Load Path Model 1 - X Path_.pdf b/Load-Path-Plotter/Path Plots/Load Path Model 1 - X Path_.pdf
deleted file mode 100644
index 93b3a6a..0000000
Binary files a/Load-Path-Plotter/Path Plots/Load Path Model 1 - X Path_.pdf and /dev/null differ
diff --git a/Load-Path-Plotter/Path Plots/Load Path Model 1 - Z Path.bmp b/Load-Path-Plotter/Path Plots/Load Path Model 1 - Z Path.bmp
deleted file mode 100644
index 8c591b4..0000000
Binary files a/Load-Path-Plotter/Path Plots/Load Path Model 1 - Z Path.bmp and /dev/null differ
diff --git a/Load-Path-Plotter/Path Plots/Load Path Model 1 - Z Path_.pdf b/Load-Path-Plotter/Path Plots/Load Path Model 1 - Z Path_.pdf
deleted file mode 100644
index d512880..0000000
Binary files a/Load-Path-Plotter/Path Plots/Load Path Model 1 - Z Path_.pdf and /dev/null differ
diff --git a/Load-Path-Plotter/Run_Solve_loadpath3D.m b/Load-Path-Plotter/Run_Solve_loadpath3D.m
index bec5661..deb0f9a 100644
--- a/Load-Path-Plotter/Run_Solve_loadpath3D.m
+++ b/Load-Path-Plotter/Run_Solve_loadpath3D.m
@@ -1,6 +1,6 @@
-function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,...
- pulse, parallel, newPDF, recompute, step_size, path_length,...
- plot_minimum_vector, plot_maximum_vector)
+function Run_Solve_loadpath3D(simulationDirectory, seedDirectory, saveDirectory, modelName,pathDirectory,...
+ pulse, parallel, newPDF, recompute, stepSize, pathLength,...
+ plotMinimumVector, plotMaximumVector)
%% ******************** House Keeping ******************************
tic
% Closes previously opened waitbars
@@ -8,40 +8,40 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
delete(F);
% Read's seed data in
- Seed = importdata(seed_dir, ',');
+ Seed = importdata(seedDirectory, ',');
[numSeeds, ~] = size(Seed);
if numSeeds > 0
- xseed = Seed(:,1);
- yseed = Seed(:,2);
- zseed = Seed(:,3);
+ xSeed = Seed(:,1);
+ ySeed = Seed(:,2);
+ zSeed = Seed(:,3);
end
%% HouseKeeping - waitbar setup
- wb = waitbar(0,'1','Name','Computing Load Paths',...
+ waitBar = waitbar(0,'1','Name','Computing Load Paths',...
'CreateCancelBtn',...
'setappdata(gcbf,''canceling'',1)');
- setappdata(wb,'canceling',0)
- data_read_time = 7;
- plot_time = 3;
- print_time = 10;
- path_time = 80;
- total_time = data_read_time + plot_time + print_time + path_time;
- current_time = 0;
+ setappdata(waitBar,'canceling',0)
+ DATA_READ_TIME = 7;
+ PLOT_TIME = 3;
+ PRINT_TIME = 10;
+ PATH_TIME = 80;
+ totalTime = DATA_READ_TIME + PLOT_TIME + PRINT_TIME + PATH_TIME;
+ CURRENT_TIME = 0;
warning('off','MATLAB:scatteredInterpolant:DupPtsAvValuesWarnId');
warning('off','MATLAB:MKDIR:DirectoryExists')
%% Naming output files and killing interfering processes
- model_name = [model_name, ' - ',upper(path_dir), ' Path'];
- model_data_name = regexprep(model_name, ' ', '_');
+ modelName = [modelName, ' - ',upper(pathDirectory), ' Path'];
+ modelDataName = regexprep(modelName, ' ', '_');
- path_separator = '/';
+ pathSeparator = '/';
if ispc
- path_separator = '\';
- system(strjoin(['taskkill /fi "WINDOWTITLE eq ', model_name,'.pdf"'],''));
+ pathSeparator = '\';
+ system(strjoin(['taskkill /fi "WINDOWTITLE eq ', modelName,'.pdf"'],''));
end
- nodei = strjoin([sim_dir path_separator 'nodeInfo.txt'],'');
- numNodes = importdata(nodei);
+ iNode = strjoin([simulationDirectory pathSeparator 'nodeInfo.txt'],'');
+ numNodes = importdata(iNode);
numNodes = numNodes(2);
%% ****************** Populate Nodes and Elements *********************
@@ -49,34 +49,34 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
% Detects whether previous data has been computed, if yes, skips
% recomputation unless forced by user in GUI
- output_path = strjoin([save_dir, path_separator,'Path Data', path_separator, 'data_', model_data_name,'.mat'], '');
+ output_path = strjoin([saveDirectory, pathSeparator,'Path Data', pathSeparator, 'data_', modelDataName,'.mat'], '');
if ~exist(output_path, 'file') || recompute
fprintf('New model or user nominated to recompute data. Starting now.\n')
- waitbar(current_time/total_time,wb,sprintf('Computing Initial Data'))
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Computing Initial Data'))
%Nodal Information module
- [StressData, numNodes] = Input_nodeDat(sim_dir, numNodes);
- current_time = current_time + data_read_time/3;
- waitbar(current_time/total_time,wb,sprintf('Computing Initial Data'))
+ [StressData, numNodes] = Input_nodeDat(simulationDirectory, numNodes);
+ CURRENT_TIME = CURRENT_TIME + DATA_READ_TIME/3;
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Computing Initial Data'))
fprintf('Nodal information complete. Starting stress population.\n')
%Node data module
- [nodes] = Input_NodeDatRead(sim_dir, StressData, numNodes);
- current_time = current_time + data_read_time/3;
- waitbar(current_time/total_time,wb,sprintf('Computing Initial Data'))
+ [nodes] = Input_NodeDatRead(simulationDirectory, StressData, numNodes);
+ CURRENT_TIME = CURRENT_TIME + DATA_READ_TIME/3;
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Computing Initial Data'))
fprintf('Nodal stresses populated. Element generation beginning.\n')
%Element data and main data structure generation - %DK read element connectivity is read
- [nodePerEl, PartArr] = Input_datread(sim_dir,nodes);
- current_time = current_time + data_read_time/3;
+ [nodePerEl, PartArr] = Input_datread(simulationDirectory,nodes);
+ CURRENT_TIME = CURRENT_TIME + DATA_READ_TIME/3;
fprintf('Elements constructed, directories being created and data being saved.\n')
- ename = 'Path Data';
- dname = char(save_dir);
- mkdir(dname,ename);
- save(strjoin([dname path_separator ename path_separator 'data_' model_data_name '.mat'],''),'PartArr','nodes', 'nodePerEl');
+ eName = 'Path Data';
+ dName = char(saveDirectory);
+ mkdir(dName,eName);
+ save(strjoin([dName pathSeparator eName pathSeparator 'data_' modelDataName '.mat'],''),'PartArr','nodes', 'nodePerEl');
%% ****************** Define quadrilateral faces of elements **************************
%% ****************** and check face normal is positive pointing out **************
%% ****************** Only works for Hex8 Bricks
@@ -97,17 +97,17 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
PointVec = zeros(1,3);
for kk = 1,8;
kkk = elnods(kk);
- if path_dir == 'X'
+ if pathDirectory == 'X'
PointVec(1) = PointVec(1) + nodes(kkk).xStress/8.0;
PointVec(2) = PointVec(2) + nodes(kkk).xyStress/8.0;
PointVec(3) = PointVec(3) + nodes(kkk).xzStress/8.0;
end
- if path_dir == 'Y'
+ if pathDirectory == 'Y'
PointVec(1) = PointVec(1) + nodes(kkk).xyStress/8.0;
PointVec(2) = PointVec(2) + nodes(kkk).yStress/8.0;
PointVec(3) = PointVec(3) + nodes(kkk).yzStress/8.0;
end
- if path_dir == 'Z'
+ if pathDirectory == 'Z'
PointVec(1) = PointVec(1) + nodes(kkk).xzStress/8.0;
PointVec(2) = PointVec(2) + nodes(kkk).yzStress/8.0;
PointVec(3) = PointVec(3) + nodes(kkk).zStress/8.0;
@@ -125,9 +125,9 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
for k = 1:numel
if abs(CGXYZ(1,k) - xs) < 0.1
nSeeds = nSeeds + 1;
- xseed(nSeeds) = CGXYZ(1,k);
- yseed(nSeeds) = CGXYZ(2,k);
- zseed(nSeeds) = CGXYZ(3,k);
+ xSeed(nSeeds) = CGXYZ(1,k);
+ ySeed(nSeeds) = CGXYZ(2,k);
+ zSeed(nSeeds) = CGXYZ(3,k);
end
end
numSeeds = nSeeds;
@@ -135,20 +135,20 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
else
%This loads data if the preprocessign has already been done.
fprintf('Previous model detected, loading data.\n')
- waitbar(current_time/total_time,wb,sprintf('Loading Data'))
- load(strjoin([save_dir path_separator 'Path Data' path_separator 'data_' model_data_name,'.mat'],''));
- current_time = current_time + data_read_time;
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Loading Data'))
+ load(strjoin([saveDirectory pathSeparator 'Path Data' pathSeparator 'data_' modelDataName,'.mat'],''));
+ CURRENT_TIME = CURRENT_TIME + DATA_READ_TIME;
fprintf('Data loaded. Starting path computation.\n')
end
%******************** Waitbar and Status Update ***************************
- if getappdata(wb,'canceling')
- delete(wb)
+ if getappdata(waitBar,'canceling')
+ delete(waitBar)
return
end
- waitbar(current_time/total_time,wb,sprintf('Starting Paths'))
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Starting Paths'))
%% **************** Load Path Generation ******************************
%Initialise data containers for load paths
@@ -175,8 +175,8 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
%Main work horse module - Runge Kutta
reverse_path = false;
[x, y, z, intense] = RunLibrary_rungekuttaNatInter3D(...
- xseed(i),yseed(i),zseed(i), PartArr, path_dir,...
- path_length,reverse_path,step_size, wb);
+ xSeed(i),ySeed(i),zSeed(i), PartArr, pathDirectory,...
+ pathLength,reverse_path,stepSize, waitBar);
if isempty(x)
fprintf('Path %i unsuccessful\n',i)
continue
@@ -188,8 +188,8 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
Paths(i).I.forward = intense;
[x, y, z, intense ] = RunLibrary_rungekuttaNatInter3D(...
- xseed(i),yseed(i),zseed(i), PartArr, path_dir,...
- path_length,reverse_path,step_size, wb);
+ xSeed(i),ySeed(i),zSeed(i), PartArr, pathDirectory,...
+ pathLength,reverse_path,stepSize, waitBar);
Paths(i).X.total = [fliplr(x), Paths(i).X.forward];
Paths(i).Y.total = [fliplr(y), Paths(i).Y.forward];
Paths(i).Z.total = [fliplr(z), Paths(i).Z.forward];
@@ -197,21 +197,21 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
[mdk,ndk] = size(intense);
fprintf('Path %i done\n',i);
end
- current_time = current_time +80;
+ CURRENT_TIME = CURRENT_TIME +80;
% ****************** Single thread processing
case 0
for i = 1:numSeeds
%fprintf('Starting path %i\n',i)
- if getappdata(wb,'canceling')
- delete(wb)
+ if getappdata(waitBar,'canceling')
+ delete(waitBar)
return
end
- waitbar(current_time/total_time,wb,sprintf('Seed %i of %i Computing', i, numSeeds))
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Seed %i of %i Computing', i, numSeeds))
warning('off','MATLAB:scatteredInterpolant:DupPtsAvValuesWarnId');
reverse_path = false;
[dkx, dky, dkz, dkintense] = RunLibrary_rungekuttaNatInter3D(...
- xseed(i),yseed(i),zseed(i), PartArr, path_dir,...
- path_length,reverse_path,step_size, wb);
+ xSeed(i),ySeed(i),zSeed(i), PartArr, pathDirectory,...
+ pathLength,reverse_path,stepSize, waitBar);
if isempty(dkx)
fprintf('Path %i unsuccessful\n',i)
continue
@@ -233,7 +233,7 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
while kdk < ndk;
%Plot path only if magnitude of pointing vector >
%minimum define in input
- if dkintense(kdk) > plot_minimum_vector;
+ if dkintense(kdk) > plotMinimumVector;
kkdk = kkdk+1;
x(kkdk) = dkx(kdk);
y(kkdk) = dky(kdk);
@@ -254,11 +254,11 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
Paths(i).Y.forward = y;
Paths(i).Z.forward = z;
Paths(i).I.forward = intense;
- current_time = current_time + 1/numSeeds *80/2;
+ CURRENT_TIME = CURRENT_TIME + 1/numSeeds *80/2;
reverse_path = true;
[dkx, dky, dkz, dkintense ] = RunLibrary_rungekuttaNatInter3D(...
- xseed(i), yseed(i), zseed(i), PartArr, path_dir,...
- path_length,reverse_path,step_size, wb);
+ xSeed(i), ySeed(i), zSeed(i), PartArr, pathDirectory,...
+ pathLength,reverse_path,stepSize, waitBar);
%Next block added by dk to only plot peak of pulse
@@ -279,7 +279,7 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
%vector > 20 and x coordinate is < 200.
%This is to stop path extending past 200 in some
%cases and changing length of plot for movie.
- if dkintense(kdk) > plot_minimum_vector;
+ if dkintense(kdk) > plotMinimumVector;
kkdk = kkdk+1;
x(kkdk) = dkx(kdk);
y(kkdk) = dky(kdk);
@@ -300,7 +300,7 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
Paths(i).Y.total = [fliplr(y), Paths(i).Y.forward];
Paths(i).Z.total = [fliplr(z), Paths(i).Z.forward];
Paths(i).I.total = [fliplr(intense), Paths(i).I.forward];
- current_time = current_time + 1/numSeeds *80/2;
+ CURRENT_TIME = CURRENT_TIME + 1/numSeeds *80/2;
fprintf('Path %i done\n',i)
end
end
@@ -308,11 +308,11 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
%******************** Waitbar and Status Update ***************************
- if getappdata(wb,'canceling')
- delete(wb)
+ if getappdata(waitBar,'canceling')
+ delete(waitBar)
return
end
- waitbar(current_time/total_time,wb,sprintf('Paths Finished Paths, Saving and Plotting now...\n'))
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Paths Finished Paths, Saving and Plotting now...\n'))
%% **************** Plotting and Printing ******************************
%Data is output to .mat files so that in a future update the user can
@@ -325,33 +325,33 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
%data sets may have to be condensed. And that its a good backup of the
%path calculation.
- save(strjoin([save_dir path_separator 'Path Data' path_separator 'pathdata_' model_data_name '.mat'],''), 'Paths');
+ save(strjoin([saveDirectory pathSeparator 'Path Data' pathSeparator 'pathdata_' modelDataName '.mat'],''), 'Paths');
fig = figure;
fprintf('Plotting Paths\n')
modelPlot3D([Paths(:).X],[Paths(:).Y],[Paths(:).Z],[Paths(:).I],...
- PartArr,nodes,pulse, plot_minimum_vector, plot_maximum_vector)
+ PartArr,nodes,pulse, plotMinimumVector, plotMaximumVector)
% Create new directory to store the output plots
- ename = 'Path Plots';
- dname = char(save_dir);
- mkdir(dname,ename);
+ eName = 'Path Plots';
+ dName = char(saveDirectory);
+ mkdir(dName,eName);
%********************Name of 'bmp' file hard-wired ************************
- saveas(fig,strjoin([save_dir path_separator 'Path Plots' path_separator model_name, '.bmp'],''))
+ saveas(fig,strjoin([saveDirectory pathSeparator 'Path Plots' pathSeparator modelName, '.bmp'],''))
%******************** Waitbar and Status Update ***************************
- if getappdata(wb,'canceling')
- delete(wb)
+ if getappdata(waitBar,'canceling')
+ delete(waitBar)
return
end
fprintf('Printing to PDF\n')
- current_time = current_time + plot_time;
- waitbar(current_time/total_time,wb,sprintf('Printing PDF'))
+ CURRENT_TIME = CURRENT_TIME + PLOT_TIME;
+ waitbar(CURRENT_TIME/totalTime,waitBar,sprintf('Printing PDF'))
if newPDF
dt = datestr(now,'yy_mm_dd_HH_MM_SS');
else
dt = '';
end
- dateAppenedFN = strjoin([save_dir, path_separator, 'Path Plots', path_separator ,model_name,'_', dt, '.pdf'],'');
+ dateAppenedFN = strjoin([saveDirectory, pathSeparator, 'Path Plots', pathSeparator ,modelName,'_', dt, '.pdf'],'');
gcf;
print(fig,dateAppenedFN, '-dpdf','-r1000', '-fillpage');
@@ -362,14 +362,14 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
% not. As the density is so high to see the paths properly it can be an
% expensive task to compute.
- delete(wb)
+ delete(waitBar)
fprintf('Load paths complete.\n')
%%********************************End of Computation******************************
toc
end
function [] = modelPlot3D(x_paths,y_paths,z_paths,Intensity,PartArr,...
- nodes,pulse, plot_minimum_vector, plot_maximum_vector)
+ nodes,pulse, plotMinimumVector, plotMaximumVector)
%Just some custom settings for plotting the paths
Alpha = 0.1;
Buffer = 0.35;
@@ -397,10 +397,10 @@ function Run_Solve_loadpath3D(sim_dir, seed_dir, save_dir, model_name,path_dir,.
cd = [];
cdd = flipud(hot(64));
vmax = max([Intensity(k).total]);
- if vmax > plot_maximum_vector
- vmax = plot_maximum_vector;
+ if vmax > plotMaximumVector
+ vmax = plotMaximumVector;
end
- ncol = 64 * vmax/plot_maximum_vector;
+ ncol = 64 * vmax/plotMaximumVector;
for i = 1:ncol
for j = 1:3
cd(i,j) = cdd(i,j);
diff --git a/Load-Path-Plotter/html/LoadPathGUI.html b/Load-Path-Plotter/html/LoadPathGUI.html
deleted file mode 100644
index 85ad0db..0000000
--- a/Load-Path-Plotter/html/LoadPathGUI.html
+++ /dev/null
@@ -1,1549 +0,0 @@
-
-
-
-
- LoadPathGUI
function varargout = LoadPathGUI(varargin)
-% LOADPATHGUI MATLAB code for LoadPathGUI.fig
-% LOADPATHGUI, by itself, creates a new LOADPATHGUI or raises the existing
-% singleton*.
-%
-% H = LOADPATHGUI returns the handle to a new LOADPATHGUI or the
-% handle to
-% the existing singleton*.
-%
-% LOADPATHGUI('CALLBACK',hObject,eventData,handles,...) calls the local
-% function named CALLBACK in LOADPATHGUI.M with the given input arguments.
-%
-% LOADPATHGUI('Property','Value',...) creates a new LOADPATHGUI or raises the
-% existing singleton*. Starting from the left, property value pairs are
-% applied to the GUI before LoadPathGUI_OpeningFcn gets called. An
-% unrecognized property name or invalid value makes property application
-% stop. All inputs are passed to LoadPathGUI_OpeningFcn via varargin.
-%
-% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
-% instance to run (singleton)".
-%
-% See also: GUIDE, GUIDATA, GUIHANDLES
-
-% Edit the above text to modify the response to help LoadPathGUI
-
-% Last Modified by GUIDE v2.5 13-Dec-2018 21:12:42
-
-% Begin initialization code - DO NOT EDIT
-gui_Singleton = 1;
-gui_State = struct('gui_Name', mfilename, ...
- 'gui_Singleton', gui_Singleton, ...
- 'gui_OpeningFcn', @LoadPathGUI_OpeningFcn, ...
- 'gui_OutputFcn', @LoadPathGUI_OutputFcn, ...
- 'gui_LayoutFcn', [] , ...
- 'gui_Callback', []);
-if nargin && ischar(varargin{1})
- gui_State.gui_Callback = str2func(varargin{1});
-end
-
-if nargout
- [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
-else
- gui_mainfcn(gui_State, varargin{:});
-end
-% End initialization code - DO NOT EDIT
-
-
-% --- Executes just before LoadPathGUI is made visible.
-function LoadPathGUI_OpeningFcn(hObject, eventdata, handles, varargin)
-% This function has no output args, see OutputFcn.
-% hObject handle to figure
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-% varargin command line arguments to LoadPathGUI (see VARARGIN)
-
-% Choose default command line output for LoadPathGUI
-handles.output = hObject;
-
-% Update handles structure
-set(handles.checkbox1, 'value',1)
-set(handles.edit3, 'String', 'Load Path Model 1')
-set(handles.edit1, 'String', 'C:\')
-set(handles.edit2, 'String', 'C:\')
-set(handles.edit4, 'String', 'C:\')
-set(handles.text15, 'String', 'Step Size')
-
-guidata(hObject, handles);
-
-% UIWAIT makes LoadPathGUI wait for user response (see UIRESUME)
-% uiwait(handles.figure1);
-
-
-% --- Outputs from this function are returned to the command line.
-function varargout = LoadPathGUI_OutputFcn(hObject, eventdata, handles)
-% varargout cell array for returning output args (see VARARGOUT);
-% hObject handle to figure
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Get default command line output from handles structure
-varargout{1} = handles.output;
-
-
-% --- Executes on button press in cmd_getDir.
-function cmd_getDir_Callback(hObject, eventdata, handles)
-% hObject handle to cmd_getDir (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
- folder_name = uigetdir(handles.edit1.String, 'Select Folder Containing Simulation Files');
- set(handles.edit1, 'String', folder_name)
- handles.cmd_getDir.UserData = sim_folder_check(folder_name);
-
-
-function edit1_Callback(hObject, eventdata, handles)
-% hObject handle to edit1 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit1 as text
-% str2double(get(hObject,'String')) returns contents of edit1 as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function edit1_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit1 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-% --- Executes on button press in checkbox1.
-function checkbox1_Callback(hObject, eventdata, handles)
-% hObject handle to checkbox1 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hint: get(hObject,'Value') returns toggle state of checkbox1
-
-
-
-% --------------------------------------------------------------------
-
-
-% --- Executes on selection change in popupm0enu1.
-function popupmenu1_Callback(hObject, eventdata, handles)
-% hObject handle to popupmenu1 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
-% contents{get(hObject,'Value')} returns selected item from popupmenu1
- contents = cellstr(get(hObject,'String'));
- contents{get(hObject,'Value')};
-
-
-% --- Executes during object creation, after setting all properties.
-function popupmenu1_CreateFcn(hObject, eventdata, handles)
-% hObject handle to popupmenu1 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: popupmenu controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-% --- Executes on button press in pushbutton4.
-function pushbutton4_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton4 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
- [file_name, path_dir] = uigetfile({'*.txt'}, 'Select Seed Point File');
- set(handles.edit2, 'String', [path_dir file_name])
- handles.pushbutton4.UserData = seed_point_check([path_dir file_name]);
-
-
-function edit2_Callback(hObject, eventdata, handles)
-% hObject handle to edit2 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit2 as text
-% str2double(get(hObject,'String')) returns contents of edit2 as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function edit2_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit2 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-% --- Executes on selection change in popupmenu2.
-function popupmenu2_Callback(hObject, eventdata, handles)
-% hObject handle to popupmenu2 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
-% contents{get(hObject,'Value')} returns selected item from popupmenu2
-
-
-% --- Executes during object creation, after setting all properties.
-function popupmenu2_CreateFcn(hObject, eventdata, handles)
-% hObject handle to popupmenu2 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: popupmenu controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-% --- Executes on button press in checkbox2.
-function checkbox2_Callback(hObject, eventdata, handles)
-% hObject handle to checkbox2 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hint: get(hObject,'Value') returns toggle state of checkbox2
-
-
-% --- Executes on button press in checkbox3.
-function checkbox3_Callback(hObject, eventdata, handles)
-% hObject handle to checkbox3 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hint: get(hObject,'Value') returns toggle state of checkbox3
-
-
-% --- Executes on button press in pushbutton5.
-function pushbutton5_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton5 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-h = helpdlg(['The Load Path program has been optimised to output a set of'...
-' initialising data in the event that the user would like to select new'...
-' seed locations. This greatly speeds up subsequent plots.'...
-newline newline...
-'If the underlying model has been modified then the user'...
-' will need to select this option, as this data will need to be recomputed.'...
-' If this is the first time this model has had load paths plotted, there'...
-' is no need to select this option.'],'Recomputing Data');
-help_dialog_settings(h)
-
-% --- Executes on button press in pushbutton6.
-function pushbutton6_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton6 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-h = helpdlg(['By default the Load Path program will output a simple PDF '...
- 'of the path plots. If the user would like to plot paths at '...
- 'different seed locations, the program will overwrite the previous '...
- 'PDF.'...
- newline newline...
- 'Select this option if the previous PDF is to be retained. New '...
- 'PDF''''s will have the same file name but with the date and '...
- 'time appended to the end of the name in the following structure:'...
- newline newline...
- '"''Output File Name - Path Direction\_HH.MM.SS\_dd/mm/yy''"'],...
- 'Generating New PDF''''s');
-help_dialog_settings(h)
-
-% --- Executes on button press in pushbutton7.
-function pushbutton7_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton7 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-helpmessage = ...
- ['The path direction should be selected in the relative to the '...
- 'model''''s coordinate system. ' newline newline...
- '\bfNote:\rm Keep in mind that paths '...
- 'that do not exit the model space at a reaction point will eddy.'...
- 'When paths eddy, they will proceed to keep being computed '...
- 'until the upper limit of the path length is reached leading to '...
- 'longer run times.'...
- ];
-h = helpdlg(helpmessage, 'Path Direction''''s');
-
-help_dialog_settings(h)
-
-
-% --- Executes on button press in pushbutton8.
-function pushbutton8_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton8 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-helpmessage = ...
- ['The Seed Point file is a text file that dictates where the '...
- 'load paths will initiate from. Future developements will allow '...
- 'the user to interactively select seed locations in a MATLAB '...
- 'figure as well as load a file of seed locations.'...
- newline newline...
- 'The format of the seed file for \itn\rm number of points is:'...
- newline newline...
- 'X_1, Y_1, Z_1'...
- newline...
- 'X_2, Y_2, Z_2'...
- newline...
- ' \ldots' newline newline...
- 'X_n, Y_n, Z_n'...
- ];
-h = helpdlg(helpmessage, 'Seed Point Files');
-
-help_dialog_settings(h)
-
-% --- Executes on button press in pushbutton9.
-function pushbutton9_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton9 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-helpmessage = ...
- ['The dimension of the simulation refers to whether the model is '...
- 'two or three dimensional. AIAA - V1 only 3D.'...
- ];
-h = helpdlg(helpmessage, 'Dimension of Simulation');
-
-help_dialog_settings(h)
-
-% --- Executes on button press in pushbutton10.
-function pushbutton10_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton10 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-helpmessage = ...
- ['The Load Path program has been developed to allow clustering '...
- 'and general parallel processing.'...
- 'If this option is selected the simulation will parallelise to '...
- 'a default of four slave workers. This drastically improves '...
- 'the performance.' newline...
- 'However, it is recommended to run the program '...
- 'with a single seed point first as MATLAB requires an intial '...
- 'run of the code to perform optimally with parallelisation.'...
- newline newline ...
- 'The default is on.'...
- ];
-h = helpdlg(helpmessage, 'Dimension of Simulation');
-
-help_dialog_settings(h)
-
-% --- Executes on button press in pushbutton11.
-function pushbutton11_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton11 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-helpmessage = ...
- ['The simulation folder path is the directory where the core '...
- 'simulation files are stored. It will typically look like: '...
- newline newline...
- '\itC:Sample Simulation\\Sample Simulation\_files\\dp0\\SYS-X\\MECH\rm'...
- newline newline...
- 'The \it"SYS-X"\rm part of the file path refers to the system within '...
- 'the ANSYS simulation. The user may have renamed the systems '...
- 'within simulation, therefore it is important to check that'...
- ' the directory points to the correct system.'...
- newline newline...
- 'This directory should contain all the files relavent to the load '...
- 'path program. These files specifically are:\it' newline newline...
- 'ds.dat' newline...
- 'nodeInfo.txt' newline...
- 'elInfo.txt' newline...
- 'NodalSolution.txt\rm' newline...
- ];
-h = helpdlg(helpmessage, 'Dimension of Simulation');
-
-help_dialog_settings(h)
-
-
-function help_dialog_settings(handle)
- text_handle = handle.Children(3).Children;
- text_handle.Interpreter = 'tex';
- text_handle.FontName = 'Cambria';
- text_handle.FontSize = 10;
- buffer = 7;
- chi_extent = text_handle.Extent;
- par_pos = handle.Position;
- new_pos_x = (chi_extent(3)+chi_extent(1));
- new_pos_y = (chi_extent(4)+chi_extent(2));
- handle.Position(3) = new_pos_x+buffer;
- handle.Position(4) = new_pos_y+buffer;
-
-
-
-function edit3_Callback(hObject, eventdata, handles)
-% hObject handle to edit3 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit3 as text
-% str2double(get(hObject,'String')) returns contents of edit3 as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function edit3_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit3 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-% --- Executes on button press in pushbutton13.
-function pushbutton13_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton13 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-helpmessage = ...
- ['Please choose a title for the load path model. Do not append '...
- 'the load path direction or other information other than the title '...
- 'as these are added automatically in the output files.'...
- ];
-h = helpdlg(helpmessage, 'Choosing a Title');
-
-help_dialog_settings(h)
-
-
-% --- Executes on button press in checkbox4.
-function checkbox4_Callback(hObject, eventdata, handles)
-% hObject handle to checkbox4 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hint: get(hObject,'Value') returns toggle state of checkbox4
-
-
-% --- Executes on button press in pushbutton14.
-function pushbutton14_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton14 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-helpmessage = ...
- ['Turn this option on if plotting pulse. '...
- 'Code will create seeds and define minimum and maximum for plot of pulse.'
- ];
-h = helpdlg(helpmessage, 'Plotting Pulse');
-
-help_dialog_settings(h)
-
-
-% --- Executes on button press in pushbutton15.
-function pushbutton15_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton15 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
- folder_name = uigetdir('C:\', 'Select Save Directory');
- set(handles.edit4, 'String', folder_name)
-
-
-function edit4_Callback(hObject, eventdata, handles)
-% hObject handle to edit4 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit4 as text
-% str2double(get(hObject,'String')) returns contents of edit4 as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function edit4_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit4 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-% --- Executes on button press in pushbutton16.
-function pushbutton16_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton16 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-helpmessage = ...
- ['The default save directory is the C: drive. Select an alternative '...
- 'directory to save the output files and results.'...
- newline newline...
- '\bfNote:\rm Ensure the "data_*.mat" data file is in the save '...
- 'directory if you are wanting to reuse the initilaisation data from '...
- 'a previous simulation. Otherwise this information will be '...
- 'recalculated, extending runtimes.'
- ];
-h = helpdlg(helpmessage, 'Save Directory Selection');
-
-help_dialog_settings(h)
-
-
-% function retval = save_dir_check(save_dir)
-% retval = 1;
-% errmsg = '';
-%
-% if ~exist(save_dir, 'file')
-% retval = 0;
-% errmsg = ['The file does not exist.'...
-% newline newline...
-% 'See "What''''s This?" for details on how to fill this field.'];
-% end
-%
-% if ~retval
-% errordlg(errmsg,'File Error');
-% end
-
-
-
-
-function [retval] = sim_folder_check(sim_dir)
- retval = 1;
-
- req_files = {'ds.dat','nodeInfo.txt','nodalSolution.txt'};
-
- if ~exist(sim_dir, 'dir')
- retval = 0;
- errmsg = ['The directory does not exist or is not a folder.'...
- newline newline...
- 'See "What''''s This?" for details on how to fill this field.'];
- end
-
- listing = dir(sim_dir);
- file_list = {listing.name};
- num_files = size(intersect(file_list,req_files),2);
-
- if sum(num_files) <length(req_files)
- retval = 0;
- errmsg = ['The appropriate files cannot be found. '...
- 'Ensure all required files are available and '...
- 'named according to the help directions.'...
- newline newline...
- 'See "What''''s This?" for details.'];
- end
-
- if ~retval
- e = errordlg(errmsg,'File Error');
- help_dialog_settings(e)
- end
-
-function [retval] = seed_point_check(seed_dir)
- retval = 1;
- errmsg = '';
-
- if ~exist(seed_dir, 'file')
- retval = 0;
- errmsg = ['The file does not exist.'...
- newline newline...
- 'See "What''''s This?" for details on how to fill this field.'];
- end
-
- if ~retval
- e = errordlg(errmsg,'File Error');
- help_dialog_settings(e)
- end
-
-
-
- % --- Executes on button press in pushbutton12.
-function pushbutton12_Callback(hObject, eventdata, handles)
-% hObject handle to pushbutton12 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
- if ~handles.cmd_getDir.UserData
- errmsg = ['The appropriate files cannot be found. '...
- 'The simulation cannot be started without the correct files. '...
- 'Please select the correct Simulation Folder Path.'...
- newline newline...
- 'See "What''''s This?" for details.'];
- e = errordlg(errmsg,'File Error');
- help_dialog_settings(e)
- return
- end
-
- if ~handles.pushbutton4.UserData
- errmsg = ['Please ensure the appropriate seed file is selected.'...
- 'The simulation cannot be started without the correct files. '...
- newline newline...
- 'See "What''''s This?" for details.'];
- e = errordlg(errmsg,'File Error');
- help_dialog_settings(e)
- return
- end
-
- if ~step_size_error_check(handles.edit5)
- return
- end
-
- if ~path_length_error_check(handles.edit6)
- return
- end
-
- %if ~path_minimum_vector_error_check(handles.edit7)
- % return
- %end
-
- %dimension = handles.popupmenu1.String{handles.popupmenu1.Value};
- dimension = '3D';
- model_name = handles.edit3.String;
- pulse = handles.checkbox4.Value;
- parallel = handles.checkbox1.Value;
- newPDF = handles.checkbox2.Value;
- recompute = handles.checkbox3.Value;
- sim_dir = handles.edit1.String;
- seed_dir = handles.edit2.String;
- save_dir = handles.edit4.String;
- path_dir = handles.popupmenu2.String{handles.popupmenu2.Value};
- step_size = handles.edit5.UserData;
- path_length = handles.edit6.UserData;
- plot_minimum_vector = handles.edit7.UserData;
- plot_maximum_vector = handles.edit8.UserData;
- Run_Solve_loadpath3D(...
- sim_dir, seed_dir, save_dir, model_name,path_dir,...
- pulse, parallel, newPDF,recompute, step_size, path_length,...
- plot_minimum_vector, plot_maximum_vector);
-
-function edit5_Callback(hObject, eventdata, handles)
-% hObject handle to edit5 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit5 as text
-% str2double(get(hObject,'String')) returns contents of edit5 as a double
- if step_size_error_check(hObject)
- hObject.UserData = str2double(get(hObject,'String'));
- end
-
-% --- Executes during object creation, after setting all properties.
-function edit5_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit5 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-
-function edit6_Callback(hObject, eventdata, handles)
-% hObject handle to edit6 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit6 as text
-% str2double(get(hObject,'String')) returns contents of edit6 as a double
- if path_length_error_check(hObject)
- hObject.UserData = str2double(get(hObject,'String'));
- end
-function [ret] = path_length_error_check(hObject)
- ret = 0;
- if isempty(get(hObject,'String'))
- return
- end
- path_length = str2double(get(hObject,'String'));
- if isnan(path_length) ||~floor(path_length) == path_length || path_length <= 0
- errmsg = ['The the path length must be a positive real integer.'...
- newline newline...
- 'See "What''''s This?" for details.'];
- e = errordlg(errmsg,'Path Length');
- help_dialog_settings(e)
- end
- ret = 1;
-
-function [ret] = step_size_error_check(hObject)
- ret = 0;
- if isempty(get(hObject,'String'))
- return
- end
- step = str2double(get(hObject,'String'));
- if isnan(step) || step<=0
- errmsg = ['The step size must be a positive real number.'...
- newline newline...
- 'See "What''''s This?" for details.'];
- e = errordlg(errmsg,'Step Size Error');
- help_dialog_settings(e)
- end
- ret = 1;
-
-% --- Executes during object creation, after setting all properties.
-function edit6_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit6 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-
-function edit7_Callback(hObject, eventdata, handles)
-% hObject handle to edit7 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit7 as text
-% str2double(get(hObject,'String')) returns contents of edit7 as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function edit7_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit7 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
-
-
-function edit8_Callback(hObject, eventdata, handles)
-% hObject handle to edit8 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles structure with handles and user data (see GUIDATA)
-
-% Hints: get(hObject,'String') returns contents of edit8 as text
-% str2double(get(hObject,'String')) returns contents of edit8 as a double
-
-
-% --- Executes during object creation, after setting all properties.
-function edit8_CreateFcn(hObject, eventdata, handles)
-% hObject handle to edit8 (see GCBO)
-% eventdata reserved - to be defined in a future version of MATLAB
-% handles empty - handles not created until after all CreateFcns called
-
-% Hint: edit controls usually have a white background on Windows.
-% See ISPC and COMPUTER.
-if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
-end
-
Naming output files and killing interfering processes
model_name = [model_name, ' - ',upper(path_dir), ' Path'];
- model_data_name = regexprep(model_name, ' ', '_');
-
- %Want to make this platform independent. This line is only supported in
- %windows distributions. Working on generalising, as yest dont have
- %corresponding mac command.
-% system(['taskkill /fi "WINDOWTITLE eq ', model_name,'.pdf"']);
- if ismac
- slash = '/';
- elseif ispc
- slash = '\';
- system(['taskkill /fi "WINDOWTITLE eq ', model_name,'.pdf"']);
- end
-
- nodei = [sim_dir slash 'nodeInfo.txt'];
- numNodes = importdata(nodei);
- numNodes = numNodes(2);
-
**************** Populate Nodes and Elements *******************
% Detects whether previous data has been computed, if yes, skips
- % recomputation unless forced by user in GUI
-
- if ~exist([save_dir slash 'Path Data' slash 'data_' model_data_name,'.mat'], 'file') || recompute
-
fprintf('New model or user nominated to recompute data. Starting now.\n')
- waitbar(current_time/total_time,wb,sprintf('Computing Initial Data'))
-
- %Nodal Information module
- [StressData, numNodes] = Input_nodeDat(sim_dir, numNodes);
- current_time = current_time + data_read_time/3;
- waitbar(current_time/total_time,wb,sprintf('Computing Initial Data'))
- fprintf('Nodal information complete. Starting stress population.\n')
-
- %Node data module
- [nodes] = Input_NodeDatRead(sim_dir, StressData, numNodes);
- current_time = current_time + data_read_time/3;
- waitbar(current_time/total_time,wb,sprintf('Computing Initial Data'))
- fprintf('Nodal stresses populated. Element generation beginning.\n')
-
- %Element data and main data structure generation - %DK read element connectivity is read
- [nodePerEl, PartArr] = Input_datread(sim_dir,nodes);
- current_time = current_time + data_read_time/3;
-
- fprintf('Elements constructed, directories being created and data being saved.\n')
- mkdir([save_dir, slash 'Path Data'])
- save([save_dir,slash 'Path Data' slash 'data_',model_data_name,'.mat'],'PartArr','nodes', 'nodePerEl');
-
**************** Define quadrilateral faces of elements ************************
**************** and check face normal is positive pointing out ************
**************** Only works for Hex8 Bricks
numParts = 1;
- [irow,numel] = size(PartArr(numParts).elements);
- RN(1:3,1:6,1:numel) = 0.0;
- XC(1:6,1:numel) = 0.0;
- YC(1:6,1:numel) = 0.0;
- ZC(1:6,1:numel) = 0.0;
- nfaces = 6;
- %numel = PartArr(1).span;
- I = 1;
- J = 2;
- K = 3;
- L = 4;
- M = 5;
- N = 6;
- O = 7;
- P = 8;
- dkfaces = [[J;I;L;K],[I;J;N;M],[J;K;O;N],[K;L;P;O],[L;I;M;P],[M;N;O;P]];
- for kk = 1:numel
- elnods = PartArr(1).elements(kk).nodenums;
- for k = 1:nfaces
- for kkk = 1:4
- kkkk = dkfaces(kkk,k);
- kkkkk = elnods(kkkk);
- Xdk(kkk,k) = nodes(kkkkk).xCoordinate;
- Ydk(kkk,k) = nodes(kkkkk).yCoordinate;
- Zdk(kkk,k) = nodes(kkkkk).zCoordinate;
- end
- %Centroid of face
- XC(k,kk) = 0.0;
- YC(k,kk) = 0.0;
- ZC(k,kk) = 0.0;
- for kkk = 1:4
- XC(k,kk) = XC(k,kk) + Xdk(kkk,k)/4.0;
- YC(k,kk) = YC(k,kk) + Ydk(kkk,k)/4.0;
- ZC(k,kk) = ZC(k,kk) + Zdk(kkk,k)/4.0;
- end
- end
- %CG of element kk
- for kkk=1:3
- CGXYZ(kkk,kk) = 0.0;
- end
- for k = 1 : nfaces;
- CGXYZ(1,kk) = CGXYZ(1,kk) + XC(k,kk)/6.0;
- CGXYZ(2,kk) = CGXYZ(2,kk) + YC(k,kk)/6.0;
- CGXYZ(3,kk) = CGXYZ(3,kk) + ZC(k,kk)/6.0;
- end
- for k = 1:nfaces;
- %Normal to face
- V1 = Xdk(3,k) - Xdk(1,k);
- V2 = Ydk(3,k) - Ydk(1,k);
- V3 = Zdk(3,k) - Zdk(1,k);
- RL = V1*V1 + V2*V2 + V3*V3;
- RL = sqrt(RL);
- V1 = V1/RL;
- V2 = V2/RL;
- V3 = V3/RL;
- W1 = Xdk(4,k) - Xdk(2,k);
- W2 = Ydk(4,k) - Ydk(2,k);
- W3 = Zdk(4,k) - Zdk(2,k);
- RL = W1*W1 + W2*W2 + W3*W3;
- RL = sqrt(RL);
- W1 = W1/RL;
- W2 = W2/RL;
- W3 = W3/RL;
- %Normal = V1 X V2
- RN(1,k,kk) = V2*W3-V3*W2;
- RN(2,k,kk) = V3*W1-V1*W3;
- RN(3,k,kk) = V1*W2-V2*W1;
- V1 = XC(k,kk) - CGXYZ(1,kk);
- V2 = YC(k,kk) - CGXYZ(2,kk);
- V3 = ZC(k,kk) - CGXYZ(3,kk);
- dot = RN(1,k,kk)*V1 + RN(2,k,kk)*V2 + RN(3,k,kk)*V3;
- if dot < 0;
- for kkk = 1:3;
- RN(kkk,k,kk) = -RN(kkk,k,kk);
- end
- end
- end
- end
- clear N
- N(1,:,:) = XC;
- N(2,:,:) = YC;
- N(3,:,:) = ZC;
-
**************** If numSeeds == 0 Define Seeds based on maximum pointing vector ************************
**************** Defines seeds at peak of pulse for transient solution ************************
if numSeeds == 0;
- %Set up list of element pointing vectors
- %Determine x-coordinate for maximum magnitude of pointing vector
- %to define peak of pulse. Set seeds on all elements with XCG
- %equal to that value
- VectorMag(1:numel) = 0.0;
- for k = 1:numel
- elnods = PartArr(1).elements(k).nodenums;
- PointVec(1:3) = 0.0;
- for kk = 1,8;
- kkk = elnods(kk);
- if path_dir == 'X'
- PointVec(1) = PointVec(1) + nodes(kkk).xStress/8.0;
- PointVec(2) = PointVec(2) + nodes(kkk).xyStress/8.0;
- PointVec(3) = PointVec(3) + nodes(kkk).xzStress/8.0;
- end
- if path_dir == 'Y'
- PointVec(1) = PointVec(1) + nodes(kkk).xyStress/8.0;
- PointVec(2) = PointVec(2) + nodes(kkk).yStress/8.0;
- PointVec(3) = PointVec(3) + nodes(kkk).yzStress/8.0;
- end
- if path_dir == 'Z'
- PointVec(1) = PointVec(1) + nodes(kkk).xzStress/8.0;
- PointVec(2) = PointVec(2) + nodes(kkk).yzStress/8.0;
- PointVec(3) = PointVec(3) + nodes(kkk).zStress/8.0;
- end
- end
- VectorMag(k) = sqrt(PointVec(1)*PointVec(1)+PointVec(2)*PointVec(2)+PointVec(3)*PointVec(3));
- end
- [VectorSort, IX] = sort(VectorMag);
- k=1;
- kk = IX(numel-k+1);
- xs = CGXYZ(1,kk);
- ys = CGXYZ(2,kk);
- zs = CGXYZ(3,kk);
- nSeeds = 0;
- for k = 1:numel;
- if abs(CGXYZ(1,k) - xs) < 0.1;
- nSeeds = nSeeds + 1;
- xseed(nSeeds) = CGXYZ(1,k);
- yseed(nSeeds) = CGXYZ(2,k);
- zseed(nSeeds) = CGXYZ(3,k);
- end
- end
- numSeeds = nSeeds;
- end
-
else
- %This loads data if the preprocessign has already been done.
- fprintf('Previous model detected, loading data.\n')
- waitbar(current_time/total_time,wb,sprintf('Loading Data'))
- load([save_dir slash 'Path Data' slash 'data_' model_data_name,'.mat']);
- current_time = current_time + data_read_time;
-
- fprintf('Data loaded. Starting path computation.\n')
-
- end
- %******************** Waitbar and Status Update ***************************
-
- if getappdata(wb,'canceling')
- delete(wb)
- return
- end
-
- waitbar(current_time/total_time,wb,sprintf('Starting Paths'))
-
%Initialise data containers for load paths
-
- Paths(numSeeds).X.forward = [];
- Paths(numSeeds).Y.forward = [];
- Paths(numSeeds).Z.forward = [];
- Paths(numSeeds).I.forward = [];
- Paths(numSeeds).X.total = [];
- Paths(numSeeds).Y.total = [];
- Paths(numSeeds).Z.total = [];
- Paths(numSeeds).I.total = [];
-
- switch parallel
- %Parallel computation if load paths
- case 1
- workers = 4;
- % Currently 2D and 3D are separate, very crude. Future
- % update is to pass as vector and scale all functions
- % according to the length of that vector.
- parfor (i = 1:numSeeds, workers)
- fprintf('Starting path %i\n',i)
- warning('off','MATLAB:scatteredInterpolant:DupPtsAvValuesWarnId');
- %Main work horse module - Runge Kutta
-
- [x, y, z, intense] = RunLibrary_rungekuttaNatInter3D(xseed(i),...
- yseed(i),zseed(i), PartArr, path_dir, nodePerEl,path_length,false,step_size,wb,nodes,RN,XC,YC,ZC);
- if isempty(x)
- fprintf('Path %i unsuccessful\n',i)
- continue
- end
-
- Paths(i).X.forward = x;
- Paths(i).Y.forward = y;
- Paths(i).Z.forward = z;
- Paths(i).I.forward = intense;
-
- [x, y, z, intense ] = ...
- RunLibrary_rungekuttaNatInter3D(xseed(i), yseed(i),...
- zseed(i), PartArr, path_dir, nodePerEl,path_length, true,step_size, wb,RN,N);
- Paths(i).X.total = [fliplr(x), Paths(i).X.forward];
- Paths(i).Y.total = [fliplr(y), Paths(i).Y.forward];
- Paths(i).Z.total = [fliplr(z), Paths(i).Z.forward];
- Paths(i).I.total = [fliplr(intense), Paths(i).I.forward];
- [mdk,ndk] = size(intense);
- fprintf('Path %i done\n',i);
- end
- current_time = current_time +80;
- % ****************** Single thread processing
- case 0
- for i = 1:numSeeds
- %fprintf('Starting path %i\n',i)
- if getappdata(wb,'canceling')
- delete(wb)
- return
- end
-
- waitbar(current_time/total_time,wb,sprintf('Seed %i of %i Computing', i, numSeeds))
- warning('off','MATLAB:scatteredInterpolant:DupPtsAvValuesWarnId');
- reverse_path = false;
- [dkx, dky, dkz, dkintense] = RunLibrary_rungekuttaNatInter3D(...
- xseed(i),yseed(i),zseed(i), PartArr, path_dir,...
- path_length,reverse_path,step_size, wb,RN,N);
- if isempty(dkx)
- fprintf('Path %i unsuccessful\n',i)
- continue
- end
-
- %Next block only plot peak of pulse
- if pulse == 1
- clear x;
- clear y;
- clear z;
- clear intense;
- x = [];
- y = [];
- z = [];
- intense = [];
- kdk = 1;
- kkdk = 0;
- [mdk,ndk] = size(dkintense);
- while kdk < ndk;
- %Hard wired to plot path only if magnitude of pointing vector > 20
- %pointing vector > 20.0
- if dkintense(kdk) > 20.0;
- kkdk = kkdk+1;
- x(kkdk) = dkx(kdk);
- y(kkdk) = dky(kdk);
- z(kkdk) = dkz(kdk);
- intense(kkdk) = dkintense(kdk);
- end
- kdk = kdk + 1;
- end
- end
- if pulse == 0
- x = dkx;
- y = dky;
- z = dkz;
- intense = dkintense;
- end
-
- Paths(i).X.forward = x;
- Paths(i).Y.forward = y;
- Paths(i).Z.forward = z;
- Paths(i).I.forward = intense;
- current_time = current_time + 1/numSeeds *80/2;
- reverse_path = true;
- [dkx, dky, dkz, dkintense ] = RunLibrary_rungekuttaNatInter3D(...
- xseed(i), yseed(i), zseed(i), PartArr, path_dir,...
- path_length,reverse_path,step_size, wb,RN,N);
-
- %Next block added by dk to only plot peak of pulse
-
- if pulse == 1
- clear x;
- clear y;
- clear z;
- clear intense;
- x = [];
- y = [];
- z = [];
- intense = [];
- kdk = 1;
- kkdk = 0;
- [mdk,ndk] = size(dkintense);
- while kdk < ndk;
- %Only plot path if magnitude of pointing
- %vector > 20 and x coordinate is < 200.
- %This is to stop path extending past 200 in some
- %cases and changing length of plot for movie.
- if dkintense(kdk) > plot_minimum_vector;
- kkdk = kkdk+1;
- x(kkdk) = dkx(kdk);
- y(kkdk) = dky(kdk);
- z(kkdk) = dkz(kdk);
- intense(kkdk) = dkintense(kdk);
- end
- kdk = kdk + 1;
- end
- end
- if pulse == 0
- x = dkx;
- y = dky;
- z = dkz;
- intense = dkintense;
- [mdk,ndk] = size(intense);
- end
- Paths(i).X.total = [fliplr(x), Paths(i).X.forward];
- Paths(i).Y.total = [fliplr(y), Paths(i).Y.forward];
- Paths(i).Z.total = [fliplr(z), Paths(i).Z.forward];
- Paths(i).I.total = [fliplr(intense), Paths(i).I.forward];
- current_time = current_time + 1/numSeeds *80/2;
- fprintf('Path %i done\n',i)
- end
- end
- fprintf('All seeds tested and appropriate paths computed. Saving path data.\n')
-
- %******************** Waitbar and Status Update ***************************
-
- if getappdata(wb,'canceling')
- delete(wb)
- return
- end
- waitbar(current_time/total_time,wb,sprintf('Paths Finished Paths, Saving and Plotting now...\n'))
-
************** Plotting and Printing ****************************
%Data is output to .mat files so that in a future update the user can
- %modulate the load path program. For example they could load previous
- %paths and just run the plotting and printing section of the code. Or
- %the user could just compute the paths and then send them to someone
- %else to plot them on their machine or with their specific settings.
-
- %Other considerations are for future transient analysis where multiple
- %data sets may have to be condensed. And that its a good backup of the
- %path calculation.
-
- save([save_dir slash 'Path Data' slash 'pathdata_' model_data_name '.mat'], 'Paths');
- fig = figure;
- fprintf('Plotting Paths\n')
-
- modelPlot3D([Paths(:).X],[Paths(:).Y],[Paths(:).Z],[Paths(:).I],PartArr,nodes,pulse)
- % Create new directory to store the output plots
- mkdir(save_dir,[slash 'Path Plots'])
- %********************Name of 'bmp' file hard-wired ************************
- %saveas(fig,'examples\Example1 - Isotropic Plate with Loaded Hole\Path Plots\myplot.bmp')
- saveas(fig,[save_dir slash 'Path Plots' slash model_name, '.bmp'])
- %******************** Waitbar and Status Update ***************************
- if getappdata(wb,'canceling')
- delete(wb)
- return
- end
- fprintf('Printing to PDF\n')
- current_time = current_time + plot_time;
- waitbar(current_time/total_time,wb,sprintf('Printing PDF'))
-
- if newPDF
- dt = datestr(now,'HH.MM.SS_dd/mm/yy');
- dateAppenedFN = [save_dir, slash 'Path Plots' slash ,model_name,'_', dt, '.pdf'];
- else
- dateAppenedFN = [save_dir,slash 'Path Plots' slash ,model_name, '.pdf'];
- end
-
- % Contrary to variable name and the description in the GUI, this was
- % repurposed to let the user choose where to print the plot to a pdf or
- % not. As the density is so high to see the paths properly it can be an
- % expensive task to compute.
-
- %Future update will check whether an instance of the .pdf is already
- %open and modify the name so that saving conflicts dont happen.
-
- delete(wb)
- fprintf('Load paths complete.\n')
-
- %%********************************End of Computation******************************
-
end
-function [] = modelPlot3D(x_paths,y_paths,z_paths,Intensity,PartArr,nodes,pulse)
- %Just some custom settings for plotting the paths
- Alpha = 0.1;
- Buffer = 0.35;
- RunPlot_wireFrame(PartArr,Alpha, Buffer,nodes);
- seedLength = size(x_paths(:),1);
- maxInt = max(max([Intensity.total]));
- minInt = min(min([Intensity.total]));
- if isempty(maxInt)
- disp('No Successful Paths')
- return
- end
- for k = 1:seedLength
- if isempty(x_paths(k).total)
- fprintf('Path %i unsuccessful', k)
- continue
- end
- cd = colormap('parula');
- %%*********************************If transient solution hardwire maximum ***********
- %%*********************************Should be same for all plots in sequence *********
- %%*********************************Not just current plot. ***************************
- %%*********************************pulse = 1 if plot is transient *************
- if pulse == 1
- cd = colormap(flipud(hot));
- cdd = [];
- cd = [];
- cdd = flipud(hot(64));
- vmax = max([Intensity(k).total]);
- if vmax > plot_maximum_vector;
- vmax = plot_maximum_vector;
- end
- ncol = 64 * vmax/plot_maximum_vector;
- for i = 1:ncol;
- for j = 1:3;
- cd(i,j) = cdd(i,j);
- end
- end
- cd = colormap(cd);
- end
- %finish
- cd = interp1(linspace(minInt,maxInt,length(cd)),cd,Intensity(k).total);
- cd = uint8(cd'*255);
- cd(4,:) = 255;
- paths = line(x_paths(k).total,y_paths(k).total,z_paths(k).total);
- drawnow;
- set(paths.Edge,'ColorBinding','interpolated', 'ColorData',cd)
- end
- %Turn off plot of colorbar
- colorbar;
-end
-