From 82a19ea8c4bd44ba6cb675931881b66e5cee6b14 Mon Sep 17 00:00:00 2001 From: Boris Kaus Date: Sat, 26 Oct 2024 23:02:57 +0200 Subject: [PATCH] removes warnings --- test/examples.jl | 3 +++ test/test_dmstag.jl | 28 +++++++++++++++------------- test/test_snes.jl | 11 ++++++----- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/test/examples.jl b/test/examples.jl index a9521d00..3b89a902 100644 --- a/test/examples.jl +++ b/test/examples.jl @@ -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) @@ -8,6 +10,7 @@ function find_sources(path::String, sources=String[]) end sources end +=# @testset "examples" begin examples_dir = joinpath(@__DIR__, "..", "examples") diff --git a/test/test_dmstag.jl b/test/test_dmstag.jl index 7578a623..9761a528 100644 --- a/test/test_dmstag.jl +++ b/test/test_dmstag.jl @@ -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) @@ -611,8 +612,13 @@ 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) @@ -620,11 +626,7 @@ end 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) diff --git a/test/test_snes.jl b/test/test_snes.jl index 952e7420..c65b3628 100644 --- a/test/test_snes.jl +++ b/test/test_snes.jl @@ -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) @@ -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