Repository navigation
Expand file tree
/
Copy pathPrincipalCrossSectionBlock.python.cpp
More file actions
108 lines (89 loc) · 2.92 KB
/
Copy pathPrincipalCrossSectionBlock.python.cpp
File metadata and controls
108 lines (89 loc) · 2.92 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
// system includes
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
// local includes
#include "ACEtk/continuous/PrincipalCrossSectionBlock.hpp"
#include "tools/views/views-python.hpp"
#include "definitions.hpp"
// namespace aliases
namespace python = pybind11;
namespace continuous {
void wrapPrincipalCrossSectionBlock( python::module& module, python::module& ) {
// type aliases
using Block = njoy::ACEtk::continuous::PrincipalCrossSectionBlock;
// wrap views created by this block
// create the block
python::class_< Block > block(
module,
"PrincipalCrossSectionBlock",
"The continuous energy ESZ block with the principal cross sections\n\n"
"The PrincipalCrossSectionBlock class contains 5 arrays of the same length:\n"
" - the energy points\n"
" - the total cross section\n"
" - the elastic scattering cross section\n"
" - the projectile disappearance cross section\n"
" - the average heating numbers\n\n"
"The size of each (the total number of energy points) is stored in NXS(3)."
);
// wrap the block
block
.def(
python::init< std::vector< double >, std::vector< double >,
std::vector< double >, std::vector< double >,
std::vector< double > >(),
python::arg( "energies" ), python::arg( "total" ),
python::arg( "disappearance" ), python::arg( "elastic" ),
python::arg( "heating" ),
"Initialise the block\n\n"
"Arguments:\n"
" self the block\n"
" energies the energy values\n"
" total the total cross section values\n"
" disappearance the projectile disappearance cross section values\n"
" elastic the elastic cross section values\n"
" heating the average heating cross section values"
)
.def_property_readonly(
"NES",
&Block::NES,
"The number of energy points"
)
.def_property_readonly(
"number_energy_points",
&Block::numberEnergyPoints,
"The number of energy points"
)
.def_property_readonly(
"energies",
[] ( const Block& self ) -> DoubleRange
{ return self.energies(); },
"The energy values"
)
.def_property_readonly(
"total",
[] ( const Block& self ) -> DoubleRange
{ return self.total(); },
"The total cross section values"
)
.def_property_readonly(
"disappearance",
[] ( const Block& self ) -> DoubleRange
{ return self.disappearance(); },
"The projectile disappearance cross section values"
)
.def_property_readonly(
"elastic",
[] ( const Block& self ) -> DoubleRange
{ return self.elastic(); },
"The elastic cross section values"
)
.def_property_readonly(
"heating",
[] ( const Block& self ) -> DoubleRange
{ return self.heating(); },
"The average heating numbers"
);
// add standard block definitions
addStandardBlockDefinitions< Block >( block );
}
} // continuous namespace