OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
unit_code.F File Reference
#include "implicit_f.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine unit_code (length, field, key, fac, ierr1, id)

Function/Subroutine Documentation

◆ unit_code()

subroutine unit_code ( integer length,
character, dimension(*) field,
character, dimension(*) key,
fac,
integer ierr1,
integer id )

Definition at line 33 of file unit_code.F.

34 USE message_mod
35 USE format_mod , ONLY : fmt_f
36C-----------------------------------------------
37C I m p l i c i t T y p e s
38C-----------------------------------------------
39#include "implicit_f.inc"
40C-----------------------------------------------
41C D u m m y A r g u m e n t s
42C-----------------------------------------------
43 INTEGER LENGTH,IERR1,ID
44 CHARACTER FIELD*(*),KEY*(*) !precondition:LEN(KEY)>=4 ('-check bounds' error otherwise)
45 my_real fac
46C-----------------------------------------------
47C C o m m o n B l o c k s
48C-----------------------------------------------
49C-----------------------------------------------
50C L o c a l V a r i a b l e s
51C-----------------------------------------------
52 INTEGER I,J,J1,J2,J3,N,IREEL
53 CHARACTER CFAC*20, CUNIT
54C=======================================================================
55 ireel = 0
56 READ(field,err=100,fmt=fmt_f) fac
57 ireel=1
58* La valeur entree est un reel
59100 CONTINUE
60* La valeur entree est un code (ou une erreur)
61 IF (ireel == 0) THEN
62 cfac=' '
63 ierr1= 1
64 i = 1
65 j = 0
66 j1 = 1
67 j2 = 1
68 j3 = 1
69C Skip leading spaces
70 DO WHILE (i <= length)
71 IF (field(i:i) /= ' ') EXIT
72 I=I+1
73 ENDDO
74C Read, skip trailing spaces
75 DO WHILE (I <= LENGTH)
76 IF (FIELD(I:I) == ' ') EXIT
77 J=J+1
78 I=I+1
79 ENDDO
80 J3 = I-1
81 IF (J == 1) THEN
82 CUNIT=FIELD(J3:J3)
83 ELSEIF (J == 2) THEN
84 J1 = J3-1
85 CUNIT=FIELD(J3:J3)
86 CFAC(1:2)=FIELD(J1:J1)
87 ELSEIF (J == 3) THEN
88 J1 = J3-2
89 J2 = J3-1
90 CUNIT=FIELD(J3:J3)
91 CFAC(1:2)=FIELD(J1:J2)
92 ELSE
93 J1 = -HUGE(J1)
94 J2 = -HUGE(J2)
95 CUNIT=''
96 CFAC(1:2)=''
97 IERR1=0
98 ENDIF
99C---
100 SELECT CASE (CFAC(1:2))
101 CASE ('y ')
102 FAC=EM20*EM04
103 CASE ('z ')
104 FAC=EM20*EM01
105 CASE ('a ')
106 FAC=EM18
107 CASE ('p ')
108 FAC=EM12
109 CASE ('f ')
110 FAC=EM15
111 CASE ('n ')
112 FAC=EM09
113 CASE ('mu', 'u ')
114 ! greek letter mu was converted into ascii by subroutine ascii_encoding_mu_letter
115 FAC=EM06
116 CASE ('m ')
117 FAC=EM03
118 CASE ('c ')
119 FAC=EM02
120 CASE ('d ')
121 FAC=EM01
122 CASE (' ')
123 FAC=ONE
124 CASE ('da')
125 FAC=TEN
126 CASE ('h ')
127 FAC=HUNDRED
128 CASE ('k ')
129 FAC=EP03
130 CASE ('k ')
131 FAC=EP03
132 CASE ('m ')
133 FAC=EP06
134 CASE ('g ')
135 FAC=EP09
136 CASE ('t ')
137 FAC=EP12
138 CASE ('p ')
139 FAC=EP15
140 CASE ('e ')
141 FAC=EP18
142 CASE ('z ')
143 FAC=EP20*TEN
144 CASE ('y ')
145 FAC=EP20*EP04
146 CASE DEFAULT
147 FAC=-HUGE(FAC)
148 IERR1=0
149 END SELECT
150* L'unite SI de masse est le kg et pas le g
151 IF (KEY(1:4) == 'mass') FAC=FAC*EM03
152C---
153 IF (( KEY(1:4) == 'mass.AND.' CUNIT /= 'g.OR.')
154 . (KEY(1:MIN(LEN(KEY),6)) == 'length'.AND.cunit /= 'm').OR.
155 . ( key(1:4) == 'TIME' .AND.cunit /= 's').OR.
156 . (ierr1 == 0)
157 . ) THEN
158 CALL ancmsg(msgid=573,msgtype=msgerror,anmode=aninfo_blind_1,i1=id,c2=key,c1=field(j1:j3))
159 ENDIF
160C-----
161 ENDIF
162C-----
163 RETURN
#define my_real
Definition cppsort.cpp:32
initmumps id
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)
Definition message.F:889