Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfHielscher committed Feb 18, 2018
2 parents b20516b + 20e7622 commit e4dd48a
Show file tree
Hide file tree
Showing 758 changed files with 807,379 additions and 9,248 deletions.
5 changes: 3 additions & 2 deletions EBSDAnalysis/@EBSD/calcTensor.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@

% initialize avarage tensors
TVoigt = T{1};
TVoigt.M = zeros(repmat(3,1,TVoigt.rank));
TVoigt.CS = specimenSymmetry;
TReuss = TVoigt;
TReuss = inv(TVoigt);
TVoigt.M = zeros(repmat(3,1,TVoigt.rank));
TReuss.M = zeros(repmat(3,1,TReuss.rank));

% get phases and populate tensors
phases = unique(ebsd.phaseId)';
Expand Down
7 changes: 6 additions & 1 deletion EBSDAnalysis/@EBSD/plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@

h = plotUnitCells([ebsd.prop.x(:), ebsd.prop.y(:)],...
property, ebsd.unitCell, 'parent', mP.ax, varargin{:});


elseif nargin>1 && isa(varargin{1},'crystalShape')

cS = varargin{1};
plot(ebsd.prop.x,ebsd.prop.y,zUpDown * cS.diameter,ebsd.orientations * cS,varargin{2:end});

else % phase plot

for k=1:numel(ebsd.phaseMap)
Expand Down
2 changes: 1 addition & 1 deletion EBSDAnalysis/@EBSD/subsasgn.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
ebsd.id = subsasgn(ebsd.id,s(1),[]);
ebsd.phaseId = subsasgn(ebsd.phaseId,s(1),[]);

ebsd = EBSD(ebsd)
ebsd = EBSD(ebsd);

elseif ischar(b)

Expand Down
3 changes: 3 additions & 0 deletions EBSDAnalysis/@EBSDsquare/smooth.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,8 @@

% store to EBSD variable
ebsd.rotations = rot;

% set nan rotations to not indexed
ebsd.phaseId(isnan(rot(:))) = 1;

end
2 changes: 1 addition & 1 deletion EBSDAnalysis/@grain2d/area.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
% grains - @grain2d
%
% Output
% A - list of areas
% A - list of areas (in measurement units)
%

A = zeros(length(grains.poly),1);
Expand Down
2 changes: 1 addition & 1 deletion EBSDAnalysis/@grain2d/diameter.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [d] = diameter(grains)
% diameter of a grain
% diameter of a grain in measurement units
% longest distance between any two vertices of the grain boundary

% do extract this as it is much faster
Expand Down
3 changes: 1 addition & 2 deletions EBSDAnalysis/@grain2d/equivalentPerimeter.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
% Input
% grains - @grain2d
%
% Output
% p - perimeter
% Output (in measurement units)
%
% See also
% grain2d/deltaarea grain2d/paris grain2d/equivalentRadius
Expand Down
2 changes: 1 addition & 1 deletion EBSDAnalysis/@grain2d/equivalentRadius.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
% grains - @grain2d
%
% Output
% r - radius
% r - radius (in measurement units)
%
% See also
% grain2d/deltaarea grain2d/equivalentPerimeter grain2d/paris
Expand Down
1 change: 1 addition & 0 deletions EBSDAnalysis/@grain2d/grain2d.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

function grains = set.V(grains,V)
grains.boundary.V = V;
grains.innerBoundary.V = V;

% update V in triple points
tP = grains.triplePoints;
Expand Down
45 changes: 36 additions & 9 deletions EBSDAnalysis/@grain2d/hist.m
Original file line number Diff line number Diff line change
@@ -1,34 +1,59 @@
function hist(grains,varargin)
function [binId, cumArea] = hist(grains,varargin)
% plot a grain size histogram
%
% Syntax
% hist(grains)
% hist(grains,n) % specify the number of bins
%
% % use an arbitrary property for the histogramm
% hist(grains,grains.equivalentRadius)
%
% binId = hist(grains) % returns the bin for each grain
%
% Input
% grains - @grain2d
% n - number of bins, default ist 15
%

[mtexFig,isNew] = newMtexFigure(varargin{:});
mtexFig.keepAspectRatio = false;

if nargin>1 && isnumeric(varargin{1})
% exract area and maybe an aditional property
area = grains.area;
if nargin>1 && isnumeric(varargin{1}) && length(varargin{1}) == length(grains)
prop = varargin{1};
varargin(1) = [];
else
prop = area;
end

if ~isempty(varargin) && isnumeric(varargin{1})
nbins = varargin{1};
else
nbins = 15;
end

area = grains.area;
idList = grains.indexedPhasesId;

bins = linspace(0,max(area)+eps,nbins);
bins = linspace(0,max(prop)+eps,nbins);

