destroy_geopotential_model Subroutine

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

Note

This is just a wapper for destroy in geopotential_model.

Arguments

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

pointer to a container containing a geopotential_model


Calls

proc~~destroy_geopotential_model~~CallsGraph proc~destroy_geopotential_model c_interface_module::destroy_geopotential_model destroy destroy proc~destroy_geopotential_model->destroy

Source Code

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

    implicit none

    type(c_ptr),intent(in),value :: cp  !! pointer to a [[container]]
                                        !! containing a [[geopotential_model]]

    type(container),pointer :: grav_container !! Fortran version of `cp`

    ! 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)
            call g%destroy()
            !cp = c_null_ptr  ! should we do this too (make inout ?)
        end select
        deallocate(grav_container)
    else
        error stop 'error: pointer is not associated'
    end if

    end subroutine destroy_geopotential_model