#ifdef NG_PYTHON #include #include namespace py = pybind11; #include #include namespace PYBIND11_NAMESPACE { template bool CheckCast( py::handle obj ) { try{ obj.cast(); return true; } catch (py::cast_error &e) { return false; } } template struct extract { py::handle obj; extract( py::handle aobj ) : obj(aobj) {} bool check() { return CheckCast(obj); } T operator()() { return obj.cast(); } }; } struct NGDummyArgument {}; inline void NOOP_Deleter(void *) { ; } namespace netgen { ////////////////////////////////////////////////////////////////////// // Lambda to function pointer conversion template struct function_traits : public function_traits {}; template struct function_traits { typedef ReturnType (*pointer)(Args...); typedef ReturnType return_type; }; template typename function_traits::pointer FunctionPointer (const Function& lambda) { return static_cast::pointer>(lambda); } template inline std::string ToString (const T& t) { std::stringstream ss; ss << t; return ss.str(); } } #endif