texture class replaces manual conversions
This commit is contained in:
parent
e48059d6f1
commit
5d0a67e5dc
|
@ -690,8 +690,8 @@ subroutine material_parseTexture
|
|||
integer :: j, t, i
|
||||
character(len=65536), dimension(:), allocatable :: strings ! Values for given key in material config
|
||||
integer, dimension(:), allocatable :: chunkPos
|
||||
real(pReal), dimension(3,3) :: texture_transformation ! maps texture to microstructure coordinate system
|
||||
type(rotation) :: eulers
|
||||
real(pReal), dimension(3,3) :: texture_transformation ! maps texture to microstructure coordinate system
|
||||
type(rotation) :: unajusted, adjusted
|
||||
|
||||
do t=1, size(config_texture)
|
||||
if (config_texture(t)%countKeys('(gauss)') /= 1) call IO_error(147,ext_msg='count((gauss)) != 1')
|
||||
|
@ -740,8 +740,9 @@ subroutine material_parseTexture
|
|||
end select
|
||||
enddo
|
||||
if(dNeq(math_det33(texture_transformation),1.0_pReal)) call IO_error(157,t)
|
||||
call eulers%fromEulerAngles(texture_Eulers(:,t))
|
||||
texture_Eulers(:,t) = math_RtoEuler(matmul(eulers%asRotationMatrix(),texture_transformation))
|
||||
call unajusted%fromEulerAngles(texture_Eulers(:,t))
|
||||
call adjusted%fromRotationMatrix(matmul(unajusted%asRotationMatrix(),texture_transformation))
|
||||
texture_Eulers(:,t) = adjusted%asEulerAngles()
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
|
33
src/math.f90
33
src/math.f90
|
@ -966,39 +966,6 @@ pure function math_qRot(Q,v)
|
|||
end function math_qRot
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief Euler angles (in radians) from rotation matrix
|
||||
!> @details rotation matrix is meant to represent a PASSIVE rotation,
|
||||
!> composed of INTRINSIC rotations around the axes of the
|
||||
!> rotating reference frame
|
||||
!> (see http://en.wikipedia.org/wiki/Euler_angles for definitions)
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
pure function math_RtoEuler(R)
|
||||
|
||||
real(pReal), dimension (3,3), intent(in) :: R
|
||||
real(pReal), dimension(3) :: math_RtoEuler
|
||||
real(pReal) :: sqhkl, squvw, sqhk
|
||||
|
||||
sqhkl=sqrt(R(1,3)*R(1,3)+R(2,3)*R(2,3)+R(3,3)*R(3,3))
|
||||
squvw=sqrt(R(1,1)*R(1,1)+R(2,1)*R(2,1)+R(3,1)*R(3,1))
|
||||
sqhk =sqrt(R(1,3)*R(1,3)+R(2,3)*R(2,3))
|
||||
|
||||
math_RtoEuler(2) = acos(math_clip(R(3,3)/sqhkl,-1.0_pReal, 1.0_pReal))
|
||||
|
||||
if((math_RtoEuler(2) < 1.0e-8_pReal) .or. (pi-math_RtoEuler(2) < 1.0e-8_pReal)) then
|
||||
math_RtoEuler(3) = 0.0_pReal
|
||||
math_RtoEuler(1) = acos(math_clip(R(1,1)/squvw, -1.0_pReal, 1.0_pReal))
|
||||
if(R(2,1) > 0.0_pReal) math_RtoEuler(1) = 2.0_pReal*pi-math_RtoEuler(1)
|
||||
else
|
||||
math_RtoEuler(3) = acos(math_clip(R(2,3)/sqhk, -1.0_pReal, 1.0_pReal))
|
||||
if(R(1,3) < 0.0) math_RtoEuler(3) = 2.0_pReal*pi-math_RtoEuler(3)
|
||||
math_RtoEuler(1) = acos(math_clip(-R(3,2)/sin(math_RtoEuler(2)), -1.0_pReal, 1.0_pReal))
|
||||
if(R(3,1) < 0.0) math_RtoEuler(1) = 2.0_pReal*pi-math_RtoEuler(1)
|
||||
end if
|
||||
|
||||
end function math_RtoEuler
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief rotation matrix from Bunge-Euler (3-1-3) angles (in radians)
|
||||
!> @details rotation matrix is meant to represent a PASSIVE rotation, composed of INTRINSIC
|
||||
|
|
Loading…
Reference in New Issue