line_basis Subroutine

public subroutine line_basis(r0, v0, basis, inv_basis)

Calculates basis from a line with +x in the direction of line

Arguments

Type IntentOptional AttributesName
real(kind=Float64), intent(in), dimension(3):: r0

Starting point of line [cm]

real(kind=Float64), intent(in), dimension(3):: v0

Direction of line

real(kind=Float64), intent(out), dimension(3,3):: basis

Basis for transforming from line coordinates to cartesian

real(kind=Float64), intent(out), optional dimension(3,3):: inv_basis

Inverse basis for the reverse transformation cartesian to line


Calls

proc~~line_basis~~CallsGraph proc~line_basis line_basis proc~tb_zyx tb_zyx proc~line_basis->proc~tb_zyx

Called by

proc~~line_basis~~CalledByGraph proc~line_basis line_basis proc~read_chords read_chords proc~read_chords->proc~line_basis proc~bremsstrahlung bremsstrahlung proc~bremsstrahlung->proc~line_basis program~fidasim fidasim program~fidasim->proc~read_chords program~fidasim->proc~bremsstrahlung

Contents

Source Code


Source Code

subroutine line_basis(r0, v0, basis, inv_basis)
    !+ Calculates basis from a line with +x in the direction of line
    real(Float64), dimension(3), intent(in)              :: r0
        !+ Starting point of line [cm]
    real(Float64), dimension(3), intent(in)              :: v0
        !+ Direction of line
    real(Float64), dimension(3,3), intent(out)           :: basis
        !+ Basis for transforming from line coordinates to cartesian
    real(Float64), dimension(3,3), intent(out), optional :: inv_basis
        !+ Inverse basis for the reverse transformation cartesian to line

    real(Float64), dimension(3) :: rf
    real(Float64) :: alpha, beta, dis

    rf = r0 + v0
    dis = sqrt(sum((rf - r0)**2))
    beta = asin((r0(3) - rf(3))/dis)
    alpha = atan2(rf(2)-r0(2),rf(1)-r0(1))

    call tb_zyx(alpha,beta,0.d0,basis)

    if(present(inv_basis)) inv_basis = transpose(basis)

end subroutine line_basis