Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Julia bindings #1025

Open
wants to merge 111 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
8de441a
Partial Julia bindings
eschnett Jun 27, 2021
b657d95
Julia: Wrap store_chunk
eschnett Jun 27, 2021
2de8c93
Move Julia package to a separate repository
eschnett Jun 28, 2021
eee0d35
Require C++17 for Julia wrappers
eschnett Jun 28, 2021
4d71540
Julia: Only require C++14
eschnett Jun 28, 2021
0e6ec91
Julia: Switch back to C++17
eschnett Jun 28, 2021
48d6024
Disable std::variant on Apple with clang
eschnett Jun 28, 2021
2865845
cmake: Only look for C++ MPI
eschnett Jun 28, 2021
9c81660
Install Julia bindings
eschnett Jun 29, 2021
d33895e
Rename to WriteIterations::getindex
eschnett Jul 3, 2021
492912d
Rename to MeshRecordComponent1
eschnett Jul 4, 2021
5ab016c
Simplify function names
eschnett Jul 4, 2021
34f11ab
Use separate function names for templates
eschnett Jul 5, 2021
d679474
New API for loadChunk
eschnett Jul 7, 2021
828222b
Split files to reduce build time
eschnett Jul 7, 2021
4697250
Merge branch 'dev' into eschnett/julia-bindings
eschnett Jul 7, 2021
bc3d5f9
Disable ReadIterations
eschnett Jul 7, 2021
2492182
Define chunk function wrappers
eschnett Jul 7, 2021
8d444e8
Add functions to create shared_ptrs
eschnett Jul 7, 2021
29cd7ff
Use `cxx_` prefix instead of `1` suffix
eschnett Jul 7, 2021
d4d0db7
Rename Container to CXX_Container; remove unused code
eschnett Jul 8, 2021
b41d41e
Correct wrapping names
eschnett Jul 8, 2021
b1801e1
Wrap availableChunks
eschnett Jul 8, 2021
e7861d6
Merge branch 'dev' into eschnett/julia-bindings
eschnett Jul 8, 2021
91b07e7
Correct error in wrapping WrittenChunkInfo
eschnett Jul 8, 2021
5839134
Correct template parameter type
eschnett Jul 8, 2021
933f01a
Merge branch 'dev' into eschnett/julia-bindings
eschnett Jul 30, 2021
1f6559b
Julia: Rename SeriesImpl -> SeriesInterface
eschnett Jul 30, 2021
d7ebecb
Merge branch 'dev' into eschnett/julia-bindings
eschnett Aug 7, 2021
0df99cc
Merge branch 'dev' into eschnett/julia-bindings
eschnett Aug 20, 2021
e315fe8
Disable Julia bindings by default
eschnett Aug 20, 2021
895e060
Clean up macro FORALL_OPENPMD_TYPES
eschnett Aug 20, 2021
1fe64f1
Avoid compiler warnings
eschnett Aug 20, 2021
46a7b00
Experiment with templates for iterating over types
eschnett Aug 20, 2021
bcf29cc
Simplify cmake statements for Julia
eschnett Sep 17, 2021
a9955b3
Correct Julia bindings for MPI_Comm
eschnett Sep 17, 2021
b0c1fd0
Rename Julia library to openPMD.jl
eschnett Sep 17, 2021
2f26607
Merge branch 'dev' of https://github.com/openPMD/openPMD-api into esc…
eschnett Sep 17, 2021
5c192e3
Remove Julia wrapper for "DATATYPE"
eschnett Sep 17, 2021
5c4d14f
Remove "AUTO" logic for Julia
eschnett Sep 17, 2021
7c663d8
CI: Build Julia bindings on macOS
eschnett Sep 17, 2021
d42b4d6
CI: Install Julia via homebrew
eschnett Sep 17, 2021
cbb0da4
CI: Correct cmake options for installing libcxxwrap-julia
eschnett Sep 18, 2021
a288938
CI: Require macOS 10.12+ for Julia bindings
eschnett Sep 18, 2021
dd9aff6
CI: Build Julia bindings on gcc9_py38_pd_nompi_h5_ad1_ad2_libcpp
eschnett Sep 18, 2021
19af703
Add `close` function to Series object
eschnett Oct 13, 2021
ffac9cf
Merge branch 'dev' of https://github.com/openPMD/openPMD-api into esc…
eschnett Oct 13, 2021
f32b68b
[julia] Wrap Series::closeee
eschnett Oct 13, 2021
3d23f12
Julia interface: Clean up handling std::array<double, 7>
eschnett Dec 17, 2021
88d734a
Merge branch 'dev' of https://github.com/openPMD/openPMD-api into esc…
eschnett Dec 30, 2021
7daa833
Resolve merge errors
eschnett Dec 31, 2021
218b67e
Update Julia interface
eschnett Dec 31, 2021
1e9e69c
CI: Update to Julia 1.6.5; correct yaml syntax
eschnett Dec 31, 2021
de3d451
CI: Use newer version of libcxxwrap-julia
eschnett Dec 31, 2021
896daeb
CI: Correct Julia/libcxxwrap download commands
eschnett Dec 31, 2021
1228708
Avoid unused-parameter warning
eschnett Dec 31, 2021
d146f5f
Avoid compiler warnings
eschnett Dec 31, 2021
d7eefb9
Add missing include header
eschnett Dec 31, 2021
d3c042b
Correct pointer casts
eschnett Jan 1, 2022
3c9f215
Remove outdated function from Julia bindings
eschnett Jan 2, 2022
32f4fe6
[Julia] Use memcpy to handle MPI_Comm
eschnett Jan 2, 2022
b9c0bc4
Merge remote-tracking branch 'mainline/dev' into eschnett/julia-bindings
ax3l Jan 25, 2022
9edac3b
CI: Simply with cmake-easyinstall
ax3l Jan 25, 2022
a6a4d55
Merge branch 'dev' into eschnett/julia-bindings
eschnett Mar 8, 2022
3f1a23d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 8, 2022
84bce33
Set CMAKE_OSX_DEPLOYMENT_TARGET to 10.14
eschnett Mar 8, 2022
e6a18e7
Merge branch 'dev' into eschnett/julia-bindings
eschnett Nov 11, 2022
46d19af
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2022
479b3d7
Julia: Update ADIOS2 format enum constants
eschnett Nov 11, 2022
20cdbe7
Julia: Wrap call to seriesFlush in lambda to resolve overload
eschnett Nov 11, 2022
e31818f
Simplify CMakeLists.txt
eschnett May 19, 2023
9c97be2
Merge branch 'dev' into eschnett/julia-bindings
eschnett May 19, 2023
61fe000
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 19, 2023
c11fcd0
CI: Correct yaml syntax
eschnett May 19, 2023
e602993
CI: Require newer macOS when installing dependencies
eschnett May 19, 2023
e364217
CI: Require newer libcxxwrap on macOS
eschnett May 19, 2023
7424187
CI: Require macOS 10.15 for Julia bindings
eschnett May 19, 2023
4be71b1
CI: Install `dot` executable when building documentation
eschnett May 19, 2023
655febb
Document install with Julia
eschnett May 19, 2023
13ea8b4
CI: Rename workflow
eschnett May 19, 2023
130c167
Replace FORALL_OPENPMD_TYPES -> forallJuliaTypes
franzpoeschel Jun 5, 2023
769adbc
Replace typedef -> using
franzpoeschel Jun 5, 2023
b381ad8
Use overload_cast
franzpoeschel Jun 5, 2023
c6f63a1
Rename USE_Julia to USE_JULIA
eschnett Aug 1, 2023
f7e4424
Add copyright comments to Julia bindings
eschnett Aug 1, 2023
21cecd4
CI: Update USE_JULIA config option
eschnett Aug 1, 2023
8dc4076
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 1, 2023
db180de
Merge pull request #2 from franzpoeschel/julia-bindings-review
eschnett Aug 2, 2023
8fb74b9
Add minimal Julia example
eschnett Aug 2, 2023
ddf4fbc
CI: Run Julia self-tests
eschnett Aug 2, 2023
2ee34a0
CI: Install CxxWrap for Julia tests
eschnett Aug 2, 2023
a17a10d
CI: Install CxxWrap for Julia tests
eschnett Aug 2, 2023
5229a57
CI: Switch to Julia 1.7
eschnett Aug 3, 2023
100a586
Merge branch 'dev' into julia-bindings-current-dev
franzpoeschel Aug 10, 2023
3b1b37c
Set openPMD.jl library target properties
franzpoeschel Aug 10, 2023
1918464
Add low-level Julia test
franzpoeschel Aug 10, 2023
c6fe874
Install CxxWrap Julia package and fix CI run
franzpoeschel Aug 11, 2023
d548c90
Install CxxWrap Julia package and fix CI run
franzpoeschel Aug 11, 2023
d427b19
Update RPATH setting to generalized method
franzpoeschel Aug 18, 2023
184610f
Merge branch 'eschnett/julia-bindings' of ssh://github.com/eschnett/o…
eschnett Aug 18, 2023
d59773a
Don't export openPMD_datatypes to Julia
eschnett Sep 5, 2023
724806e
Merge branch 'dev' into eschnett/julia-bindings
eschnett Sep 5, 2023
54a5052
Don't export openPMD_datatypes to Julia
eschnett Sep 5, 2023
fa2efa5
Configure Julia include and library directories
eschnett Sep 5, 2023
5d5612d
Configure Julia include and library directories
eschnett Sep 5, 2023
9eaec53
Don't configure Julia include and library directories
eschnett Sep 6, 2023
cac9488
Julia: Correct `set_const` definitions for `Datatype` enum
eschnett Sep 7, 2023
5213e2e
CI: Correct shared library suffix for Apple
eschnett Sep 8, 2023
805756f
Julia: Correct low-level test
eschnett Sep 9, 2023
a0b015e
CI: Install libcxxwrap-julia @v0.11.0
eschnett Sep 9, 2023
26b6ca7
Merge branch 'dev' into eschnett/julia-bindings
eschnett Oct 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
cmake --build build --parallel 2
ctest --test-dir build --output-on-failure

