Note
This is just a wapper for initialize
in geopotential_model.
mueller method
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=c_int), | intent(in), | value | :: | itype |
mode :
|
|
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 |
pointer to a container containing a geopotential_model
function initialize_geopotential_model(itype,gravfile,n,m) & result(cp) bind(c,name='initialize_geopotential_model') implicit none integer(c_int),intent(in),value :: itype !! mode : !! !! * 1 (Mueller) is only mode !! currently supported type(c_ptr),intent(in),value :: gravfile !! gravity coefficient file name integer(c_int),intent(in),value :: n !! degree integer(c_int),intent(in),value :: m !! order type(c_ptr) :: cp !! pointer to a [[container]] !! containing a [[geopotential_model]] type(container),pointer :: grav_container !! Fortran version of `cp` class(geopotential_model),pointer :: grav !! the data in the container logical :: status_ok !! initialization status flag character(len=:),allocatable :: gravfile_f !! Fortran version of `gravfile` allocate(grav_container) select case (itype) case(1) !! mueller method allocate(geopotential_model_mueller :: grav_container%data) select type (g => grav_container%data) class is (geopotential_model_mueller) ! get the gravity file name: call c_ptr_to_f_string(gravfile,gravfile_f) call g%initialize(gravfile_f,n,m,status_ok) if (.not. status_ok) then write(*,*) 'error in initialize!' call g%destroy() cp = c_null_ptr else cp = c_loc(grav_container) end if end select case default error stop 'error: invalid itype input' end select ! if there was an error: if (c_associated(cp,c_null_ptr)) then deallocate(grav_container) end if end function initialize_geopotential_model