prism_get_localcomm.F90
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 subroutine prism_get_localcomm ( comp_id, local_comm, ierror )
00014
00015
00016
00017 use PRISM, dummy_interface => PRISM_Get_localcomm
00018 use PSMILe
00019
00020 implicit none
00021
00022
00023
00024
00025 integer, intent(In) :: comp_id
00026
00027
00028
00029 integer, intent(Out) :: ierror, local_comm
00030
00031
00032
00033
00034
00035 integer, parameter :: nerrp = 2
00036 integer, dimension (nerrp) :: ierrp (nerrp)
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 Character(len=len_cvs_string), save :: mycvs =
00066 '$Id: prism_get_localcomm.F90 2687 2010-10-28 15:15:52Z coquart $'
00067
00068
00069
00070 #ifdef VERBOSE
00071 print *, trim(ch_id), ': prism_get_localcomm: start'
00072 print *, trim(ch_id), ': prism_get_localcomm: comp_id =', comp_id
00073 call psmile_flushstd
00074 #endif /* VERBOSE */
00075
00076 if ( .not. PRISM_is_initialized ) then
00077
00078 ierror = PRISM_Error_Initialized
00079 ierrp (1) = comp_id
00080
00081 call psmile_error (ierror, 'PRISM_Get_MPI_Comm', &
00082 ierrp, 1, __FILE__, __LINE__)
00083 return
00084 endif
00085
00086 ierror = 0
00087
00088 if (comp_id == PRISM_Appl_id) then
00089 local_comm = Appl%comm_user
00090 else
00091
00092
00093
00094 if (comp_id < 1 .or. &
00095 comp_id > Number_of_Comps_allocated) then
00096
00097 ierrp (1) = comp_id
00098 ierrp (2) = Number_of_Comps_allocated
00099
00100 ierror = PRISM_Error_Arg
00101
00102 call psmile_error ( ierror, 'comp_id', &
00103 ierrp, 2, __FILE__, __LINE__ )
00104 return
00105 endif
00106
00107 if (Comps(comp_id)%status == PSMILe_status_free) then
00108
00109 ierrp (1) = comp_id
00110
00111 ierror = PRISM_Error_Arg
00112
00113 call psmile_error ( PRISM_Error_Arg, 'comp_id (not active)', &
00114 ierrp, 1, __FILE__, __LINE__ )
00115 return
00116 endif
00117
00118 local_comm = Comps(comp_id)%comm_user
00119 endif
00120
00121 #ifdef PRISM_ASSERTION
00122 if ( local_comm == MPI_Comm_NULL ) then
00123 call psmile_assert ( __FILE__, __LINE__, &
00124 'returned communicator should be not MPI_COMM_NULL')
00125 endif
00126 #endif
00127
00128 #ifdef VERBOSE
00129 print *, trim(ch_id), ': prism_get_localcomm: eof ierror =', &
00130 ierror, '; local_comm =', local_comm
00131
00132 call psmile_flushstd
00133 #endif /* VERBOSE */
00134
00135 end subroutine prism_get_localcomm