25 #ifndef XC_PYTHON_UTILS_H 26 #define XC_PYTHON_UTILS_H 28 #include <boost/python/list.hpp> 30 #include "utility/matrices/m_double.h" 31 #include <boost/python/suite/indexing/map_indexing_suite.hpp> 36 boost::python::list xc_id_to_py_list(
const XC::ID &);
38 std::vector<double> vector_double_from_py_object(
const boost::python::object &);
39 std::vector<int> vector_int_from_py_object(
const boost::python::object &);
40 m_double m_double_from_py_object(
const boost::python::object &);
50 template <
class Container,
bool NoProxy,
class DerivedPolicies>
53 template <
class Container,
bool NoProxy>
56 NoProxy, final_mapptr_derived_policies<Container, NoProxy> > {};
67 :
public boost::python::map_indexing_suite<
76 using typename boost::python::map_indexing_suite<
77 Container,NoProxy,DerivedPolicies>::data_type;
78 using typename boost::python::map_indexing_suite<
79 Container,NoProxy,DerivedPolicies>::value_type;
82 template <
class Class>
84 extension_def(Class& cl)
87 std::string elem_name =
"mapptr_indexing_suite_";
88 boost::python::object class_name(cl.attr(
"__name__"));
89 boost::python::extract<std::string> class_name_extractor(class_name);
90 elem_name += class_name_extractor();
91 elem_name +=
"_entry";
95 typedef typename boost::mpl::if_<
96 boost::mpl::and_<std::is_pointer<data_type>, boost::mpl::bool_<!NoProxy> >
97 , boost::python::return_internal_reference<>
98 , boost::python::default_call_policies
99 >::type get_data_return_policy;
101 boost::python::class_<value_type>(elem_name.c_str())
102 .def(
"__repr__", &DerivedPolicies::print_elem)
103 .def(
"data", &DerivedPolicies::get_data, get_data_return_policy())
104 .def(
"key", &DerivedPolicies::get_key)
Matrix which element type has estructura de anillo respecto a las operaciones + y *...
Definition: ZMatrix.h:37
Solution to export std::map<key, T *> to Python as iterable objects.
Definition: xc_python_utils.h:51
Definition: xc_python_utils.h:54
Vector of integers.
Definition: ID.h:95
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35