00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_do_masks_match (mask1_array, mask1_shape, &
00012 mask2_array, mask2_shape, &
00013 inter, nparts, &
00014 match, ierror)
00015
00016
00017
00018 use PRISM_constants
00019
00020 use PSMILe, dummy_interface => PSMILe_do_masks_match
00021
00022 implicit none
00023
00024
00025
00026 Integer, Intent (In) :: mask1_shape (2, ndim_3d)
00027
00028
00029
00030 Logical, Intent (In) :: mask1_array (
00031 mask1_shape(1,1):mask1_shape(2,1),
00032 mask1_shape(1,2):mask1_shape(2,2),
00033 mask1_shape(1,3):mask1_shape(2,3))
00034
00035
00036
00037 Integer, Intent (In) :: mask2_shape (2, ndim_3d)
00038
00039
00040
00041 Logical, Intent (In) :: mask2_array (
00042 mask2_shape(1,1):mask2_shape(2,1),
00043 mask2_shape(1,2):mask2_shape(2,2),
00044 mask2_shape(1,3):mask2_shape(2,3))
00045
00046
00047
00048 Integer, Intent (In) :: nparts
00049
00050
00051
00052 Integer, Intent (In) :: inter (2, ndim_3d, nparts)
00053
00054
00055
00056
00057
00058 Logical, Intent (Out) :: match
00059
00060
00061
00062
00063
00064
00065
00066 Integer, Intent (Out) :: ierror
00067
00068
00069
00070
00071
00072
00073
00074 Integer :: i, ipart, j, k
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 Character(len=len_cvs_string), save :: mycvs =
00100 '$Id: psmile_do_masks_match.F90 2325 2010-04-21 15:00:07Z valcke $'
00101
00102
00103
00104 #ifdef VERBOSE
00105 print 9990, trim(ch_id)
00106
00107 call psmile_flushstd
00108 #endif /* VERBOSE */
00109
00110
00111
00112 ierror = 0
00113
00114
00115
00116 parts: do ipart = 1, nparts
00117
00118 if (inter(2,1,ipart) > inter(1,1,ipart)) then
00119
00120 do k = inter(1,3,ipart), inter(2,3,ipart)
00121 do j = inter(1,2,ipart), inter(2,2,ipart)
00122
00123 do i = inter(1,1,ipart), inter(2,1,ipart)
00124 if ( mask1_array (i,j,k) .neqv. mask2_array (i,j,k) ) exit parts
00125 end do
00126 end do
00127 end do
00128
00129 else if (inter(2,1,ipart) == inter(1,1,ipart)) then
00130
00131
00132
00133 i = inter(1,1,ipart)
00134
00135 do k = inter(1,3,ipart), inter(2,3,ipart)
00136 do j = inter(1,2,ipart), inter(2,2,ipart)
00137
00138 if ( mask1_array (i,j,k) .neqv. mask2_array (i,j,k) ) exit parts
00139 end do
00140 end do
00141 endif
00142
00143 end do parts
00144
00145
00146
00147 match = ipart > nparts
00148
00149 #ifdef VERBOSE
00150 if (.not. match) then
00151 print 9970, trim(ch_id), i,j,k, &
00152 mask1_array(i,j,k), mask2_array (i,j,k)
00153 endif
00154 #endif /* VERBOSE */
00155
00156
00157
00158 #ifdef VERBOSE
00159 print 9980, trim(ch_id), ierror, match
00160 call psmile_flushstd
00161 #endif /* VERBOSE */
00162
00163
00164
00165
00166
00167 #ifdef VERBOSE
00168
00169 9990 format (1x, a, ': psmile_do_masks_match:')
00170 9980 format (1x, a, ': psmile_do_masks_match: eof ierror =', i3, &
00171 '; match =', l2)
00172
00173 9970 format (1x, a, ": psmile_do_masks_match: mask values don't match ", &
00174 "in index (", i4, ',', i4, ',', i4, ") !", &
00175 /1x, 'local value', l2, ', remote value', l2)
00176
00177 #endif /* VERBOSE */
00178
00179 end subroutine PSMILe_do_masks_match