psmile_set_points_gridless.F90

Go to the documentation of this file.
00001 !
00002 !-----------------------------------------------------------------------
00003 ! Copyright 2006-2010, CERFACS, Toulouse, France.
00004 ! Copyright 2006-2010, SGI Germany, Munich, Germany.
00005 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00006 ! All rights reserved. Use is subject to OASIS4 license terms.
00007 !-----------------------------------------------------------------------
00008 !BOP
00009 !
00010 ! !ROUTINE: psmile_set_points_gridless
00011 !
00012 ! !INTERFACE:
00013 
00014       subroutine psmile_set_points_gridless ( method_id, point_name, &
00015                                              grid_id, new_points, ierror)
00016 !
00017 ! !USES:
00018 !
00019       use PRISM
00020 !
00021       use PSMILe, dummy => psmile_set_points_gridless
00022 !
00023       implicit none
00024 !
00025 ! !INPUT PARAMETERS:
00026 !
00027       Character(len=*), Intent (In)       :: point_name
00028 
00029 !     Specifies the name of the set of points specified, unique on each
00030 !     process within each component.
00031 
00032       Integer,          Intent (In)       :: grid_id
00033 
00034 !     Specifies handle to the grid information created by routine
00035 !     PRISM_def_grid.
00036 
00037       Logical,          Intent (In)       :: new_points
00038 !
00039 !     Logical to indicate whether a new method id should be generated or not.
00040 !
00041 ! !INPUT/OUTPUT PARAMETERS:
00042 !
00043       Integer,          Intent (InOut)    :: method_id
00044 
00045 !     handle to the defined method.
00046 !
00047 ! !OUTPUT PARAMETERS:
00048 !
00049       Integer,          Intent (Out)      :: ierror
00050 
00051 !     Returns the error code of psmile_set_points_gridless;
00052 !             ierror = 0 : No error
00053 !             ierror > 0 : Severe error
00054 !
00055 ! !LOCAL VARIABLES
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 ! !DESCRIPTION:
00065 !
00066 ! Subroutine "psmile_set_points_gridless" defines/returns the method id
00067 ! "method_id" for a gridless grid with id "grid_id".
00068 ! The points of grid type "PRIDM_Gridless" are always defined on the
00069 ! vertices of the grid. Therefore, it is not necessary to pass coordinate
00070 ! arrays for the location of the points.
00071 !
00072 ! !REVISION HISTORY:
00073 !
00074 !   Date      Programmer   Description
00075 ! ----------  ----------   -----------
00076 ! 01.12.03    H. Ritzdorf  created
00077 !
00078 !EOP
00079 !----------------------------------------------------------------------
00080 !
00081 ! $Id: psmile_set_points_gridless.F90 2773 2010-11-25 14:48:32Z hanke $
00082 ! $Author: hanke $
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 !  Initialization
00097 !-----------------------------------------------------------------------
00098 
00099       ierror = 0
00100 
00101 !-----------------------------------------------------------------------
00102 !  Control input arguments
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 !  Store data on vertices
00139 !-----------------------------------------------------------------------
00140 
00141       if ( new_points ) then
00142 
00143 !-----------------------------------------------------------------------
00144 !  get a new method Id
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 ! Get n_dim which was defined in PRISM_def_grid
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 !  Store shapes
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 !     Update status and other info's
00222 !-----------------------------------------------------------------------
00223 !
00224 !     Mark status as changed
00225 !     ? Special status for ``unimportant data'' required?
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 !  Formats:
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

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1