-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathdmshell.jl
More file actions
36 lines (31 loc) · 825 Bytes
/
dmshell.jl
File metadata and controls
36 lines (31 loc) · 825 Bytes
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
using Test
using PETSc, MPI
# Initialize MPI & PETSc only if needed
mpi_started = false
if !MPI.Initialized()
MPI.Init()
mpi_started = true
end
try
local petsclib = PETSc.getlib()
petsc_started = false
if !PETSc.initialized(petsclib)
PETSc.initialize(petsclib)
petsc_started = true
end
@testset "DMShell basic" begin
shell = LibPETSc.DMShellCreate(petsclib, MPI.COMM_WORLD)
@test shell.ptr != C_NULL
LibPETSc.DMSetUp(petsclib, shell)
LibPETSc.DMDestroy(petsclib, shell)
end
if petsc_started
PETSc.finalize(petsclib)
end
catch e
try if petsc_started; PETSc.finalize(petsclib); end catch end
rethrow(e)
finally
# Do not call MPI.Finalize() from tests; test harness manages MPI lifecycle
nothing
end