gcc9_py38_pd_nompi_h5_ad2_libcpp:
gcc9_py38_pd_nompi_h5_ad2_libcpp_julia:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs-on: ubuntu-20.04
if: github.event.pull_request.draft == false
steps:
Expand All @@ -240,15 +240,26 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install g++ libopenmpi-dev libhdf5-openmpi-dev python3 python3-numpy python3-mpi4py python3-pandas
# TODO ADIOS2
# TODO ADIOS2
# Install Julia
wget https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.7-linux-x86_64.tar.gz
sudo tar -xz -C /usr/local -f julia-1.6.7-linux-x86_64.tar.gz
rm julia-1.6.7-linux-x86_64.tar.gz
# Install cmake-easyinstall
sudo curl -L -o /usr/local/bin/cmake-easyinstall https://git.io/JvLxY
sudo chmod a+x /usr/local/bin/cmake-easyinstall
export CEI_SUDO="sudo"
# Install libcxxwrap-julia
cmake-easyinstall git+https://github.com/JuliaInterop/[email protected] -DJulia_EXECUTABLE=/usr/local/julia-1.6.7/bin/julia
- name: Build
env: {CXXFLAGS: -Werror, PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig}
run: |
share/openPMD/download_samples.sh build
cmake -S . -B build \
-DopenPMD_USE_PYTHON=ON \
-DopenPMD_USE_MPI=ON \
cmake -S . -B build \
-DopenPMD_USE_HDF5=ON \
-DopenPMD_USE_Julia=ON \
-DopenPMD_USE_MPI=ON \
-DopenPMD_USE_PYTHON=ON \
-DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build build --parallel 2
ctest --test-dir build --output-on-failure
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ jobs:
brew update
brew install adios2 || true
brew install hdf5-mpi || true
brew install julia || true
brew install python || true
python3 -m pip install -U mpi4py numpy pandas
set -e
# Install cmake-easyinstall
sudo curl -L -o /usr/local/bin/cmake-easyinstall https://git.io/JvLxY
sudo chmod a+x /usr/local/bin/cmake-easyinstall
# Install libcxxwrap-julia
cmake-easyinstall git+https://github.com/JuliaInterop/[email protected]
- name: Build
env: {CXXFLAGS: -Werror, MACOSX_DEPLOYMENT_TARGET: 10.15}
# 10.14+ due to std::visit
Expand All @@ -35,10 +41,11 @@ jobs:
run: |
share/openPMD/download_samples.sh build
cmake -S . -B build \
-DopenPMD_USE_PYTHON=ON \
-DopenPMD_USE_MPI=ON \
-DopenPMD_USE_HDF5=ON \
-DopenPMD_USE_ADIOS2=ON \
-DopenPMD_USE_HDF5=ON \
-DopenPMD_USE_Julia=ON \
-DopenPMD_USE_MPI=ON \
-DopenPMD_USE_PYTHON=ON \
-DopenPMD_USE_INVASIVE_TESTS=ON
cmake --build build --parallel 3
ctest --test-dir build --verbose
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ build:
tools:
python: "3.11"
apt_packages:
- graphviz
- librsvg2-bin
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#
cmake_minimum_required(VERSION 3.15.0)

