00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 subroutine psmile_set_points_gridless ( method_id, point_name, &
00015 grid_id, new_points, ierror)
00016
00017
00018
00019 use PRISM
00020
00021 use PSMILe, dummy => psmile_set_points_gridless
00022
00023 implicit none
00024
00025
00026
00027 Character(len=*), Intent (In) :: point_name
00028
00029
00030
00031
00032 Integer, Intent (In) :: grid_id
00033
00034
00035
00036
00037 Logical, Intent (In) :: new_points
00038
00039
00040
00041
00042
00043 Integer, Intent (InOut) :: method_id
00044
00045
00046
00047
00048
00049 Integer, Intent (Out) :: ierror
00050
00051
00052
00053
00054
00055
00056
00057 Type (Coords_Block), pointer :: coords_pointer
00058 Integer :: i, n_dim
00059
00060 Integer, parameter :: nerrp = 3
00061 Integer :: ierrp (nerrp)
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 Character(len=len_cvs_string), save :: mycvs =
00085 '$Id: psmile_set_points_gridless.F90 2773 2010-11-25 14:48:32Z hanke $'
00086
00087
00088
00089 #ifdef VERBOSE
00090 print 9990, trim(ch_id), grid_id, new_points
00091
00092 call psmile_flushstd
00093 #endif /* VERBOSE */
00094
00095
00096
00097
00098
00099 ierror = 0
00100
00101
00102
00103
00104
00105 if (grid_id < 1 .or. &
00106 grid_id > Number_of_Grids_allocated ) then
00107 ierrp (1) = grid_id
00108 ierrp (2) = Number_of_Grids_allocated
00109
00110 ierror = PRISM_Error_Arg
00111
00112 call psmile_error ( ierror, 'grid_id', &
00113 ierrp, 2, __FILE__, __LINE__ )
00114 return
00115 endif
00116
00117 if (Grids(grid_id)%status /= PSMILe_status_defined) then
00118 ierrp (1) = grid_id
00119
00120 ierror = PRISM_Error_Arg
00121
00122 call psmile_error ( PRISM_Error_Arg, 'grid_id (not active)', &
00123 ierrp, 1, __FILE__, __LINE__ )
00124 return
00125 endif
00126
00127 if ( Grids(grid_id)%grid_type /= PRISM_Gridless ) then
00128 ierrp (1) = grid_id
00129 ierror = PRISM_Error_Arg
00130
00131 call psmile_error ( PRISM_Error_Arg, &
00132 'Coordinate points must be specified for all grids except for grids of type PRISM_Gridless', &
00133 ierrp, 1, __FILE__, __LINE__ )
00134 return
00135 endif
00136
00137
00138
00139
00140
00141 if ( new_points ) then
00142
00143
00144
00145
00146
00147 call psmile_get_method_handle (grid_id, method_id, ierror)
00148
00149 if (ierror > 0) then
00150 ierrp (1) = method_id
00151 ierror = PRISM_Error_Arg
00152 call psmile_error ( PRISM_Error_Arg, 'Failed to get a new method id', &
00153 ierrp, 1, __FILE__, __LINE__ )
00154 return
00155 endif
00156
00157 Allocate(Methods(method_id)%coords_pointer, STAT = ierror)
00158
00159 if (ierror > 0) then
00160 ierrp (1) = ierror
00161 ierror = PRISM_Error_Alloc
00162 call psmile_error ( ierror, 'coords_pointer', &
00163 ierrp, 1, __FILE__, __LINE__ )
00164 return
00165 endif
00166
00167 coords_pointer => Methods(method_id)%coords_pointer
00168
00169 do i = 1, ndim_3d
00170 Nullify ( coords_pointer%coords_real(i)%vector )
00171 Nullify ( coords_pointer%coords_dble(i)%vector )
00172 #if defined ( PRISM_QUAD_TYPE )
00173 Nullify ( coords_pointer%coords_quad(i)%vector )
00174 #endif
00175 end do
00176
00177 coords_pointer%coords_datatype = MPI_DATATYPE_NULL
00178
00179 Methods(method_id)%used_for_coupling = .false.
00180
00181 else
00182
00183 if ( Methods(method_id)%method_type /= PSMILe_PointMethod ) then
00184
00185 ierror = PRISM_Error_Parameter
00186 ierrp (1) = ierror
00187 ierrp (2) = method_id
00188 call psmile_error ( ierror, 'not a method_id for points', &
00189 ierrp, 2, __FILE__, __LINE__ )
00190 return
00191 endif
00192
00193 coords_pointer => Methods(method_id)%coords_pointer
00194 endif
00195
00196
00197
00198
00199
00200 n_dim = Grids(grid_id)%n_dim
00201 if ( n_dim > ndim_3d ) then
00202 ierrp (1) = n_dim
00203
00204 ierror = PRISM_Error_Internal
00205 call psmile_error ( ierror, 'unsupported dimension Grids(grid_id)%n_dim', &
00206 ierrp, 1, __FILE__, __LINE__ )
00207 return
00208 endif
00209
00210 Methods(method_id)%size = 0
00211
00212
00213
00214
00215
00216 coords_pointer%coords_shape = 1
00217 coords_pointer%coords_shape(1:2,1:n_dim) = &
00218 Grids(grid_id)%grid_shape(1:2,1:n_dim)
00219
00220
00221
00222
00223
00224
00225
00226
00227 Methods(method_id)%status = PSMILe_status_defined
00228
00229 Methods(method_id)%grid_id = grid_id
00230
00231 Methods(method_id)%method_type = PSMILe_PointMethod
00232
00233 Methods(method_id)%point_name = point_name
00234
00235 #ifdef VERBOSE
00236 print 9980, trim(ch_id), ierror, method_id
00237
00238 call psmile_flushstd
00239 #endif /* VERBOSE */
00240
00241
00242
00243 #ifdef VERBOSE
00244
00245 9990 format (1x, a, ': psmile_set_points_gridless: grid_id ', i3, &
00246 '; new handle ', l1)
00247 9980 format (1x, a, ': psmile_set_points_gridless: eof ierror =', i3, &
00248 '; method_id', i5)
00249
00250 #endif /* VERBOSE */
00251
00252 end subroutine psmile_set_points_gridless