psmile_int2char.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_int2char
00008 !
00009 ! !INTERFACE:
00010 
00011       subroutine psmile_int2char (number, string, ipos)
00012 !
00013 ! !USES:
00014 !
00015       use PSMILe_common, dummy_interface => PSMILe_int2char
00016 !
00017       implicit none
00018 !
00019 ! !INPUT PARAMETERS:
00020 !
00021       integer,Intent(In)    :: number
00022 
00023 !     Integer written to character string "string".
00024 
00025 !
00026 ! !INPUT/OUTPUT PARAMETERS:
00027 !
00028       character(len=*), Intent(InOut)  :: string
00029 
00030 !     character string
00031 
00032       integer,Intent(InOut) :: ipos
00033 
00034 !     Pointer to the last used index in "string" =
00035 !     Length of "string" currently used.
00036 !
00037 ! !LOCAL VARIABLES
00038 !
00039       character(len=5) :: format
00040       integer          :: length
00041 !
00042 ! !DESCRIPTION:
00043 !
00044 ! Subroutine "PSMILe_int2char" writes the integer "number" as a string into
00045 ! "string(ipos+1:)" and updates "ipos" to point to the last used index
00046 ! in "string".
00047 !
00048 !
00049 ! !REVISION HISTORY:
00050 !
00051 !   Date      Programmer    Description
00052 ! ----------  -----------   -----------
00053 ! 01.12.03    H. Ritzdorf   created
00054 !
00055 !EOP
00056 !----------------------------------------------------------------------
00057 !
00058 ! $Id: psmile_int2char.F90 2325 2010-04-21 15:00:07Z valcke $
00059 ! $Author: valcke $
00060 !
00061    Character(len=len_cvs_string), save :: mycvs = 
00062        '$Id: psmile_int2char.F90 2325 2010-04-21 15:00:07Z valcke $'
00063 !
00064 !----------------------------------------------------------------------
00065 !
00066 !  Compute number of digits required for 'number'
00067 !
00068       length = int ( log10 (dble(abs(number))+0.5d0) ) + 1
00069       if (number .lt. 0) length = length + 1
00070 !
00071 !   Write integer value and update index 'ipos'
00072 !
00073       write (format, '(''(i'', i2, '')'')') length
00074       if (ipos+length .le. len(string)) &
00075          write (string (ipos+1:), format) number
00076 
00077       ipos = ipos + length
00078 !
00079       end subroutine PSMILe_int2char

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1