# macOS 10.15 is required for certain C++17 features.
# (This variable needs to be set before calling `project`.)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")

eschnett marked this conversation as resolved.
Show resolved Hide resolved
project(openPMD VERSION 0.16.0) # LANGUAGES CXX

# the openPMD "markup"/"schema" standard version
Expand Down Expand Up @@ -143,6 +147,7 @@ endfunction()
openpmd_option(MPI "Parallel, Multi-Node I/O for clusters" AUTO)
openpmd_option(HDF5 "HDF5 backend (.h5 files)" AUTO)
openpmd_option(ADIOS2 "ADIOS2 backend (.bp files)" AUTO)
openpmd_option(Julia "Enable Julia bindings" OFF)
eschnett marked this conversation as resolved.
Show resolved Hide resolved
openpmd_option(PYTHON "Enable Python bindings" AUTO)

option(openPMD_INSTALL "Add installation targets" ON)
Expand Down Expand Up @@ -388,6 +393,20 @@ endif()

# TODO: Check if ADIOS2 is parallel when openPMD_HAVE_MPI is ON

# External library: libcxxwrap-julia
if(openPMD_USE_Julia)
find_package(JlCxx 0.8.3 REQUIRED)
set(openPMD_HAVE_Julia TRUE)
else()
set(openPMD_HAVE_Julia FALSE)
endif()
if(openPMD_HAVE_Julia)
get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION)
get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memo to myself: generalize.

  • Control RPATH install (default: on) via option.
  • Add JlCxx_location only to openPMD_jl target

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prepared in #1105

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have pushed a commit adapting to this change d427b19
Would probably be good if you look at that again @ax3l @eschnett

