Skip to content

Commit

Permalink
Adding missing bindings for p6est functionality
Browse files Browse the repository at this point in the history
Adding an example script that illustrated how to leverage p6est
functionality
  • Loading branch information
amartinhuertas committed Jan 15, 2024
1 parent c6db4f4 commit 57d616f
Show file tree
Hide file tree
Showing 7 changed files with 555 additions and 5 deletions.
3 changes: 1 addition & 2 deletions gen/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
Clang = "40e3b903-d033-50b4-a0cc-940c62c95e31"

[compat]
Clang = "0.10.1"
Clang = "=0.10.1"
julia = "1.0"

4 changes: 3 additions & 1 deletion gen/headers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const P4EST_HEADER_FILES = [
const P6EST_HEADER_FILES = [
"p6est.h",
"p6est_extended.h",
"p6est_ghost.h"]
"p6est_ghost.h",
"p6est_lnodes.h",
"p6est_vtk.h"]

const P8EST_HEADER_FILES = [
"p8est.h",
Expand Down
2 changes: 1 addition & 1 deletion src/P4est_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ include(joinpath(@__DIR__, "api_fixes.jl"))
# Export everything starting with ...
################################################################
foreach(names(@__MODULE__, all=true)) do s
if startswith(string(s), "sc") || startswith(string(s), "p4est") || startswith(string(s), "p6est") || startswith(string(s), "p8est")
if startswith(string(s), "sc") || startswith(string(s), "p2est") || startswith(string(s), "p4est") || startswith(string(s), "p6est") || startswith(string(s), "p8est")
@eval export $s
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/api_fixes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ PXEST_NAMED_STRUCTS = Union{p4est_quadrant, p4est_tree, p4est_inspect, p4est_con
p4est_ghost_t, p4est_ghost_exchange, p4est_iter_volume_info, p4est_iter_face_side,
p4est_iter_face_info, p4est_iter_corner_side, p4est_iter_corner_info, p4est_lnodes,
p4est_lnodes_rank, p4est_lnodes_buffer, p4est_search_local_t, p4est_vtk_context,
p6est_connectivity, p2est_quadrant, p6est_ghost, p8est_quadrant, p8est_tree, sc_array,
p6est, p6est_connectivity, p2est_quadrant, p6est_ghost, p8est_quadrant, p8est_tree, sc_array,
p8est_inspect, p8est_connectivity, p8est, p8est_geometry, p8est_ghost_t,
p8est_ghost_exchange, p8est_iter_volume_info, p8est_iter_face_side, p8est_iter_face_info,
p8est_iter_edge_side, p8est_iter_edge_info, p8est_iter_corner_side, p8est_iter_corner_info,
Expand Down
34 changes: 34 additions & 0 deletions src/bindings/p6est_api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,37 @@ end
function p6est_ghost_checksum(p6est, ghost)
ccall((:p6est_ghost_checksum, p4est_lib), UInt32, (Ptr{p6est_t}, Ptr{p6est_ghost_t}), p6est, ghost)
end
# Julia wrapper for header: p6est_lnodes.h
# Automatically generated using Clang.jl


function p6est_lnodes_new(p6est, ghost_layer, degree)
ccall((:p6est_lnodes_new, p4est_lib), Ptr{p6est_lnodes_t}, (Ptr{p6est_t}, Ptr{p6est_ghost_t}, Cint), p6est, ghost_layer, degree)
end

function p6est_lnodes_get_column_labels(p6est, lnodes)
ccall((:p6est_lnodes_get_column_labels, p4est_lib), Ptr{p4est_gloidx_t}, (Ptr{p6est_t}, Ptr{p8est_lnodes_t}), p6est, lnodes)
end
# Julia wrapper for header: p6est_vtk.h
# Automatically generated using Clang.jl


function p6est_vtk_write_file(p6est, filename)
ccall((:p6est_vtk_write_file, p4est_lib), Cvoid, (Ptr{p6est_t}, Cstring), p6est, filename)
end

function p6est_vtk_write_header(p6est, scale, write_tree, write_rank, wrap_rank, point_scalars, point_vectors, filename)
ccall((:p6est_vtk_write_header, p4est_lib), Cint, (Ptr{p6est_t}, Cdouble, Cint, Cint, Cint, Cstring, Cstring, Cstring), p6est, scale, write_tree, write_rank, wrap_rank, point_scalars, point_vectors, filename)
end

function p6est_vtk_write_point_scalar(p6est, filename, scalar_name, values)
ccall((:p6est_vtk_write_point_scalar, p4est_lib), Cint, (Ptr{p6est_t}, Cstring, Cstring, Ptr{Cdouble}), p6est, filename, scalar_name, values)
end

function p6est_vtk_write_point_vector(p6est, filename, vector_name, values)
ccall((:p6est_vtk_write_point_vector, p4est_lib), Cint, (Ptr{p6est_t}, Cstring, Cstring, Ptr{Cdouble}), p6est, filename, vector_name, values)
end

function p6est_vtk_write_footer(p6est, filename)
ccall((:p6est_vtk_write_footer, p4est_lib), Cint, (Ptr{p6est_t}, Cstring), p6est, filename)
end
4 changes: 4 additions & 0 deletions src/bindings/p6est_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@ struct p6est_ghost
end

const p6est_ghost_t = p6est_ghost
const p6est_lnodes_t = p8est_lnodes_t
const p6est_lnodes_code_t = p8est_lnodes_code_t
const p6est_lnodes_rank_t = p8est_lnodes_rank_t
const p6est_lnodes_buffer_t = p8est_lnodes_buffer_t
Loading

0 comments on commit 57d616f

Please sign in to comment.