-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/distributions part3 #8
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
04f53c0
Adding an enum for the reference frame
whaeck 6ed6f03
Adding python bindings for the reference frame enumerator
whaeck 0821d70
Adding the distribution data type
whaeck 4aad503
Adding placeholder types for fully isotropic angular distributions an…
whaeck 863fd77
Adding two body and uncorrelated distribution data
whaeck 4bddc57
Finalising test for TwoBodyDistributionData
whaeck 6e978fd
Finishing test for UncorrelatedDistributionData
whaeck f03eb62
Integrating distribution data into ReactionProduct
whaeck d0f301c
Adding a missing include file
whaeck 5c4f6c5
Adding bindings and tests for TabulatedEnergyDistribution
whaeck 2f2d000
Adding more python bindings and tests
whaeck 47aab21
Updating ...
whaeck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
// local includes | ||
#include "dryad/DistributionDataType.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapDistributionDataType( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::DistributionDataType; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::enum_< Component > component( | ||
|
||
module, | ||
"DistributionDataType", | ||
"The distribition data type for a reaction product", | ||
python::arithmetic() | ||
); | ||
|
||
// wrap the component | ||
component | ||
.value( "TwoBody", Component::TwoBody ) | ||
.value( "Uncorrelated", Component::Uncorrelated ); | ||
} |
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,92 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
#include <pybind11/operators.h> | ||
|
||
// local includes | ||
#include "definitions.hpp" | ||
#include "dryad/LegendreAngularDistributions.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapLegendreAngularDistributions( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::LegendreAngularDistributions; | ||
using LegendreAngularDistribution = njoy::dryad::LegendreAngularDistribution; | ||
using InterpolationType = njoy::dryad::InterpolationType; | ||
using ToleranceConvergence = njoy::dryad::ToleranceConvergence; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::class_< Component > component( | ||
|
||
module, | ||
"LegendreAngularDistributions", | ||
"Angular distribution data given using Legendre expansions" | ||
); | ||
|
||
// wrap the component | ||
component | ||
.def( | ||
|
||
python::init< std::vector< double >, | ||
std::vector< LegendreAngularDistribution >, | ||
std::vector< std::size_t >, | ||
std::vector< InterpolationType > >(), | ||
python::arg( "grid" ), python::arg( "distributions" ), | ||
python::arg( "boundaries" ), python::arg( "interpolants" ), | ||
"Initialise the angular distributions\n\n" | ||
"Arguments:\n" | ||
" self the angular distribution table\n" | ||
" grid the grid values\n" | ||
" distributions the distributions\n" | ||
" boundaries the boundaries of the interpolation regions\n" | ||
" interpolants the interpolation types of the interpolation regions,\n" | ||
" see InterpolationType for all interpolation types" | ||
) | ||
.def( | ||
|
||
python::init< std::vector< double >, | ||
std::vector< LegendreAngularDistribution >, | ||
InterpolationType >(), | ||
python::arg( "grid" ), python::arg( "distributions" ), | ||
python::arg( "interpolant" ) = InterpolationType::LinearLinear, | ||
"Initialise the angular distributions\n\n" | ||
"Arguments:\n" | ||
" self the multiplicity table\n" | ||
" grid the grid values\n" | ||
" distributions the distributions\n" | ||
" interpolant the interpolation type (default lin-lin),\n" | ||
" see InterpolationType for all interpolation types" | ||
) | ||
.def_property_readonly( | ||
|
||
"grid", | ||
&Component::grid, | ||
"The grid values for which distributions are given" | ||
) | ||
.def_property_readonly( | ||
|
||
"distributions", | ||
&Component::distributions, | ||
"The associated distributions" | ||
) | ||
.def( | ||
|
||
"__call__", | ||
[] ( const Component& self, double value, double cosine ) -> decltype(auto) | ||
{ return self( value, cosine ); }, | ||
python::arg( "value" ), python::arg( "cosine" ), | ||
"Evaluate the angular distributions\n\n" | ||
"Arguments:\n" | ||
" self the table\n" | ||
" value the grid value\n" | ||
" cosine the cosine value" | ||
); | ||
|
||
// add standard tabulated data definitions | ||
addStandardInterpolationTableDefinitions< Component >( component ); | ||
} |
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,31 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
// local includes | ||
#include "dryad/ReferenceFrame.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapReferenceFrame( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::ReferenceFrame; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::enum_< Component > component( | ||
|
||
module, | ||
"ReferenceFrame", | ||
"The reference frame used to describe data", | ||
python::arithmetic() | ||
); | ||
|
||
// wrap the component | ||
component | ||
.value( "Laboratory", Component::Laboratory ) | ||
.value( "CentreOfMass", Component::CentreOfMass ); | ||
} |
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,92 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
#include <pybind11/operators.h> | ||
|
||
// local includes | ||
#include "definitions.hpp" | ||
#include "dryad/TabulatedAngularDistributions.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapTabulatedAngularDistributions( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::TabulatedAngularDistributions; | ||
using TabulatedAngularDistribution = njoy::dryad::TabulatedAngularDistribution; | ||
using InterpolationType = njoy::dryad::InterpolationType; | ||
using ToleranceConvergence = njoy::dryad::ToleranceConvergence; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::class_< Component > component( | ||
|
||
module, | ||
"TabulatedAngularDistributions", | ||
"Angular distribution data given as tables" | ||
); | ||
|
||
// wrap the component | ||
component | ||
.def( | ||
|
||
python::init< std::vector< double >, | ||
std::vector< TabulatedAngularDistribution >, | ||
std::vector< std::size_t >, | ||
std::vector< InterpolationType > >(), | ||
python::arg( "grid" ), python::arg( "distributions" ), | ||
python::arg( "boundaries" ), python::arg( "interpolants" ), | ||
"Initialise the angular distributions\n\n" | ||
"Arguments:\n" | ||
" self the angular distribution table\n" | ||
" grid the grid values\n" | ||
" distributions the distributions\n" | ||
" boundaries the boundaries of the interpolation regions\n" | ||
" interpolants the interpolation types of the interpolation regions,\n" | ||
" see InterpolationType for all interpolation types" | ||
) | ||
.def( | ||
|
||
python::init< std::vector< double >, | ||
std::vector< TabulatedAngularDistribution >, | ||
InterpolationType >(), | ||
python::arg( "grid" ), python::arg( "distributions" ), | ||
python::arg( "interpolant" ) = InterpolationType::LinearLinear, | ||
"Initialise the angular distributions\n\n" | ||
"Arguments:\n" | ||
" self the multiplicity table\n" | ||
" grid the grid values\n" | ||
" distributions the distributions\n" | ||
" interpolant the interpolation type (default lin-lin),\n" | ||
" see InterpolationType for all interpolation types" | ||
) | ||
.def_property_readonly( | ||
|
||
"grid", | ||
&Component::grid, | ||
"The grid values for which distributions are given" | ||
) | ||
.def_property_readonly( | ||
|
||
"distributions", | ||
&Component::distributions, | ||
"The associated distributions" | ||
) | ||
.def( | ||
|
||
"__call__", | ||
[] ( const Component& self, double value, double cosine ) -> decltype(auto) | ||
{ return self( value, cosine ); }, | ||
python::arg( "value" ), python::arg( "cosine" ), | ||
"Evaluate the angular distributions\n\n" | ||
"Arguments:\n" | ||
" self the table\n" | ||
" value the grid value\n" | ||
" cosine the cosine value" | ||
); | ||
|
||
// add standard tabulated data definitions | ||
addStandardInterpolationTableDefinitions< Component >( component ); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Distribition"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in fix/review