|
| 1 | +// system includes |
| 2 | +#include <pybind11/pybind11.h> |
| 3 | +#include <pybind11/stl.h> |
| 4 | + |
| 5 | +// local includes |
| 6 | +#include "ACEtk/Table.hpp" |
| 7 | + |
| 8 | +// namespace aliases |
| 9 | +namespace python = pybind11; |
| 10 | + |
| 11 | +void wrapData( python::module& module, python::module& ) { |
| 12 | + |
| 13 | + // type aliases |
| 14 | + using Component = njoy::ACEtk::Table::Data; |
| 15 | + |
| 16 | + // wrap views created by this component |
| 17 | + |
| 18 | + // create the component |
| 19 | + python::class_< Component > component( |
| 20 | + |
| 21 | + module, |
| 22 | + "Data", |
| 23 | + "The data in an ACE table\n\n" |
| 24 | + "The data in an ACE table consists of the following arrays:\n" |
| 25 | + " - the IZAW array which contains 16 integer, double pairs\n" |
| 26 | + " - the NXS array which contains information needed to properly interpret\n" |
| 27 | + " the XSS array\n" |
| 28 | + " - the JXS array which contains 32 locators to specific blocks in the\n" |
| 29 | + " XSS array (the meaning of the JXS locators depend on the type of the\n" |
| 30 | + " ACE table)\n" |
| 31 | + " - the XSS array which contains the actual data" |
| 32 | + ); |
| 33 | + |
| 34 | + // wrap the component |
| 35 | + component |
| 36 | + .def( |
| 37 | + |
| 38 | + python::init< std::array< int32_t, 16 >&&, std::array< double, 16 >&&, |
| 39 | + std::array< int64_t, 16 >&&, std::array< int64_t, 32 >&&, |
| 40 | + std::vector< double >&& >(), |
| 41 | + python::arg( "iz" ), python::arg( "aw" ), python::arg( "nxs" ), |
| 42 | + python::arg( "jxs" ), python::arg( "xss" ), |
| 43 | + "Initialise the component\n\n" |
| 44 | + "Arguments:\n" |
| 45 | + " self the data arrays\n" |
| 46 | + " iz the IZ array\n" |
| 47 | + " aw the AW array\n" |
| 48 | + " nxs the NXS array\n" |
| 49 | + " jxs the JXS array\n" |
| 50 | + " xss the XSS array" |
| 51 | + ) |
| 52 | + .def_property_readonly( |
| 53 | + |
| 54 | + "iz", |
| 55 | + python::overload_cast<>( &Component::IZ, python::const_ ), |
| 56 | + "The iz array" |
| 57 | + ) |
| 58 | + .def_property_readonly( |
| 59 | + |
| 60 | + "aw", |
| 61 | + python::overload_cast<>( &Component::AW, python::const_ ), |
| 62 | + "The aw array" |
| 63 | + ) |
| 64 | + .def_property_readonly( |
| 65 | + |
| 66 | + "nxs", |
| 67 | + python::overload_cast<>( &Component::NXS, python::const_ ), |
| 68 | + "The nxs array" |
| 69 | + ) |
| 70 | + .def_property_readonly( |
| 71 | + |
| 72 | + "jxs", |
| 73 | + python::overload_cast<>( &Component::JXS, python::const_ ), |
| 74 | + "The jxs array" |
| 75 | + ) |
| 76 | + .def_property_readonly( |
| 77 | + |
| 78 | + "xss", |
| 79 | + python::overload_cast<>( &Component::XSS, python::const_ ), |
| 80 | + "The xss array" |
| 81 | + ) |
| 82 | + .def( |
| 83 | + |
| 84 | + "iz", |
| 85 | + python::overload_cast< std::size_t >( &Component::IZ, python::const_ ), |
| 86 | + python::arg( "index" ), |
| 87 | + "Return a value from the IZ array\n\n" |
| 88 | + "Arguments:\n" |
| 89 | + " self the data arrays\n" |
| 90 | + " index the index (one-based)" |
| 91 | + ) |
| 92 | + .def( |
| 93 | + |
| 94 | + "aw", |
| 95 | + python::overload_cast< std::size_t >( &Component::AW, python::const_ ), |
| 96 | + python::arg( "index" ), |
| 97 | + "Return a value from the AW array\n\n" |
| 98 | + "Arguments:\n" |
| 99 | + " self the data arrays\n" |
| 100 | + " index the index (one-based)" |
| 101 | + ) |
| 102 | + .def( |
| 103 | + |
| 104 | + "nxs", |
| 105 | + python::overload_cast< std::size_t >( &Component::NXS, python::const_ ), |
| 106 | + python::arg( "index" ), |
| 107 | + "Return a value from the NXS array\n\n" |
| 108 | + "Arguments:\n" |
| 109 | + " self the data arrays\n" |
| 110 | + " index the index (one-based)" |
| 111 | + ) |
| 112 | + .def( |
| 113 | + |
| 114 | + "jxs", |
| 115 | + python::overload_cast< std::size_t >( &Component::JXS, python::const_ ), |
| 116 | + python::arg( "index" ), |
| 117 | + "Return a value from the JXS array\n\n" |
| 118 | + "Arguments:\n" |
| 119 | + " self the data arrays\n" |
| 120 | + " index the index (one-based)" |
| 121 | + ) |
| 122 | + .def( |
| 123 | + |
| 124 | + "xss", |
| 125 | + python::overload_cast< std::size_t >( &Component::XSS, python::const_ ), |
| 126 | + python::arg( "index" ), |
| 127 | + "Return a value from the XSS array\n\n" |
| 128 | + "Arguments:\n" |
| 129 | + " self the data arrays\n" |
| 130 | + " index the index (one-based)" |
| 131 | + ); |
| 132 | +} |
0 commit comments