-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding bindings for ScatteringMatrix
- Loading branch information
Showing
11 changed files
with
118 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
// local includes | ||
#include "NDItk/multigroup/ScatteringMatrix.hpp" | ||
#include "tools/views/views-python.hpp" | ||
#include "definitions.hpp" | ||
#include "read.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
namespace multigroup { | ||
|
||
void wrapScatteringMatrix( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Record = njoy::NDItk::multigroup::ScatteringMatrix; | ||
using LegendreMoment = njoy::NDItk::multigroup::LegendreMoment; | ||
|
||
// wrap views created by this record | ||
|
||
// create the record | ||
python::class_< Record > record( | ||
|
||
module, | ||
"ScatteringMatrix", | ||
"A scattering matrix record for multigroup neutron and photon data" | ||
); | ||
|
||
// wrap the record | ||
record | ||
.def( | ||
|
||
python::init< std::vector< LegendreMoment > >(), | ||
python::arg( "moments" ), | ||
"Initialise the record\n\n" | ||
"Arguments:\n" | ||
" self the record\n" | ||
" moments the Legendre moments of the scattering matrix" | ||
) | ||
.def_property_readonly( | ||
|
||
"number_primary_groups", | ||
&Record::numberPrimaryGroups, | ||
"The number of primary groups defined by this record" | ||
) | ||
.def_property_readonly( | ||
|
||
"number_outgoing_groups", | ||
&Record::numberOutgoingGroups, | ||
"The number of outgoing groups defined by this record" | ||
) | ||
.def_property_readonly( | ||
|
||
"number_legendre_moments", | ||
&Record::numberLegendreMoments, | ||
"The number of moments defined in this record" | ||
) | ||
.def_property_readonly( | ||
|
||
"moments", | ||
&Record::moments, | ||
"The Legendre moments" | ||
) | ||
.def( | ||
|
||
"has_moment", | ||
&Record::hasMoment, | ||
python::arg( "order" ), | ||
"Return whether or not a given moment is present\n\n" | ||
" self the record\n" | ||
" order the Legendre order to look for" | ||
) | ||
.def( | ||
|
||
"moment", | ||
&Record::moment, | ||
python::arg( "order" ), | ||
"Return the moment for a given order\n\n" | ||
" self the record\n" | ||
" order the Legendre order to look for" | ||
) | ||
.def_static( | ||
|
||
"from_string", | ||
[] ( const std::string& string, unsigned int incident, | ||
unsigned int outgoing, unsigned int number ) -> Record | ||
{ return read< Record >( string, incident, outgoing, number ); }, | ||
python::arg( "string" ), python::arg( "incident" ), | ||
python::arg( "outgoing" ), python::arg( "number" ), | ||
"Read the record from a string\n\n" | ||
"An exception is raised if something goes wrong while reading the\n" | ||
"record\n\n" | ||
"Arguments:\n" | ||
" string the string representing the record\n" | ||
" incident the number of incident energy groups\n" | ||
" outgoing the number of outgoing energy groups\n" | ||
" number the number of moments" | ||
); | ||
|
||
// add standard record definitions | ||
addStandardRecordDefinitions< Record, DoubleRange >( record ); | ||
} | ||
|
||
} // multigroup namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters