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