Skip to content

Commit

Permalink
Merge pull request #318 from mtex-toolbox/develop
Browse files Browse the repository at this point in the history
MTEX 5.0.1
  • Loading branch information
ralfHielscher authored Feb 25, 2018
2 parents e4dd48a + bb32a5d commit c1c3c41
Show file tree
Hide file tree
Showing 73 changed files with 824 additions and 204 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
2 changes: 1 addition & 1 deletion CHANGELOG
18 changes: 4 additions & 14 deletions EBSDAnalysis/@EBSD/EBSD.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
properties
id = [] % unique id's starting with 1
rotations = rotation % rotations without crystal symmetry
A_D = [] % adjecency matrix of the measurement points
end

% general properties
Expand All @@ -37,11 +36,14 @@

properties (Dependent = true)
orientations % rotation including symmetry
weights % is this realy needed?
grainId % id of the grain to which the EBSD measurement belongs to
mis2mean % misorientation to the mean orientation of the corresponding grain
end

properties (Access = protected)
A_D = [] % adjecency matrix of the measurement points
end

methods

function ebsd = EBSD(rot,phases,CSList,varargin)
Expand Down Expand Up @@ -153,18 +155,6 @@

end

function w = get.weights(ebsd)
if ebsd.isProp('weights')
w = ebsd.prop.weights;
else
w = ones(size(ebsd));
end
end

function ebsd = set.weights(ebsd,weights)
ebsd.prop.weights = weights;
end

% function dx = get.dx(ebsd)
% uc = ebsd.unitCell;
% if size(uc,1) == 4
Expand Down
38 changes: 18 additions & 20 deletions EBSDAnalysis/@EBSD/calcTensor.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
% compute the average tensor for an EBSD data set
%
% Syntax
% [TVoigt, TReuss, THill] = calcTensor(ebsd,T_phase1,T_phase2,...) - returns
% the Voigt--, Reuss-- and Hill-- @tensor, applies each tensor
% given in order of input to each phase
% % applies a tensor on a given phase
% [TVoigt, TReuss, THill] = calcTensor(ebsd('phase2'),T_phase2)
%
% [TVoigt, TReuss, THill] = calcTensor(ebsd('phase2'),T_phase2) - returns the Voigt--,
% Reuss-- and Hill-- @tensor, applies a tensor
% on a given phase
% % applies each tensor given in order of input to each phase
% [TVoigt, TReuss, THill] = calcTensor(ebsd,T_phase1,T_phase2,...)
%
% THill = calcTensor(ebsd,T_phase1,T_phase2,'Hill') - returns the specified
% @tensor, i.e. 'Hill' in this case
% % returns the specified tensor
% THill = calcTensor(ebsd,T_phase1,T_phase2,'Hill')
%
% TVoigt = calcTensor(ebsd,T_phase1,T_phase2,'geometricMean') - use
% geometric mean instead of arithmetric one
% % geometric mean instead of arithmetric one
% TGeom = calcTensor(ebsd,T_phase1,T_phase2,'geometricMean')
%
% Input
% ebsd - @EBSD
Expand All @@ -24,9 +22,10 @@
% T - @tensor
%
% Options
% Voigt - voigt mean
% Reuss - reuss mean
% Hill - hill mean
% Voigt - Voigt mean
% Reuss - Reuss mean
% Hill - Hill mean
% geometricMean -geometric mean
%
% See also
%
Expand Down Expand Up @@ -59,11 +58,10 @@
% cycle through phases and tensors
for p = phases

% extract orientations and wights
% extract orientations
ebsd_p = subSet(ebsd,ebsd.phaseId == p);
ori = ebsd_p.orientations;
weights = ebsd_p.weights ./ length(ebsd);


rotT = rotate(T{p},ori);
rotInvT = rotate(inv(T{p}),ori);

Expand All @@ -75,11 +73,11 @@

end

% take the mean of the rotated tensors times the weight
TVoigt = sum(weights .* rotT) + TVoigt;
% take the mean of the rotated tensors
TVoigt = sum(rotT ./ length(ebsd)) + TVoigt;

