-
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 #2 from njoy/feature/xs
Initial developments
- Loading branch information
Showing
82 changed files
with
21,703 additions
and
8 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
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/InteractionType.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapInteractionType( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::InteractionType; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::enum_< Component > component( | ||
|
||
module, | ||
"InteractionType", | ||
"The projectile-target interaction type", | ||
python::arithmetic() | ||
); | ||
|
||
// wrap the component | ||
component | ||
.value( "Atomic", Component::Atomic ) | ||
.value( "Nuclear", Component::Nuclear ); | ||
} |
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,135 @@ | ||
// system includes | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
// local includes | ||
#include "dryad/ProjectileTarget.hpp" | ||
#include "dryad/format/endf/createProjectileTargetFromFile.hpp" | ||
|
||
// namespace aliases | ||
namespace python = pybind11; | ||
|
||
void wrapProjectileTarget( python::module& module, python::module& ) { | ||
|
||
// type aliases | ||
using Component = njoy::dryad::ProjectileTarget; | ||
using ParticleID = njoy::dryad::ParticleID; | ||
using Reaction = njoy::dryad::Reaction; | ||
using ToleranceConvergence = njoy::dryad::ToleranceConvergence; | ||
using InteractionType = njoy::dryad::InteractionType; | ||
|
||
// wrap views created by this component | ||
|
||
// create the component | ||
python::class_< Component > component( | ||
|
||
module, | ||
"ProjectileTarget", | ||
"A data associated to a given projectile and target" | ||
); | ||
|
||
// wrap the component | ||
component | ||
.def( | ||
|
||
python::init< ParticleID, ParticleID, InteractionType, | ||
std::vector< Reaction > >(), | ||
python::arg( "projectile" ), python::arg( "target" ), | ||
python::arg( "type" ), python::arg( "reactions" ), | ||
"Initialise the ProjectileTarget\n\n" | ||
"Arguments:\n" | ||
" self the reaction\n" | ||
" projectile the particle identifier\n" | ||
" target the target identifier\n" | ||
" type the interaction type\n" | ||
" reactions the reaction data" | ||
) | ||
.def_property_readonly( | ||
|
||
"projectile_identifier", | ||
&Component::projectileIdentifier, | ||
"The projectile identifier" | ||
) | ||
.def_property_readonly( | ||
|
||
"target_identifier", | ||
&Component::targetIdentifier, | ||
"The target identifier" | ||
) | ||
.def_property_readonly( | ||
|
||
"interaction_type", | ||
&Component::interactionType, | ||
"The interaction type (atomic or nuclear)" | ||
) | ||
.def_property_readonly( | ||
|
||
"resonances", | ||
&Component::resonances, | ||
"The resonance parameters" | ||
) | ||
.def_property_readonly( | ||
|
||
"reactions", | ||
&Component::reactions, | ||
"The reactions" | ||
) | ||
.def( | ||
|
||
"has_reaction", | ||
&Component::hasReaction, | ||
"Return whether or not a reaction is present\n\n" | ||
"Arguments:\n" | ||
" self the ProjectileTarget\n" | ||
" id the the reaction identifier" | ||
) | ||
.def( | ||
|
||
"reaction", | ||
&Component::reaction, | ||
"Return the requested reaction\n\n" | ||
"Arguments:\n" | ||
" self the ProjectileTarget\n" | ||
" id the the reaction identifier" | ||
) | ||
.def_property_readonly( | ||
|
||
"is_linearised", | ||
&Component::isLinearised, | ||
"Flag indicating whether or not the data is linearised" | ||
) | ||
.def( | ||
|
||
"linearise", | ||
&Component::linearise, | ||
python::arg( "tolerance" ) = ToleranceConvergence(), | ||
"Linearise the data and return a new object\n\n" | ||
"Arguments:\n" | ||
" self the ProjectileTarget\n" | ||
" tolerance the linearisation tolerance" | ||
) | ||
.def( | ||
|
||
"linearise_inplace", | ||
&Component::lineariseInplace, | ||
python::arg( "tolerance" ) = ToleranceConvergence(), | ||
"Linearise the data inplace\n\n" | ||
"Arguments:\n" | ||
" self the ProjectileTarget\n" | ||
" tolerance the linearisation tolerance" | ||
) | ||
.def_static( | ||
|
||
"from_endf_file", | ||
[] ( const std::string& filename ) -> Component { | ||
|
||
return njoy::dryad::format::endf::createProjectileTargetFromFile( filename ); | ||
}, | ||
python::arg( "filename" ), | ||
"Create a ProjectileTarget from an ENDF file\n\n" | ||
"If there are multiple materials in the ENDF file, only the first material\n" | ||
"will be transformed into a ProjectileTarget.\n\n" | ||
"Arguments:\n" | ||
" filename the ENDF file name" | ||
); | ||
} |
Oops, something went wrong.