From 2833357b3f3ce6032c01aeb87d43f3598f32dfc5 Mon Sep 17 00:00:00 2001 From: amartin Date: Tue, 21 Sep 2021 18:09:43 +1000 Subject: [PATCH 1/2] Renaming p4est_wrapper->P4est_wrapper --- Project.toml | 2 +- README.md | 34 +++++++++++++++++----------------- docs/make.jl | 10 +++++----- docs/src/index.md | 4 ++-- src/p4est_wrapper.jl | 12 ++++++------ test/example_1.jl | 12 ++++++------ test/example_2.jl | 16 ++++++++-------- test/example_3.jl | 36 ++++++++++++++++++------------------ test/runtests.jl | 16 ++++++++-------- test/test_p4est_bindings.jl | 28 +++++++++++++--------------- test/test_p8est_bindings.jl | 26 ++++++++++++-------------- test/test_sc_bindings.jl | 14 ++++++-------- 12 files changed, 102 insertions(+), 108 deletions(-) diff --git a/Project.toml b/Project.toml index f5e389f..e155631 100644 --- a/Project.toml +++ b/Project.toml @@ -1,4 +1,4 @@ -name = "p4est_wrapper" +name = "P4est_wrapper" uuid = "3743d7c0-8adf-11ea-380b-7d33b0ecc1da" authors = ["Victor Sande ", "Alberto F. Martin "] version = "0.1.0" diff --git a/README.md b/README.md index 0c168d5..7dd57bb 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ -# p4est_wrapper +# P4est_wrapper Julia wrappers for p4est library ([Parallel AMR on Forests of Octrees](http://www.p4est.org/)) -[![Build Status](https://github.com/gridap/p4est_wrapper.jl/workflows/CI/badge.svg?branch=master)](https://github.com/gridap/p4est_wrapper.jl/actions) -[![Codecov](https://codecov.io/gh/gridap/p4est_wrapper.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/gridap/p4est_wrapper.jl) +[![Build Status](https://github.com/gridap/P4est_wrapper.jl/workflows/CI/badge.svg?branch=master)](https://github.com/gridap/P4est_wrapper.jl/actions) +[![Codecov](https://codecov.io/gh/gridap/P4est_wrapper.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/gridap/P4est_wrapper.jl) ## Basic Usage ```julia using MPI -using p4est_wrapper +using P4est_wrapper using Test -sc_init(MPI.COMM_WORLD, Cint(true), Cint(true), C_NULL, p4est_wrapper.SC_LP_DEFAULT) -p4est_init(C_NULL, p4est_wrapper.SC_LP_DEFAULT) +sc_init(MPI.COMM_WORLD, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT) +p4est_init(C_NULL, P4est_wrapper.SC_LP_DEFAULT) unitsquare_connectivity = p4est_connectivity_new_unitsquare() unitsquare_forest = p4est_new(MPI.COMM_WORLD, unitsquare_connectivity, 0, C_NULL, C_NULL) ... @@ -28,22 +28,22 @@ MPI.Finalize() ## Installation -**p4est_wrapper.jl** itself is installed when you add and use it into another project. +**P4est_wrapper.jl** itself is installed when you add and use it into another project. Please, ensure that your system fulfill the requirements. To include into your project form Julia REPL, use the following commands: ``` -pkg> add p4est_wrapper -julia> using p4est_wrapper +pkg> add P4est_wrapper +julia> using P4est_wrapper ``` If, for any reason, you need to manually build the project, write down the following commands in Julia REPL: ``` -pkg> add p4est_wrapper -pkg> build p4est_wrapper -julia> using p4est_wrapper +pkg> add P4est_wrapper +pkg> build P4est_wrapper +julia> using P4est_wrapper ``` ### Requirements @@ -51,15 +51,15 @@ julia> using p4est_wrapper - `p4est >= 2.2` - `MPI` -`p4est_wrapper` julia package requires `p4est` library ([Parallel AMR on Forests of Octrees](http://www.p4est.org/)), and (optionally) `MPI` to work correctly. +`P4est_wrapper` julia package requires `p4est` library ([Parallel AMR on Forests of Octrees](http://www.p4est.org/)), and (optionally) `MPI` to work correctly. - Latests versions of julia `MPI` use artifacts to locally install a MPI distribution. You should take care with the compatibility (version/vendor/distribution) between the parallel `p4est` and `MPI` libraries. If you want julia `MPI` library to wrap your local MPI library, you must export `JULIA_MPI_BINARY="system"` before installing the package. - - Parallel `p4est` library can be manually installed in a custom path on your local machine. In order to succesfull describe your custom installation to be discovered by `p4est_wrapper`, you must export `P4EST_ROOT_DIR` environment variable pointing to the installation directory. If this environment variable is not available, and `julia >= 1.3`, `p4est_wrapper` will try to use [`P4est_jll` artifact](https://github.com/JuliaBinaryWrappers/P4est_jll.jl), but you should take into account that this artifact is not for parallel computations (MPI not enabled). Finally, in other case `p4est_wrapper` will try to find the `p4est` library in the usual linux user library directory (`/usr/lib`). + - Parallel `p4est` library can be manually installed in a custom path on your local machine. In order to succesfull describe your custom installation to be discovered by `P4est_wrapper`, you must export `P4EST_ROOT_DIR` environment variable pointing to the installation directory. If this environment variable is not available, and `julia >= 1.3`, `P4est_wrapper` will try to use [`P4est_jll` artifact](https://github.com/JuliaBinaryWrappers/P4est_jll.jl), but you should take into account that this artifact is not for parallel computations (MPI not enabled). Finally, in other case `P4est_wrapper` will try to find the `p4est` library in the usual linux user library directory (`/usr/lib`). #### Basic OpenMPI installation in debian based systems `MPI` can be obtained from the default repositories of your Debian-based OS by means of `apt` tool. -Basic `MPI` installation in order to use it from `p4est_wrapper` julia package is as follows: +Basic `MPI` installation in order to use it from `P4est_wrapper` julia package is as follows: ``` apt-get update @@ -102,8 +102,8 @@ Note: you need the following tools: ## Automated p4est wrapper generator -`p4est_wrapper` bindings are automatically generated by using [Clang](https://github.com/JuliaInterop/Clang.jl) package. +`P4est_wrapper` bindings are automatically generated by using [Clang](https://github.com/JuliaInterop/Clang.jl) package. -To learn more about how it works, please read the README file at [gen directory](https://github.com/gridap/p4est_wrapper.jl/tree/master/gen). +To learn more about how it works, please read the README file at [gen directory](https://github.com/gridap/P4est_wrapper.jl/tree/master/gen). diff --git a/docs/make.jl b/docs/make.jl index 76ca937..c9da0ec 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,17 +1,17 @@ -using Documenter, p4est_wrapper +using Documenter, P4est_wrapper makedocs(; - modules=[p4est_wrapper], + modules=[P4est_wrapper], format=Documenter.HTML(), pages=[ "Home" => "index.md", ], - repo="https://github.com/gridap/p4est_wrapper.jl/blob/{commit}{path}#L{line}", - sitename="p4est_wrapper.jl", + repo="https://github.com/gridap/P4est_wrapper.jl/blob/{commit}{path}#L{line}", + sitename="P4est_wrapper.jl", authors="VĂ­ctor Sande , Large Scale Scientific Computing", assets=String[], ) deploydocs(; - repo="github.com/gridap/p4est_wrapper.jl", + repo="github.com/gridap/P4est_wrapper.jl", ) diff --git a/docs/src/index.md b/docs/src/index.md index 67e0657..bed6282 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,8 +1,8 @@ -# p4est_wrapper.jl +# P4est_wrapper.jl ```@index ``` ```@autodocs -Modules = [p4est_wrapper] +Modules = [P4est_wrapper] ``` diff --git a/src/p4est_wrapper.jl b/src/p4est_wrapper.jl index af83ce5..f8221d2 100644 --- a/src/p4est_wrapper.jl +++ b/src/p4est_wrapper.jl @@ -1,4 +1,4 @@ -module p4est_wrapper +module P4est_wrapper ################################################################ # Check correct installation @@ -6,19 +6,19 @@ module p4est_wrapper # Load in `deps.jl`, complaining if it does not exist const depsjl_path = joinpath(@__DIR__, "..", "deps", "deps.jl") if !isfile(depsjl_path) - error("p4est_wrapper was not build properly. Please run Pkg.build(\"p4est.jl\").") + error("P4est_wrapper was not build properly. Please run Pkg.build(\"p4est.jl\").") end include(depsjl_path) # Check if p4est library was found if(!P4EST_FOUND) - error("p4est_wrapper was not build properly. Please run Pkg.build(\"p4est.jl\").") + error("P4est_wrapper was not build properly. Please run Pkg.build(\"p4est.jl\").") end # Use library path from build process const p4est_lib = P4EST_LIB ################################################################ -# Use dependencies +# Use dependencies ################################################################ using Libdl using MPI @@ -32,7 +32,7 @@ export Ctm, Ctime_t, Cclock_t # Include P4EST bindings -# The following file fix and/or complete +# The following file fix and/or complete # the automated generation of types and data structures include(joinpath(@__DIR__, "common_fixes.jl")) @@ -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), "p4est") || startswith(string(s), "p6est") || startswith(string(s), "p8est") @eval export $s end end diff --git a/test/example_1.jl b/test/example_1.jl index f340bcf..bd5d326 100644 --- a/test/example_1.jl +++ b/test/example_1.jl @@ -1,5 +1,5 @@ using MPI -using p4est_wrapper +using P4est_wrapper using Test # Initialize MPI if not initialized yet @@ -38,17 +38,17 @@ const search_point_fn_c = @cfunction(search_point_fn, Cint, (Ptr{p4est_t}, p4est # Main program ############################################################################# -mpicomm = p4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) +mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) # Create a connectivity structure for the unit square. -unitsquare_connectivity = p4est_connectivity_new_unitsquare() +unitsquare_connectivity = p4est_connectivity_new_unitsquare() @test unitsquare_connectivity != C_NULL # Create a new forest -unitsquare_forest = p4est_new(mpicomm, unitsquare_connectivity, 0, C_NULL, C_NULL) +unitsquare_forest = p4est_new(mpicomm, unitsquare_connectivity, 0, C_NULL, C_NULL) @test unitsquare_forest != C_NULL -# Register callback function to decide for refinement. +# Register callback function to decide for refinement. p4est_refine(unitsquare_forest, 1, my_refine_c, C_NULL) # Create a new sc_array @@ -59,7 +59,7 @@ ptr_to_points_sc_array = sc_array_new_count(sizeof(point_t), 2) points_sc_array = ptr_to_points_sc_array[] @test points_sc_array.elem_count == 2 && points_sc_array.elem_size == sizeof(point_t) -# Obtain reference to first point_t +# Obtain reference to first point_t ptr_to_points_array = Ptr{point_t}(sc_array_index(ptr_to_points_sc_array,0)) @test ptr_to_points_array != C_NULL diff --git a/test/example_2.jl b/test/example_2.jl index 04b759f..d31cc88 100644 --- a/test/example_2.jl +++ b/test/example_2.jl @@ -1,5 +1,5 @@ using MPI -using p4est_wrapper +using P4est_wrapper using Test # Initialize MPI if not initialized yet @@ -26,24 +26,24 @@ const my_refine_c = @cfunction(my_refine, Cint, (Ptr{p4est_t}, p4est_topidx_t, P # Main program ############################################################################# -mpicomm = p4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) +mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) # Create a connectivity structure for the unit square. -unitsquare_connectivity = p4est_connectivity_new_unitsquare() +unitsquare_connectivity = p4est_connectivity_new_unitsquare() @assert Bool(p4est_connectivity_is_valid(unitsquare_connectivity)) # Create a new forest -unitsquare_forest = p4est_new(mpicomm, unitsquare_connectivity, sizeof(p4est_quadrant_t), C_NULL, C_NULL) +unitsquare_forest = p4est_new(mpicomm, unitsquare_connectivity, sizeof(p4est_quadrant_t), C_NULL, C_NULL) @test unitsquare_forest != C_NULL -# Register callback function to decide for refinement. +# Register callback function to decide for refinement. p4est_refine(unitsquare_forest, 1, my_refine_c, C_NULL) # Equally partition the forest. The partition can be by element count or by a user-defined weight. p4est_partition(unitsquare_forest, 0, C_NULL); -# Build the ghost layer. -ptr_to_p4est_ghost = p4est_ghost_new(unitsquare_forest, p4est_wrapper.P4EST_CONNECT_FULL) +# Build the ghost layer. +ptr_to_p4est_ghost = p4est_ghost_new(unitsquare_forest, P4est_wrapper.P4EST_CONNECT_FULL) p4est_ghost = ptr_to_p4est_ghost[] # Obtain ghost quadrants @@ -56,7 +56,7 @@ for i=1:p4est_ghost.mpisize quadrant = ptr_ghost_quadrants[j+1] piggy3 = quadrant.p.piggy3 @test Bool(p4est_quadrant_is_valid(ptr_ghost_quadrants+(sizeof(p4est_quadrant_t)*j))) - p4est_quadrant_print(p4est_wrapper.SC_LP_INFO, ptr_ghost_quadrants+(sizeof(p4est_quadrant_t)*j)) + p4est_quadrant_print(P4est_wrapper.SC_LP_INFO, ptr_ghost_quadrants+(sizeof(p4est_quadrant_t)*j)) print("(i, j, local_num, which_tree) ($(i),$(j),$(piggy3.local_num),$(piggy3.which_tree)) \n") end end diff --git a/test/example_3.jl b/test/example_3.jl index 22b3f95..2a9b9cd 100644 --- a/test/example_3.jl +++ b/test/example_3.jl @@ -1,5 +1,5 @@ using MPI -using p4est_wrapper +using P4est_wrapper using Test # Initialize MPI if not initialized yet @@ -27,8 +27,8 @@ const coarsen_flag = Cint(2) # back function to an array of ints with as many entries as forest quadrants. This call back function # initializes the quadrant->p.user_data void * pointer of all quadrants such that it # points to the corresponding entry in the global array mentioned in the previous sentence. -function init_fn_callback_2d(forest_ptr::Ptr{p4est_t}, - which_tree::p4est_topidx_t, +function init_fn_callback_2d(forest_ptr::Ptr{p4est_t}, + which_tree::p4est_topidx_t, quadrant_ptr::Ptr{p4est_quadrant_t}) @assert which_tree == 0 # Extract a reference to the first (and uniquely allowed) tree @@ -45,8 +45,8 @@ end const init_fn_callback_2d_c = @cfunction(init_fn_callback_2d, Cvoid, (Ptr{p4est_t}, p4est_topidx_t, Ptr{p4est_quadrant_t})) -function refine_callback_2d(::Ptr{p4est_t}, - which_tree::p4est_topidx_t, +function refine_callback_2d(::Ptr{p4est_t}, + which_tree::p4est_topidx_t, quadrant_ptr::Ptr{p4est_quadrant_t}) @assert which_tree == 0 quadrant = quadrant_ptr[] @@ -58,17 +58,17 @@ const refine_callback_2d_c = @cfunction(refine_callback_2d, Cint, (Ptr{p4est_t}, # For each refined quadrant: # num_calls is even -> leave untouched all children # num_calls is odd -> mark all children for coarsening -function refine_replace_callback_2d(forest_ptr::Ptr{p4est_t}, - which_tree::p4est_topidx_t, - num_outgoing::Cint, - outgoing_ptr::Ptr{Ptr{p4est_quadrant_t}}, - num_incoming::Cint, +function refine_replace_callback_2d(forest_ptr::Ptr{p4est_t}, + which_tree::p4est_topidx_t, + num_outgoing::Cint, + outgoing_ptr::Ptr{Ptr{p4est_quadrant_t}}, + num_incoming::Cint, incoming_ptr::Ptr{Ptr{p4est_quadrant_t}}) @assert which_tree == 0 @assert num_outgoing == 1 - @assert num_incoming == p4est_wrapper.P4EST_CHILDREN - incoming = unsafe_wrap(Array, incoming_ptr, p4est_wrapper.P4EST_CHILDREN) - for quadrant_index = 1:p4est_wrapper.P4EST_CHILDREN + @assert num_incoming == P4est_wrapper.P4EST_CHILDREN + incoming = unsafe_wrap(Array, incoming_ptr, P4est_wrapper.P4EST_CHILDREN) + for quadrant_index = 1:P4est_wrapper.P4EST_CHILDREN quadrant = incoming[quadrant_index][] if (num_calls % 2 == 0) unsafe_store!(Ptr{Cint}(quadrant.p.user_data), nothing_flag, 1) @@ -87,8 +87,8 @@ function coarsen_callback_2d(forest_ptr::Ptr{p4est_t}, quadrants_ptr::Ptr{Ptr{p4est_quadrant_t}}) @assert which_tree == 0 coarsen = Cint(1) - quadrants = unsafe_wrap(Array, quadrants_ptr, p4est_wrapper.P4EST_CHILDREN) - for quadrant_index = 1:p4est_wrapper.P4EST_CHILDREN + quadrants = unsafe_wrap(Array, quadrants_ptr, P4est_wrapper.P4EST_CHILDREN) + for quadrant_index = 1:P4est_wrapper.P4EST_CHILDREN quadrant = quadrants[quadrant_index][] coarsen = Cint(unsafe_wrap(Array, Ptr{Cint}(quadrant.p.user_data), 1)[] == coarsen_flag) if (!Bool(coarsen)) return coarsen end @@ -119,9 +119,9 @@ end # Main program ############################################################################# -mpicomm = p4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) -sc_init(mpicomm, Cint(true), Cint(true), C_NULL, p4est_wrapper.SC_LP_DEFAULT) -p4est_init(C_NULL, p4est_wrapper.SC_LP_DEFAULT) +mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) +sc_init(mpicomm, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT) +p4est_init(C_NULL, P4est_wrapper.SC_LP_DEFAULT) unitsquare_connectivity = p4est_connectivity_new_unitsquare() unitsquare_forest = p4est_new(mpicomm, unitsquare_connectivity, 0, C_NULL, C_NULL) diff --git a/test/runtests.jl b/test/runtests.jl index 1061402..71da50a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,42 +1,42 @@ using MPI -using p4est_wrapper +using P4est_wrapper using Test # Skip tests if library was not properly loaded -if p4est_wrapper.P4EST_FOUND +if P4est_wrapper.P4EST_FOUND nprocs = min(Sys.CPU_THREADS, 2) dir = dirname(@__FILE__) julia = Base.julia_cmd() mpiexec = MPI.mpiexec_path - @testset "Test SC bindings" begin + @testset "Test SC bindings" begin cmd = `$mpiexec -n $nprocs --allow-run-as-root --tag-output $(julia) $(joinpath(dir, "test_sc_bindings.jl"))` @show cmd run(cmd) end - @testset "Test P4EST bindings" begin + @testset "Test P4EST bindings" begin cmd = `$mpiexec -n $nprocs --allow-run-as-root --tag-output $(julia) $(joinpath(dir, "test_p4est_bindings.jl"))` @show cmd run(cmd) end - @testset "Test P8EST bindings" begin + @testset "Test P8EST bindings" begin cmd = `$mpiexec -n $nprocs --allow-run-as-root --tag-output $(julia) $(joinpath(dir, "test_p8est_bindings.jl"))` @show cmd run(cmd) end - @testset "Example 1" begin + @testset "Example 1" begin cmd = `$mpiexec -n $nprocs --allow-run-as-root --tag-output $(julia) $(joinpath(dir, "example_1.jl"))` @show cmd run(cmd) end - @testset "Example 2" begin + @testset "Example 2" begin cmd = `$mpiexec -n $nprocs --allow-run-as-root --tag-output $(julia) $(joinpath(dir, "example_2.jl"))` @show cmd run(cmd) end - @testset "Example 3" begin + @testset "Example 3" begin cmd = `$mpiexec -n $nprocs --allow-run-as-root --tag-output $(julia) $(joinpath(dir, "example_3.jl"))` @show cmd run(cmd) diff --git a/test/test_p4est_bindings.jl b/test/test_p4est_bindings.jl index 0b66bc1..379804a 100644 --- a/test/test_p4est_bindings.jl +++ b/test/test_p4est_bindings.jl @@ -1,5 +1,5 @@ using MPI -using p4est_wrapper +using P4est_wrapper using Test # Initialize MPI if not initialized yet @@ -11,7 +11,7 @@ end # Definition of data structures and function callbacks ############################################################################# -mpicomm = p4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) +mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) # Dummy callback dummy_callback( ::Ptr{p4est_t}, which_tree::p4est_topidx_t, quadrant::Ptr{p4est_quadrant_t}) = Cint(0) @@ -31,12 +31,12 @@ unitsquare_connectivity = p4est_connectivity_new_unitsquare() @test p4est_connectivity_reduce(unitsquare_connectivity) == nothing # Test new connectivities -for test_conn in [p4est_connectivity_new_periodic(), - p4est_connectivity_new_rotwrap(), - p4est_connectivity_new_corner(), - p4est_connectivity_new_pillow(), - p4est_connectivity_new_moebius(), - p4est_connectivity_new_star(), +for test_conn in [p4est_connectivity_new_periodic(), + p4est_connectivity_new_rotwrap(), + p4est_connectivity_new_corner(), + p4est_connectivity_new_pillow(), + p4est_connectivity_new_moebius(), + p4est_connectivity_new_star(), p4est_connectivity_new_cubed(), p4est_connectivity_new_brick(3, 18, 0, 1)] @test test_conn != C_NULL @@ -46,7 +46,7 @@ for test_conn in [p4est_connectivity_new_periodic(), end # Create a new forest -unitsquare_forest = p4est_new(mpicomm, unitsquare_connectivity, 0, C_NULL, C_NULL) +unitsquare_forest = p4est_new(mpicomm, unitsquare_connectivity, 0, C_NULL, C_NULL) @test unitsquare_forest != C_NULL # Create/Destroy geometry @@ -63,16 +63,16 @@ unitsquare_forest_copy = p4est_copy_ext(unitsquare_forest, 1, 0) # Operations on forests @test p4est_partition(unitsquare_forest, 0, C_NULL) == nothing @test p4est_partition_ext(unitsquare_forest, 0, C_NULL) == 0 -@test p4est_balance(unitsquare_forest, p4est_wrapper.P4EST_CONNECT_FULL, C_NULL) == nothing -@test p4est_balance_ext(unitsquare_forest, p4est_wrapper.P4EST_CONNECT_FULL, C_NULL, C_NULL) == nothing +@test p4est_balance(unitsquare_forest, P4est_wrapper.P4EST_CONNECT_FULL, C_NULL) == nothing +@test p4est_balance_ext(unitsquare_forest, P4est_wrapper.P4EST_CONNECT_FULL, C_NULL, C_NULL) == nothing @test p4est_refine(unitsquare_forest, 1, dummy_callback_c, C_NULL) == nothing @test p4est_refine_ext(unitsquare_forest, 1, -1, dummy_callback_c, C_NULL, C_NULL) == nothing @test p4est_coarsen(unitsquare_forest, 1, dummy_callback_c, C_NULL) == nothing @test p4est_coarsen_ext(unitsquare_forest, 1, 0, dummy_callback_c, C_NULL, C_NULL) == nothing @test p4est_revision(unitsquare_forest) == 0 @test typeof(p4est_checksum(unitsquare_forest)) == UInt32 -@test p4est_connect_type_int(p4est_wrapper.P4EST_CONNECT_FACE) == 1 -@test unsafe_string(p4est_connect_type_string(p4est_wrapper.P4EST_CONNECT_FACE)) == "FACE" +@test p4est_connect_type_int(P4est_wrapper.P4EST_CONNECT_FACE) == 1 +@test unsafe_string(p4est_connect_type_string(P4est_wrapper.P4EST_CONNECT_FACE)) == "FACE" # Destroy the forest @test p4est_destroy(unitsquare_forest) == nothing @@ -83,5 +83,3 @@ unitsquare_forest_copy = p4est_copy_ext(unitsquare_forest, 1, 0) if (MPI.Initialized() && !isinteractive()) MPI.Finalize() end - - diff --git a/test/test_p8est_bindings.jl b/test/test_p8est_bindings.jl index 51f65a4..749aca8 100644 --- a/test/test_p8est_bindings.jl +++ b/test/test_p8est_bindings.jl @@ -1,5 +1,5 @@ using MPI -using p4est_wrapper +using P4est_wrapper using Test # Initialize MPI if not initialized yet @@ -10,7 +10,7 @@ end ############################################################################# # Definition of data structures and function callbacks ############################################################################# -mpicomm = p4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) +mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) # Dummy callback dummy_callback( ::Ptr{p8est_t}, which_tree::p4est_topidx_t, quadrant::Ptr{p8est_quadrant_t}) = Cint(0) @@ -30,12 +30,12 @@ unitcube_connectivity = p8est_connectivity_new_unitcube() @test p8est_connectivity_reduce(unitcube_connectivity) == nothing # Test new connectivities -for test_conn in [p8est_connectivity_new_periodic(), +for test_conn in [p8est_connectivity_new_periodic(), p8est_connectivity_new_twocubes(), - p8est_connectivity_new_twowrap(), - p8est_connectivity_new_rotcubes(), - p8est_connectivity_new_shell(), - p8est_connectivity_new_sphere(), + p8est_connectivity_new_twowrap(), + p8est_connectivity_new_rotcubes(), + p8est_connectivity_new_shell(), + p8est_connectivity_new_sphere(), p8est_connectivity_new_brick(3, 2, 8, 1, 0, 1)] @test test_conn != C_NULL @test p8est_connectivity_is_valid(test_conn) == 1 @@ -44,7 +44,7 @@ for test_conn in [p8est_connectivity_new_periodic(), end # Create a new forest -unitcube_forest = p8est_new(mpicomm, unitcube_connectivity, 0, C_NULL, C_NULL) +unitcube_forest = p8est_new(mpicomm, unitcube_connectivity, 0, C_NULL, C_NULL) @test unitcube_forest != C_NULL # Create/Destroy geometry @@ -61,16 +61,16 @@ unitcube_forest_copy = p8est_copy_ext(unitcube_forest, 1, 0) # Operations on forests @test p8est_partition(unitcube_forest, 0, C_NULL) == nothing @test p8est_partition_ext(unitcube_forest, 0, C_NULL) == 0 -@test p8est_balance(unitcube_forest, p4est_wrapper.P8EST_CONNECT_FULL, C_NULL) == nothing -@test p8est_balance_ext(unitcube_forest, p4est_wrapper.P8EST_CONNECT_FULL, C_NULL, C_NULL) == nothing +@test p8est_balance(unitcube_forest, P4est_wrapper.P8EST_CONNECT_FULL, C_NULL) == nothing +@test p8est_balance_ext(unitcube_forest, P4est_wrapper.P8EST_CONNECT_FULL, C_NULL, C_NULL) == nothing @test p8est_refine(unitcube_forest, 1, dummy_callback_c, C_NULL) == nothing @test p8est_refine_ext(unitcube_forest, 1, -1, dummy_callback_c, C_NULL, C_NULL) == nothing @test p8est_coarsen(unitcube_forest, 1, dummy_callback_c, C_NULL) == nothing @test p8est_coarsen_ext(unitcube_forest, 1, 0, dummy_callback_c, C_NULL, C_NULL) == nothing @test p8est_revision(unitcube_forest) == 0 @test typeof(p8est_checksum(unitcube_forest)) == UInt32 -@test p8est_connect_type_int(p4est_wrapper.P8EST_CONNECT_FACE) == 1 -@test unsafe_string(p8est_connect_type_string(p4est_wrapper.P8EST_CONNECT_FACE)) == "FACE" +@test p8est_connect_type_int(P4est_wrapper.P8EST_CONNECT_FACE) == 1 +@test unsafe_string(p8est_connect_type_string(P4est_wrapper.P8EST_CONNECT_FACE)) == "FACE" # Destroy the forest @test p8est_destroy(unitcube_forest) == nothing @@ -81,5 +81,3 @@ unitcube_forest_copy = p8est_copy_ext(unitcube_forest, 1, 0) if (MPI.Initialized() && !isinteractive()) MPI.Finalize() end - - diff --git a/test/test_sc_bindings.jl b/test/test_sc_bindings.jl index 897ce96..8c287a3 100644 --- a/test/test_sc_bindings.jl +++ b/test/test_sc_bindings.jl @@ -1,5 +1,5 @@ using MPI -using p4est_wrapper +using P4est_wrapper using Test el_num = Cint(8) @@ -10,18 +10,18 @@ if !MPI.Initialized() MPI.Init() end -mpicomm = p4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) +mpicomm = P4est_wrapper.P4EST_ENABLE_MPI ? MPI.COMM_WORLD : Cint(0) # SC library initialization -sc_init(mpicomm, Cint(true), Cint(true), C_NULL, p4est_wrapper.SC_LP_DEFAULT) +sc_init(mpicomm, Cint(true), Cint(true), C_NULL, P4est_wrapper.SC_LP_DEFAULT) @test typeof(sc_is_root()) == Cint # SC package related API -id = sc_package_register(C_NULL, p4est_wrapper.SC_LP_INFO, "p4est", "A forest of octrees") +id = sc_package_register(C_NULL, P4est_wrapper.SC_LP_INFO, "p4est", "A forest of octrees") @test sc_package_is_registered(id) == 1 sc_package_lock(id) sc_package_unlock(id) -sc_package_set_verbosity(id, p4est_wrapper.SC_LP_DEBUG) +sc_package_set_verbosity(id, P4est_wrapper.SC_LP_DEBUG) sc_package_print_summary(id) # SC memory allocation/deallocation related API @@ -56,7 +56,7 @@ sc_array_ptr = sc_array_new(el_size) @test sc_array_memset(sc_array_ptr,0) == nothing @test sc_array_reset(sc_array_ptr) == nothing @test sc_array_truncate(sc_array_ptr) == nothing -@test sc_array_rewind(sc_array_ptr,2*el_num) == nothing +@test sc_array_rewind(sc_array_ptr,2*el_num) == nothing @test sc_array_resize(sc_array_ptr,2*el_num) == nothing @test sc_array_destroy(sc_array_ptr) == nothing @@ -86,5 +86,3 @@ sc_mempool_ptr = sc_mempool_new(el_size) if (MPI.Initialized() && !isinteractive()) MPI.Finalize() end - - From a71d00b58e82063a896e9c957e42d2507dd8925d Mon Sep 17 00:00:00 2001 From: amartin Date: Tue, 21 Sep 2021 18:10:52 +1000 Subject: [PATCH 2/2] Renaming main file --- src/{p4est_wrapper.jl => P4est_wrapper.jl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{p4est_wrapper.jl => P4est_wrapper.jl} (100%) diff --git a/src/p4est_wrapper.jl b/src/P4est_wrapper.jl similarity index 100% rename from src/p4est_wrapper.jl rename to src/P4est_wrapper.jl