% take the mean of the rotated tensors times the weight
TReuss = sum(weights .* rotInvT) + TReuss;
% take the mean of the rotated tensors
TReuss = sum(rotInvT ./ length(ebsd)) + TReuss;

end

Expand Down
2 changes: 1 addition & 1 deletion INSTALL
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


# rule for making release
RNAME = mtex-5.0.0
RNAME = mtex-5.0.1
RDIR = ../releases
release:
rm -rf $(RDIR)/$(RNAME)*
Expand Down
2 changes: 0 additions & 2 deletions ODFAnalysis/@ODF/plotPDF.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ function plotPDF(odf,h,varargin)
argin_check([h{:}],'Miller');
for i = 1:length(h), h{i} = odf.CS.ensureCS(h{i}); end



% plotting grid
sR = fundamentalSector(odf.SS,varargin{:});
rAll = plotS2Grid(sR,varargin{:});
Expand Down
11 changes: 11 additions & 0 deletions S2Fun/@S2AxisField/S2AxisField.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
classdef S2AxisField
% a class represeneting a axis field on the sphere

methods

function AF = S2AxisField(varargin)
end

end

end
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion S2Fun/@S2AxisFieldHarmonic/S2AxisFieldHarmonic.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
classdef S2AxisFieldHarmonic
classdef S2AxisFieldHarmonic < S2AxisField
% a class represeneting a axis field on the sphere

properties
Expand Down
11 changes: 4 additions & 7 deletions S2Fun/@S2AxisFieldHarmonic/eval.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@
% f - @vector3d
%

