libena 0.4.18-dev.9021
QE C++ library
Loading...
Searching...
No Matches
cxxwrap.hpp File Reference

Plain-data packers for libena results in CxxWrap.jl (Julia) bindings. More...

#include <libqe/bind/cxxwrap.hpp>
#include <jlcxx/stl.hpp>
#include <jlcxx/tuple.hpp>
#include <libena/rotation.hpp>
#include <libena/positions.hpp>
#include <libena/ccd.hpp>
#include <cstdint>
#include <string>
#include <tuple>
#include <vector>

Go to the source code of this file.

Namespaces

namespace  qe
 
namespace  qe::bind
 
namespace  qe::bind::jl
 

Typedefs

using qe::bind::jl::NodePositionsTuple = std::tuple< std::vector< double >, int32_t, int32_t, std::vector< double >, int32_t, int32_t, std::vector< double >, int32_t, int32_t, std::vector< double >, int32_t, int32_t >
 
using qe::bind::jl::MovedNodesTuple = std::tuple< std::vector< double >, int32_t, int32_t, std::vector< double >, int32_t, int32_t >
 (nodes, rows, cols, centroids, rows, cols)
 
using qe::bind::jl::RotationTuple = std::tuple< std::vector< double >, int32_t, int32_t, std::vector< double >, std::vector< std::string > >
 (rotation, rows, cols, eigenvalues, column_names)
 
using qe::bind::jl::CCDTuple = std::tuple< int32_t, int32_t, std::vector< double >, std::vector< double >, std::vector< double >, std::vector< double >, std::vector< double > >
 

Functions

std::vector< double > qe::bind::jl::pack (const arma::vec &v)
 
NodePositionsTuple qe::bind::jl::to_tuple (const qe::NodePositions &r)
 
MovedNodesTuple qe::bind::jl::to_tuple (const qe::MovedNodes &r)
 
RotationTuple qe::bind::jl::to_tuple (const qe::RotationResult &r)
 
CCDTuple qe::bind::jl::to_tuple (const qe::CCDResult &r)
 

Detailed Description

Plain-data packers for libena results in CxxWrap.jl (Julia) bindings.

Results cross the boundary as std::tuple values of std::vector / int32_t, which Julia receives as plain Tuples of CxxWrap's own StdVector type. No result type is registered with add_type, so modules built by different products (ENA.jl, a future TMA.jl, ...) can be loaded together: CxxWrap keys registered types by C++ type, and the same packer compiled into two modules would clash. The Julia wrapper reshapes the tuples into NamedTuples.

Matrices travel as (data, rows, cols): data is column-major, Armadillo's and Julia's layout, so reshape(collect(data), rows, cols) rebuilds them.

Requires CxxWrap (jlcxx, with jlcxx/stl.hpp: link cxxwrap_julia_stl); never included by libena.hpp. Array conversion comes from libqe/bind/cxxwrap.hpp.