Get position pos
given indices ind
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=Int32), | intent(in), | dimension(3) | :: | ind | Indices |
|
real(kind=Float64), | intent(out), | dimension(3) | :: | pos | Position in beam_grid coordinates [cm] |
|
integer, | intent(in), | optional | :: | input_coords | Indicates coordinate system of |
subroutine get_position(ind, pos, input_coords)
!+ Get position `pos` given indices `ind`
integer(Int32), dimension(3), intent(in) :: ind
!+ Indices
real(Float64), dimension(3), intent(out) :: pos
!+ Position in [[libfida:beam_grid]] coordinates [cm]
integer, intent(in), optional :: input_coords
!+ Indicates coordinate system of `ind`. Beam grid (0) and cylindrical (2)
real(Float64), dimension(3) :: pos_temp1, pos_temp2
integer :: ics, ocs
if(present(input_coords)) then
ics = input_coords
else
ics = 0
endif
if(ics.eq.0) then
pos(1) = beam_grid%xc(ind(1))
pos(2) = beam_grid%yc(ind(2))
pos(3) = beam_grid%zc(ind(3))
endif
if(ics.eq.2) then
pos_temp1(1) = inter_grid%r(ind(1))
pos_temp1(2) = inter_grid%z(ind(2))
pos_temp1(3) = inter_grid%phi(ind(3))
call cyl_to_xyz(pos_temp1,pos)
endif
end subroutine get_position