OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
unit_code.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| unit_code ../starter/source/general_controls/computation/unit_code.F
25!||--- called by ------------------------------------------------------
26!|| hm_read_unit ../starter/source/general_controls/computation/hm_read_unit.F
27!||--- calls -----------------------------------------------------
28!|| ancmsg ../starter/source/output/message/message.F
29!||--- uses -----------------------------------------------------
30!|| format_mod ../starter/share/modules1/format_mod.F90
31!|| message_mod ../starter/share/message_module/message_mod.F
32!||====================================================================
33 SUBROUTINE unit_code(LENGTH,FIELD,KEY,FAC,IERR1,ID)
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, 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
164 END
#define my_real
Definition cppsort.cpp:32
#define min(a, b)
Definition macros.h:20
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:895
subroutine unit_code(length, field, key, fac, ierr1, id)
Definition unit_code.F:34