diff --git a/bindings/python/context_shim.cpp b/bindings/python/context_shim.cpp index 9ed6d8c6..ad948cf0 100644 --- a/bindings/python/context_shim.cpp +++ b/bindings/python/context_shim.cpp @@ -7,6 +7,7 @@ * Please, refer to the LICENSE file in the root directory. * SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include @@ -51,6 +52,8 @@ register_context(pybind11::module& m) .def( "size", [](const context_shim& c) { return c.m.size(); }, "number of ranks within the communicator"); + + m.def("expose_cpp_ptr", [](context_shim* obj){return reinterpret_cast(&obj->m);}); } } // namespace pyghex diff --git a/bindings/python/unstructured/communication_object.cpp b/bindings/python/unstructured/communication_object.cpp index f64b10e0..20f7f38c 100644 --- a/bindings/python/unstructured/communication_object.cpp +++ b/bindings/python/unstructured/communication_object.cpp @@ -7,6 +7,7 @@ * Please, refer to the LICENSE file in the root directory. * SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include @@ -90,6 +91,8 @@ register_communication_object(pybind11::module& m) return type{c.m}; }, pybind11::keep_alive<0, 1>()); + + m.def("expose_cpp_ptr", [](type* obj){return reinterpret_cast(obj);}); }); } diff --git a/bindings/python/unstructured/domain_descriptor.cpp b/bindings/python/unstructured/domain_descriptor.cpp index b92af8f5..12bb8c33 100644 --- a/bindings/python/unstructured/domain_descriptor.cpp +++ b/bindings/python/unstructured/domain_descriptor.cpp @@ -7,6 +7,7 @@ * Please, refer to the LICENSE file in the root directory. * SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include @@ -53,6 +54,8 @@ register_domain_descriptor(pybind11::module& m) "Returns the indices") .def_property_readonly_static("__cpp_type__", [type_name](const pybind11::object&) { return type_name; }); + + m.def("expose_cpp_ptr", [](type* obj){return reinterpret_cast(obj);}); }); } diff --git a/bindings/python/unstructured/pattern.cpp b/bindings/python/unstructured/pattern.cpp index ee51db6e..f7c7b06d 100644 --- a/bindings/python/unstructured/pattern.cpp +++ b/bindings/python/unstructured/pattern.cpp @@ -7,6 +7,7 @@ * Please, refer to the LICENSE file in the root directory. * SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include @@ -68,6 +69,8 @@ register_pattern(pybind11::module& m) cls.def("__call__", &pattern_container::template operator(), pybind11::keep_alive<0, 2>()); }); + + m.def("expose_cpp_ptr", [](pattern_container* obj){return reinterpret_cast(obj);}); }); } diff --git a/include/ghex/unstructured/user_concepts.hpp b/include/ghex/unstructured/user_concepts.hpp index a2003d5a..46c85492 100644 --- a/include/ghex/unstructured/user_concepts.hpp +++ b/include/ghex/unstructured/user_concepts.hpp @@ -355,6 +355,9 @@ class data_descriptor assert(!(outer_stride) || (outer_stride >= (levels_first ? m_levels : m_domain_size))); } + /** @brief empty constructor*/ + data_descriptor(){} + // member functions device_id_type device_id() const noexcept { return arch_traits::default_id(); }