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 2 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
56 changes: 56 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ openpmd_option(MPI "Parallel, Multi-Node I/O for clusters" AUTO)
openpmd_option(HDF5 "HDF5 backend (.h5 files)" AUTO)
openpmd_option(ADIOS1 "ADIOS1 backend (.bp files)" AUTO)
openpmd_option(ADIOS2 "ADIOS2 backend (.bp files)" AUTO)
openpmd_option(JULIA "Enable Julia bindings" AUTO)
openpmd_option(PYTHON "Enable Python bindings" AUTO)

option(openPMD_INSTALL "Add installation targets" ON)
Expand Down Expand Up @@ -283,6 +284,34 @@ endif()

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

# External library: libcxxwrap-julia
if(openPMD_USE_JULIA STREQUAL AUTO)
find_package(JlCxx 0.8.3)
ax3l marked this conversation as resolved.
Show resolved Hide resolved
if(JlCxx_FOUND)
set(openPMD_HAVE_JlCxx TRUE)
else()
set(openPMD_HAVE_JlCxx FALSE)
endif()
if(JULIA_FOUND)
set(openPMD_HAVE_JULIA TRUE)
else()
set(openPMD_HAVE_JULIA FALSE)
endif()
elseif(openPMD_USE_JULIA)
eschnett marked this conversation as resolved.
Show resolved Hide resolved
find_package(JlCxx 0.8.3 REQUIRED)
set(openPMD_HAVE_JULIA TRUE)
set(openPMD_HAVE_JlCxx TRUE)
eschnett marked this conversation as resolved.
Show resolved Hide resolved
else()
set(openPMD_HAVE_JULIA FALSE)
set(openPMD_HAVE_JlCxx FALSE)
endif()
if(openPMD_HAVE_JlCxx)
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 @@ -574,6 +603,33 @@ else()
target_compile_definitions(openPMD PRIVATE openPMD_USE_VERIFY=0)
endif()

# Julia bindings
if(openPMD_HAVE_JlCxx)
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/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/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/version.cpp
)
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
12 changes: 12 additions & 0 deletions src/binding/julia/Access.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// 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("READ_ONLY", Access::READ_ONLY);
mod.set_const("READ_WRITE", Access::READ_WRITE);
mod.set_const("CREATE", Access::CREATE);
}
22 changes: 22 additions & 0 deletions src/binding/julia/Attributable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Attributable

#include "defs.hpp"

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

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

type.method("get_attribute1", &Attributable::getAttribute);
type.method("delete_attribute!", &Attributable::deleteAttribute);
type.method("attributes", &Attributable::attributes);
type.method("num_attributes1", &Attributable::numAttributes);
type.method("contains_attribute", &Attributable::containsAttribute);
type.method("comment", &Attributable::comment);
type.method("set_comment!", &Attributable::setComment);
type.method("series_flush", static_cast<void (Attributable::*)()>(
&Attributable::seriesFlush));
}
14 changes: 14 additions & 0 deletions src/binding/julia/Attribute.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Attribute

#include "defs.hpp"

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

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

#define USE_TYPE(NAME, ENUM, TYPE) \
type.method("get1_" NAME, &Attribute::get<TYPE>);
{ FORALL_OPENPMD_TYPES }
#undef USE_TYPE
}
22 changes: 22 additions & 0 deletions src/binding/julia/BaseRecordComponent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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>(
"BaseRecordComponent", jlcxx::julia_base_type<Attributable>());

type.method("unit_SI", &BaseRecordComponent::unitSI);
type.method("reset_datatype1!", &BaseRecordComponent::resetDatatype);
type.method("get_datatype1", &BaseRecordComponent::getDatatype);
type.method("is_constant", &BaseRecordComponent::constant);
// TODO: availableChunks
}
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;
83 changes: 83 additions & 0 deletions src/binding/julia/Container.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#ifndef CONTAINER_HPP
#define CONTAINER_HPP

// Container

#include "defs.hpp"

#include <memory>
#include <type_traits>

// Define supertype relationships
namespace jlcxx {
template <typename T, typename K> struct SuperType<Container<T, K>> {
typedef Attributable type;
};
} // namespace jlcxx

// TODO: use std::optional instead of std::unique_ptr
typedef jlcxx::TypeWrapper<
jlcxx::Parametric<jlcxx::TypeVar<1>, jlcxx::TypeVar<2>>>
julia_Container_type_t;
extern std::unique_ptr<julia_Container_type_t> julia_Container_type;

