!+ ! Subroutine bmad_track1_bunch (ix_lat, ix_ele, bunch_start, bunch_end, c_err) ! ! Routine to track a bunch through one lattice element. ! ! Input: ! ix_lat -- Integer: Index of lattice to use. ! ix_ele -- Integer: Index of element to use. ! bunch_end -- CPP_bunch: Bunch at start of element. ! ! Output: ! bunch_end -- CPP_bunch: Bunch at end of element ! c_err -- logical(c_bool): Error flag. !- subroutine bmad_track1_bunch (ix_lat, ix_ele, bunch_start, bunch_end, c_err) use bmad_common_mod use beam_mod implicit none type (c_ptr), value :: bunch_start, bunch_end type (bunch_struct), target :: bunch type (lat_struct), pointer :: lat type (ele_struct), pointer :: ele real(rp) s_start, s_end integer i, ix_lat, ix_ele character(*), parameter :: r_name = 'bmad_track1_bunch' logical(c_bool) c_err logical err ! c_err = c_logic(.true.) call bmad_set_lat_pointer (err, r_name, ix_lat, lat, ix_ele, ele) if (err) return ! call bunch_to_f (bunch_start, c_loc(bunch)) call track1_bunch (bunch, lat, ele, bunch, err) call bunch_to_c (c_loc(bunch), bunch_end) c_err = c_logic(err) end subroutine