Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function [output, output2] = gtReadBoundariesStructure(boundaries_structure, boundaries_structure_test, bridges)
%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 equivelent (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=[];
count=1;
load parameters
spacegroup=parameters.acq.spacegroup;
if spacegroup==225 | spacegroup==229
sym = gtGetCubicSymOp;
elseif spacegroup==167 || spacegroup==663 || spacegroup==194
sym= gtGetHexagonalSymOp_sab;
else
disp('spacegroup not supported! cant do symmetry operations!')
end
%loop through structure
for i=1:length(boundaries_structure)
%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>1000
%if 1 %no test
% if boundaries_structure(i).crack5_count>100
% if isempty(boundaries_structure(i).sigma) | boundaries_structure(i).sigma~=3
%if boundaries_structure(i).sigma==3
% poles(end+1,:)=boundaries_structure(i).gb_norm;
%
poles(end+1,:)=boundaries_structure(i).gb_norm_grain1;
poles(end+1,:)=boundaries_structure(i).gb_norm_grain2;
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
if 1
%apply the symmetry operators
poles2=[];
for i=1:length(sym)
if spacegroup==225 | spacegroup==229
poles2=[poles2; poles*sym(i).g];
elseif spacegroup==167 || spacegroup==663 || spacegroup==194
poles2=[poles2; poles*sym(i).g3];
end
end
poles=poles2;
output=poles;
output2=[];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
%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=1:length(boundaries_structure_test)
for i=bridges
%criteria
%if boundaries_structure(i).grain1~=0 & boundaries_structure(i).grain2~=0 & ~isempty(boundaries_structure(i).gb_norm)
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) | 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;
end
count=count+1;
end%criteria
end%loop
output=density;
output2=vpw;
count
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%