psmile_extent_subgrid_3d_dble.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_Extent_Subgrid_3d_dble
00008 !
00009 ! !INTERFACE:
00010 
00011       subroutine psmile_extent_subgrid_3d_dble (         &
00012                     array, idlow, idhigh, jdlow, jdhigh, &
00013                            kdlow, kdhigh, nbr_corners,   &
00014                            shape,                        &
00015                     extent, ierror)
00016 !
00017 ! !USES:
00018 !
00019       use PRISM_constants
00020 !
00021       use PSMILe, dummy_interface => PSMILe_Extent_Subgrid_3d_dble
00022 
00023       implicit none
00024 !
00025 ! !INPUT PARAMETERS:
00026 !
00027       Integer, Intent (In)             :: idlow, idhigh
00028       Integer, Intent (In)             :: jdlow, jdhigh
00029       Integer, Intent (In)             :: kdlow, kdhigh, nbr_corners
00030 
00031 !     Dimensions of "array"
00032 
00033       Double Precision, Intent (In)    :: array (idlow:idhigh, jdlow:jdhigh, 
00034                                                  kdlow:kdhigh, nbr_corners)
00035 
00036 !     Fully dimensioned Array for which the extent of the subarray
00037 !     should be computed.
00038 !
00039       Integer, Intent (In)             :: shape (2, ndim_3d)
00040 
00041 !     Definintion of the subgrid
00042 !
00043 ! !OUTPUT PARAMETERS:
00044 !
00045       Double Precision, Intent (Out)   :: extent (2)
00046 
00047 !     Returns the extent of subarray "array (shape(:), nbr_corners)"
00048 
00049       Integer, Intent (Out)            :: ierror
00050 
00051 !     Returns the error code of PSMILe_Extent_Subgrid_3d_dble;
00052 !             ierror = 0 : No error
00053 !             ierror > 0 : Severe error
00054 !
00055 ! !DESCRIPTION:
00056 !
00057 ! Subroutine "PSMILe_Extent_Subgrid_3d_dble" computes the extent
00058 ! of the subgrid contained in array (shape(:), nbr_corners).
00059 !
00060 ! !REVISION HISTORY:
00061 !
00062 !   Date      Programmer   Description
00063 ! ----------  ----------   -----------
00064 ! 01.12.03    H. Ritzdorf  created
00065 !
00066 !EOP
00067 !----------------------------------------------------------------------
00068 !
00069 ! $Id: psmile_extent_subgrid_3d_dble.F90 2325 2010-04-21 15:00:07Z valcke $
00070 ! $Author: valcke $
00071 !
00072    Character(len=len_cvs_string), save :: mycvs = 
00073        '$Id: psmile_extent_subgrid_3d_dble.F90 2325 2010-04-21 15:00:07Z valcke $'
00074 !
00075 !----------------------------------------------------------------------
00076 
00077 #ifdef VERBOSE
00078       print *, trim(ch_id), ': PSMILe_Extent_Subgrid_3d_dble'
00079 
00080       call psmile_flushstd
00081 #endif /* VERBOSE */
00082 !
00083 !  Initialization
00084 !
00085       ierror = 0
00086 !
00087 !===> Evaluation of face points only is not correct
00088 !     HR: A checkboard access would help to decrease the number of
00089 !         acesses. However, this would imply, that the corner volumes
00090 !         would always fit.
00091 !
00092 !     Try, to help the compiler; is this necessary ?
00093 !
00094       if (shape(1,1) == idlow .and. shape(2,1) == idhigh) then
00095          if (shape(1,2) == jdlow .and. shape(2,2) == jdhigh) then
00096             if (shape(1,3) == kdlow .and. shape(2,3) == kdhigh) then
00097                extent (1) = MINVAL (array)
00098                extent (2) = MAXVAL (array)
00099             else
00100                extent (1) = MINVAL (array (:, :,                  &
00101                                            shape(1,3):shape(1,3), &
00102                                            1:nbr_corners))
00103                extent (2) = MAXVAL (array (:, :,                  &
00104                                            shape(1,3):shape(1,3), &
00105                                            1:nbr_corners))
00106             endif
00107          else 
00108             extent (1) = MINVAL (array (:,                     &
00109                                         shape(1,2):shape(1,2), &
00110                                         shape(1,3):shape(1,3), &
00111                                         1:nbr_corners))
00112             extent (2) = MAXVAL (array (:,                     &
00113                                         shape(1,2):shape(1,2), &
00114                                         shape(1,3):shape(1,3), &
00115                                         1:nbr_corners))
00116          endif
00117 
00118       else
00119 
00120          extent (1) = MINVAL (array (shape(1,1):shape(2,1), &
00121                                      shape(1,2):shape(1,2), &
00122                                      shape(1,3):shape(1,3), &
00123                                      1:nbr_corners))
00124          extent (2) = MAXVAL (array (shape(1,1):shape(2,1), &
00125                                      shape(1,2):shape(1,2), &
00126                                      shape(1,3):shape(1,3), &
00127                                      1:nbr_corners))
00128       endif
00129 !
00130 !===> All done
00131 !
00132 #ifdef VERBOSE
00133       print *, trim(ch_id), ': PSMILe_Extent_Subgrid_3d_dble eof', &
00134                             ': ierror =', ierror, &
00135                             ', extent ', extent
00136 
00137       call psmile_flushstd
00138 #endif /* VERBOSE */
00139 !
00140       end subroutine PSMILe_Extent_Subgrid_3d_dble

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1