prismtrs_get_epio_handle.F90
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 subroutine prismtrs_get_epio_handle (id_epio_id, &
00013 id_err)
00014
00015
00016
00017 USE PRISMDrv, dummy_interface => PRISMTrs_get_epio_handle
00018
00019 IMPLICIT NONE
00020
00021
00022
00023
00024
00025
00026 INTEGER, INTENT (Out) :: id_epio_id
00027
00028
00029
00030
00031 INTEGER, INTENT (Out) :: id_err
00032
00033
00034
00035
00036 INTEGER :: ib, il_new_dim
00037
00038 INTEGER, PARAMETER :: nerrp = 2
00039 INTEGER :: ierrp (nerrp)
00040
00041 TYPE (Drv_Epio), DIMENSION(:), POINTER :: NewDrv_Epios
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 Character(len=len_cvs_string), save :: mycvs =
00062 '$Id: prismtrs_get_epio_handle.F90 2325 2010-04-21 15:00:07Z valcke $'
00063
00064
00065
00066 #ifdef VERBOSE
00067 PRINT *, '| Enter PRISMTrs_get_epio_handle'
00068 call psmile_flushstd
00069 #endif
00070
00071
00072 id_err = 0
00073
00074
00075
00076 DO ib = 1, Number_of_Epios_allocated
00077 IF (Drv_Epios(ib)%status == PSMILe_status_free) EXIT
00078 END DO
00079
00080 IF (ib <= Number_of_Epios_allocated) THEN
00081 id_epio_id = ib
00082 Drv_Epios(id_epio_id)%status = PSMILe_status_defined
00083 #ifdef VERBOSE
00084 PRINT *, '| Quit PRISMTrs_get_epio_handle - no reallocation'
00085 call psmile_flushstd
00086 #endif
00087 RETURN
00088 ENDIF
00089
00090
00091
00092 il_new_dim = Number_of_Epios_allocated + 8
00093
00094 ALLOCATE (NewDrv_Epios (il_new_dim), STAT = id_err)
00095 IF (id_err > 0) THEN
00096 ierrp (1) = id_err
00097 ierrp (2) = il_new_dim
00098 id_err = PRISM_Error_Alloc
00099
00100 call psmile_error_common ( id_err, 'NewEPIOs', &
00101 ierrp, 2, __FILE__, __LINE__ )
00102 RETURN
00103 ENDIF
00104
00105 IF (Number_of_Epios_allocated > 0) &
00106 NewDrv_Epios (1:Number_of_Epios_allocated) = &
00107 Drv_Epios (1:Number_of_Epios_allocated)
00108
00109 NewDrv_Epios(Number_of_Epios_allocated+1:il_new_dim)%status = &
00110 PSMILe_status_free
00111
00112
00113
00114 IF (Number_of_Epios_allocated > 0) THEN
00115 DEALLOCATE (Drv_Epios, STAT = id_err)
00116 IF (id_err > 0) THEN
00117 ierrp (1) = id_err
00118 id_err = PRISM_Error_Dealloc
00119
00120 call psmile_error_common ( id_err, 'EPIOs', &
00121 ierrp, 1, __FILE__, __LINE__ )
00122 RETURN
00123 ENDIF
00124 END IF
00125
00126
00127
00128 Drv_Epios => NewDrv_Epios
00129
00130 id_epio_id = Number_of_Epios_allocated + 1
00131 Number_of_Epios_allocated = il_new_dim
00132
00133 Drv_Epios(id_epio_id)%status = PSMILe_status_defined
00134
00135 #ifdef VERBOSE
00136 PRINT *, '| Quit PRISMTrs_get_epio_handle - reallocation done'
00137 call psmile_flushstd
00138 #endif
00139 END SUBROUTINE PRISMTrs_get_epio_handle