message(STATUS "Found JlCxx version ${JlCxx_VERSION} at ${JlCxx_location}")
endif()

# external library: pybind11 (optional)
set(_PY_DEV_MODULE Development.Module)
if(CMAKE_VERSION VERSION_LESS 3.18.0)
Expand Down Expand Up @@ -593,6 +612,37 @@ else()
target_compile_definitions(openPMD PRIVATE openPMD_USE_VERIFY=0)
endif()

# Julia bindings
if(openPMD_HAVE_Julia)
add_library(openPMD.jl SHARED
src/binding/julia/Access.cpp
src/binding/julia/Attributable.cpp
src/binding/julia/Attribute.cpp
src/binding/julia/BaseRecordComponent.cpp
src/binding/julia/ChunkInfo.cpp
src/binding/julia/Container.cpp
src/binding/julia/Dataset.cpp
src/binding/julia/Datatype.cpp
src/binding/julia/Format.cpp
src/binding/julia/Iteration.cpp
src/binding/julia/Mesh.cpp
src/binding/julia/MeshRecordComponent.cpp
src/binding/julia/ReadIterations.cpp
src/binding/julia/RecordComponent.cpp
src/binding/julia/RecordComponent_load_chunk.cpp
src/binding/julia/RecordComponent_make_constant.cpp
src/binding/julia/RecordComponent_store_chunk.cpp
src/binding/julia/Series.cpp
src/binding/julia/UnitDimension.cpp
src/binding/julia/WriteIterations.cpp
src/binding/julia/openPMD.cpp
src/binding/julia/shared_ptr.cpp
src/binding/julia/version.cpp
)
openpmd_cxx_required(openPMD.jl)
target_link_libraries(openPMD.jl PRIVATE openPMD JlCxx::cxxwrap_julia JlCxx::cxxwrap_julia_stl)
endif()

