psmile_get_comp_handle.F90
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_get_comp_handle (comp_id, comp_name, ierror)
00012
00013
00014
00015 use PRISM_constants
00016
00017 use PSMILe, dummy_interface => PSMILe_Get_comp_handle
00018
00019 implicit none
00020
00021
00022
00023 character (len=*), Intent(In) :: comp_name
00024
00025
00026
00027
00028
00029 integer, Intent (Out) :: comp_id
00030
00031
00032
00033 integer, Intent (Out) :: ierror
00034
00035
00036
00037
00038
00039
00040
00041
00042 type (Component), Pointer :: New_Comps(:)
00043
00044 integer :: i
00045 integer :: new_dim
00046
00047 integer, parameter :: nerrp = 2
00048 integer :: ierrp (nerrp)
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 Character(len=len_cvs_string), save :: mycvs =
00069 '$Id: psmile_get_comp_handle.F90 2325 2010-04-21 15:00:07Z valcke $'
00070
00071
00072
00073 #ifdef VERBOSE
00074 print *, trim(ch_id), ': PSMILe_Get_comp_handle: start'
00075
00076 call psmile_flushstd
00077 #endif /* VERBOSE */
00078
00079
00080
00081
00082
00083 ierror = 0
00084 comp_id = 0
00085
00086
00087
00088
00089
00090 do i = 1, Number_of_Comps_allocated
00091 if (Comps(i)%status == PSMILe_status_free) exit
00092 end do
00093
00094 if ( i <= Number_of_Comps_allocated) then
00095
00096 comp_id = i
00097
00098 else
00099
00100
00101
00102 new_dim = Number_of_Comps_allocated + 8
00103
00104 Allocate (New_Comps (new_dim), STAT = ierror)
00105 if (ierror > 0) then
00106 ierrp (1) = ierror
00107 ierrp (2) = new_dim
00108 ierror = PRISM_Error_Alloc
00109
00110 call psmile_error ( ierror, 'New_Comps', &
00111 ierrp, 2, __FILE__, __LINE__ )
00112 return
00113 endif
00114
00115 New_Comps (1:Number_of_Comps_allocated) = &
00116 Comps (1:Number_of_Comps_allocated)
00117
00118 New_Comps(Number_of_Comps_allocated+1:new_dim)%status = &
00119 PSMILe_status_free
00120
00121
00122
00123 Deallocate (Comps, STAT = ierror)
00124 if (ierror > 0) then
00125 ierrp (1) = ierror
00126 ierror = PRISM_Error_Dealloc
00127
00128 call psmile_error ( ierror, 'Comps', &
00129 ierrp, 1, __FILE__, __LINE__ )
00130 return
00131 endif
00132
00133
00134
00135 Comps => New_Comps
00136
00137 comp_id = Number_of_Comps_allocated + 1
00138
00139 Number_of_Comps_allocated = new_dim
00140
00141 endif
00142
00143 Comps(comp_id)%status = PSMILe_status_defined
00144 Comps(comp_id)%act_comm = MPI_COMM_NULL
00145
00146 #ifdef VERBOSE
00147 print *, trim(ch_id), ': PSMILe_Get_comp_handle: eof handle, ierror =', &
00148 comp_id, ierror
00149
00150 call psmile_flushstd
00151 #endif /* VERBOSE */
00152
00153 end subroutine PSMILe_Get_comp_handle