cumArea = zeros(numel(bins)-1,numel(idList));
binId = zeros(length(grains),1);

% loop through all phases
for id = 1:numel(idList)

phaseArea = area(grains.phaseId==idList(id));
phaseId = grains.phaseId==idList(id);
phaseArea = area(phaseId);
phaseProp = prop(phaseId);

% find for each area the binId
[tmp,binId] = histc(phaseArea,bins);

% compute the sum of areas belonging to the same bin
[~,binIdLocal] = histc(phaseProp,bins);
binId(phaseId) = binIdLocal;

% compute the sum of areas belonging to the same bin
for i = 1:numel(bins)-1
cumArea(i,id) = sum(phaseArea(binId == i)) ./ sum(area);
cumArea(i,id) = sum(phaseArea(binIdLocal == i)) ./ sum(area);
end

end
Expand All @@ -46,3 +71,5 @@ function hist(grains,varargin)
legend(min{:})

if isNew, mtexFig.drawNow(varargin{:});end

if nargout == 0, clear binId; end
2 changes: 1 addition & 1 deletion EBSDAnalysis/@grain2d/perimeter.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
% grains - @grain2d
%
% Output
% peri - perimeter
% peri - perimeter (in measurement units)
%
% See also
% grain2d/equivalentPerimeter
Expand Down
32 changes: 27 additions & 5 deletions EBSDAnalysis/@grain2d/plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
%
% PatchProperty - see documentation of patch objects for manipulating the
% apperance, e.g. 'EdgeColor'
% Options
% noBoundary - do not plot boundaries
% displayName - name used in legend
%
% See also
% EBSD/plot grainBoundary/plot

Expand All @@ -36,6 +40,12 @@
disp(' plot(oM)')
end

plotBoundary = true;
% allow to plot grain faces only without boundaries
if check_option(varargin,'noBoundary')
plotBoundary = false;
end

% numerical data are given
if nargin>1 && isnumeric(varargin{1})

Expand All @@ -46,6 +56,16 @@

% plot polygons
h = plotFaces(grains.poly,grains.V,property,'parent', mP.ax,varargin{:});

elseif nargin>1 && isa(varargin{1},'crystalShape')

scaling = sqrt(grains.area);
xy = [grains.centroid,scaling*zUpDown];

h = plot(xy + scaling .* (rotate(varargin{1},grains.meanOrientation)),...
'parent', mP.ax,varargin{:});

plotBoundary = false;

elseif check_option(varargin,'FaceColor')

Expand Down Expand Up @@ -83,11 +103,13 @@
end

% we have to plot grain boundary individually
hold on
hh = plot(grains.boundary,varargin{:});
set(get(get(hh,'Annotation'),'LegendInformation'),'IconDisplayStyle','off');
hold off

if plotBoundary
hold on
hh = plot(grains.boundary,varargin{:});
set(get(get(hh,'Annotation'),'LegendInformation'),'IconDisplayStyle','off');
hold off
end

if check_option(varargin,'DisplayName')
legend('-DynamicLegend','location','NorthEast');
end
Expand Down
15 changes: 13 additions & 2 deletions EBSDAnalysis/@grain2d/smooth.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
function grains = smooth(grains,iter,varargin)
% constraint laplacian smoothing of grains
% constraint laplacian smoothing of grain boundaries
% and inner boundaries.
%
% Input
% grains - @grain2d
% iter - number of iterations (optional, default: 1)
%
% Output
% grains - @grain2d
%
% Options
% 'gauss','exp','umbrella' or 'rate' - interpoaltion methods (default: 'rate')
% second_order, S2 - second order smoothing

if nargin < 2 || isempty(iter), iter = 1; end

% compute incidence matrix vertices - faces
I_VF = grains.boundary.I_VF;
I_VF = [grains.boundary.I_VF,grains.innerBoundary.I_VF];

% compute vertice adjacency matrix
A_V = I_VF * I_VF';
Expand Down
3 changes: 2 additions & 1 deletion EBSDAnalysis/EBSDSmoothing/EBSDFilter.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
classdef EBSDFilter < handle
% abstract class for denoising EBSD data

%

methods (Abstract = true)
q = smooth(q,varargin)
end
Expand Down
7 changes: 0 additions & 7 deletions EBSDAnalysis/tools/fft_rho.m

This file was deleted.

6 changes: 0 additions & 6 deletions EBSDAnalysis/tools/fft_theta.m

This file was deleted.

