Newer
Older
Wolfgang Ludwig
committed
function [output, output2] = gtReadBoundariesStructure(boundaries_structure, vThr, DoSym)
%boundaries_structure is a .mat file used to store boundary data.
%it contains: boundaries_structure(i).
% grain1
% grain2
% count
% crack1_count
% crack2_count
% crack5_count
% gb_norm
% gb_norm_confidence
% gb_centre
% misorientation_angle
% misorientation_axis
% gb_norm_grain1
% gb_norm_grain2
% sigma
% grain1_R_vector
% grain2_R_vector
%therefore, can pull out the poles for a pole figure according to different
%criteria, as well as producing symmetry equivalent (for xtallographic
%things) if required.
% add - in a crude way - the stuff to read from the the
% boundaries_structure_test - the pole figure density for each boundary
% after dealing with curved boundaries.
%output is either poles or density - either way then used in gtMakePoleFigure
%output2 is valid poles weight, not used for poles case
%should be able to combine boundaries_structure and
%boundaries_structure_test. Keep separate for the moment while testing.
poles=[];
parameters=[];
load('parameters.mat');
Yoann Guilhem
committed
spacegroup = parameters.cryst.spacegroup;
Yoann Guilhem
committed
% Get symmetry operators
symm = gtCrystGetSymmetryOperators([], spacegroup);
if size(hkl, 2) == 4
symm = {symm.g};
elseif size(hkl, 2) == 3
symm = {symm.g3};
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
%loop through structure
for i=1:length(boundaries_structure)
if 1
%for i=bridges
%criteria
if boundaries_structure(i).grain1~=0 && boundaries_structure(i).grain2~=0 && ~isempty(boundaries_structure(i).gb_norm)
% if boundaries_structure(i).grain1<500 && boundaries_structure(i).grain2<500 && boundaries_structure(i).count>200
if boundaries_structure(i).count>vThr %& boundaries_structure(i).count<4000
% if (boundaries_structure(i).gb_centre(1)<150 || boundaries_structure(i).gb_centre(1)>350) && (boundaries_structure(i).gb_centre(2)<150 || boundaries_structure(i).gb_centre(2)>350)
% if 1 %no test
% if boundaries_structure(i).crack5_count>100
% if isempty(boundaries_structure(i).sigma) || boundaries_structure(i).sigma~=3
% if isempty(boundaries_structure(i).sigma)
% if boundaries_structure(i).sigma==3
% poles(end+1,:)=boundaries_structure(i).gb_norm;
%
if 1
poles(end+1,:)=boundaries_structure(i).gb_norm_grain1;
poles(end+1,:)=boundaries_structure(i).gb_norm_grain2;
weights(end+1)=boundaries_structure(i).count;
weights(end+1)=boundaries_structure(i).count;
end % criteria 2
end%criteria
end
end
if 0
% alternative structure for specific grain poles
for a=1:20
if boundaries_structure(i).grain1==a && boundaries_structure(i).grain2~=0
poles(end+1,:)=boundaries_structure(i).gb_norm_grain1;
end
if boundaries_structure(i).grain2==a && boundaries_structure(i).grain1~=0
poles(end+1,:)=boundaries_structure(i).gb_norm_grain2;
end
end
end
end%loop
if DoSym
% Apply the symmetry operators
poles2 = [];
for ii=1:length(symm)
poles2 = [poles2; poles*symm(ii)];
poles = poles2;
weights = repmat(weights', length(symm), 1);
%add this to correspond to line in gtMakePoleFigure
poles=[poles; -poles];
weights=[weights; weights];
output=poles;
output2=weights;
save poles poles
save weights weights
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%find a non-empty density map to preallocate
i=1;
density=[];
count=0;
vpw=0;%valid poles_weight for normalising
while isempty(density)
density=zeros(size(boundaries_structure_test(i).grain1_pole_density));
i=i+1;
end
for i=bridges
%if boundaries_structure(i).grain1~=0 && boundaries_structure(i).grain2~=0 && ~isempty(boundaries_structure(i).gb_norm)
% if boundaries_structure(i).crack5_count>100
% if isempty(boundaries_structure(i).sigma) || boundaries_structure(i).sigma~=3
%if (isempty(boundaries_structure(i).sigma) || boundaries_structure(i).sigma~=3) && boundaries_structure(i).grain1~=0 && boundaries_structure(i).grain2~=0
% if isempty(boundaries_structure(i).sigma)
% if boundaries_structure(i).sigma==3
% if boundaries_structure(i).sigma==9
% if boundaries_structure(i).misorientation_angle>15
%
if ~isempty(boundaries_structure_test(i).grain1_pole_density)
density=density+boundaries_structure_test(i).grain1_pole_density;
vpw=vpw+boundaries_structure_test(i).grain1_valid_poles_weight;
end
if ~isempty(boundaries_structure_test(i).grain2_pole_density)
density=density+boundaries_structure_test(i).grain2_pole_density;
vpw=vpw+boundaries_structure_test(i).grain2_valid_poles_weight;
count=count+1;
end%criteria
end%loop
output=density;
output2=vpw;
count
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Yoann Guilhem
committed
end % end function