mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
minimal export of Table
This commit is contained in:
parent
9389ecdf62
commit
7c4f1cf53a
@ -8,6 +8,7 @@
|
|||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
|
|
||||||
#include "array.hpp"
|
#include "array.hpp"
|
||||||
|
#include "table.hpp"
|
||||||
#include "archive.hpp"
|
#include "archive.hpp"
|
||||||
#include "flags.hpp"
|
#include "flags.hpp"
|
||||||
#include "ngcore_api.hpp"
|
#include "ngcore_api.hpp"
|
||||||
@ -60,6 +61,23 @@ template <typename Type> struct type_caster<ngcore::Array<Type>>
|
|||||||
: ngcore_list_caster<ngcore::Array<Type>, Type> { };
|
: ngcore_list_caster<ngcore::Array<Type>, Type> { };
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
template <typename Type> struct type_caster<std::shared_ptr<ngcore::Table<Type>>>
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
static handle cast(T &&src, return_value_policy policy, handle parent)
|
||||||
|
{
|
||||||
|
std::cout << "handle called with type src = " << typeid(src).name() << std::endl;
|
||||||
|
|
||||||
|
return handle(); // what so ever
|
||||||
|
}
|
||||||
|
|
||||||
|
PYBIND11_TYPE_CASTER(Type, _("Table[") + make_caster<Type>::name + _("]"));
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace pybind11
|
} // namespace pybind11
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -240,6 +258,14 @@ namespace ngcore
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void ExportTable (py::module &m)
|
||||||
|
{
|
||||||
|
py::class_<ngcore::Table<T>, std::shared_ptr<ngcore::Table<T>>> (m, ("Table+"+GetPyName<T>()).c_str())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NGCORE_API SetFlag(Flags &flags, std::string s, py::object value);
|
void NGCORE_API SetFlag(Flags &flags, std::string s, py::object value);
|
||||||
// Parse python kwargs to flags
|
// Parse python kwargs to flags
|
||||||
Flags NGCORE_API CreateFlagsFromKwArgs(const py::kwargs& kwargs, py::object pyclass = py::none(),
|
Flags NGCORE_API CreateFlagsFromKwArgs(const py::kwargs& kwargs, py::object pyclass = py::none(),
|
||||||
|
@ -19,6 +19,8 @@ PYBIND11_MODULE(pyngcore, m) // NOLINT
|
|||||||
ExportArray<size_t>(m);
|
ExportArray<size_t>(m);
|
||||||
ExportArray<double>(m);
|
ExportArray<double>(m);
|
||||||
|
|
||||||
|
ExportTable<int>(m);
|
||||||
|
|
||||||
py::class_<BitArray, shared_ptr<BitArray>> (m, "BitArray")
|
py::class_<BitArray, shared_ptr<BitArray>> (m, "BitArray")
|
||||||
.def(py::init([] (size_t n) { return make_shared<BitArray>(n); }),py::arg("n"))
|
.def(py::init([] (size_t n) { return make_shared<BitArray>(n); }),py::arg("n"))
|
||||||
.def(py::init([] (const BitArray& a) { return make_shared<BitArray>(a); } ), py::arg("ba"))
|
.def(py::init([] (const BitArray& a) { return make_shared<BitArray>(a); } ), py::arg("ba"))
|
||||||
|
Loading…
Reference in New Issue
Block a user