early return not needed here
This commit is contained in:
parent
2254746177
commit
b6abbfca9d
33
src/math.f90
33
src/math.f90
|
@ -1783,26 +1783,25 @@ function math_sampleGaussOri(center,noise)
|
||||||
real(pReal), dimension(3), parameter :: ORIGIN = 0.0_pReal
|
real(pReal), dimension(3), parameter :: ORIGIN = 0.0_pReal
|
||||||
real(pReal), dimension(5) :: rnd
|
real(pReal), dimension(5) :: rnd
|
||||||
|
|
||||||
if (abs(noise) < tol_math_check) then
|
noScatter: if (abs(noise) < tol_math_check) then
|
||||||
math_sampleGaussOri = center
|
math_sampleGaussOri = center
|
||||||
return
|
else noScatter
|
||||||
endif
|
! Helming uses different distribution with Bessel functions
|
||||||
|
! therefore the gauss scatter width has to be scaled differently
|
||||||
|
scatter = 0.95_pReal * noise
|
||||||
|
cosScatter = cos(scatter)
|
||||||
|
|
||||||
! Helming uses different distribution with Bessel functions
|
do
|
||||||
! therefore the gauss scatter width has to be scaled differently
|
call halton(5_pInt,rnd)
|
||||||
scatter = 0.95_pReal * noise
|
rnd(1:3) = 2.0_pReal*rnd(1:3)-1.0_pReal ! expand 1:3 to range [-1,+1]
|
||||||
cosScatter = cos(scatter)
|
disturb = [ scatter * rnd(1), & ! phi1
|
||||||
|
sign(1.0_pReal,rnd(2))*acos(cosScatter+(1.0_pReal-cosScatter)*rnd(4)), & ! Phi
|
||||||
|
scatter * rnd(3)] ! phi2
|
||||||
|
if (rnd(5) <= exp(-1.0_pReal*(math_EulerMisorientation(ORIGIN,disturb)/scatter)**2_pReal)) exit
|
||||||
|
enddo
|
||||||
|
|
||||||
do
|
math_sampleGaussOri = math_RtoEuler(math_mul33x33(math_EulerToR(disturb),math_EulerToR(center)))
|
||||||
call halton(5_pInt,rnd)
|
endif noScatter
|
||||||
rnd(1:3) = 2.0_pReal*rnd(1:3)-1.0_pReal ! expand 1:3 to range [-1,+1]
|
|
||||||
disturb = [ scatter * rnd(1), & ! phi1
|
|
||||||
sign(1.0_pReal,rnd(2))*acos(cosScatter+(1.0_pReal-cosScatter)*rnd(4)), & ! Phi
|
|
||||||
scatter * rnd(3)] ! phi2
|
|
||||||
if (rnd(5) <= exp(-1.0_pReal*(math_EulerMisorientation(ORIGIN,disturb)/scatter)**2_pReal)) exit
|
|
||||||
enddo
|
|
||||||
|
|
||||||
math_sampleGaussOri = math_RtoEuler(math_mul33x33(math_EulerToR(disturb),math_EulerToR(center)))
|
|
||||||
|
|
||||||
end function math_sampleGaussOri
|
end function math_sampleGaussOri
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue