Note
This is just a wapper for get_acc
in geopotential_model.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | intent(in), | value | :: | cp |
pointer to a container containing a geopotential_model |
|
integer(kind=c_int), | intent(in), | value | :: | n |
degree |
|
integer(kind=c_int), | intent(in), | value | :: | m |
order |
|
real(kind=c_double), | intent(in), | dimension(3) | :: | rvec |
position vector |
|
real(kind=c_double), | intent(out), | dimension(3) | :: | acc |
acceleration vector |
subroutine get_acceleration(cp,n,m,rvec,acc) bind(c,name='get_acceleration') implicit none type(c_ptr),intent(in),value :: cp !! pointer to a [[container]] !! containing a [[geopotential_model]] integer(c_int),intent(in),value :: n !! degree integer(c_int),intent(in),value :: m !! order real(c_double),dimension(3),intent(in) :: rvec !! position vector real(c_double),dimension(3),intent(out) :: acc !! acceleration vector type(container),pointer :: grav_container !! Fortran version of `cp` ! just in case wp /= c_double, we have to make a copy here real(wp),dimension(3) :: rvec_f !! position vector real(wp),dimension(3) :: acc_f !! acceleration vector ! convert cp to fortran: call c_f_pointer(cp,grav_container) if (associated(grav_container)) then select type (g => grav_container%data) class is (geopotential_model) rvec_f = rvec call g%get_acc(rvec_f,n,m,acc_f) acc = acc_f end select else error stop 'error: pointer is not associated' end if end subroutine get_acceleration