1 subroutine utulbi ( nuroul, nomflo, lnomfl,
2 > typfic, motcle, numer1, numer2,
3 > ulsort, langue, codret )
4 c ______________________________________________________________________
8 c Outil de Maillage Adaptatif par Raffinement et Deraffinement d'EDF R&D
10 c Version originale enregistree le 18 juin 1996 sous le numero 96036
11 c aupres des huissiers de justice Simart et Lavoir a Clamart
12 c Version 11.2 enregistree le 13 fevrier 2015 sous le numero 2015/014
13 c aupres des huissiers de justice
14 c Lavoir, Silinski & Cherqui-Abrahmi a Clamart
16 c HOMARD est une marque deposee d'Electricite de France
22 c ______________________________________________________________________
24 c UTilitaire - Unite Logiques des BIlans
26 c ______________________________________________________________________
28 c but : retourner le numero d'unite logique associe aux fichiers
29 c d'ecriture des bilans.
30 c . on ouvre le fichier et on renvoie le numero attribue.
31 c . la premiere cause d'erreur donnant un code de retour non nul
32 c est une mauvaise demande de type de fichier.
33 c ensuite, en cas d'erreur dans la recherche du fichier, si le
34 c type demande est positif, on renvoie le numero de la sortie
35 c standard. si le type est negatif on renvoie un code 3.
37 c Selon qu'un mot-cle a ete fourni ou non, le fichier a pour nom :
38 c "info".+[numer1.]+[numer2.]+suffixe(typfic)
39 c prefixe.+[numer1.]+[numer2.]+suffixe(typfic)
40 c ______________________________________________________________________
42 c . nom . e/s . taille . description .
43 c .____________________________________________________________________.
44 c . nuroul . s . 1 . numero d'unite logique lie au fichier .
45 c . nomflo . s . 200 . nom local du fichier .
46 c . lnomfl . s . 1 . longueur du nom local du fichier .
47 c . typfic . e . 1 . type de fichier souhaite : .
48 c . . . . 1 : bilan sur les entites .
49 c . . . . 2 : pour xmgrace .
50 c . . . . 3 : histogramme sur l'indicateur d'erreur .
51 c . . . . 4 : postscript .
52 c . . . . 5 : champ en ascii .
56 c . . . . 9 : numero d'iteration .
57 c . . . . 10 : valeurs brutes .
58 c . . . . 100 : fortran des objets stockes .
59 c . motcle . e . * . si longueur > 0 : remplace le prefixe .
60 c . . . . si longueur = 0 : on garde le prefixe .
61 c . numer1 . e . 1 . si >= 0 : 1er numero a intercaler .
62 c . . . . si < 0 : on ne fait rien .
63 c . numer2 . e . 1 . si >= 0 : 2nd numero a intercaler .
64 c . . . . si < 0 : on ne fait rien .
65 c . ulsort . e . 1 . unite logique de la liste standard .
66 c . langue . e . 1 . langue des messages .
67 c . . . . 1 : francais, 2 : anglais .
68 c . codret . s . 1 . code de retour .
69 c . . . . 0 : pas de probleme .
70 c . . . . 1 : mauvais type de fichier demande .
71 c . . . . 3 : probleme a l'ouverture .
72 c ______________________________________________________________________
75 c 0. declarations et dimensionnement
78 c 0.1. ==> generalites
84 parameter ( nompro = 'UTULBI' )
96 integer nuroul, lnomfl
97 integer typfic, numer1, numer2
102 integer ulsort, langue, codret
104 c 0.4. ==> variables locales
107 integer lnomfi, lgchai
116 parameter ( nbmess = 10 )
117 character*80 texte(nblang,nbmess)
119 c 0.5. ==> initialisations
120 c ______________________________________________________________________
128 #ifdef _DEBUG_HOMARD_
129 write (ulsort,texte(langue,1)) 'Entree', nompro
133 texte(1,5) = '(''Mot-cle : '',a)'
134 texte(1,6) = '(''Numero '',i8,'' : '',i4)'
135 texte(1,4) = '(''Type de fichier demande : '',i4)'
136 texte(1,7) = '('' --> suffixe : '',a5)'
137 texte(1,8) = '(''Repertoire racine : '',a)'
138 texte(1,9) = '(''Unite logique :'',i3)'
139 texte(1,10) = '(''Nom du fichier : '',a)'
141 texte(2,5) = '(''Keyword: '',a)'
142 texte(2,6) = '(''Number '',i8,'': '',i4)'
143 texte(2,4) = '(''File type: '',i4)'
144 texte(2,7) = '('' --> : '',a5)'
145 texte(2,8) = '(''Root directory: '',a)'
146 texte(2,9) = '(''Logical unit:'',i3)'
147 texte(2,10) = '(''File name: '',a)'
151 #ifdef _DEBUG_HOMARD_
152 write (ulsort,texte(langue,4)) typfic
153 write (ulsort,texte(langue,5)) motcle
154 write (ulsort,texte(langue,6)) 1, numer1
155 write (ulsort,texte(langue,6)) 2, numer2
162 if ( abs(typfic).eq.1 ) then
164 elseif ( abs(typfic).eq.2 ) then
166 elseif ( abs(typfic).eq.3 ) then
168 elseif ( abs(typfic).eq.4 ) then
170 elseif ( abs(typfic).eq.5 ) then
172 elseif ( abs(typfic).eq.6 ) then
174 elseif ( abs(typfic).eq.7 ) then
176 elseif ( abs(typfic).eq.8 ) then
178 elseif ( abs(typfic).eq.9 ) then
180 elseif ( abs(typfic).eq.10 ) then
182 elseif ( abs(typfic).eq.100 ) then
188 #ifdef _DEBUG_HOMARD_
189 write (ulsort,texte(langue,7)) suffix
192 nomfic( 1: 80) = blan80
193 nomfic( 81:160) = blan80
194 nomfic(161:200) = blan80(1:40)
197 c 3. Definition du repertoire des fichiers
199 #ifdef _DEBUG_HOMARD_
200 write (ulsort,90002) '3. Repertoire ; codret', codret
202 c 3.1. ==> Recherche de la donnee eventuelle
204 if ( codret.eq.0 ) then
208 call utosde ( typobs, ulsort, langue, codret )
210 if ( codret.ne.0 ) then
214 nomfic(1:lnomfi) = '.'
220 call utfino ( typobs, iaux, nomfic, lnomfi,
222 > ulsort, langue, codret )
228 c 3.2. ==> Mise en forme du nom du repertoire
230 if ( codret.eq.0 ) then
232 call dmsepf ( slash )
234 nomfic(lnomfi:lnomfi) = slash
238 #ifdef _DEBUG_HOMARD_
239 if ( codret.eq.0 ) then
240 if ( lnomfi.gt.0 ) then
241 write (ulsort,90002) 'lnomfi', lnomfi
242 write (ulsort,texte(langue,8)) nomfic(1:lnomfi)
248 c 4. nom complet du fichier
250 #ifdef _DEBUG_HOMARD_
251 write (ulsort,90002) '4. nom du fichier ; codret', codret
254 if ( lnomfi.gt.0 ) then
256 c 4.1. ==> mot-cle a intercaler
258 if ( codret.eq.0 ) then
260 call utlgut ( lgchai, motcle,
261 > ulsort, langue, codret )
265 if ( codret.eq.0 ) then
267 nomflo( 1: 80) = blan80
268 nomflo( 81:160) = blan80
269 nomflo(161:200) = blan80(1:40)
271 if ( lgchai.eq.0 ) then
274 nomflo(1:lnomfl) = 'info'
279 nomflo(1:lnomfl) = motcle(1:lgchai)
280 cc nomflo(1:lgchai) = motcle(1:lgchai)
287 c 4.2. ==> 1ere chaine a intercaler
288 c En general, on impose un retour sur au moins 2 caracteres
289 c Pour les valeurs brutes, au moins 3 caracteres
291 if ( numer1.ge.0 ) then
293 if ( codret.eq.0 ) then
295 if ( numer1.lt.100 .and. abs(typfic).ne.10 ) then
297 elseif ( numer1.lt.1000 ) then
299 elseif ( numer1.lt.10000 ) then
304 call utench ( numer1, '0', lgchai, chaine(1:iaux),
305 > ulsort, langue, codret )
308 cgn print *,'lgchai = ',lgchai
309 cgn print *,'chaine = ',chaine
311 if ( codret.eq.0 ) then
313 iaux = lnomfl + 1 + lgchai
314 nomflo(lnomfl+1:iaux) = '.'//chaine(1:lgchai)
321 c 4.3. ==> 2ere chaine a intercaler
322 c Remarque : on impose un retour sur 3 caracteres
324 if ( numer2.ge.0 ) then
326 if ( codret.eq.0 ) then
328 call utench ( numer2, '0', lgchai, chaine(1:3),
329 > ulsort, langue, codret )
332 cgn print *,'lgchai = ',lgchai
333 cgn print *,'chaine = ',chaine
335 if ( codret.eq.0 ) then
337 iaux = lnomfl + 1 + lgchai
338 nomflo(lnomfl+1:iaux) = '.'//chaine(1:lgchai)
345 c 4.4. ==> suffixe retenu
347 if ( codret.eq.0 ) then
349 call utlgut ( lgchai, suffix,
350 > ulsort, langue, codret )
352 iaux = lnomfl + 1 + lgchai
353 nomflo(lnomfl+1:iaux) = '.'//suffix(1:lgchai)
358 c 4.5. ==> nom complet
360 if ( codret.eq.0 ) then
362 nomfic(lnomfi+1:lnomfi+1+lnomfl) = nomflo(1:lnomfl)
363 lnomfi = lnomfi+lnomfl
367 #ifdef _DEBUG_HOMARD_
368 write (ulsort,texte(langue,10)) nomflo(1:lnomfl)
369 write (ulsort,texte(langue,10)) nomfic(1:lnomfi)
375 c 5. recherche de l'unite logique associee
377 #ifdef _DEBUG_HOMARD_
378 write (ulsort,90002) '5. unite logique ; codret', codret
381 if ( codret.eq.0 ) then
383 c 5.1. ==> rien n'a ete precise, on le met dans la sortie standard
385 if ( lnomfi.le.0 ) then
389 c 5.2. ==> recherche du numero d'unite logique associee au fichier
390 c soit il existe deja, soit on le cree.
395 call gucara ( nomfic, lnomfi, nuroul, codret)
397 if ( codret.eq.0 ) then
399 if ( nuroul.eq.0 ) then
400 call guoufs ( nomfic, lnomfi, nuroul, codret )
401 if ( codret.eq.0 ) then
402 call gurbbu ( nuroul, codret)
409 #ifdef _DEBUG_HOMARD_
410 write (ulsort,texte(langue,9)) nuroul
423 if ( codret.ne.0 ) then
427 write (ulsort,texte(langue,1)) 'Sortie', nompro
428 write (ulsort,texte(langue,2)) codret
429 write (ulsort,texte(langue,4)) typfic
430 write (ulsort,texte(langue,5)) motcle
431 write (ulsort,texte(langue,6)) 1, numer1
432 write (ulsort,texte(langue,6)) 2, numer2
436 #ifdef _DEBUG_HOMARD_
437 write (ulsort,texte(langue,1)) 'Sortie', nompro