xref: /libCEED/julia/LibCEED.jl/README.md (revision 44554ea01e90fce366fc2a203c44be15754a38d6)
1*44554ea0SWill Pazner# LibCEED.jl: Julia Interface for [libCEED](https://github.com/CEED/libCEED)
2*44554ea0SWill Pazner
3*44554ea0SWill Pazner## Installation
4*44554ea0SWill Pazner
5*44554ea0SWill PaznerWhen the LibCEED.jl package is built, it requires the environment variable
6*44554ea0SWill Pazner`JULIA_LIBCEED_LIB` to be set to the location of the compiled libCEED shared
7*44554ea0SWill Paznerlibrary.
8*44554ea0SWill Pazner
9*44554ea0SWill PaznerFor example, the package can be installed by:
10*44554ea0SWill Pazner```julia
11*44554ea0SWill Pazner% JULIA_LIBCEED_LIB=/path/to/libceed.so julia
12*44554ea0SWill Paznerjulia> # press ] to enter package manager
13*44554ea0SWill Pazner
14*44554ea0SWill Pazner(@v1.5) pkg> add LibCEED
15*44554ea0SWill Pazner```
16*44554ea0SWill Pazneror, equivalently,
17*44554ea0SWill Pazner```julia
18*44554ea0SWill Pazner% julia
19*44554ea0SWill Pazner
20*44554ea0SWill Paznerjulia> withenv("JULIA_LIBCEED_LIB" => "/path/to/libceed.so") do
21*44554ea0SWill Pazner    Pkg.add("LibCEED")
22*44554ea0SWill Paznerend
23*44554ea0SWill Pazner```
24*44554ea0SWill Pazner
25*44554ea0SWill Pazner
26*44554ea0SWill Pazner## Usage
27*44554ea0SWill Pazner
28*44554ea0SWill PaznerThis package provides both a low-level and high-level interface for libCEED.
29*44554ea0SWill Pazner
30*44554ea0SWill Pazner### Low-Level Interface
31*44554ea0SWill Pazner
32*44554ea0SWill PaznerThe low-level interface (provided in the `LibCEED.C` module) is in one-to-one
33*44554ea0SWill Paznercorrespondence with the C libCEED iterface, and is automatically generated (with
34*44554ea0SWill Paznersome minor manual modifications) using the Julia package Clang.jl. The script
35*44554ea0SWill Paznerused to generate bindings is available in `generate_bindings.jl`.
36*44554ea0SWill Pazner
37*44554ea0SWill PaznerWith the low-level interface, the user is responsible for freeing all allocated
38*44554ea0SWill Paznermemory (calling the appropriate `Ceed*Destroy` functions). This interface is
39*44554ea0SWill Paznernot type-safe, and calling functions with the wrong arguments can cause libCEED
40*44554ea0SWill Paznerto crash.
41*44554ea0SWill Pazner
42*44554ea0SWill Pazner### High-Level Interface
43*44554ea0SWill Pazner
44*44554ea0SWill PaznerThe high-level interface provides a more idiomatic Julia interface to the
45*44554ea0SWill PaznerlibCEED library. Objects allocated using the high-level interface will
46*44554ea0SWill Paznerautomatically be destroyed by the garbage collector, so the user does not need
47*44554ea0SWill Paznerto manually manage memory.
48*44554ea0SWill Pazner
49*44554ea0SWill PaznerSee the documentation for more information.
50