# python bindings
if(openPMD_HAVE_PYTHON)
add_library(openPMD.py MODULE
Expand Down Expand Up @@ -1053,6 +1103,10 @@ if(openPMD_INSTALL)
endforeach()
endif()

if(openPMD_HAVE_Julia)
list(APPEND openPMD_INSTALL_TARGET_NAMES openPMD.jl)
endif()

if(openPMD_INSTALL_RPATH)
set(openPMD_INSTALL_RPATH_TARGET_NAMES ${openPMD_INSTALL_TARGET_NAMES})
if(openPMD_HAVE_PYTHON)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Please transition to ADIOS2.
For reading legacy ADIOS1 BP3 files, either use an older version of openPMD-api or the BP3 backend in ADIOS2.
Note that ADIOS2 does not support compression in BP3 files.

Julia 1.7 to 1.9 are supported. The development version of Julia
(future 1.10) is supported as well. Julia 1.6 is too old.


0.15.0
------
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ while those can be built either with or without:
* MPI 2.1+, e.g. OpenMPI 1.6.5+ or MPICH2

Optional language bindings:
* Julia:
* Most Julia users will not build `openPMD_api` from source. The
Julia package `openPMD.jl` will automatically download a suitable
`openPMD_api` binary.
* Julia 1.7 - 1.10
* [libcxxwrap_julia](https://github.com/JuliaInterop/libcxxwrap-julia) 0.8.3 - 0.9.7
* Python:
* Python 3.7 - 3.11
* pybind11 2.10.1+
Expand Down
1 change: 1 addition & 0 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS \
WARN_IF_UNDOCUMENTED = NO
WARN_NO_PARAMDOC = NO
# the ideal CI enforcing world: WARN_AS_ERROR = YES
WARN_AS_ERROR = YES
14 changes: 13 additions & 1 deletion docs/source/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ Additional CMake options can be passed via individual environment variables, whi

.. image:: cmake.svg

Using the Julia Package
-----------------------

A package for openPMD-api is available via the Julia Package Registry:

.. code-block:: julia

# We need Julia 1.7 or newer
using("Pkg")
Pkg.add("openPMD")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only remaining question before merging this PR is how we should go about documentation?
I feel like we should mark this as experimental until we also have the high-level bindings merged?
Should we add documentation apart from install.rst, too? I think that we can keep it short due to the experimental status.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds fine. I would point to openPMD.jl as an existing package that uses these bindings, so that people are not put off by the experimental status – it's not openPMD that is experimental, it's only the way things are currently glued together.



From Source with CMake
----------------------

Expand All @@ -147,7 +159,7 @@ Linux & OSX
# -DCMAKE_INSTALL_PREFIX=$HOME/somepath
# for options append:
# -DopenPMD_USE_...=...
# e.g. for python support add:
# e.g. for Python support add:
# -DopenPMD_USE_PYTHON=ON -DPython_EXECUTABLE=$(which python3)
cmake ../openPMD-api

Expand Down
1 change: 0 additions & 1 deletion include/openPMD/Series.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ namespace openPMD
{
class ReadIterations;
class Series;
class Series;

namespace internal
{
Expand Down
13 changes: 13 additions & 0 deletions src/binding/julia/Access.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// IO/Access
eschnett marked this conversation as resolved.
Show resolved Hide resolved

#include "defs.hpp"

void define_julia_Access(jlcxx::Module &mod)
{
mod.add_bits<Access>("Access", jlcxx::julia_type("CppEnum"));
jlcxx::stl::apply_stl<Access>(mod);

mod.set_const("ACCESS_READ_ONLY", Access::READ_ONLY);
mod.set_const("ACCESS_READ_WRITE", Access::READ_WRITE);
mod.set_const("ACCESS_CREATE", Access::CREATE);
}
24 changes: 24 additions & 0 deletions src/binding/julia/Attributable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Attributable

#include "defs.hpp"

void define_julia_Attributable(jlcxx::Module &mod)
{
auto type = mod.add_type<Attributable>("CXX_Attributable");

#define USE_TYPE(NAME, ENUM, TYPE) \
type.method( \
"cxx_set_attribute_" NAME "!", &Attributable::setAttribute<TYPE>);
{FORALL_OPENPMD_TYPES(USE_TYPE)}
#undef USE_TYPE

type.method("cxx_get_attribute", &Attributable::getAttribute);
type.method("cxx_delete_attribute!", &Attributable::deleteAttribute);
type.method("cxx_attributes", &Attributable::attributes);
type.method("cxx_num_attributes", &Attributable::numAttributes);
type.method("cxx_contains_attribute", &Attributable::containsAttribute);
type.method("cxx_comment", &Attributable::comment);
type.method("cxx_set_comment!", &Attributable::setComment);
type.method(
"cxx_series_flush", [](Attributable &attr) { attr.seriesFlush(); });
}
17 changes: 17 additions & 0 deletions src/binding/julia/Attribute.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Attribute

#include "defs.hpp"

void define_julia_Attribute(jlcxx::Module &mod)
{
auto type = mod.add_type<Attribute>("CXX_Attribute");

type.method("cxx_dtype", [](const Attribute &attr) { return attr.dtype; });

#define USE_TYPE(NAME, ENUM, TYPE) \
type.method("cxx_get_" NAME, &Attribute::get<TYPE>);
{
FORALL_OPENPMD_TYPES(USE_TYPE)
}
#undef USE_TYPE
}
25 changes: 25 additions & 0 deletions src/binding/julia/BaseRecordComponent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// BaseRecordComponent

#include "defs.hpp"

// Define supertype relationships
namespace jlcxx
{
template <>
struct SuperType<BaseRecordComponent>
{
typedef Attributable type;
};
} // namespace jlcxx

void define_julia_BaseRecordComponent(jlcxx::Module &mod)
{
auto type = mod.add_type<BaseRecordComponent>(
"CXX_BaseRecordComponent", jlcxx::julia_base_type<Attributable>());

type.method("cxx_unit_SI", &BaseRecordComponent::unitSI);
type.method("cxx_reset_datatype!", &BaseRecordComponent::resetDatatype);
type.method("cxx_get_datatype", &BaseRecordComponent::getDatatype);
type.method("cxx_isconstant", &BaseRecordComponent::constant);
type.method("cxx_available_chunks", &BaseRecordComponent::availableChunks);
}
31 changes: 31 additions & 0 deletions src/binding/julia/ChunkInfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// ChunkInfo

#include "defs.hpp"

// Define supertype relationships
namespace jlcxx
{
template <>
struct SuperType<WrittenChunkInfo>
{
typedef ChunkInfo type;
};
} // namespace jlcxx

void define_julia_ChunkInfo(jlcxx::Module &mod)
{
auto chunkInfo = mod.add_type<ChunkInfo>("CXX_ChunkInfo");
chunkInfo.constructor<>();
chunkInfo.constructor<Offset, Extent>();
chunkInfo.method("cxx_offset", [](const ChunkInfo &chunkInfo_) {
return chunkInfo_.offset;
});
chunkInfo.method("cxx_extent", [](const ChunkInfo &chunkInfo_) {
return chunkInfo_.extent;
});

auto writtenChunkInfo = mod.add_type<WrittenChunkInfo>(
"CXX_WrittenChunkInfo", jlcxx::julia_base_type<ChunkInfo>());
writtenChunkInfo.constructor<>();
writtenChunkInfo.constructor<Offset, Extent>();
}
3 changes: 3 additions & 0 deletions src/binding/julia/Container.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "Container.hpp"

std::unique_ptr<julia_Container_type_t> julia_Container_type;
Loading