template <typename Eltype, typename Keytype>
void define_julia_Container(jlcxx::Module &mod) {
if (!julia_Container_type)
julia_Container_type = std::make_unique<julia_Container_type_t>(
mod.add_type<jlcxx::Parametric<jlcxx::TypeVar<1>, jlcxx::TypeVar<2>>>(
"Container", jlcxx::julia_base_type<Attributable>()));

julia_Container_type->apply<Container<Eltype, Keytype>>([](auto type) {
using ContainerT = typename decltype(type)::type;
using key_type = typename ContainerT::key_type;
using mapped_type = typename ContainerT::mapped_type;
using size_type = typename ContainerT::size_type;
static_assert(std::is_same_v<Eltype, mapped_type>);
static_assert(std::is_same_v<Keytype, key_type>);

type.template constructor<const ContainerT &>();

type.method("empty1", &ContainerT::empty);
type.method("length1", &ContainerT::size);
type.method("empty1!", &ContainerT::clear);
type.method("getindex1",
static_cast<mapped_type &(ContainerT::*)(const key_type &)>(
&ContainerT::at));
type.method("get1!",
[](ContainerT &cont, const key_type &key) -> mapped_type & {
return cont[key];
});
type.method("setindex1!",
[](ContainerT &cont, const mapped_type &value,
const key_type &key) { return cont[key] = value; });
type.method("count1", &ContainerT::count);
type.method("contains1", &ContainerT::contains);
type.method("delete1!",
static_cast<size_type (ContainerT::*)(const key_type &)>(
&ContainerT::erase));
type.method("keys1", [](const ContainerT &cont) {
std::vector<key_type> res;
res.reserve(cont.size());
for (auto iter = cont.begin(); iter != cont.end(); ++iter)
res.push_back(iter->first);
return res;
});
// type.method("values1", [](const ContainerT &cont) {
// std::vector<mapped_type *> res;
// res.reserve(cont.size());
// for (auto iter = cont.begin(); iter != cont.end(); ++iter)
// res.push_back(&iter->second);
// return res;
// });
// type.method("collect1", [](const ContainerT &cont) {
// std::vector<std::pair<key_type, mapped_type *>> res;
// res.reserve(cont.size());
// for (auto iter = cont.begin(); iter != cont.end(); ++iter)
// res.emplace_back(iter->first, &iter->second);
// return res;
// });
});
}

#endif // #ifndef CONTAINER_HPP
23 changes: 23 additions & 0 deletions src/binding/julia/Dataset.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Dataset

#include "defs.hpp"

void define_julia_Dataset(jlcxx::Module &mod) {
auto type = mod.add_type<Dataset>("Dataset");

type.constructor<Datatype, Extent>();
type.constructor<Datatype, Extent, const std::string &>();
type.constructor<Extent>();

type.method("extend1!", &Dataset::extend);
type.method("set_chunk_size1!", &Dataset::setChunkSize);
type.method("set_compression!", &Dataset::setCompression);
type.method("set_custom_transform!", &Dataset::setCustomTransform);
type.method("extent1", [](const Dataset &d) { return d.extent; });
type.method("dtype1", [](const Dataset &d) { return d.dtype; });
type.method("rank1", [](const Dataset &d) { return d.rank; });
type.method("chunk_size1", [](const Dataset &d) { return d.chunkSize; });
type.method("compression", [](const Dataset &d) { return d.compression; });
type.method("transform", [](const Dataset &d) { return d.transform; });
type.method("options", [](const Dataset &d) { return d.options; });
}
35 changes: 35 additions & 0 deletions src/binding/julia/Datatype.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Datatype

#include "defs.hpp"

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

#define USE_TYPE(NAME, ENUM, TYPE) mod.set_const(NAME, ENUM);
{ FORALL_OPENPMD_TYPES }
#undef USE_TYPE
mod.set_const("DATATYPE", Datatype::DATATYPE);
mod.set_const("UNDEFINED", Datatype::UNDEFINED);

mod.set_const("openPMD_datatypes", openPMD_Datatypes);
// mod.method("determine_datatype", determineDatatype);
mod.method("to_bytes1", toBytes);
mod.method("to_bits1", toBits);
mod.method("is_vector1", isVector);
mod.method("is_floating_point1", (bool (*)(Datatype))isFloatingPoint);
mod.method("is_complex_floating_point1",
static_cast<bool (*)(Datatype)>(isComplexFloatingPoint));
mod.method("is_integer1", (std::tuple<bool, bool>(*)(Datatype))isInteger);
// isSameFloatingPoint
// isSameComplexFloatingPoint
// isSameInteger
mod.method("is_same1", isSame);
mod.method("basic_datatype1", basicDatatype);
mod.method("to_vector_type1", toVectorType);
mod.method("datatype_to_string1", datatypeToString);
mod.method("string_to_datatype1", stringToDatatype);
mod.method("warn_wrong_datatype1", warnWrongDtype);
// mod.method("==", operator==);
// mod.method("!=", operator!=);
}
18 changes: 18 additions & 0 deletions src/binding/julia/Format.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// IO/Format

#include "defs.hpp"

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

mod.set_const("HDF5", Format::HDF5);
mod.set_const("ADIOS1", Format::ADIOS1);
mod.set_const("ADIOS2", Format::ADIOS2);
mod.set_const("ADIOS2_SST", Format::ADIOS2_SST);
mod.set_const("ADIOS2_SSC", Format::ADIOS2_SSC);
mod.set_const("JSON", Format::JSON);
mod.set_const("DUMMY", Format::DUMMY);
mod.method("determine_format", determineFormat);
mod.method("suffix", suffix);
}
30 changes: 30 additions & 0 deletions src/binding/julia/Iteration.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Iteration

#include "defs.hpp"

#include <string>

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

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

type.method("time1", &Iteration::time<double>);
type.method("set_time!", &Iteration::setTime<double>);
type.method("dt", &Iteration::dt<double>);
type.method("set_dt!", &Iteration::setDt<double>);
type.method("time_unit_SI", &Iteration::timeUnitSI);
type.method("set_time_unit_SI!", &Iteration::setTimeUnitSI);
type.method("close1",
static_cast<Iteration &(Iteration::*)(bool)>(&Iteration::close));
type.method("open", &Iteration::open);
type.method("closed", &Iteration::closed);
type.method("closed_by_writer", &Iteration::closedByWriter);
type.method("meshes",
[](Iteration &iter) -> Container<Mesh> & { return iter.meshes; });
// TODO: particles
}
Loading