Salome HOME
Homard executable
[modules/homard.git] / src / tool / Utilitaire / utapte.F
1       subroutine utapte ( nomobj, typnom, choix,
2      >                    nombre, lgtabl,
3      >                    adpoin, adtabl,
4      >                    ulsort, langue, codret )
5 c ______________________________________________________________________
6 c
7 c                             H O M A R D
8 c
9 c Outil de Maillage Adaptatif par Raffinement et Deraffinement d'EDF R&D
10 c
11 c Version originale enregistree le 18 juin 1996 sous le numero 96036
12 c aupres des huissiers de justice Simart et Lavoir a Clamart
13 c Version 11.2 enregistree le 13 fevrier 2015 sous le numero 2015/014
14 c aupres des huissiers de justice
15 c Lavoir, Silinski & Cherqui-Abrahmi a Clamart
16 c
17 c    HOMARD est une marque deposee d'Electricite de France
18 c
19 c Copyright EDF 1996
20 c Copyright EDF 1998
21 c Copyright EDF 2002
22 c Copyright EDF 2020
23 c ______________________________________________________________________
24 c
25 c     UTilitaire : Allocation d'un objet de type PtTabEnt
26 c     --           -                             - -  -
27 c ______________________________________________________________________
28 c .        .     .        .                                            .
29 c .  nom   . e/s . taille .           description                      .
30 c .____________________________________________________________________.
31 c . nomobj . es  . char8  . nom de l'objet PtTabEnt                    .
32 c . typnom . e   .    1   . type du nom de l'objet PtTabEnt            .
33 c .        .     .        . 0 : le nom est a creer automatiquement     .
34 c .        .     .        . 1 : le nom est impose par l'appel          .
35 c . choix  . e   .    1   . option du travail :                        .
36 c .        .     .        . 0 : on fait tout                           .
37 c .        .     .        . 1 : on n'alloue que la tete                .
38 c .        .     .        . 2 : on n'alloue que les branches           .
39 c .        .     .        . 3 : on modifie les longueurs               .
40 c . nombre . e   .    1   . nombre d'entrees ; le tableau Pointeur est .
41 c .        .     .        . dimensionne (0:nombre)                     .
42 c . lgtabl . e   .    1   . longueur de la Table                       .
43 c . adpoin .   s .    1   . adresse de Pointeur                        .
44 c . adtabl .   s .    1   . adresse de Table                           .
45 c . ulsort . e   .   1    . numero d'unite logique de la liste standard.
46 c . langue . e   .    1   . langue des messages                        .
47 c .        .     .        . 1 : francais, 2 : anglais                  .
48 c . codret . es  .    1   . code de retour des modules                 .
49 c .        .     .        . 0 : pas de probleme                        .
50 c ______________________________________________________________________
51 c
52 c====
53 c 0. declarations et dimensionnement
54 c====
55 c
56 c 0.1. ==> generalites
57 c
58       implicit none
59       save
60 c
61       character*6 nompro
62       parameter ( nompro = 'UTAPTE' )
63 c
64 #include "nblang.h"
65 c
66 c 0.2. ==> communs
67 c
68 #include "envex1.h"
69 c
70 #include "gmenti.h"
71 c
72 c 0.3. ==> arguments
73 c
74       character*8 nomobj
75 c
76       integer typnom
77       integer choix
78       integer nombre, lgtabl
79       integer adpoin, adtabl
80 c
81       integer ulsort, langue, codret
82 c
83 c 0.4. ==> variables locales
84 c
85       integer codre1, codre2, codre3, codre4
86       integer codre0
87       integer iaux, jaux
88 c
89       integer nbmess
90       parameter ( nbmess = 10 )
91       character*80 texte(nblang,nbmess)
92 c
93 c 0.5. ==> initialisations
94 c ______________________________________________________________________
95 c
96 c====
97 c 1. messages
98 c====
99 c
100 c 1.1. ==> tout va bien
101 c
102       codret = 0
103 c
104 c 1.2. ==> les messages
105 c
106 #include "impr01.h"
107 c
108 #ifdef _DEBUG_HOMARD_
109       write (ulsort,texte(langue,1)) 'Entree', nompro
110       call dmflsh (iaux)
111 #endif
112 c
113       texte(1,10) = '(''Mauvaise demande de type de nom :'',i6)'
114       texte(1,4) = '(''Probleme pour allouer l''''objet '',a8)'
115       texte(1,5) = '(''typnom = '',i3,'', choix = '',i3)'
116       texte(1,6) = '(''nombre = '',i3,'', lgtabl = '',i3)'
117       texte(1,7) = '(''Avant modification de tailles :'')'
118 c
119       texte(2,10) = '(''Bad request for the type of the name :'',i6)'
120       texte(2,4) = '(''Problem while allocating object '',a8)'
121       texte(2,5) = '(''typnom = '',i3,'', choix = '',i3)'
122       texte(2,6) = '(''nombre = '',i3,'', lgtabl = '',i3)'
123       texte(2,7) = '(''Before size modification :'')'
124 c
125 #ifdef _DEBUG_HOMARD_
126       write (ulsort,texte(langue,5)) typnom, choix
127       write (ulsort,texte(langue,6)) nombre, lgtabl
128 #endif
129 c
130 c====
131 c 2. Allocation de l'objet de tete
132 c====
133 c
134 c 2.1. ==> la tete
135 c
136       if ( choix.eq.0 .or. choix.eq.1 ) then
137 c
138         if ( typnom.eq.0 ) then
139 c  
140           call gmalot ( nomobj, 'PtTabEnt', 0, iaux, codre1 )
141           codret = abs(codre1)
142 c
143         elseif ( typnom.eq.1 ) then
144 c
145           call gmaloj ( nomobj, 'PtTabEnt', 0, iaux, codre1 )
146           codret = abs(codre1)
147 c
148         else
149 c
150           codret = -1
151 c
152         endif
153 c
154         if ( codret.eq.0 ) then
155 c
156         call gmecat ( nomobj, 1, nombre, codret )
157 c
158         endif
159 c
160       else
161 c
162         codret = 0
163 c
164       endif
165 c
166 c====
167 c 3. Les branches
168 c====
169 c
170       if ( choix.eq.0 .or. choix.eq.2 ) then
171 c
172         if ( codret.eq.0 ) then
173 c
174         call gmecat ( nomobj, 1, nombre, codre1 )
175         iaux = nombre + 1
176         call gmaloj ( nomobj//'.Pointeur', ' ', iaux, adpoin, codre2 )
177         call gmecat ( nomobj, 2, lgtabl, codre3 )
178         call gmaloj ( nomobj//'.Table' , ' ', lgtabl, adtabl, codre4 )
179 c
180         codre0 = min ( codre1, codre2, codre3, codre4 )
181         codret = max ( abs(codre0), codret,
182      >                 codre1, codre2, codre3, codre4 )
183 c
184         endif
185 c
186         if ( codret.eq.0 ) then
187 c
188         imem(adpoin) = 0
189 c
190         endif
191 c
192       endif
193 c
194 c====
195 c 4. Modifications
196 c====
197 c
198       if ( choix.eq.3 ) then
199 c
200         if ( codret.eq.0 ) then
201 c
202         call gmliat ( nomobj, 1, iaux, codre1 )
203         call gmliat ( nomobj, 2, jaux, codre2 )
204 c
205         codre0 = min ( codre1, codre2 )
206         codret = max ( abs(codre0), codret,
207      >                 codre1, codre2 )
208 c
209         endif
210 c
211         if ( codret.eq.0 ) then
212 c
213 #ifdef _DEBUG_HOMARD_
214         write (ulsort,texte(langue,7))
215         call gmprsx (nompro, nomobj )
216         call gmprsx (nompro, nomobj//'.Pointeur' )
217         call gmprsx (nompro, nomobj//'.Table' )
218 #endif
219 c
220         call gmecat ( nomobj, 1, nombre, codre1 )
221         call gmecat ( nomobj, 2, lgtabl, codre2 )
222         call gmmod ( nomobj//'.Pointeur', adpoin,
223      >               iaux+1, nombre+1, 1, 1, codre3 )
224         call gmmod ( nomobj//'.Table', adtabl,
225      >               jaux, lgtabl, 1, 1, codre4 )
226 c
227         codre0 = min ( codre1, codre2, codre3, codre4 )
228         codret = max ( abs(codre0), codret,
229      >                 codre1, codre2, codre3, codre4 )
230 c
231         endif
232 c
233       endif
234 c
235 c====
236 c 4. la fin
237 c====
238 c
239 #ifdef _DEBUG_HOMARD_
240       call gmprsx (nompro, nomobj )
241       call gmprsx (nompro, nomobj//'.Pointeur' )
242       call gmprsx (nompro, nomobj//'.Table' )
243 #endif
244 c
245       if ( codret.ne.0 ) then
246 c
247 #include "envex2.h"
248 c
249       write (ulsort,texte(langue,1)) 'Sortie', nompro
250       write (ulsort,texte(langue,2)) codret
251       if ( codret.eq.-1 ) then
252         write (ulsort,texte(langue,10)) typnom
253       else
254         write (ulsort,texte(langue,4)) nomobj
255       endif
256 c
257       endif
258 c
259 #ifdef _DEBUG_HOMARD_
260       write (ulsort,texte(langue,1)) 'Sortie', nompro
261       call dmflsh (iaux)
262 #endif
263 c
264       end