00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_mg_coarse_2d_dble (lev, chmin, chmax, &
00012 found, locations, coords1, coords2, &
00013 ibeg, iend)
00014
00015
00016
00017 use PRISM_constants
00018
00019 use PSMILe, dummy_interface => PSMILe_mg_coarse_2d_dble
00020
00021 implicit none
00022
00023
00024
00025 Integer, Intent (InOut) :: ibeg
00026
00027
00028
00029
00030 Integer, Intent (InOut) :: iend
00031
00032
00033
00034
00035
00036 Integer, Intent (InOut) :: found (iend)
00037
00038
00039
00040
00041 Integer, Intent (InOut) :: locations (iend)
00042
00043
00044
00045
00046
00047
00048
00049 Integer, Intent (In) :: lev
00050
00051
00052
00053 Type (dble_vector), Intent (In) :: chmin (ndim_2d)
00054
00055
00056
00057 Type (dble_vector), Intent (In) :: chmax (ndim_2d)
00058
00059
00060
00061 Double Precision, Intent (In) :: coords1 (iend)
00062 Double Precision, Intent (In) :: coords2 (iend)
00063
00064
00065
00066
00067
00068
00069
00070 Integer :: i, i2
00071 #ifdef VERBOSE
00072 Integer :: n
00073 #endif
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 Character(len=len_cvs_string), save :: mycvs =
00096 '$Id: psmile_mg_coarse_2d_dble.F90 2325 2010-04-21 15:00:07Z valcke $'
00097
00098
00099
00100
00101
00102 #ifdef VERBOSE
00103 print 9990, trim(ch_id), lev, ibeg, iend
00104
00105 call psmile_flushstd
00106 #endif /* VERBOSE */
00107
00108 #ifdef PRISM_ASSERTION
00109 if (chmin(1)%vector(1) > chmax(1)%vector (1) .or. &
00110 chmin(2)%vector(1) > chmax(2)%vector (1)) then
00111 print *, 'chmin', chmin(1)%vector(1), chmin(2)%vector(1)
00112 print *, 'chmax', chmax(1)%vector(1), chmax(2)%vector(1)
00113 call psmile_assert ( __FILE__, __LINE__, &
00114 'incorrect coarsest box')
00115 endif
00116 #endif
00117
00118
00119
00120
00121 do i = ibeg, iend
00122 if (chmin(1)%vector(1) <= coords1(i) .and. &
00123 chmax(1)%vector(1) >= coords1(i) .and. &
00124 chmin(2)%vector(1) <= coords2(i) .and. &
00125 chmax(2)%vector(1) >= coords2(i)) then
00126 found (i) = lev
00127 endif
00128 end do
00129
00130
00131
00132
00133 do i = ibeg, iend
00134 if (found (i) == lev) exit
00135 enddo
00136
00137 if (i > iend) then
00138 iend = ibeg - 1
00139
00140 else
00141 ibeg = i
00142
00143 if (found(iend) /= lev) then
00144
00145 do i = ibeg, iend
00146 if (found(i) == lev) then
00147 i2 = i
00148 endif
00149 enddo
00150
00151 iend = i2
00152
00153 endif
00154 endif
00155
00156
00157
00158 #ifdef VERBOSE
00159
00160
00161
00162 #ifdef DONT_USE_COUNT
00163 n = 0
00164
00165 do i = ibeg, iend
00166 if (found(i) == lev) n = n + 1
00167 end do
00168 #else
00169 n = count (found(ibeg:iend) == lev)
00170
00171 #ifdef DEBUG
00172 print *, 'chmin', chmin(1)%vector(1), chmin(2)%vector(1)
00173 print *, 'chmax', chmax(1)%vector(1), chmax(2)%vector(1)
00174
00175 do i = ibeg, iend
00176 if (found(i) /= lev) then
00177 print *, i
00178 print *, coords1(i)
00179 print *, coords2(i)
00180 exit
00181 endif
00182 end do
00183 #endif
00184 #endif
00185
00186 print 9980, trim(ch_id), lev, n
00187
00188 call psmile_flushstd
00189 #endif /* VERBOSE */
00190
00191
00192
00193 9990 format (1x, a, ': PSMILe_mg_coarse_2d_dble: level', i3, &
00194 ', ibeg, iend', 2i6)
00195 9980 format (1x, a, ': PSMILe_mg_coarse_2d_dble: eof, level', i3, &
00196 ', found =', i9)
00197
00198 end subroutine PSMILe_mg_coarse_2d_dble