TreeMig Code
Loading...
Searching...
No Matches
IntToChar.f90
Go to the documentation of this file.
1!==============================================================================
2!
3! Name : IntToChar
4!
5! Purpose: Converts the Integer value intvalue to the character string
6! charvar of predefined length ndigits.
7! If the INTEGER has less <ndigits digits, leading zeros are stored.
8!
9! Remarks: contains the SUBROUTINE
10!
11! IntToChar (<PrepareMyOutput<TreeMigSlaveWork<...)
12!
13!==============================================================================
14! design : H. Lischke, N. Zimmermann
15! author(s) : H. Lischke, N. Zimmermann
16! implementation : H. Lischke, N. Zimmermann
17! cleaner : T.J. Loeffler
18! copyright : (c) 1999, 03 by H. Lischke
19!==============================================================================
20!=====================================================================
40!===============================================================
41
42SUBROUTINE inttochar(ndigits,intvalue,charvar)
44 IMPLICIT NONE
45
46 INTEGER, INTENT(in):: ndigits, intvalue
47 character, INTENT(out):: charvar(ndigits)
48 INTEGER:: idigit,digit,intval,digval,tenpower
49 character(1):: digchar
50 intval=intvalue
51 do idigit = ndigits, 1, -1
52 tenpower = 10**(idigit-1)
53 digit = int(intval/tenpower)
54 if (digit>9) then
55 write (logmessage, *) 'Too large number ',intvalue,' for this character array of length ', ndigits
57 error stop
58 end if
59 digval = digit*tenpower
60 intval = intval-digval
61 digchar= char(48+digit)
62 charvar(ndigits-idigit+1) = digchar
63 end do
64end SUBROUTINE inttochar
65
66
67
68
subroutine inttochar(ndigits, intvalue, charvar)
IntToChar
Definition IntToChar.f90:43
LoggerModule.
character(len=1024) logmessage
subroutine logerror(msg)
LogError