79 changes: 2 additions & 77 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,66 +1,7 @@
# Makefile of the MTEX toolbox
#
#--------------- begin editable section -------------------------------
#
# here comes your operating system
# glnx86 - 32 bit Linux
# glnxa64 - 64 bit Linux
# maci - 32 bit Mac OSX
# maci64 - 64 bit Mac OSX
# win32 - 32 bit Windows
# win64 - 64 bit Windows
#
TARGET= glnxa64
#
# please correct the following installation directories:
#
# path to FFTW, i.e. to libfftw3.a
FFTW_LIB_PATH = /usr/lib/x86_64-linux-gnu/
# path to FFTW header file, i.e., to fftw3.h
FFTW_H_PATH = /usr/include/
#
# path to NFFT, i.e. to libnfft3.a
NFFT_LIB_PATH = /usr/local/lib
# path the NFFT header file, i.e., to nfft.h
NFFT_H_PATH = /usr/local/include/
#
# matlab path
MATLABPATH = /opt/matlab
#
# compiler flags
CFLAGS= -c -O3 -Wall -fomit-frame-pointer -fstrict-aliasing -ffast-math -mfpmath=sse,387 -mieee-fp -m3dnow -mmmx -msse -msse2
LDFLAGS= -lm #-lpthread
# MEX flags
# for 32 bit systems set
#MEXFLAGS=-$(TARGET) -compatibleArrayDims
# for 64 bit systems set
MEXFLAGS=-$(TARGET) -largeArrayDims
#
#--------------- end editable section ---------------------------------
#
# local directories
BPATH = c/bin/$(TARGET)/
SUBDIRS = c/kernel.dir c/test.dir c/mex.dir


# top-level rule, to compile everything.
all: $(SUBDIRS)


# descent into subdirectories
%.dir:
$(MAKE) -e CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" NFFT_LIB_PATH=$(NFFT_LIB_PATH) NFFT_H_PATH=$(NFFT_H_PATH) FFTW_LIB_PATH=$(FFTW_LIB_PATH) FFTW_H_PATH=$(FFTW_H_PATH) MATLABPATH=$(MATLABPATH) MEXFLAGS="$(MEXFLAGS)" TARGET="$(TARGET)" -C $*
$(MAKE) TARGET="$(TARGET)" install -C $*


# rule for cleaning re-compilable files.
clean:
# rm -f c/bin/*
find . -name '*~' -or -name '*.log' -or -name '.directory' -or -name '*.o' -or -name '*.mex*' | xargs /bin/rm -rf


# rule for making release
RNAME = mtex-4.5.2
RNAME = mtex-5.0.0
RDIR = ../releases
release:
rm -rf $(RDIR)/$(RNAME)*
Expand All @@ -69,26 +10,10 @@ release:
chmod -R a+rX $(RDIR)/$(RNAME)
rm -rf $(RDIR)/$(RNAME)/.git
rm -rf $(RDIR)/$(RNAME)/.git*
#rm -rf $(RDIR)/$(RNAME)/doc/html/helpsearch/*
rm -rf $(RDIR)/$(RNAME)/doc/html/helpsearch*
find $(RDIR)/$(RNAME) -name '*~' -or -name '*.log' -or -name '*.o' -or -name '*.orig' -or -name '.directory' -or -name '*.mat' | xargs /bin/rm -rf
rm -f $(RDIR)/$(RNAME)/c/nsoft/test_nfsoft_adjoint
rm -rf $(RDIR)/$(RNAME)/help/html
rm -rf $(RDIR)/$(RNAME).zip

cd $(RDIR); zip -rq $(RNAME).zip $(RNAME)

windows-binaries:
rm -rf ../../mtex-win.tar.gz
tar -czvf mtex-win.tar.gz ./c/bin/win32/*.exe `find . -name '*.mexw32'`

linux-binaries:
rm -rf ../../mtex-linux.tar.gz
tar -czvf ../../mtex-linux.tar.gz ./c/bin/glnx86/* `find . -name '*.mexglx'`

mac-binaries:
rm -rf ../../mtex-mac.tar.gz
tar -czvf ../../mtex-mac.tar.gz ./c/bin/maci/* `find . -name '*.mexmaci'`

mac64-binaries:
rm -rf ../../mtex-mac64.tar.gz
tar -czvf ../../mtex-mac64.tar.gz ./c/bin/maci64(* `find . -name '*.mexmaci'`
8 changes: 2 additions & 6 deletions ODFAnalysis/@BinghamComponent/calcPDF.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@
c = (A1 .* A2) * component.kappa;

bc = sqrt(b.^2 + c.^2);
if isfinite(C)
Z = Z + reshape(exp(a) ./ C .* besseli(0,bc),size(Z));
else
Z = Z + reshape(call_extern('evalmhyper','INTERN',d,'EXTERN',component.kappa,a,bc),size(Z));
end

Z = Z + reshape(exp(a) ./ C .* besseli(0,bc),size(Z));

end
end

Expand Down
Loading

0 comments on commit e4dd48a

Please sign in to comment.