-
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.
Merge pull request #11 from njoy/feature/distributions-part6
Feature/distributions part6
- Loading branch information
Showing
25 changed files
with
10,654 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
#include <pybind11/operators.h> | ||
|
||
// local includes | ||
#include "definitions.hpp" | ||
#include "dryad/TabulatedFormFactor.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapTabulatedFormFactor( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::TabulatedFormFactor; | ||
using InterpolationType = njoy::dryad::InterpolationType; | ||
using ToleranceConvergence = njoy::dryad::ToleranceConvergence; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::class_< Component > component( | ||
|
||
module, | ||
"TabulatedFormFactor", | ||
"A form factor table" | ||
); | ||
|
||
// wrap the component | ||
component | ||
.def( | ||
|
||
python::init< std::vector< double >, std::vector< double >, | ||
std::vector< std::size_t >, | ||
std::vector< InterpolationType > >(), | ||
python::arg( "energies" ), python::arg( "values" ), | ||
python::arg( "boundaries" ), python::arg( "interpolants" ), | ||
"Initialise the form factor table\n\n" | ||
"Arguments:\n" | ||
" self the form factor table\n" | ||
" energies the energy values\n" | ||
" values the form factor values\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< double >, | ||
InterpolationType >(), | ||
python::arg( "energies" ), python::arg( "values" ), | ||
python::arg( "interpolant" ) = InterpolationType::LinearLinear, | ||
"Initialise the form factor table\n\n" | ||
"Arguments:\n" | ||
" self the form factor table\n" | ||
" energies the energy values\n" | ||
" values the form factor values\n" | ||
" interpolant the interpolation type (default lin-lin),\n" | ||
" see InterpolationType for all interpolation types" | ||
) | ||
.def_property_readonly( | ||
|
||
"energies", | ||
&Component::energies, | ||
"The energy values" | ||
) | ||
.def_property_readonly( | ||
|
||
"values", | ||
&Component::values, | ||
"The form factor values" | ||
) | ||
.def_property_readonly( | ||
|
||
"lower_energy_limit", | ||
&Component::lowerEnergyLimit, | ||
"The lower energy limit" | ||
) | ||
.def_property_readonly( | ||
|
||
"upper_energy_limit", | ||
&Component::upperEnergyLimit, | ||
"The upper energy limit" | ||
) | ||
.def( | ||
|
||
"__call__", | ||
[] ( const Component& self, double energy ) -> decltype(auto) | ||
{ return self( energy ); }, | ||
python::arg( "energy" ), | ||
"Evaluate the table for a given energy value\n\n" | ||
"Arguments:\n" | ||
" self the table\n" | ||
" energy the energy value" | ||
); | ||
|
||
// add standard tabulated data definitions | ||
addStandardTabulatedDefinitions< 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
#include <pybind11/operators.h> | ||
|
||
// local includes | ||
#include "definitions.hpp" | ||
#include "dryad/TabulatedScatteringFunction.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapTabulatedScatteringFunction( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::TabulatedScatteringFunction; | ||
using InterpolationType = njoy::dryad::InterpolationType; | ||
using ToleranceConvergence = njoy::dryad::ToleranceConvergence; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::class_< Component > component( | ||
|
||
module, | ||
"TabulatedScatteringFunction", | ||
"A scattering function table" | ||
); | ||
|
||
// wrap the component | ||
component | ||
.def( | ||
|
||
python::init< std::vector< double >, std::vector< double >, | ||
std::vector< std::size_t >, | ||
std::vector< InterpolationType > >(), | ||
python::arg( "inverse_lengths" ), python::arg( "values" ), | ||
python::arg( "boundaries" ), python::arg( "interpolants" ), | ||
"Initialise the scattering function table\n\n" | ||
"Arguments:\n" | ||
" self the scattering function table\n" | ||
" inverse_lengths the inverse length values\n" | ||
" values the scattering function values\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< double >, | ||
InterpolationType >(), | ||
python::arg( "inverse_lengths" ), python::arg( "values" ), | ||
python::arg( "interpolant" ) = InterpolationType::LinearLinear, | ||
"Initialise the scattering function table\n\n" | ||
"Arguments:\n" | ||
" self the scattering function table\n" | ||
" inverse_lengths the inverse length values\n" | ||
" values the scattering function values\n" | ||
" interpolant the interpolation type (default lin-lin),\n" | ||
" see InterpolationType for all interpolation types" | ||
) | ||
.def_property_readonly( | ||
|
||
"inverse_lengths", | ||
&Component::inverseLengths, | ||
"The inverse length values" | ||
) | ||
.def_property_readonly( | ||
|
||
"values", | ||
&Component::values, | ||
"The scattering function values" | ||
) | ||
.def_property_readonly( | ||
|
||
"lower_inverse_length_limit", | ||
&Component::lowerInverseLengthLimit, | ||
"The lower inverse length limit" | ||
) | ||
.def_property_readonly( | ||
|
||
"upper_inverse_length_limit", | ||
&Component::upperInverseLengthLimit, | ||
"The upper inverse length limit" | ||
) | ||
.def( | ||
|
||
"__call__", | ||
[] ( const Component& self, double inverse_length ) -> decltype(auto) | ||
{ return self( inverse_length ); }, | ||
python::arg( "inverse_length" ), | ||
"Evaluate the table for a given energy value\n\n" | ||
"Arguments:\n" | ||
" self the table\n" | ||
" inverse_length the inverse length value" | ||
); | ||
|
||
// add standard tabulated data definitions | ||
addStandardTabulatedDefinitions< 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
Oops, something went wrong.