Salome HOME
Homard executable
[modules/homard.git] / src / tool / Dependance_Machine / dmjohe.F
1       subroutine dmjohe ( numann, nummoi, numjou, numjos,
2      >                    numheu, nummin, numsec )
3 c ______________________________________________________________________
4 c
5 c                             H O M A R D
6 c
7 c Outil de Maillage Adaptatif par Raffinement et Deraffinement d'EDF R&D
8 c
9 c Version originale enregistree le 18 juin 1996 sous le numero 96036
10 c aupres des huissiers de justice Simart et Lavoir a Clamart
11 c Version 11.2 enregistree le 13 fevrier 2015 sous le numero 2015/014
12 c aupres des huissiers de justice
13 c Lavoir, Silinski & Cherqui-Abrahmi a Clamart
14 c
15 c    HOMARD est une marque deposee d'Electricite de France
16 c
17 c Copyright EDF 1996
18 c Copyright EDF 1998
19 c Copyright EDF 2002
20 c Copyright EDF 2020
21 c ______________________________________________________________________
22 c   Dependance Machine : JOur et HEure
23 c   -          -         --      --
24 c ______________________________________________________________________
25 c
26 c
27 c  retourne la date et l'heure
28 c ______________________________________________________________________
29 c .        .     .        .                                            .
30 c .  nom   . e/s . taille .           description                      .
31 c .____________________________________________________________________.
32 c . numann .  s  .   1    . numero de l'annee                          .
33 c . nummoi .  s  .   1    . numero du mois                             .
34 c . numjou .  s  .   1    . numero du jour (1-->31)                    .
35 c . numjos .  s  .   1    . numero du jour symbolique (0-->7)          .
36 c .        .     .        . 0 : rien n'est fourni par la machine       .
37 c .        .     .        . 1-->7 : numero du jour dans la semaine     .
38 c . numheu .  s  .   1    . numero de l'heure                          .
39 c . nummin .  s  .   1    . numero des minutes                         .
40 c . numsec .  s  .   1    . numero des secondes                        .
41 c ______________________________________________________________________
42 c
43 c====
44 c 0. declarations et dimensionnement
45 c====
46 c
47 c 0.1. ==> generalites
48 c
49       implicit none
50       save
51 c
52 cgn      character*6 nompro
53 cgn      parameter ( nompro = 'DMJOHE' )
54 c
55 c 0.2. ==> communs
56 c
57 c 0.3. ==> arguments
58 c
59       integer numann, nummoi, numjou, numjos
60       integer numheu, nummin, numsec
61 c
62 c 0.4. ==> variables locales
63 c
64       integer iaux
65 c
66       character*24 tampon
67       character*8 chjour, heurus
68       character*4 nomann
69       character*3 tabday (7)
70       character*3 tabmon (12)
71       character*3 nomjou, nommoi
72 c
73 c====
74 c 1. les constantes
75 c====
76 c 1.1. ==> nom des jours
77 c
78       tabday (1) = 'Mon'
79       tabday (2) = 'Tue'
80       tabday (3) = 'Wed'
81       tabday (4) = 'Thu'
82       tabday (5) = 'Fri'
83       tabday (6) = 'Sat'
84       tabday (7) = 'Sun'
85 c
86 c 1.2. ==> nom des mois
87 c
88       tabmon (1) = 'Jan'
89       tabmon (2) = 'Feb'
90       tabmon (3) = 'Mar'
91       tabmon (4) = 'Apr'
92       tabmon (5) = 'May'
93       tabmon (6) = 'Jun'
94       tabmon (7) = 'Jul'
95       tabmon (8) = 'Aug'
96       tabmon (9) = 'Sep'
97       tabmon (10) = 'Oct'
98       tabmon (11) = 'Nov'
99       tabmon (12) = 'Dec'
100 c
101 c====
102 c 2.  determination de la date et de l'heure de passage du calcul
103 c====
104 c
105       chjour = '07/19/94'
106       heurus = '09:42:23'
107       tampon = 'Thu Jul 19  9:42:23 1994'
108       nomann = '1994'
109 c
110 c sur machine UNIX ou WINDOWS de base
111 c       1234567890123456789012345678
112 c      'day mon dd hh:mm:ss yyyy'
113 c ex : 'Thu Jul 19  9:42:23 1994'
114 c====
115 c
116 c 2.1. ==> appel a la fonction machine
117 c
118       call dmdate ( tampon )
119 c
120 c 2.2. ==> archivage sous forme standard
121 c
122       nomann = tampon(21:24)
123       nommoi = tampon(5:7)
124       nomjou = tampon(1:3)
125       chjour(4:5) = tampon(9:10)
126 c
127       heurus = tampon(12:19)
128 c
129 c====
130 c 3. decodage commun a toutes les machines
131 c====
132 c
133       if ( index('0123456789',nomann(3:3)).gt.0 .and.
134      >     index('0123456789',nomann(4:4)).gt.0       ) then
135 c
136         read ( nomann(3:4) , fmt='(i2)' ) numann
137 c
138         if (nomann(1:2).eq.'19') then
139           numann = numann + 1900
140         else
141           numann = numann + 2000
142         endif
143       else
144         numann = 1970
145       endif
146 c
147       if ( chjour(4:4).eq.' ' ) then
148         chjour(4:4) = '0'
149       endif
150       if ( index('0123',chjour(4:4)).gt.0 .and.
151      >     index('0123456789',chjour(5:5)).gt.0       ) then
152 c
153         read ( chjour(4:5) , fmt='(i2)' ) numjou
154 c
155         if ( numjou.le.0 .or. numjou.gt.31 ) then
156           numjou = 1
157         endif
158       else if ( chjour(5:5).eq.' ' .and.
159      >      index('123456789',chjour(4:4)).gt.0       ) then
160 c
161         read ( chjour(4:4) , fmt='(i1)' ) numjou
162 c
163       else
164         numjou = 1
165       endif
166 c
167 c apres la date, on s'occupe maintenant de l'heure :
168 c
169       if ( heurus(1:1).eq.' ' ) then
170         heurus(1:1) = '0'
171       endif
172       if ( index('012',heurus(1:1)).gt.0        .and.
173      >     index('0123456789',heurus(2:2)).gt.0       ) then
174 c
175         read ( heurus(1:2),fmt='(i2)' ) numheu
176 c
177         if (numheu.gt.23) then
178           numheu = 0
179         endif
180 c
181       else if ( heurus(2:2).eq.' '        .and.
182      >     index('0123456789',heurus(1:1)).gt.0       ) then
183 c
184         read ( heurus(1:1),fmt='(i1)' ) numheu
185 c
186       else
187 c
188         numheu = 0
189 c
190       endif
191 c
192       if ( index(' 012345',heurus(4:4)).gt.0 .and.
193      >     index('0123456789',heurus(5:5)).gt.0       ) then
194 c
195         read ( heurus(4:5),fmt='(i2)' ) nummin
196 c
197         if (nummin.gt.59) then
198           nummin = 0
199         endif
200 c
201       else if ( heurus(5:5).eq.' ' .and.
202      >     index('0123456789',heurus(4:4)).gt.0       ) then
203 c
204         read ( heurus(4:4),fmt='(i1)' ) nummin
205 c
206       else
207 c
208         nummin = 0
209 c
210       endif
211 c
212       if ( index(' 012345',heurus(7:7)).gt.0 .and.
213      >     index('0123456789',heurus(8:8)).gt.0       ) then
214 c
215         read ( heurus(7:8),fmt='(i2)' ) numsec
216 c
217         if (numsec.gt.59) then
218           numsec = 0
219         endif
220 c
221       else if ( heurus(8:8).eq.' ' .and.
222      >     index('0123456789',heurus(7:7)).gt.0       ) then
223 c
224         read ( heurus(7:7),fmt='(i1)' ) numsec
225 c
226       else
227 c
228         numsec = 0
229 c
230       endif
231 c
232 c====
233 c 4. decodages specifiques
234 c    . nummoi = numero du mois
235 c    . numjos = numero du jour dans la semaine
236 c====
237 c
238       nummoi = 0
239       do 41 , iaux = 1 , 12
240         if ( nommoi .eq. tabmon(iaux) ) then
241           nummoi = iaux
242         endif
243    41 continue
244 c
245       numjos = 0
246       do 42 , iaux = 1 , 7
247         if ( nomjou .eq. tabday(iaux) ) then
248           numjos = iaux
249         endif
250    42 continue
251 c
252       if (numjou.gt.28 .and. nummoi.gt.1) then
253         if (nummoi.eq.2 .and. mod(numann,4).ne.0) then
254           nummoi = 0
255         else if (nummoi.eq.2 .and. mod(numann,4).eq.0) then
256           if (numjou.gt.29) then
257             nummoi = 0
258           endif
259         else if (nummoi.eq.4 .or. nummoi.eq.6) then
260           if (numjou.gt.30) then
261             nummoi = 0
262           endif
263         else if (nummoi.eq.9 .or. nummoi.eq.11) then
264           if (numjou.gt.30) then
265             nummoi = 0
266           endif
267         endif
268       endif
269 c
270       end