c_interface_module Module

C interfaces to some of the routines. This is an experiment to be able to call them from Python. (see the python_test.py file in tests)


Uses

  • module~~c_interface_module~~UsesGraph module~c_interface_module c_interface_module iso_c_binding iso_c_binding module~c_interface_module->iso_c_binding module~geopotential_module geopotential_module module~c_interface_module->module~geopotential_module module~kind_module kind_module module~c_interface_module->module~kind_module module~geopotential_module->module~kind_module module~numbers_module numbers_module module~geopotential_module->module~numbers_module iso_fortran_env iso_fortran_env module~kind_module->iso_fortran_env module~numbers_module->module~kind_module

Used by

  • module~~c_interface_module~~UsedByGraph module~c_interface_module c_interface_module module~fortran_astrodynamics_toolkit fortran_astrodynamics_toolkit module~fortran_astrodynamics_toolkit->module~c_interface_module

Interfaces

interface

  • private function strlen(str) result(isize) bind(C, name='strlen')

    C string length

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), value :: str

    Return Value integer(kind=c_int)


Derived Types

type, private ::  container

a container for data that is to be passed to C. We include it here so that we can use c_loc()

Components

Type Visibility Attributes Name Initial
class(*), private, pointer :: data

Functions

private function initialize_geopotential_model(itype, gravfile, n, m) result(cp) bind(c,name='initialize_geopotential_model')

This is just a wapper for initialize in geopotential_model.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in), value :: itype

mode :

Read more…
type(c_ptr), intent(in), value :: gravfile

gravity coefficient file name

integer(kind=c_int), intent(in), value :: n

degree

integer(kind=c_int), intent(in), value :: m

order

Return Value type(c_ptr)

pointer to a container containing a geopotential_model


Subroutines

private subroutine destroy_geopotential_model(cp) bind(c,name='destroy_geopotential_model')

This is just a wapper for destroy in geopotential_model.

Read more…

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in), value :: cp

pointer to a container containing a geopotential_model

private subroutine get_acceleration(cp, n, m, rvec, acc) bind(c,name='get_acceleration')

This is just a wapper for get_acc in geopotential_model.

Read more…

Arguments

Type IntentOptional 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

private subroutine c_ptr_to_f_string(cp, fstr)

Convert a c_ptr to a string into a Fortran string.

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in) :: cp
character(len=:), intent(out), allocatable :: fstr

private subroutine f_string_to_c_ptr(fstr, buffer)

Convert a Fortran string to a c_ptr to a string. (the C string must already have been allocated to a fixed size)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: fstr
type(c_ptr), intent(inout) :: buffer

a preallocated string buffer

private subroutine return_a_string(ival, buffer) bind(c,name='return_a_string')

Just a test of f_string_to_c_ptr.

Arguments

Type IntentOptional Attributes Name
integer(kind=c_int), intent(in), value :: ival
type(c_ptr), intent(inout) :: buffer

a preallocated string buffer