-
Notifications
You must be signed in to change notification settings - Fork 1
/
module.F90
525 lines (474 loc) · 24.8 KB
/
module.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
MODULE CONSTANTS_MODULE
DOUBLE PRECISION, PARAMETER :: zero = 0.d0
DOUBLE PRECISION, PARAMETER :: one = 1.d0
DOUBLE PRECISION, PARAMETER :: two = 2.d0
DOUBLE PRECISION, PARAMETER :: three = 3.d0
DOUBLE PRECISION, PARAMETER :: four = 4.d0
DOUBLE PRECISION, PARAMETER :: third = one/three
DOUBLE PRECISION, PARAMETER :: two_third = two/three
DOUBLE PRECISION, PARAMETER :: half = one/two
DOUBLE PRECISION, PARAMETER :: sqrt2i = one/SQRT(two)
END MODULE CONSTANTS_MODULE
MODULE MPIUTILS_MODULE
INTERFACE
SUBROUTINE MPIUTILS_SPLITCOMM3D(comm, &
lreord, iwt, ndivx, ndivy, ndivz, &
global_comm, intra_table_comm, &
inter_table_comm, ierr)
IMPLICIT NONE
INTEGER, INTENT(IN) :: comm, iwt, ndivx, ndivy, ndivz
LOGICAL, INTENT(IN) :: lreord
INTEGER, INTENT(OUT) :: global_comm, intra_table_comm, &
inter_table_comm, ierr
END SUBROUTINE MPIUTILS_SPLITCOMM3D
SUBROUTINE MPIUTILS_SPLITCOMM2D(comm, &
lreord, iwt, ndivx, ndivz, &
global_comm, intra_table_comm, &
inter_table_comm, ierr)
IMPLICIT NONE
INTEGER, INTENT(IN) :: comm, iwt, ndivx, ndivz
LOGICAL, INTENT(IN) :: lreord
INTEGER, INTENT(OUT) :: global_comm, intra_table_comm, &
inter_table_comm, ierr
END SUBROUTINE MPIUTILS_SPLITCOMM2D
SUBROUTINE MPIUTILS_INITIALIZE3D(comm, ireord, iwt, &
ndivx, ndivy, ndivz, ierr) &
BIND(C, NAME='mpiutils_initialize3d')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(IN) :: comm, ireord, iwt, ndivx, ndivy, ndivz
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE MPIUTILS_INITIALIZE3D
SUBROUTINE MPIUTILS_INITIALIZE2D(comm, ireord, iwt, ndivx, ndivz, ierr) &
BIND(C, NAME='mpiutils_initialize2d')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(IN) :: comm, ireord, iwt, ndivx, ndivz
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE MPIUTILS_INITIALIZE2D
SUBROUTINE MPIUTILS_GRD2IJK(igrd, nx, ny, nz, i, j, k, ierr) &
BIND(C, NAME='mpiutils_grd2ijk')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(IN) :: igrd, nx, ny, nz
INTEGER(C_INT), INTENT(OUT) :: i, j, k, ierr
END SUBROUTINE MPIUTILS_GRD2IJK
SUBROUTINE MPIUTILS_FINALIZE() &
BIND(C, NAME='mpiutils_finalize')
USE ISO_C_BINDING
IMPLICIT NONE
END SUBROUTINE MPIUTILS_FINALIZE
SUBROUTINE MPIUTILS_GET_COMMUNICATORS(globalComm, intraTableComm, &
interTableComm, ierr) &
BIND(C, NAME='mpiutils_getCommunicators')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(OUT) :: globalComm, intraTableComm, &
interTableComm, ierr
END SUBROUTINE MPIUTILS_GET_COMMUNICATORS
END INTERFACE
INTEGER, SAVE :: global_comm ! overall communication
INTEGER, SAVE :: intra_table_comm ! communicate within the traveltime table
INTEGER, SAVE :: inter_table_comm ! communicate between the traveltime tables
LOGICAL, SAVE :: linitComm = .FALSE. ! flag indicating communicators are set
END MODULE MPIUTILS_MODULE
MODULE EIKONAL3D_TYPES
TYPE levelType
INTEGER, ALLOCATABLE :: ixyz_level(:) !> (ix,iy,iz) indices at each node
!> in the level
INTEGER, ALLOCATABLE :: level_ptr(:) !> start index of ixyz_level for
!> i'th level
INTEGER, ALLOCATABLE :: nnl(:) !> number of nodes in level
INTEGER nlevels !> number of levels
END TYPE levelType
TYPE localModelType
TYPE (levelType) lstruct !> local level structure
DOUBLE PRECISION, ALLOCATABLE :: slow(:) !> local slowness model (s/m)
DOUBLE PRECISION, ALLOCATABLE :: u(:) !> local traveltimes (s)
INTEGER, ALLOCATABLE :: l2g_node(:) !> maps from the local to the global
!> node
LOGICAL, ALLOCATABLE :: lghost_node(:) !> if true then this is a ghost
!> node that i must get from a
!> neighbor
LOGICAL, ALLOCATABLE :: lupd(:) !> if true then i must update this
!> node
INTEGER nx !> number of local x locations
INTEGER ny !> number of local y locations
INTEGER nz !> number of local z locations
INTEGER nxyz !> number of local grid points
INTEGER ix1 !> first global x node index of my local model
INTEGER iy1 !> first global y node index of my local model
INTEGER iz1 !> first global z node index of my local model
INTEGER myblock !> my block number
END TYPE localModelType
TYPE solverParametersType
DOUBLE PRECISION x0 !> x0 of global model (m)
DOUBLE PRECISION y0 !> y0 of global model (m)
DOUBLE PRECISION z0 !> z0 of global model (m)
DOUBLE PRECISION h !> grid spacing of model (m)
DOUBLE PRECISION tol !> tolerance (s) to declare convergence
INTEGER nx !> number of x grid points in global model
INTEGER ny !> number of y grid points in global model
INTEGER nz !> number of z grid points in global model
INTEGER ndivx !> number of blocks in x direction
INTEGER ndivy !> number of blocks in y direction
INTEGER ndivz !> number of blocks in z direction
INTEGER noverlap !> number of overlapping nodes in ghost communication
INTEGER maxit !> max number of iterations in fast sweeping method
INTEGER iverb !> controls verbosity
END TYPE solverParametersType
TYPE ghostType
DOUBLE PRECISION, ALLOCATABLE :: send_buff(:) !> Workspace for sending to
!> mydest
DOUBLE PRECISION, ALLOCATABLE :: recv_buff(:) !> Workspace for receiving from
!> mysrc
INTEGER, ALLOCATABLE :: isend_dest(:) !> indices of my local model
!> that i'm sending to mydest
INTEGER, ALLOCATABLE :: irecv_dest(:) !> indices of my local model
!> that i'm getting from mysrc
INTEGER nsend !> number of nodes to send to mydest
INTEGER nrecv !> number of nodes to receive from mydest
INTEGER mysrc !> process ID i'm receiving from
INTEGER mydest !> process ID i'm sending to
INTEGER send_request !> MPI status of non-blocking send request
INTEGER recv_request !> MPI status of non-blocking receive request
LOGICAL lrecv !> if true then i've received this request
END TYPE ghostType
END MODULE EIKONAL3D_TYPES
MODULE EIKONAL3D_MODULE
USE CONSTANTS_MODULE, ONLY : zero, one, two, three, four, &
third, two_third, half
USE EIKONAL3D_TYPES
INTERFACE
DOUBLE PRECISION FUNCTION GET_UXMIN3D(nx, ny, ix, iy, iz, u)
IMPLICIT NONE
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: u
INTEGER, INTENT(IN) :: ix, iy, iz, nx, ny
END FUNCTION GET_UXMIN3D
DOUBLE PRECISION FUNCTION GET_UYMIN3D(nx, ny, ix, iy, iz, u)
IMPLICIT NONE
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: u
INTEGER, INTENT(IN) :: ix, iy, iz, nx, ny
END FUNCTION GET_UYMIN3D
DOUBLE PRECISION FUNCTION GET_UZMIN3D(nx, ny, nz, ix, iy, iz, u)
IMPLICIT NONE
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: u
INTEGER, INTENT(IN) :: ix, iy, iz, nx, ny, nz
END FUNCTION GET_UZMIN3D
SUBROUTINE SORT3(a, b, c, a1, a2, a3)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: a, b, c
DOUBLE PRECISION, INTENT(OUT) :: a1, a2, a3
END SUBROUTINE SORT3
DOUBLE PRECISION FUNCTION SOLVE_HAMILTONIAN2D(a, b, fijh)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: a, b, fijh
END FUNCTION SOLVE_HAMILTONIAN2D
DOUBLE PRECISION FUNCTION SOLVE_HAMILTONIAN3D(a, b, c, fijkh, ierr)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: a, b, c, fijkh
INTEGER, INTENT(OUT) :: ierr
END FUNCTION SOLVE_HAMILTONIAN3D
SUBROUTINE UPDATE3D(nx, ny, nz, ix, iy, iz, h, slow, u, ierr)
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: slow
INTEGER, INTENT(IN) :: ix, iy, iz, nx, ny, nz
DOUBLE PRECISION, INTENT(IN) :: h
DOUBLE PRECISION, DIMENSION(:), INTENT(INOUT) :: u
INTEGER, INTENT(OUT) :: ierr
END SUBROUTINE UPDATE3D
SUBROUTINE EIKONAL3D_FSM(iverb, maxit, nx, ny, nz, h, tol, &
lstruct, lupd, slow, &
u, ierr)
USE EIKONAL3D_TYPES, ONLY : levelType
IMPLICIT NONE
TYPE(levelType), INTENT(IN) :: lstruct
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: slow
DOUBLE PRECISION, INTENT(IN) :: h, tol
INTEGER, INTENT(IN) :: iverb, maxit, nx, ny, nz
LOGICAL, DIMENSION(:), INTENT(IN) :: lupd
INTEGER, INTENT(OUT) :: ierr
DOUBLE PRECISION, DIMENSION(:), INTENT(INOUT) :: u
END SUBROUTINE EIKONAL3D_FSM
SUBROUTINE EVAL_UPDATE3D(nx, ny, nz, &
lrevx, lrevy, lrevz, &
h, nnl, ixyz_level, &
lupd, slow, &
u, ierr)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: h
INTEGER, INTENT(IN) :: nnl, nx, ny, nz
LOGICAL, INTENT(IN) :: lrevx, lrevy, lrevz
DOUBLE PRECISION, INTENT(IN), DIMENSION(:) :: slow
INTEGER, INTENT(IN), DIMENSION(:) :: ixyz_level
LOGICAL, INTENT(IN), DIMENSION(:) :: lupd
DOUBLE PRECISION, INTENT(INOUT), DIMENSION(:) :: u
INTEGER, INTENT(OUT) :: ierr
END SUBROUTINE EVAL_UPDATE3D
SUBROUTINE EIKONAL_SCATTER_MODEL(comm, l2g_node, slow, slow_loc)
IMPLICIT NONE
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: slow
INTEGER, DIMENSION(:), INTENT(IN) :: l2g_node
INTEGER, INTENT(IN) :: comm
DOUBLE PRECISION, DIMENSION(:), INTENT(OUT) :: slow_loc
END SUBROUTINE EIKONAL_SCATTER_MODEL
SUBROUTINE EIKONAL_SCATTER_BCS(comm, l2g_node, lisbc, u, lisbc_loc, u_loc)
IMPLICIT NONE
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: u
INTEGER, DIMENSION(:), INTENT(IN) :: l2g_node
LOGICAL, DIMENSION(:), INTENT(IN) :: lisbc
INTEGER, INTENT(IN) :: comm
DOUBLE PRECISION, DIMENSION(:), INTENT(OUT) :: u_loc
LOGICAL, DIMENSION(:), INTENT(OUT) :: lisbc_loc
END SUBROUTINE EIKONAL_SCATTER_BCS
SUBROUTINE EIKONAL_GATHER_TRAVELTIMES(comm, l2g_node, u_loc, u)
IMPLICIT NONE
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: u_loc
INTEGER, DIMENSION(:), INTENT(IN) :: l2g_node
INTEGER, INTENT(IN) :: comm
DOUBLE PRECISION, DIMENSION(:), INTENT(OUT) :: u
END SUBROUTINE EIKONAL_GATHER_TRAVELTIMES
SUBROUTINE EIKONAL3D_SETBCS(nx, ny, nz, nsrc, &
dx, dy, dz, x0, y0, z0, &
ts, xs, ys, zs, slow, &
lisbc, u, ierr)
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: slow, ts, xs, ys, zs
DOUBLE PRECISION, INTENT(IN) :: dx, dy, dz, x0, y0, z0
INTEGER, INTENT(IN) :: nx, ny, nz, nsrc
DOUBLE PRECISION, DIMENSION(:), INTENT(OUT) :: u
LOGICAL, DIMENSION(:), INTENT(OUT) :: lisbc
INTEGER, INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_SETBCS
SUBROUTINE EIKONAL3D_FSM_MPI(sweepComm, blockComm, &
iverb, maxit, &
nx_loc, ny_loc, nz_loc, &
h, tol, &
lstruct, ghosts, &
lupd_loc, lghost_node, &
slow_loc, u, ierr)
USE EIKONAL3D_TYPES, ONLY : ghostType, levelType
IMPLICIT NONE
TYPE(levelType), INTENT(IN) :: lstruct
TYPE(ghostType), DIMENSION(:), INTENT(INOUT) :: ghosts
DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: slow_loc
DOUBLE PRECISION, INTENT(IN) :: h, tol
LOGICAL, DIMENSION(:), INTENT(IN) :: lghost_node, lupd_loc
INTEGER, INTENT(IN) :: blockComm, sweepComm, iverb, maxit, &
nx_loc, ny_loc, nz_loc
DOUBLE PRECISION, DIMENSION(:), INTENT(INOUT) :: u
INTEGER, INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_FSM_MPI
SUBROUTINE EIKONAL3D_GET_LOCAL_TTIMES4(nloc, ttimes4, ierr)
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(IN) :: nloc
REAL(C_FLOAT), INTENT(OUT) :: ttimes4(nloc)
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_GET_LOCAL_TTIMES4
SUBROUTINE EIKONAL_INIT_GRID(nx, isx, x0, dx, xs, ixloc, ierr)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: x0, dx, xs
INTEGER, INTENT(IN) :: nx, isx
INTEGER, INTENT(OUT) :: ixloc(3), ierr
END SUBROUTINE EIKONAL_INIT_GRID
SUBROUTINE EIKONAL_SOURCE_INDEX(nx, x0, dx, xs, isx)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: x0, dx, xs
INTEGER, INTENT(IN) :: nx
INTEGER, INTENT(OUT) :: isx
END SUBROUTINE EIKONAL_SOURCE_INDEX
SUBROUTINE EIKONAL_GRD2IJK(igrd, nx, ny, nz, i, j, k, ierr)
IMPLICIT NONE
INTEGER, INTENT(IN) :: igrd, nx, ny, nz
INTEGER, INTENT(OUT) :: i, j, k, ierr
END SUBROUTINE EIKONAL_GRD2IJK
SUBROUTINE EIKONAL_EXCHANGE_BLOCKING(comm, ghosts, u)
USE EIKONAL3D_TYPES, ONLY : ghostType
IMPLICIT NONE
INTEGER, INTENT(IN) :: comm
TYPE(ghostType), DIMENSION(:), INTENT(INOUT) :: ghosts
DOUBLE PRECISION, DIMENSION(:), INTENT(INOUT) :: u
END SUBROUTINE EIKONAL_EXCHANGE_BLOCKING
SUBROUTINE EIKONAL_EXCHANGE(comm, ghosts, u)
USE EIKONAL3D_TYPES, ONLY : ghostType
IMPLICIT NONE
INTEGER, INTENT(IN) :: comm
TYPE(ghostType), DIMENSION(:), INTENT(INOUT) :: ghosts
DOUBLE PRECISION, DIMENSION(:), INTENT(INOUT) :: u
END SUBROUTINE EIKONAL_EXCHANGE
SUBROUTINE EIKONAL3D_GHOST_COMM(comm, ndivx, ndivy, ndivz, &
noverlap, nx, ny, nz, &
ghosts, model_loc, ierr)
USE EIKONAL3D_TYPES, ONLY : ghostType
USE EIKONAL3D_TYPES, ONLY : localModelType
IMPLICIT NONE
INTEGER, INTENT(IN) :: comm, ndivx, ndivy, ndivz, noverlap, nx, ny, nz
TYPE(ghostType), INTENT(OUT), ALLOCATABLE :: ghosts(:)
TYPE (localModelType), INTENT(OUT) :: model_loc
INTEGER, INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_GHOST_COMM
SUBROUTINE EIKONAL3D_INITIALIZE(comm, iverb, nx, ny, nz, &
ndivx, ndivy, ndivz, &
noverlap, maxit, &
x0, y0, z0, h, tol, &
ierr) &
BIND(C, NAME='eikonal3d_initialize')
USE ISO_C_BINDING
IMPLICIT NONE
REAL(C_DOUBLE), INTENT(IN) :: x0, y0, z0, h, tol
INTEGER(C_INT), INTENT(IN) :: comm, iverb, maxit, ndivx, ndivy, ndivz, &
noverlap, nx, ny, nz
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_INITIALIZE
SUBROUTINE EIKONAL3D_SOLVE(comm, nsrc, n, &
ts, xs, ys, zs, slow, &
u, ierr) &
BIND(C, NAME='eikonal3d_solve')
USE ISO_C_BINDING
INTEGER(C_INT), INTENT(IN) :: comm, n, nsrc
REAL(C_DOUBLE), INTENT(IN) :: slow(n), ts(nsrc), xs(nsrc), ys(nsrc), zs(nsrc)
REAL(C_DOUBLE), INTENT(OUT) :: u(n)
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_SOLVE
SUBROUTINE EIKONAL3D_SERIAL_DRIVER(job, iverb, maxit, nsrc, &
nx, ny, nz, &
tol, h, x0, y0, z0, &
ts, xs, ys, zs, slow, &
u, ierr) &
BIND(C, NAME='eikonal3d_serial_driver')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(IN) :: job, iverb, maxit, nsrc, nx, ny, nz
REAL(C_DOUBLE), INTENT(IN) :: slow(nx*ny*nz), ts(nsrc), xs(nsrc), &
ys(nsrc), zs(nsrc), h, tol, x0, y0, z0
REAL(C_DOUBLE), INTENT(OUT) :: u(nx*ny*nz)
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_SERIAL_DRIVER
SUBROUTINE EIKONAL3D_FINALIZE(comm, ierr) BIND(C, NAME='eikonal3d_finalize')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(IN) :: comm
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE EIKONAL3D_FINALIZE
SUBROUTINE FREE_LEVEL_STRUCT(level)
USE EIKONAL3D_TYPES, ONLY : levelType
IMPLICIT NONE
TYPE(levelType), INTENT(INOUT) :: level
END SUBROUTINE FREE_LEVEL_STRUCT
SUBROUTINE FREE_LOCAL_MODEL_STRUCT(model_loc)
USE EIKONAL3D_TYPES, ONLY : localModelType
IMPLICIT NONE
TYPE(localModelType), INTENT(INOUT) :: model_loc
END SUBROUTINE FREE_LOCAL_MODEL_STRUCT
SUBROUTINE FREE_GHOST_STRUCT(ghosts)
USE EIKONAL3D_TYPES, ONLY : ghostType
IMPLICIT NONE
TYPE(ghostType), INTENT(INOUT), ALLOCATABLE :: ghosts(:)
END SUBROUTINE FREE_GHOST_STRUCT
SUBROUTINE MAKE_LEVEL_STRUCT(nx, ny, nz, lstruct, ierr)
USE EIKONAL3D_TYPES, ONLY : levelType
IMPLICIT NONE
INTEGER, INTENT(IN) :: nx, ny, nz
TYPE(levelType), INTENT(OUT) :: lstruct
INTEGER, INTENT(OUT) :: ierr
END SUBROUTINE
END INTERFACE
DOUBLE PRECISION, PARAMETER :: u_nan = HUGE(one)
TYPE(solverParametersType), SAVE :: parms
TYPE(ghostType), ALLOCATABLE, SAVE :: ghosts(:)
TYPE(localModelType), SAVE :: model_loc
LOGICAL, SAVE :: leik_init
END MODULE EIKONAL3D_MODULE
MODULE LOCATE_TYPES
TYPE locateType
INTEGER, ALLOCATABLE :: l2g_node(:)
REAL, ALLOCATABLE :: xlocs(:)
REAL, ALLOCATABLE :: ylocs(:)
REAL, ALLOCATABLE :: zlocs(:)
INTEGER ix0
INTEGER iy0
INTEGER iz0
INTEGER nx
INTEGER ny
INTEGER nz
INTEGER nxLoc
INTEGER nyLoc
INTEGER nzLoc
INTEGER ngrd
END TYPE locateType
TYPE locateParametersType
INTEGER(KIND=8) locFileID
INTEGER(KIND=8) tttFileID
INTEGER iverb
INTEGER ndivx
INTEGER ndivy
INTEGER ndivz
INTEGER nx
INTEGER ny
INTEGER nz
LOGICAL linit
END TYPE locateParametersType
END MODULE LOCATE_TYPES
MODULE LOCATE_MODULE
USE CONSTANTS_MODULE, ONLY : one, sqrt2i, two, zero
USE LOCATE_TYPES, ONLY : locateParametersType, locateType
INTERFACE
SUBROUTINE LOCATE_INITIALIZE_PDF(ngrd, pdf)
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_INT), INTENT(IN) :: ngrd
REAL(C_DOUBLE), INTENT(OUT) :: pdf(ngrd)
END SUBROUTINE LOCATE_INITIALIZE_PDF
END INTERFACE
TYPE(locateType), SAVE :: locate
TYPE(locateParametersType), SAVE :: parms
INTEGER, PARAMETER :: COMPUTE_NONE = 0
INTEGER, PARAMETER :: COMPUTE_LOCATION_ONLY = 1
INTEGER, PARAMETER :: COMPUTE_LOCATION_AND_ORIGIN_TIME = 2
INTEGER, PARAMETER :: COMPUTE_LOCATION_AND_STATICS = 3
INTEGER, PARAMETER :: COMPUTE_ORIGIN_TIME_AND_STATICS = 4
INTEGER, PARAMETER :: COMPUTE_LOCATION_ALL = 5
END MODULE LOCATE_MODULE
MODULE H5IO_MODULE
INTERFACE
SUBROUTINE H5IO_GET_MODEL_DIMENSIONSF(inFileID, &
nx, ny, nz, &
ierr) &
BIND(C, NAME='eikonal_h5io_getModelDimensionsF')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_LONG), INTENT(IN) :: inFileID
INTEGER(C_INT), INTENT(OUT) :: nx, ny, nz, ierr
END SUBROUTINE H5IO_GET_MODEL_DIMENSIONSF
SUBROUTINE H5IO_READ_MODELF(comm, fileID, &
ix0, iy0, iz0, &
nxloc, nyloc, nzloc, &
xlocs, ylocs, zlocs, ierr) &
BIND(C, NAME='eikonal_h5io_readModelF')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_LONG), INTENT(IN) :: fileID
INTEGER(C_INT), INTENT(IN) :: comm, ix0, iy0, iz0, &
nxloc, nyloc, nzloc
REAL(C_FLOAT), INTENT(OUT) :: xlocs(nxloc*nyloc*nzloc), &
ylocs(nxloc*nyloc*nzloc), &
zlocs(nxloc*nyloc*nzloc)
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE H5IO_READ_MODELF
SUBROUTINE H5IO_READ_TRAVELTIMESF(comm, tttFileID, &
station, model, iphase, &
ix0f, iy0f, iz0f, &
nxLoc, nyLoc, nzLoc, &
ttimes, ierr) &
BIND(C, NAME='eikonal_h5io_readTraveltimesF')
USE ISO_C_BINDING
IMPLICIT NONE
INTEGER(C_LONG), INTENT(IN) :: tttFileID
INTEGER(C_INT), INTENT(IN) :: comm, ix0f, iy0f, iz0f, &
iphase, model, &
nxLoc, nyLoc, nzLoc, &
station
REAL(C_FLOAT), INTENT(OUT) :: ttimes(nxLoc*nyLoc*nzLoc)
INTEGER(C_INT), INTENT(OUT) :: ierr
END SUBROUTINE H5IO_READ_TRAVELTIMESF
END INTERFACE
END MODULE H5IO_MODULE