Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
e351fbfc
Commit
e351fbfc
authored
6 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
FwdProj: reformatted a bit
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
d0f34b70
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
7_fed2/gtFedDefTensorFromComps.m
+59
-120
59 additions, 120 deletions
7_fed2/gtFedDefTensorFromComps.m
zUtil_Deformation/gtDefFwdProjGvdm2UVW.m
+3
-3
3 additions, 3 deletions
zUtil_Deformation/gtDefFwdProjGvdm2UVW.m
with
62 additions
and
123 deletions
7_fed2/gtFedDefTensorFromComps.m
+
59
−
120
View file @
e351fbfc
function
DefT
=
gtFedDefTensorFromComps
(
dcin
,
dcomps
,
method
,
eyemode
)
function
DefT
=
gtFedDefTensorFromComps
(
dcin
,
dcomps
,
method
,
eyemode
)
% Gives deformation, rotation and strain tensors from the def. components.
% Gives deformation, rotation and strain tensors from the def. components.
% This function contains the definition (including sign) of the deformation
% This function contains the definition (including sign) of the deformation
% components. Takes multiple input dc-s.
% components. Takes multiple input dc-s.
%
%
% SAMPLE coordinate system is orthogonal, right handed [X,Y,Z].
% SAMPLE coordinate system is orthogonal, right handed [X,Y,Z].
%
%
%
% INPUT
% INPUT
% dcin - deformation components; see below
% dcin - deformation components; see below
% dcomps - true for indices of deformation components present in dcin
% dcomps - true for indices of deformation components present in dcin
...
@@ -19,7 +17,6 @@ function DefT = gtFedDefTensorFromComps(dcin, dcomps, method, eyemode)
...
@@ -19,7 +17,6 @@ function DefT = gtFedDefTensorFromComps(dcin, dcomps, method, eyemode)
% if eyemode=0, it excludes the identity matrix
% if eyemode=0, it excludes the identity matrix
% if eyemode=1, it includes the identity matrix
% if eyemode=1, it includes the identity matrix
%
%
%
% SMALL DEFORMATIONS
% SMALL DEFORMATIONS
%
%
% Deformation components are defined as:
% Deformation components are defined as:
...
@@ -52,130 +49,72 @@ function DefT = gtFedDefTensorFromComps(dcin, dcomps, method, eyemode)
...
@@ -52,130 +49,72 @@ function DefT = gtFedDefTensorFromComps(dcin, dcomps, method, eyemode)
% dc(9) dc(5) dc(7); ...
% dc(9) dc(5) dc(7); ...
% dc(8) dc(7) dc(6)];
% dc(8) dc(7) dc(6)];
%
%
%
% LARGE DEFORMATIONS (FINITE DEFORMATION THEORY)
% LARGE DEFORMATIONS (FINITE DEFORMATION THEORY)
% dc(1:3) - orientation dviation expressed as a Rodrigues vector
% dc(1:3) - orientation dviation expressed as a Rodrigues vector
% dc(4:9) - right stretch tensor components (symmetric)
% dc(4:9) - right stretch tensor components (symmetric)
%
%
% DefT = RotT
*
RightStretchT
% DefT = RotT
*
RightStretchT
%
%
if
(
~
islogical
(
dcomps
))
if
~
islogical
(
dcomps
)
error
(
'dcomps needs to be 1x9 vector of logicals.'
)
error
(
'dcomps needs to be 1x9 vector of logicals.'
)
end
% Create dc with 9 components
dc
=
zeros
(
9
,
size
(
dcin
,
2
));
dc
(
dcomps
,:)
=
dcin
;
if
strcmp
(
method
,
'small'
)
if
eyemode
DefT
=
[
dc
(
4
,:)
+
1
;
...
dc
(
9
,:)
+
dc
(
3
,:)
;
...
dc
(
8
,:)
-
dc
(
2
,:)
;
...
dc
(
9
,:)
-
dc
(
3
,:)
;
...
dc
(
5
,:)
+
1
;
...
dc
(
7
,:)
+
dc
(
1
,:)
;
...
dc
(
8
,:)
+
dc
(
2
,:)
;
...
dc
(
7
,:)
-
dc
(
1
,:)
;
...
dc
(
6
,:)
+
1
];
else
DefT
=
[
dc
(
4
,:)
;
...
dc
(
9
,:)
+
dc
(
3
,:)
;
...
dc
(
8
,:)
-
dc
(
2
,:)
;
...
dc
(
9
,:)
-
dc
(
3
,:)
;
...
dc
(
5
,:)
;
...
dc
(
7
,:)
+
dc
(
1
,:)
;
...
dc
(
8
,:)
+
dc
(
2
,:)
;
...
dc
(
7
,:)
-
dc
(
1
,:)
;
...
dc
(
6
,:)
];
end
end
DefT
=
reshape
(
DefT
,
3
,
3
,[]);
% Create dc with 9 components
dc
=
zeros
(
9
,
size
(
dcin
,
2
));
dc
(
dcomps
,
:)
=
dcin
;
elseif
strcmp
(
method
,
'rod_rightstretch'
)
if
strcmp
(
method
,
'small'
)
% DefT = zeros(3, 3, size(dc,2));
if
(
eyemode
)
%
DefT
=
[
dc
(
4
,:)
+
1
;
...
% % Rodrigues vector -> normalised rotation vector
dc
(
9
,:)
+
dc
(
3
,:)
;
...
% rotdirnorm = sqrt( sum( dc(1:3,:).*dc(1:3,:), 1) );
dc
(
8
,:)
-
dc
(
2
,:)
;
...
% rotdir = dc(1:3,:) ./ rotdirnorm([1 1 1],:);
dc
(
9
,:)
-
dc
(
3
,:)
;
...
% rotdir(isnan(rotdir)) = 0;
dc
(
5
,:)
+
1
;
...
%
dc
(
7
,:)
+
dc
(
1
,:)
;
...
% % Angles
dc
(
8
,:)
+
dc
(
2
,:)
;
...
% angle = 2*atand(rotdirnorm);
dc
(
7
,:)
-
dc
(
1
,:)
;
...
%
dc
(
6
,:)
+
1
];
% for ii = 1:size(dc,2)
else
%
DefT
=
[
dc
(
4
,:)
;
...
% % Rotation vector -> rotation matrix components
dc
(
9
,:)
+
dc
(
3
,:)
;
...
% rotmatcomp = gtMathsRotationMatrixComp(rotdir(:,ii), 'col');
dc
(
8
,:)
-
dc
(
2
,:)
;
...
%
dc
(
9
,:)
-
dc
(
3
,:)
;
...
% % Rotation matrix
dc
(
5
,:)
;
...
% RotT = gtMathsRotationTensor(angle(ii), rotmatcomp);
dc
(
7
,:)
+
dc
(
1
,:)
;
...
%
dc
(
8
,:)
+
dc
(
2
,:)
;
...
% % Right stretch tensor from its components
dc
(
7
,:)
-
dc
(
1
,:)
;
...
% RightStretchT = [dc(4,ii), dc(9,ii), dc(8,ii) ; ...
dc
(
6
,:)
];
% dc(9,ii), dc(5,ii), dc(7,ii) ; ...
end
% dc(8,ii), dc(7,ii), dc(6,ii) ] + eye(3);
DefT
=
reshape
(
DefT
,
3
,
3
,[]);
%
% DefT(:,:,ii) = RotT*RightStretchT;
elseif
strcmp
(
method
,
'rod_rightstretch'
)
% end
DefT
=
zeros
(
size
(
dc
));
% Rotation tensors unfolded
RotT
=
gtMathsRod2OriMat
(
-
dc
(
1
:
3
,
:));
% % Right stretch tensor from its components
RotT
=
reshape
(
RotT
,
9
,
[]);
% RightStretchT = [dc(4,:) + 1; ...
% dc(9,:); ...
% Multiply rotation tensors and right-stretch tensors
% dc(8,:); ...
rr
=
RotT
.*
dc
([
4
4
4
9
9
9
8
8
8
],
:);
% dc(9,:); ...
DefT
(
1
:
3
,
:)
=
rr
(
1
:
3
,
:)
+
rr
(
4
:
6
,:)
+
rr
(
7
:
9
,:);
% dc(5,:) + 1; ...
% dc(7,:); ...
rr
=
RotT
.*
dc
([
9
9
9
5
5
5
7
7
7
],
:);
% dc(8,:); ...
DefT
(
4
:
6
,
:)
=
rr
(
1
:
3
,
:)
+
rr
(
4
:
6
,:)
+
rr
(
7
:
9
,:);
% dc(7,:); ...
% dc(6,:) + 1 ];
rr
=
RotT
.*
dc
([
8
8
8
7
7
7
6
6
6
],
:);
%
DefT
(
7
:
9
,
:)
=
rr
(
1
:
3
,
:)
+
rr
(
4
:
6
,
:)
+
rr
(
7
:
9
,
:);
% RightStretchT = reshape(RightStretchT, 3, []);
%
% Add the identity component in the right-stretch tensor
% DefT = RotT.*RightStretchT([1 1 1],:);
DefT
=
DefT
+
RotT
;
% DefT = DefT + RotT.*RightStretchT([2 2 2],:);
% DefT = DefT + RotT.*RightStretchT([3 3 3],:);
%
DefT
=
reshape
(
DefT
,
3
,
3
,
[]);
% DefT = reshape(DefT, 3, 3, []);
if
(
~
eyemode
)
DefT
(
1
,
1
,
:)
=
DefT
(
1
,
1
,
:)
-
1
;
DefT
=
zeros
(
size
(
dc
));
DefT
(
2
,
2
,
:)
=
DefT
(
2
,
2
,
:)
-
1
;
DefT
(
3
,
3
,
:)
=
DefT
(
3
,
3
,
:)
-
1
;
% Rotation tensors unfolded
end
RotT
=
reshape
(
gtFedRod2RotTensor
(
dc
(
1
:
3
,:)),
9
,
[]);
% Multiply rotation tensors and right-stretch tensors
rr
=
RotT
.*
dc
([
4
4
4
9
9
9
8
8
8
],:);
DefT
(
1
:
3
,:)
=
rr
(
1
:
3
,:)
+
rr
(
4
:
6
,:)
+
rr
(
7
:
9
,:);
rr
=
RotT
.*
dc
([
9
9
9
5
5
5
7
7
7
],:);
DefT
(
4
:
6
,:)
=
rr
(
1
:
3
,:)
+
rr
(
4
:
6
,:)
+
rr
(
7
:
9
,:);
rr
=
RotT
.*
dc
([
8
8
8
7
7
7
6
6
6
],:);
DefT
(
7
:
9
,:)
=
rr
(
1
:
3
,:)
+
rr
(
4
:
6
,:)
+
rr
(
7
:
9
,:);
% Add the identity component in the right-stretch tensor
DefT
=
DefT
+
RotT
;
DefT
=
reshape
(
DefT
,
3
,
3
,
[]);
if
~
eyemode
DefT
(
1
,
1
,:)
=
DefT
(
1
,
1
,:)
-
1
;
DefT
(
2
,
2
,:)
=
DefT
(
2
,
2
,:)
-
1
;
DefT
(
3
,
3
,:)
=
DefT
(
3
,
3
,:)
-
1
;
end
end
end
end
end
% of function
This diff is collapsed.
Click to expand it.
zUtil_Deformation/gtDefFwdProjGvdm2UVW.m
+
3
−
3
View file @
e351fbfc
...
@@ -126,7 +126,7 @@ function bl = gtDefFwdProjGvdm2UVW(grain, ref_sel, gv, fedpars, parameters, det_
...
@@ -126,7 +126,7 @@ function bl = gtDefFwdProjGvdm2UVW(grain, ref_sel, gv, fedpars, parameters, det_
sinth
=
sinths
(
ii_b
)
.
/
drel
;
sinth
=
sinths
(
ii_b
)
.
/
drel
;
% Predict omega angles: 4 for each plane normal
% Predict omega angles: 4 for each plane normal
[
om
,
pllab
,
~
,
rot_
l2s
]
=
gtFedPredictOmegaMultiple
(
pl_samd
,
...
[
om
,
pllab
,
~
,
rot_
s2l_c
]
=
gtFedPredictOmegaMultiple
(
pl_samd
,
...
sinth
,
labgeo
.
beamdir
', labgeo.rotdir'
,
labgeo
.
rotcomp
,
ominds
(
ii_b
));
sinth
,
labgeo
.
beamdir
', labgeo.rotdir'
,
labgeo
.
rotcomp
,
ominds
(
ii_b
));
valid_voxels
(:,
ii_b
)
=
~
isnan
(
om
);
valid_voxels
(:,
ii_b
)
=
~
isnan
(
om
);
...
@@ -143,8 +143,8 @@ function bl = gtDefFwdProjGvdm2UVW(grain, ref_sel, gv, fedpars, parameters, det_
...
@@ -143,8 +143,8 @@ function bl = gtDefFwdProjGvdm2UVW(grain, ref_sel, gv, fedpars, parameters, det_
% Diffraction vector
% Diffraction vector
dvec_lab
=
gtFedPredictDiffVecMultiple
(
pllab
,
labgeo
.
beamdir
'
);
dvec_lab
=
gtFedPredictDiffVecMultiple
(
pllab
,
labgeo
.
beamdir
'
);
rot_s2l
=
permute
(
rot_
l2s
,
[
2
1
3
]);
rot_s2l
_r
=
permute
(
rot_
s2l_c
,
[
2
1
3
]);
gvcs_lab
=
gtGeoSam2Lab
(
gvpcs
', rot_s2l, labgeo, samgeo, false, '
element_wise
'
,
element_wise_gcs
);
gvcs_lab
=
gtGeoSam2Lab
(
gvpcs
', rot_s2l
_r
, labgeo, samgeo, false, '
element_wise
'
,
element_wise_gcs
);
uvw_bl
=
gtFedPredictUVWMultiple
([],
dvec_lab
,
gvcs_lab
'
,
...
uvw_bl
=
gtFedPredictUVWMultiple
([],
dvec_lab
,
gvcs_lab
'
,
...
detgeo
.
detrefpos
', detgeo.detnorm'
,
detgeo
.
Qdet
,
...
detgeo
.
detrefpos
', detgeo.detnorm'
,
detgeo
.
Qdet
,
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment