Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into vs/petsc-3.22
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskaus committed Oct 26, 2024
2 parents 3edfdff + 3219e37 commit 2fbb4d9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
3 changes: 3 additions & 0 deletions test/examples.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#=
# already defined in mpi_examples, which is called earlier
function find_sources(path::String, sources=String[])
if isdir(path)
for entry in readdir(path)
Expand All @@ -8,6 +10,7 @@ function find_sources(path::String, sources=String[])
end
sources
end
=#

@testset "examples" begin
examples_dir = joinpath(@__DIR__, "..", "examples")
Expand Down
28 changes: 15 additions & 13 deletions test/test_dmstag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -440,18 +440,19 @@ end
mpirank = MPI.Comm_rank(comm)
mpisize = MPI.Comm_size(comm)

mutable struct Data_1{PetscScalar,PetscInt}
dm
x_l
f_l
end

for petsclib in PETSc.petsclibs
PETSc.initialize(petsclib)
PetscScalar = PETSc.scalartype(petsclib)
PetscInt = PETSc.inttype(petsclib)
if PetscScalar == Float64 || PetscScalar == Float32
# Define a struct that holds data we need in the local SNES routines below
mutable struct Data_1{PetscScalar,PetscInt}
dm
x_l
f_l
end


user_ctx = Data_1{PetscScalar,PetscInt}(nothing, nothing, nothing); # holds data we need in the local

function FormRes!(ptr_fx_g, ptr_x_g, user_ctx)
Expand Down Expand Up @@ -611,20 +612,21 @@ end
mpisize = MPI.Comm_size(comm)

# Tell AD that it can handle Complex as scalars
ForwardDiff.can_dual(::Type{ComplexF64}) = true
ForwardDiff.can_dual(::Type{ComplexF32}) = true
# ForwardDiff.can_dual(::Type{ComplexF64}) = true
# ForwardDiff.can_dual(::Type{ComplexF32}) = true
mutable struct Data_2D{PetscScalar,PetscInt}
dm
x_l
f_l
end

for petsclib in PETSc.petsclibs
PETSc.initialize(petsclib)
PetscScalar = PETSc.scalartype(petsclib)
PetscInt = PETSc.inttype(petsclib)
if PetscScalar == Float64 || PetscScalar == Float32

mutable struct Data_2D{PetscScalar,PetscInt}
dm
x_l
f_l
end

user_ctx = Data_2D{PetscScalar,PetscInt}(nothing, nothing, nothing); # holds data we need in the local

function FormRes!(ptr_fx_g, ptr_x_g, user_ctx)
Expand Down
11 changes: 6 additions & 5 deletions test/test_snes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ MPI.Initialized() || MPI.Init()
mpirank = MPI.Comm_rank(comm)
mpisize = MPI.Comm_size(comm)

# structure with which we can pass data to the user-routines above
mutable struct Data
vec
julia
end

for petsclib in PETSc.petsclibs
PETSc.initialize(petsclib)
Expand Down Expand Up @@ -46,11 +51,7 @@ MPI.Initialized() || MPI.Init()
PETSc.assemble(J1)
end

# structure with which we can pass data to the user-routines above
mutable struct Data
vec
julia
end


julia_vec = 0; # we want pointers to local vectors

Expand Down

0 comments on commit 2fbb4d9

Please sign in to comment.