bindings_orbel_el2xv Subroutine

public subroutine bindings_orbel_el2xv(nbody, c_mu, c_a, c_e, c_inc, c_capom, c_omega, c_capm, c_rx, c_ry, c_rz, c_vx, c_vy, c_vz) bind(c, name="0")

Implements a bindings version of swiftest_orbel_el2xv to be called from Python via Cython

Arguments

TypeIntentOptionalAttributesName
integer(kind=I4B), intent(in), value:: nbody

The number of bodies

type(c_ptr), intent(in), value:: c_mu

The gravitational parameter G*(M+m)

type(c_ptr), intent(in), value:: c_a

The semi-major axis

type(c_ptr), intent(in), value:: c_e

The eccentricity

type(c_ptr), intent(in), value:: c_inc

The inclination

type(c_ptr), intent(in), value:: c_capom

The longitude of the ascending node

type(c_ptr), intent(in), value:: c_omega

The argument of periapsis

type(c_ptr), intent(in), value:: c_capm

The mean anomaly

type(c_ptr), intent(in), value:: c_rx

The x-component of the position vector

type(c_ptr), intent(in), value:: c_ry

The y-component of the position vector

type(c_ptr), intent(in), value:: c_rz

The z-component of the position vector

type(c_ptr), intent(in), value:: c_vx

The x-component of the velocity vector

type(c_ptr), intent(in), value:: c_vy

The y-component of the velocity vector

type(c_ptr), intent(in), value:: c_vz

The z-component of the velocity vector


Calls

proc~~bindings_orbel_el2xv~~CallsGraph proc~bindings_orbel_el2xv bindings_orbel_el2xv shared shared proc~bindings_orbel_el2xv->shared interface~swiftest_orbel_el2xv swiftest_orbel_el2xv proc~bindings_orbel_el2xv->interface~swiftest_orbel_el2xv

Contents

Source Code


Source Code

      subroutine bindings_orbel_el2xv(nbody, c_mu, c_a, c_e, c_inc, c_capom, c_omega, c_capm, &
                                      c_rx, c_ry, c_rz, c_vx, c_vy, c_vz) &
         bind(c, name="bindings_orbel_el2xv")
         !! author: David A. Minton
         !!
         !! Implements a bindings version of swiftest_orbel_el2xv to be called from Python via Cython
         implicit none
         ! Arguments
         integer(I4B), intent(in), value :: nbody !! The number of bodies
         type(c_ptr), intent(in), value :: c_mu !! The gravitational parameter G*(M+m)
         type(c_ptr), intent(in), value :: c_a !! The semi-major axis
         type(c_ptr), intent(in), value :: c_e !! The eccentricity
         type(c_ptr), intent(in), value :: c_inc !! The inclination
         type(c_ptr), intent(in), value :: c_capom !! The longitude of the ascending node
         type(c_ptr), intent(in), value :: c_omega !! The argument of periapsis
         type(c_ptr), intent(in), value :: c_capm !! The mean anomaly
         type(c_ptr), intent(in), value :: c_rx !! The x-component of the position vector
         type(c_ptr), intent(in), value :: c_ry !! The y-component of the position vector
         type(c_ptr), intent(in), value :: c_rz !! The z-component of the position vector
         type(c_ptr), intent(in), value :: c_vx !! The x-component of the velocity vector
         type(c_ptr), intent(in), value :: c_vy !! The y-component of the velocity vector
         type(c_ptr), intent(in), value :: c_vz !! The z-component of the velocity vector
         ! Internals
         real(DP), dimension(:), pointer :: mu, a, e, inc, capom, omega, capm, rx, ry, rz, vx, vy, vz
         integer(I4B) :: i

         if (c_associated(c_mu)) then
            call c_f_pointer(c_mu, mu, shape=[nbody])
         else
            error stop "c_mu is not associated"
         end if

         if (c_associated(c_a)) then
            call c_f_pointer(c_a, a, shape=[nbody])
         else
            error stop "c_a is not associated"
         end if

         if (c_associated(c_e)) then
            call c_f_pointer(c_e, e, shape=[nbody])
         else
            error stop "c_e is not associated"
         end if

         if (c_associated(c_inc)) then
            call c_f_pointer(c_inc, inc, shape=[nbody])
         else
            error stop "c_inc is not associated"
         end if

         if (c_associated(c_capom)) then
            call c_f_pointer(c_capom, capom, shape=[nbody])
         else
            error stop "c_capom is not associated"
         end if

         if (c_associated(c_omega)) then
            call c_f_pointer(c_omega, omega, shape=[nbody])
         else
            error stop "c_omega is not associated"
         end if

         if (c_associated(c_capm)) then
            call c_f_pointer(c_capm, capm, shape=[nbody])
         else
            error stop "c_capm is not associated"
         end if

         allocate(rx(nbody))
         if (c_associated(c_rx)) then
            call c_f_pointer(c_rx, rx, shape=[nbody])
         else
            error stop "c_rx is not associated"
         end if

         allocate(ry(nbody))
         if (c_associated(c_ry)) then
            call c_f_pointer(c_ry, ry, shape=[nbody])
         else
            error stop "c_ry is not associated"
         end if

         allocate(rz(nbody))
         if (c_associated(c_rz)) then
            call c_f_pointer(c_rz, rz, shape=[nbody])
         else
            error stop "c_rz is not associated"
         end if

         allocate(vx(nbody))
         if (c_associated(c_vx)) then
            call c_f_pointer(c_vx, vx, shape=[nbody])
         else
            error stop "c_vx is not associated"
         end if   

         allocate(vy(nbody))
         if (c_associated(c_vy)) then
            call c_f_pointer(c_vy, vy, shape=[nbody])
         else
            error stop "c_vy is not associated"
         end if

         allocate(vz(nbody))
         if (c_associated(c_vz)) then
            call c_f_pointer(c_vz, vz, shape=[nbody])
         else
            error stop "c_vz is not associated"
         end if

#ifdef DOCONLOC
         do concurrent (i = 1:nbody) shared(mu, a, e, inc, capom, omega, capm, rx, ry, rz, vx, vy, vz)
#else
         do concurrent (i = 1:nbody)
#endif
            call swiftest_orbel_el2xv(mu(i), a(i), e(i), inc(i), capom(i), omega(i), capm(i), &
                                      rx(i), ry(i), rz(i), vx(i), vy(i), vz(i))
         end do

         return
      end subroutine bindings_orbel_el2xv