psmile_transform_coords.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00003 ! All rights reserved. Use is subject to OASIS4 license terms.
00004 !-----------------------------------------------------------------------
00005 !BOP
00006 !
00007 ! !ROUTINE: PSMILe_Transform_coords
00008 !
00009 ! !INTERFACE:
00010 
00011       subroutine psmile_transform_coords (comp_info, search, ierror)
00012 !
00013 ! !USES:
00014 !
00015       use prism_constants
00016       use psmile_common, only : enddef_comp, enddef_search, &
00017                                 len_cvs_string, ch_id,      &
00018                                 MPI_REAL, MPI_DOUBLE_PRECISION
00019       use psmile, only : all_comp_infos
00020       use psmile_grid, dummy_interface => psmile_transform_coords
00021 
00022       implicit none
00023 !
00024 ! !INPUT PARAMETERS:
00025 !
00026       Type (Enddef_comp), Intent (In)     :: comp_info
00027 !
00028 !     Infos on the component (located on the actual process)
00029 !
00030 ! !INPUT/OUTPUT PARAMETERS:
00031 !
00032       Type (Enddef_search), Intent (InOut) :: search
00033 
00034 !     Data on the points to be searched
00035 !
00036 ! !OUTPUT PARAMETERS:
00037 !
00038       integer, Intent (Out)               :: ierror
00039 
00040 !     Returns the error code of PSMILe_Transform_coords;
00041 !             ierror = 0 : No error
00042 !             ierror > 0 : Severe error
00043 !
00044 ! !LOCAL VARIABLES
00045 !
00046 !
00047 !     ... for partitions
00048 !
00049       Integer                      :: ipart
00050 !
00051 !     ... for grids
00052 !
00053 ! igrid   = Grid index of local comp_info in which the donor cells
00054 !           should be searched.
00055 ! 
00056       Integer                      :: igrid, sgrid
00057 !
00058 !     ... for transformations of search coordinates
00059 !
00060       Integer                      :: tr_code, tr_code_search
00061 !
00062 ! !DESCRIPTION:
00063 !
00064 ! Subroutine "PSMILe_Transform_coords" transforms the coordinates to
00065 ! be seached into the coordinate space of the source grid.
00066 !
00067 !
00068 ! !REVISION HISTORY:
00069 !
00070 !   Date      Programmer   Description
00071 ! ----------  ----------   -----------
00072 ! 03.07.21    H. Ritzdorf  created
00073 !
00074 !EOP
00075 !----------------------------------------------------------------------
00076 !
00077 ! $Id: psmile_transform_coords.F90 2787 2010-11-29 16:51:32Z hanke $
00078 ! $Author: hanke $
00079 !
00080    Character(len=len_cvs_string), save :: mycvs = 
00081        '$Id: psmile_transform_coords.F90 2787 2010-11-29 16:51:32Z hanke $'
00082 !
00083 !----------------------------------------------------------------------
00084 !
00085 !  Initialization
00086 !
00087 #ifdef VERBOSE
00088       print 9990, trim(ch_id), search%msg_intersections%src_comp_id
00089 
00090       call psmile_flushstd
00091 #endif /* VERBOSE */
00092 
00093       ierror = 0
00094 
00095       do ipart = 1, search%npart
00096 
00097          igrid = search%msg_intersections%intersections(ipart)%src_all_extents_grid_id
00098          sgrid = search%msg_intersections%intersections(ipart)%tgt_all_extents_grid_id
00099 !
00100 !===> Transform locations to be searched
00101 !     Is required only once per method.
00102 !
00103          tr_code        =                 comp_info%all_extent_infos(3, igrid)
00104          tr_code_search = &
00105             all_comp_infos(search%msg_intersections%all_comp_infos_comp_idx)%all_extent_infos(3, sgrid)
00106 
00107 #ifdef DEBUG
00108          print *, trim(ch_id), ': igrid, sgrid, codes,',  &
00109                                   igrid, sgrid, tr_code, tr_code_search
00110          print *, trim(ch_id), ': range',  &
00111                 search%msg_intersections%intersections(ipart)%intersection
00112 #endif
00113 
00114          if (tr_code /= tr_code_search) then
00115             select case (search%datatype)
00116                case (MPI_DOUBLE_PRECISION)
00117                   call psmile_transform_coords_db_re (tr_code_to=tr_code, &
00118                      tr_code_from=tr_code_search, &
00119                      coords_data_dble=search%search_dble(1:ndim_3d, ipart), &
00120                      coords_size=search%dims(1:ndim_3d, ipart), &
00121                      datatype=search%datatype, ierror=ierror)
00122                case (MPI_REAL)
00123                   call psmile_transform_coords_db_re (tr_code_to=tr_code, &
00124                      tr_code_from=tr_code_search, &
00125                      coords_data_real=search%search_real(1:ndim_3d, ipart), &
00126                      coords_size=search%dims(1:ndim_3d, ipart), &
00127                      datatype=search%datatype, ierror=ierror)
00128                case default
00129                   ierror = ierror + 1
00130             end select
00131 
00132             if (ierror > 0) return
00133 
00134 !        else
00135 
00136 !        Transformation is not required since the source grid and the
00137 !        destination grid use the same coordinate space
00138 
00139          endif
00140       end do
00141 !
00142 !===> All done
00143 !
00144 #ifdef VERBOSE
00145       print 9980, trim(ch_id), search%msg_intersections%src_comp_id, ierror
00146 
00147       call psmile_flushstd
00148 #endif /* VERBOSE */
00149 !
00150 !  Formats:
00151 !
00152 #ifdef VERBOSE
00153 
00154 9990 format (1x, a, ': psmile_transform_coords: comp_id =', i3)
00155 9980 format (1x, a, ': psmile_transform_coords: comp_id =', i3, &
00156                     '; eof ierror =', i4)
00157 
00158 #endif /* VERBOSE */
00159 
00160       end subroutine PSMILe_Transform_coords

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1