psmile_move0_neighbors.F90
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_move0_neighbors (neighbors, nloc, num_neigh, &
00012 ierror)
00013
00014
00015
00016 use PRISM_constants
00017
00018 use PSMILe, dummy_interface => PSMILe_Move0_neighbors
00019
00020 implicit none
00021
00022
00023
00024 Integer, Intent (In) :: nloc
00025
00026
00027
00028 Integer, Intent (In) :: num_neigh
00029
00030
00031
00032
00033
00034 Integer, Intent (InOut) :: neighbors (nloc, num_neigh)
00035
00036
00037
00038
00039
00040 Integer, Intent (Out) :: ierror
00041
00042
00043
00044
00045
00046
00047
00048
00049 Integer :: i, j, n
00050 Integer :: ibeg, jbeg, jend, num1
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 Character(len=len_cvs_string), save :: mycvs =
00071 '$Id: psmile_move0_neighbors.F90 2325 2010-04-21 15:00:07Z valcke $'
00072
00073
00074
00075
00076
00077 #ifdef VERBOSE
00078 print 9990, trim(ch_id)
00079
00080 call psmile_flushstd
00081 #endif /* VERBOSE */
00082
00083 #ifdef PRISM_ASSERTION
00084 #endif
00085
00086 ierror = 0
00087
00088
00089
00090 num1 = num_neigh - 1
00091
00092 do n = num_neigh-1, 1, -1
00093 ibeg = 1
00094
00095 do while ( ibeg <= nloc )
00096
00097 do i = ibeg, nloc
00098 if (neighbors (i,n) == 0) exit
00099 end do
00100
00101 if (i <= nloc) then
00102
00103
00104
00105 do j = 1, num1
00106 if (neighbors (i,j) == 0 .and. neighbors (i,j+1) > 0) exit
00107 end do
00108
00109 if (j <= num1) then
00110
00111
00112
00113 jbeg = 1
00114 jend = num_neigh
00115
00116 do while ( jbeg <= jend )
00117
00118 do j = jbeg, jend
00119 if (neighbors (i,j) == 0) exit
00120 end do
00121
00122 if (j > jend) exit
00123 jbeg = j
00124
00125
00126
00127 do j = jend, jbeg+1, -1
00128 if (neighbors (i,j) > 0) exit
00129 end do
00130
00131 if (j < jbeg + 1) exit
00132
00133 neighbors (i, jbeg) = neighbors (i, j)
00134 neighbors (i, j) = 0
00135
00136 jend = j - 1
00137 jbeg = jbeg + 1
00138 end do
00139 endif
00140 endif
00141
00142 ibeg = i + 1
00143 end do
00144
00145 end do
00146
00147
00148
00149 #ifdef VERBOSE
00150 print 9980, trim(ch_id)
00151
00152 call psmile_flushstd
00153 #endif /* VERBOSE */
00154
00155
00156
00157 9990 format (1x, a, ': psmile_move0_neigbors')
00158 9980 format (1x, a, ': psmile_move0_neigbors: eof')
00159
00160 end subroutine PSMILe_Move0_neighbors