Skip to content
Snippets Groups Projects
Commit 3be2d039 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

IPF: speedup if we have some information already

parent d12f8106
No related branches found
No related tags found
No related merge requests found
...@@ -44,8 +44,10 @@ function [cmap, Vsst, Vc_symm, vargs_out] = gtIPFCmap(phaseid, LD, varargin) ...@@ -44,8 +44,10 @@ function [cmap, Vsst, Vc_symm, vargs_out] = gtIPFCmap(phaseid, LD, varargin)
par.saturate = true; par.saturate = true;
par.save = false; par.save = false;
par.crystal_system = ''; par.crystal_system = '';
par.spacegroup = '';
par.r_vectors = []; par.r_vectors = [];
par.background = true; par.background = true;
par.symm = [];
[par, rej_pars] = parse_pv_pairs(par, varargin); [par, rej_pars] = parse_pv_pairs(par, varargin);
if ~exist('phaseid', 'var') || isempty(phaseid) if ~exist('phaseid', 'var') || isempty(phaseid)
...@@ -76,9 +78,13 @@ if size(r_vectors, 2) == 4 ...@@ -76,9 +78,13 @@ if size(r_vectors, 2) == 4
end end
% Get the crystal system % Get the crystal system
if isempty(par.crystal_system) if (isempty(par.crystal_system) || isempty(par.spacegroup))
parameters = load('parameters.mat'); parameters = gtLoadParameters();
par.crystal_system = parameters.parameters.cryst(phaseid).crystal_system; par.crystal_system = parameters.cryst(phaseid).crystal_system;
par.spacegroup = parameters.cryst(phaseid).spacegroup;
end
if (isempty(par.symm))
par.symm = gtCrystGetSymmetryOperators(par.crystal_system, par.spacegroup);
end end
% Compute all orientation matrices g % Compute all orientation matrices g
...@@ -90,7 +96,7 @@ all_g = gtMathsRod2OriMat(r_vectors.'); ...@@ -90,7 +96,7 @@ all_g = gtMathsRod2OriMat(r_vectors.');
LDc = gtVectorLab2Cryst(LD, all_g); LDc = gtVectorLab2Cryst(LD, all_g);
% Get the color and vector in the SST triangle % Get the color and vector in the SST triangle
[cmap, Vsst, ~, Vc_symm] = gtCrystVector2SST(LDc, par.crystal_system, [], par.saturate); [cmap, Vsst, ~, Vc_symm] = gtCrystVector2SST(LDc, par.crystal_system, par.symm, par.saturate);
if (par.background) if (par.background)
cmap = [ 0 0 0 ; cmap ]; cmap = [ 0 0 0 ; cmap ];
...@@ -105,7 +111,7 @@ if (par.save) ...@@ -105,7 +111,7 @@ if (par.save)
disp(['IPF cmap saved in ' fileName]) disp(['IPF cmap saved in ' fileName])
end end
if nargout > 3 if (nargout > 3)
par.r_vectors = r_vectors; par.r_vectors = r_vectors;
par.phaseid = phaseid; par.phaseid = phaseid;
par.samDir = LD; par.samDir = LD;
......
This diff is collapsed.
...@@ -24,12 +24,12 @@ function [rgb, Vsst, Vsst_p, Vc_symm] = gtCrystVector2SST(Vc, crystal_system, sy ...@@ -24,12 +24,12 @@ function [rgb, Vsst, Vsst_p, Vc_symm] = gtCrystVector2SST(Vc, crystal_system, sy
% %
% Version 001 15-10-2012 by YGuilhem % Version 001 15-10-2012 by YGuilhem
if ~exist('saturate', 'var') || isempty(saturate) if (~exist('saturate', 'var') || isempty(saturate))
saturate = true; saturate = true;
end end
% Get symmetry operators and store g3 operators into an array % Get symmetry operators and store g3 operators into an array
if ~exist('symm', 'var') || isempty(symm) if (~exist('symm', 'var') || isempty(symm))
symm = gtCrystGetSymmetryOperators(crystal_system); symm = gtCrystGetSymmetryOperators(crystal_system);
end end
symm = reshape(cell2mat({symm.g3}), 3, 3, []); symm = reshape(cell2mat({symm.g3}), 3, 3, []);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment