psmile_free_method_handle.F90

Go to the documentation of this file.
00001 !
00002 !-----------------------------------------------------------------------
00003 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00004 ! All rights reserved. Use is subject to OASIS4 license terms.
00005 !-----------------------------------------------------------------------
00006 !BOP
00007 !
00008 ! !ROUTINE: PSMILe_Free_method_handle
00009 !
00010 ! !INTERFACE:
00011 
00012       subroutine psmile_free_method_handle ( method_id, ierror)
00013 !
00014 ! !USES:
00015 !
00016       use PRISM_constants
00017 !
00018       use PSMILe, dummy_interface => PSMILe_Free_method_handle
00019 
00020       implicit none
00021 !
00022 ! !INPUT PARAMETERS:
00023 !
00024       integer, Intent (In)  :: method_id
00025 
00026 !     Handle to the grid point information to be released.
00027 !
00028 ! !OUTPUT PARAMETERS:
00029 !
00030       integer, Intent (Out)               :: ierror
00031 !     Returns the error code of PRISM_Init;
00032 !             ierror = 0 : No error
00033 !             ierror > 0 : Severe error
00034 !
00035 ! !LOCAL VARIABLES
00036 !
00037       integer                             :: i
00038 !
00039       integer, parameter                  :: nerrp = 2
00040       integer                             :: ierrp (nerrp)
00041 !
00042 ! !DESCRIPTION:
00043 !
00044 ! Subroutine "PSMILe_Free_method_handle" releases a handle to grid point information.
00045 !
00046 ! !REVISION HISTORY:
00047 !
00048 !   Date      Programmer    Description
00049 ! ----------  -----------   -----------
00050 ! 01.12.03    H. Ritzdorf   created
00051 !
00052 !EOP
00053 !----------------------------------------------------------------------
00054 !
00055 ! $Id: psmile_free_method_handle.F90 2325 2010-04-21 15:00:07Z valcke $
00056 ! $Author: valcke $
00057 !
00058    Character(len=len_cvs_string), save :: mycvs = 
00059        '$Id: psmile_free_method_handle.F90 2325 2010-04-21 15:00:07Z valcke $'
00060 !
00061 !----------------------------------------------------------------------
00062 
00063 #ifdef VERBOSE
00064       print *, trim(ch_id), ': PSMILe_Free_method_handle: start handle =', method_id
00065 
00066       call psmile_flushstd
00067 #endif /* VERBOSE */
00068 
00069 !
00070 !   Initialization
00071 !
00072       ierror = 0
00073 !
00074       if (method_id > Number_of_Methods_allocated .or. &
00075           method_id < 1) then
00076 
00077          ierrp (1) = method_id
00078          ierrp (2) = Number_of_Methods_allocated
00079 
00080          ierror = PRISM_Error_Internal
00081          call psmile_error (ierror, "invalid method handle", &
00082                             ierrp, nerrp, __FILE__, __LINE__)
00083          return
00084       endif
00085 !
00086 !   Free Index
00087 !
00088       Methods(method_id)%status = PSMILe_status_free
00089 !
00090 !   Update linked list
00091 !
00092       if (Methods(method_id)%previous_method_in_grid /= PRISM_UNDEFINED) then
00093          i = Methods(method_id)%previous_method_in_grid
00094          Methods(i)%next_method_in_grid = Methods(method_id)%next_method_in_grid
00095       endif
00096 
00097       if (Methods(method_id)%next_method_in_grid /= PRISM_UNDEFINED) then
00098          i = Methods(method_id)%next_method_in_grid
00099          Methods(i)%previous_method_in_grid = &
00100              Methods(method_id)%previous_method_in_grid
00101       endif
00102 !
00103 !   De-allocate memory
00104 !
00105       if (Associated (Methods(method_id)%send_infos_direct)) then
00106           Deallocate (Methods(method_id)%send_infos_direct)
00107       endif
00108 
00109       if (Associated (Methods(method_id)%send_infos_coupler)) then
00110           Deallocate (Methods(method_id)%send_infos_coupler)
00111       endif
00112 
00113       if (Associated (Methods(method_id)%recv_infos_direct)) then
00114           Deallocate (Methods(method_id)%recv_infos_direct)
00115       endif
00116 
00117       if (Associated (Methods(method_id)%recv_infos_coupler)) then
00118           Deallocate (Methods(method_id)%recv_infos_coupler)
00119       endif
00120 
00121 #ifdef VERBOSE
00122       print *, trim(ch_id), ': PSMILe_Free_method_handle: eof ierror =', ierror
00123 
00124       call psmile_flushstd
00125 #endif /* VERBOSE */
00126 !
00127       end subroutine PSMILe_Free_method_handle

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1