Skip to content

Commit

Permalink
Merge pull request #46 from njoy/feature/dlw-components-too
Browse files Browse the repository at this point in the history
Feature/dlw components too
  • Loading branch information
whaeck authored Mar 17, 2023
2 parents ae390a9 + e94df1b commit 786371d
Show file tree
Hide file tree
Showing 51 changed files with 2,611 additions and 135 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ if(ACEtk.python)
python/src/block/DistributionGivenElsewhere.python.cpp
python/src/block/AngularDistributionBlock.python.cpp
python/src/block/LevelScatteringDistribution.python.cpp
python/src/block/TabulatedOutgoingEnergyDistribution.python.cpp
python/src/block/OutgoingEnergyDistributionData.python.cpp
python/src/block/TabulatedKalbachMannDistribution.python.cpp
python/src/block/KalbachMannDistributionData.python.cpp
python/src/ContinuousEnergyTable.python.cpp
)

Expand Down
4 changes: 4 additions & 0 deletions cmake/unit_testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ add_subdirectory( src/ACEtk/block/IsotropicAngularDistribution/test )
add_subdirectory( src/ACEtk/block/AngularDistributionData/test )
add_subdirectory( src/ACEtk/block/AngularDistributionBlock/test )
add_subdirectory( src/ACEtk/block/LevelScatteringDistribution/test )
add_subdirectory( src/ACEtk/block/TabulatedOutgoingEnergyDistribution/test )
add_subdirectory( src/ACEtk/block/OutgoingEnergyDistributionData/test )
add_subdirectory( src/ACEtk/block/TabulatedKalbachMannDistribution/test )
add_subdirectory( src/ACEtk/block/KalbachMannDistributionData/test )
add_subdirectory( src/ACEtk/details/verify/CDF/test )
add_subdirectory( src/ACEtk/details/verify/Positive/test )
add_subdirectory( src/ACEtk/details/verify/Sorted/test )
Expand Down
8 changes: 8 additions & 0 deletions python/src/ACEtk.python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ namespace block {
void wrapFullyIsotropicDistribution( python::module&, python::module& );
void wrapDistributionGivenElsewhere( python::module&, python::module& );
void wrapLevelScatteringDistribution( python::module&, python::module& );
void wrapTabulatedOutgoingEnergyDistribution( python::module&, python::module& );
void wrapOutgoingEnergyDistributionData( python::module&, python::module& );
void wrapTabulatedKalbachMannDistribution( python::module&, python::module& );
void wrapKalbachMannDistributionData( python::module&, python::module& );

// declarations - ACE table blocks
void wrapPrincipalCrossSectionBlock( python::module&, python::module& );
Expand Down Expand Up @@ -97,6 +101,10 @@ PYBIND11_MODULE( ACEtk, module ) {
block::wrapFullyIsotropicDistribution( module, viewmodule );
block::wrapDistributionGivenElsewhere( module, viewmodule );
block::wrapLevelScatteringDistribution( module, viewmodule );
block::wrapTabulatedOutgoingEnergyDistribution( module, viewmodule );
block::wrapOutgoingEnergyDistributionData( module, viewmodule );
block::wrapTabulatedKalbachMannDistribution( module, viewmodule );
block::wrapKalbachMannDistributionData( module, viewmodule );

// wrap ACE table blocks
block::wrapPrincipalCrossSectionBlock( module, viewmodule );
Expand Down
16 changes: 8 additions & 8 deletions python/src/block/AngularDistributionData.python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ void wrapAngularDistributionData( python::module& module, python::module& ) {
)
.def(

"angular_distribution_locator",
&Block::angularDistributionLocator,
"distribution_locator",
&Block::distributionLocator,
python::arg( "index" ),
"Return the angular distribution locator for an incident energy index\n\n"
"This locator is the value as stored in the XSS array. It is relative to\n"
Expand All @@ -108,8 +108,8 @@ void wrapAngularDistributionData( python::module& module, python::module& ) {
)
.def(

"relative_angular_distribution_locator",
&Block::relativeAngularDistributionLocator,
"relative_distribution_locator",
&Block::relativeDistributionLocator,
python::arg( "index" ),
"Return the relative angular distribution locator for an incident energy index\n\n"
"This is the locator relative to the beginning of the current angular\n"
Expand All @@ -121,8 +121,8 @@ void wrapAngularDistributionData( python::module& module, python::module& ) {
)
.def(

"angular_distribution_type",
&Block::angularDistributionType,
"distribution_type",
&Block::distributionType,
python::arg( "index" ),
"Return the angular distribution type for an incident energy index\n\n"
"When the index is out of range an out of range exception is thrown\n"
Expand All @@ -132,8 +132,8 @@ void wrapAngularDistributionData( python::module& module, python::module& ) {
)
.def(

"angular_distribution_data",
&Block::angularDistributionData,
"distribution",
&Block::distribution,
python::arg( "index" ),
"Return the angular distribution data for an incident energy index\n\n"
"When the index is out of range an out of range exception is thrown\n"
Expand Down
131 changes: 131 additions & 0 deletions python/src/block/KalbachMannDistributionData.python.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// system includes
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

// local includes
#include "ACEtk/block/KalbachMannDistributionData.hpp"
#include "views.hpp"
#include "definitions.hpp"

// namespace aliases
namespace python = pybind11;

namespace block {

void wrapKalbachMannDistributionData( python::module& module,
python::module& ) {

// type aliases
using Block = njoy::ACEtk::block::KalbachMannDistributionData;
using Distribution = njoy::ACEtk::block::TabulatedKalbachMannDistribution;

// wrap views created by this block

// create the block
python::class_< Block > block(

module,
"KalbachMannDistributionData",
"Convenience interface for outgoing energy distribution data from the\n"
"DLW block for a single reaction using Kalbach-Mann systematics"
);

// wrap the block
block
.def(

python::init< std::vector< Distribution >&&, std::size_t >(),
python::arg( "distributions" ), python::arg( "locb" ) = 1,
"Initialise the block\n\n"
"Arguments:\n"
" self the block\n"
" distributions the distributions for each incident energy\n"
" locb the starting xss index with respect to the DLW block\n"
" (default = 1, the relative locators get recalculated)"
)
.def_property_readonly(

"NE",
&Block::NE,
"The number of incident energy values"
)
.def_property_readonly(

"number_incident_energies",
&Block::numberIncidentEnergies,
"The number of incident energy values"
)
.def_property_readonly(

"incident_energies",
[] ( const Block& self ) -> DoubleRange
{ return self.incidentEnergies(); },
"The incident energy values"
)
.def(

"incident_energy",
&Block::incidentEnergy,
python::arg( "index" ),
"Return the incident energy for a given index\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"LOCC",
&Block::LOCC,
python::arg( "index" ),
"Return the the distribution locator for an incident energy index\n\n"
"This locator is the value as stored in the XSS array. It is relative to\n"
"the beginning of the DLW block.\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"distribution_locator",
&Block::distributionLocator,
python::arg( "index" ),
"Return the the distribution locator for an incident energy index\n\n"
"This locator is the value as stored in the XSS array. It is relative to\n"
"the beginning of the DLW block.\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"relative_distribution_locator",
&Block::relativeDistributionLocator,
python::arg( "index" ),
"Return the relative distribution locator for an incident energy index\n\n"
"This is the locator relative to the beginning of the current angular\n"
"distribution block in the DLW block. It is always positive.\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"distribution",
&Block::distribution,
python::arg( "index" ),
"Return the distribution data for an incident energy index\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
);

// add standard block definitions
addStandardBlockDefinitions< Block >( block );
}

} // block namespace
131 changes: 131 additions & 0 deletions python/src/block/OutgoingEnergyDistributionData.python.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// system includes
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

// local includes
#include "ACEtk/block/OutgoingEnergyDistributionData.hpp"
#include "views.hpp"
#include "definitions.hpp"

// namespace aliases
namespace python = pybind11;

namespace block {

void wrapOutgoingEnergyDistributionData( python::module& module,
python::module& ) {

// type aliases
using Block = njoy::ACEtk::block::OutgoingEnergyDistributionData;
using Distribution = njoy::ACEtk::block::TabulatedOutgoingEnergyDistribution;

// wrap views created by this block

// create the block
python::class_< Block > block(

module,
"OutgoingEnergyDistributionData",
"Convenience interface for outgoing energy distribution data from the\n"
"DLW block for a single reaction using tabulated outgoing energy distributions"
);

// wrap the block
block
.def(

python::init< std::vector< Distribution >&&, std::size_t >(),
python::arg( "distributions" ), python::arg( "locb" ) = 1,
"Initialise the block\n\n"
"Arguments:\n"
" self the block\n"
" distributions the distributions for each incident energy\n"
" locb the starting xss index with respect to the DLW block\n"
" (default = 1, the relative locators get recalculated)"
)
.def_property_readonly(

"NE",
&Block::NE,
"The number of incident energy values"
)
.def_property_readonly(

"number_incident_energies",
&Block::numberIncidentEnergies,
"The number of incident energy values"
)
.def_property_readonly(

"incident_energies",
[] ( const Block& self ) -> DoubleRange
{ return self.incidentEnergies(); },
"The incident energy values"
)
.def(

"incident_energy",
&Block::incidentEnergy,
python::arg( "index" ),
"Return the incident energy for a given index\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"LOCC",
&Block::LOCC,
python::arg( "index" ),
"Return the the distribution locator for an incident energy index\n\n"
"This locator is the value as stored in the XSS array. It is relative to\n"
"the beginning of the DLW block.\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"distribution_locator",
&Block::distributionLocator,
python::arg( "index" ),
"Return the the distribution locator for an incident energy index\n\n"
"This locator is the value as stored in the XSS array. It is relative to\n"
"the beginning of the DLW block.\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"relative_distribution_locator",
&Block::relativeDistributionLocator,
python::arg( "index" ),
"Return the relative distribution locator for an incident energy index\n\n"
"This is the locator relative to the beginning of the current angular\n"
"distribution block in the DLW block. It is always positive.\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
)
.def(

"distribution",
&Block::distribution,
python::arg( "index" ),
"Return the distribution data for an incident energy index\n\n"
"When the index is out of range an out of range exception is thrown\n"
"(debug mode only).\n\n"
" self the block\n"
" index the index (one-based)"
);

// add standard block definitions
addStandardBlockDefinitions< Block >( block );
}

} // block namespace
Loading

0 comments on commit 786371d

Please sign in to comment.