Skip to content

Commit

Permalink
Use Ptr{UInt8} instead of Cstring
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Nov 7, 2022
1 parent cea2f01 commit 7799f53
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/hsl_mc66.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,32 @@ end
# Thanks to `nm -D libhsl_mc66.so`!
function mc66s(m, n, nz, irn, jcn, nblocks, control, seed, row_order, info, rowptr, column_order, colptr, netcut, rowdiff, kblocks)
ccall((:__hsl_mc66_simple_MOD_monet, libhsl_mc66),
Cvoid,
Cvoid,
(Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32}, Ref{Int32}, Ref{mc66_control{Float32}}, Ref{fa14_seed}, Ptr{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32} , Ptr{Int32}, Ref{Int32}, Ref{Float32}, Ref{Int32}),
m , n , nz , irn , jcn , nblocks , control , seed , row_order , info , rowptr , column_order, colptr , netcut , rowdiff , kblocks )
end

function mc66s_print_message(info)
lp = Ref{Int32}(6)
wp = Ref{Int32}(6)
context = Ptr{Cvoid}()
function mc66s_print_message(info, control)
context = ""
ccall((:__hsl_mc66_single_MOD_monet_print_message, libhsl_mc66),
Cvoid,
(Ref{Int32}, Ref{Int32}, Ref{Int32}, Cstring),
info , lp , wp , context)
Cvoid,
(Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{UInt8}),
info , control.lp, control.wp, context )
end

function mc66d(m, n, nz, irn, jcn, nblocks, control, seed, row_order, info, rowptr, column_order, colptr, netcut, rowdiff, kblocks)
ccall((:__hsl_mc66_double_MOD_monet, libhsl_mc66),
Cvoid,
Cvoid,
(Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32}, Ref{Int32}, Ref{mc66_control{Float64}}, Ref{fa14_seed}, Ptr{Int32}, Ref{Int32}, Ptr{Int32}, Ptr{Int32} , Ptr{Int32}, Ref{Int32}, Ref{Float64}, Ref{Int32}),
m , n , nz , irn , jcn , nblocks , control , seed , row_order , info , rowptr , column_order, colptr , netcut , rowdiff , kblocks )
end

function mc66d_print_message(info, control)
context = Ptr{Cvoid}()
context = ""
ccall((:__hsl_mc66_double_MOD_monet_print_message, libhsl_mc66),
Cvoid,
(Ref{Int32}, Ref{Int32}, Ref{Int32}, Cstring),
info , control.lp, control.wp, context)
Cvoid,
(Ref{Int32}, Ref{Int32}, Ref{Int32}, Ptr{UInt8}),
info , control.lp, control.wp, context )
end

"""
Expand Down Expand Up @@ -95,6 +93,6 @@ function mc66(A::SparseMatrixCSC, nblocks::Integer)
rowdiff = Ref{Float64}()
kblocks = Ref{Cint}()
mc66d(m, n, nz, irn, jcn, nblocks, control, seed, row_order, info, rowptr, column_order, colptr, netcut, rowdiff, kblocks)
mc66d_print_message(info[], control)
mc66d_print_message(info, control)
return row_order, column_order
end

0 comments on commit 7799f53

Please sign in to comment.