xyz = zeros(length(v),3);
M = sVF.sF.eval(v);
for i = 1:length(v)
MLocal = reshape(M(i,[1 2 4 2 3 5 4 5 6]),3,3);
[xyz(i,:),~,~] = svds(MLocal,1);
end
f = vector3d(xyz.','antipodal');
f = f(:);

[v,~] = eig3(M(:,1),M(:,2),M(:,4),M(:,3),M(:,5),M(:,6));

f = v(3,:).';

end
53 changes: 53 additions & 0 deletions S2Fun/@S2AxisFieldTri/S2AxisFieldTri.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
classdef S2AxisFieldTri < S2AxisField
% a class represeneting a function on the sphere

properties
tri % S2Triangulation
values = vector3d % function values
end

properties (Dependent = true)
vertices
antipodal
end

methods

function sVF = S2AxisFieldTri(nodes,values)
% initialize a spherical vector field

if nargin == 0, return; end

if isa(nodes,'function_handle')
n = equispacedS2Grid('resolution',1.5*degree);
values = nodes(n);
nodes = n;
end

if isa(nodes,'S2Triangulation')
sVF.tri = nodes;
else
sVF.tri = S2Triangulation(nodes);
end

sVF.values = values;

end

function v = get.vertices(S2F)
v = S2F.tri.vertices;
end

function v = get.antipodal(S2F)
v = S2F.tri.antipodal;
end

function S2F = set.vertices(S2F,v)
if ~isempty(S2F.values), S2F.values = S2F.eval(v); end
S2F.tri.vertices = v;
S2F.tri.update;
end

end

end
16 changes: 16 additions & 0 deletions S2Fun/@S2AxisFieldTri/angle.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function sF = angle(varargin)
%
% Syntax
% sVF = angle(sVF,sVF2)
% sVF = angle(sVF,v)
%
% Input
% sVF - @S2AxisFieldTri
% sVF2 - @S2AxisField
% v - @vector3d
%
% Output
% sF - @S2FunTri
%
sF = dot(varargin{:});
sF.values = acos(sF.values);
30 changes: 30 additions & 0 deletions S2Fun/@S2AxisFieldTri/cross.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function sVF = cross(sVF, a)
%
% Syntax
% sVF = cross(sVF1,sVF2)
% sVF = cross(sVF1,v)
%
% Input
% sVF1 - @S2VectorFieldTri
% sVF2 - @S2VectorField
% v - @vector3d
%
% Output
% sF - @S2VectorFieldTri
%

% first should be S2VectorFieldTri
if ~isa(sVF,'S2AxisFieldTri')
sVF = -cross(a, sVF);
return
end

if isa(a,'vector3d')
sVF.values = cross(sVF.values, a);
elseif isa(a,'S2AxisFieldTri') || isa(a,'S2VectorFieldTri')
sVF.values = cross(sVF.values, b.values);
else
sVF.values = cross(sVF.values, b.eval(sVF.vertices));
end

end
27 changes: 27 additions & 0 deletions S2Fun/@S2AxisFieldTri/dot.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function sF = dot(sVF, a, varargin)
%
% Syntax
% sVF = dot(sVF,sVF2)
% sVF = dot(sVF,v)
%
% Input
% sVF - @S2AxisFieldTri
% sVF2 - @S2AxisField
% v - @vector3d
%
% Output
% sF - @S2FunTri
%

% first should be S2VectorFieldTri
if ~isa(sVF,'S2AxisFieldTri'), [sVF,a] = deal(a,sVF); end

if isa(a,'vector3d')
sF = S2FunTri(sVF.tri, dot(sVF.values, a, varargin{:}));
elseif isa(a,'S2AxisFieldTri') || isa(a,'S2VectorFieldTri')
sF = S2FunTri(sVF.tri, dot(sVF.values, b.values, varargin{:}));
else
sF = S2FunTri(sVF.tri, dot(sVF.values, b.eval(sVF.vertices), varargin{:}));
end

end
29 changes: 29 additions & 0 deletions S2Fun/@S2AxisFieldTri/eval.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function v = eval(sVF,nodes)
%
% Syntax
% v = eval(sFV,nodes)
%
% Input
% sFV - @S2VectorField
% nodes - interpolation nodes @vector3d
%
% Output
% v - @vector3d
%

% compute bariocentric coordinates for interpolation
bario = calcBario(sVF.tri,nodes);

% interpolate in the space of symmetric 3x3 matrixes
[x,y,z] = double(sVF.values);
m = [x(:).*x(:),x(:).*y(:),y(:).*y(:),x(:).*z(:),y(:).*z(:),z(:).*z(:)];
M = bario * m;

% go back to vectors by computing the eigen vectors of the interpolated 3x3
% matrices
[v,~] = eig3(M(:,1),M(:,2),M(:,4),M(:,3),M(:,5),M(:,6));

% take only the largest eigenvector
v = v(3,:).';

end
2 changes: 1 addition & 1 deletion S2Fun/@S2Fun/quiverSection.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function quiverSection(sF,sVF,sec,varargin)
v = sVF.eval(S2);
end
v = v(:);
if check_option(varargin,'normalized'), v = v.normalized; end
if check_option(varargin,'normalized'), v = v.normalize; end

d = reshape(sF.eval(S2),length(S2), []);

Expand Down
10 changes: 5 additions & 5 deletions S2Fun/@S2FunHarmonic/conv.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
% sF = conv(sF, A)
%
% Input
% sF - @S2FunHarmonic
% sF - @S2FunHarmonic
% psi - @kernel
% A - double - list of Legendre coeficients
% A - double list of Legendre coeficients
%
% Output
% sF - @S2FunHarmonic
% sF - @S2FunHarmonic
%

% extract Legendre coefficients
if isa(psi,'double')
A = psi;
A = psi(:);
else
A = psi.A;
A = psi.A(:);
A = A ./ (2*(0:length(A)-1)+1).';
end
A = A(1:min(sF.bandwidth+1,length(A)));
Expand Down
9 changes: 3 additions & 6 deletions S2Fun/@S2FunHarmonic/dot.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
% inner product
%
% Syntax
% sF = conv(sF, psi)
% sF = conv(sF, A)
% sF = dot(sF1, sF1)
%
% Input
% sF - @S2FunHarmonic
% psi - @kernel
% A - double - list of Legendre coeficients
% sF1, sF2 - @S2FunHarmonic
%
% Output
% sF - @S2FunHarmonic
% sF - @S2FunHarmonic
%

bw = min(sF1.bandwidth,sF2.bandwidth);
Expand Down
Loading

0 comments on commit c1c3c41

Please sign in to comment.