Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c509240
Added the MF9 section, updated code for file 9
whaeck Feb 17, 2021
75b23d1
Added MF9 python bindings
whaeck Feb 17, 2021
1e2294a
Bound MF9 in darkness
whaeck Feb 18, 2021
ae6f914
Started Base for GENDF section and added GENDF DataRecord.
nathangibson14 Feb 18, 2021
dd08c56
Added MF10 coding
whaeck Feb 18, 2021
3364cf1
Small updates to MF9
whaeck Feb 18, 2021
35e6f9f
Added DataRecords to SectionBase.
nathangibson14 Feb 18, 2021
a240345
Added documentation.
nathangibson14 Feb 18, 2021
64a196a
MF10 has been bound in darkness
whaeck Feb 18, 2021
531d351
Renamed MF9 Multiplicity to ReactionProduct
whaeck Feb 18, 2021
4aaacc6
Added CrossSection as a GENDF section.
nathangibson14 Feb 18, 2021
9e851ed
Replaced the MF9 and MF10 subsection by ReactionProduct subsections, …
whaeck Feb 18, 2021
3032650
Added some missing documentation.
nathangibson14 Feb 19, 2021
88ddfa7
Updates after Wim's comments.
nathangibson14 Feb 19, 2021
932e8de
Trying to debug SegFault on ENDFtk.gendf.CrossSection.test.
nathangibson14 Feb 20, 2021
4c8873c
Fixed that SegFault.
nathangibson14 Feb 20, 2021
53a8f6e
Added FissionYielData and FissionProduct, main components of MF8 MT45…
whaeck Feb 23, 2021
d9350a5
Added python bindings for FissionYieldData
whaeck Feb 23, 2021
143c412
Some updates to the previous components
whaeck Feb 23, 2021
1966aed
More changes to the interface
whaeck Feb 23, 2021
5262e3e
Finished MF8 MT454
whaeck Feb 24, 2021
bca97e8
Bound MF8 MT454 in darkness
whaeck Feb 27, 2021
6d84121
MF8 MT459 has been bound in darkness
whaeck Feb 27, 2021
2ffff73
Added the LI flag for fully isotropic angular distributions to MF4 co…
whaeck Feb 27, 2021
6cd2452
Added Isotropic angular distributions
whaeck Mar 15, 2021
2ebe1e3
Added the isotropic angular distribution for a discrete photon
whaeck Mar 15, 2021
cccab26
Added Legendre and tabulated angular distribution components
whaeck Mar 15, 2021
6009ed3
Added Legendre angular distributions for a specific discrete photon
whaeck Mar 16, 2021
04c97b9
Saving work
whaeck Mar 17, 2021
4a59dd5
Finished coding MF14, on to testing
whaeck Mar 17, 2021
2686f29
Almost done ...
whaeck Mar 17, 2021
9f0b9e4
Forgot to update some tests following interface changes
whaeck Mar 17, 2021
ea44ab4
Updated MF14 coding, works now, still needs MF14 section test
whaeck Mar 18, 2021
0459e2d
Bound MF14 in darkness
whaeck Mar 22, 2021
54b2176
Update to latest develop
whaeck Mar 31, 2021
bd736a0
Update to latest develop
whaeck Mar 31, 2021
ecd8570
Update to latest develop
whaeck Mar 31, 2021
ba5aef7
Update to latest develop
whaeck Mar 31, 2021
96681dc
Started work on MF15
whaeck Mar 31, 2021
040714f
Added PartialDistribution to MF15
whaeck Apr 6, 2021
8478722
Finished C++ side of MF15
whaeck Apr 6, 2021
134a45b
Started binding MF15
whaeck Apr 6, 2021
8948bb2
Merged MF8 branch
whaeck Apr 6, 2021
4790ba3
Merged MF10 branch
whaeck Apr 6, 2021
915a054
Forgot to put MF14 object back in variant.
whaeck Apr 6, 2021
37118f4
Merged MF14 branch
whaeck Apr 6, 2021
1b604b4
MF15 was bound in darkness
whaeck Apr 6, 2021
4b0f6fc
Updated basic ENDF record interfaces to range-v3 0.11.0
whaeck Apr 7, 2021
3c44cd8
Updated MF1 sections
whaeck Apr 7, 2021
93cbe24
Updated MF1
whaeck Apr 7, 2021
66505a6
Updated MF2 sections
whaeck Apr 7, 2021
f6a6d09
Updated MF7 sections
whaeck Apr 7, 2021
7595d0d
Updated MF9 and MF10 sections
whaeck Apr 7, 2021
c4770a7
Updated MF3, MF4 and MF5 sections
whaeck Apr 7, 2021
2163335
Updated MF12, MF13, MF14 and MF15
whaeck Apr 7, 2021
4136d55
Updated MF8 sections
whaeck Apr 7, 2021
a9c43ff
Updated MF6 section, the ENDFtk tree and Material and Tape
whaeck Apr 7, 2021
fe04b4d
Updated python bindings
whaeck Apr 7, 2021
dbf04fd
Adding g++-9 to actions again
whaeck Apr 8, 2021
23b1847
Some more cpp20 namespace updates
whaeck Apr 15, 2021
b166bc4
Oops ...
whaeck Apr 15, 2021
f100c41
Updated build system files
whaeck Apr 15, 2021
4302afc
Moving range-v3 update to gendf work
whaeck Apr 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added Legendre and tabulated angular distribution components
  • Loading branch information
whaeck committed Mar 15, 2021
commit cccab26bb729b3160487faf0fd6b78ef004344ed
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ pybind11_add_module( ENDFtk.python
python/src/section/14.python.cpp
python/src/section/14/Isotropic.python.cpp
python/src/section/14/IsotropicDiscretePhoton.python.cpp
python/src/section/14/LegendreCoefficients.python.cpp
python/src/section/14/TabulatedDistribution.python.cpp
python/src/file/1.python.cpp
python/src/file/2.python.cpp
python/src/file/3.python.cpp
Expand Down
2 changes: 2 additions & 0 deletions cmake/unit_testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ add_subdirectory( src/ENDFtk/section/13/TotalCrossSection/test )
add_subdirectory( src/ENDFtk/section/13/test )
add_subdirectory( src/ENDFtk/section/14/Isotropic/test )
add_subdirectory( src/ENDFtk/section/14/IsotropicDiscretePhoton/test )
add_subdirectory( src/ENDFtk/section/14/LegendreCoefficients/test )
add_subdirectory( src/ENDFtk/section/14/TabulatedDistribution/test )
add_subdirectory( src/ENDFtk/section/2/151/BreitWignerLValue/Resonance/test )
add_subdirectory( src/ENDFtk/section/2/151/BreitWignerLValue/test )
add_subdirectory( src/ENDFtk/section/2/151/Isotope/test )
Expand Down
4 changes: 2 additions & 2 deletions python/src/file/14.python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ void wrapSection_14( python::module&, python::module& );
void wrapFile_14( python::module& module, python::module& viewmodule ) {

// type aliases
using Section = njoy::ENDFtk::section::Type< 4 >;
using File = njoy::ENDFtk::file::Type< 4 >;
using Section = njoy::ENDFtk::section::Type< 14 >;
using File = njoy::ENDFtk::file::Type< 14 >;
using SectionRange = BidirectionalAnyView< Section >;

// create the submodule
Expand Down
4 changes: 4 additions & 0 deletions python/src/section/14.python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace mf14 {

void wrapIsotropic( python::module&, python::module& );
void wrapIsotropicDiscretePhoton( python::module&, python::module& );
void wrapLegendreCoefficients( python::module&, python::module& );
void wrapTabulatedDistribution( python::module&, python::module& );
}

void wrapSection_14( python::module& module, python::module& viewmodule ) {
Expand All @@ -24,6 +26,8 @@ void wrapSection_14( python::module& module, python::module& viewmodule ) {
// wrap components
mf14::wrapIsotropic( module, viewmodule );
mf14::wrapIsotropicDiscretePhoton( module, viewmodule );
mf14::wrapLegendreCoefficients( module, viewmodule );
mf14::wrapTabulatedDistribution( module, viewmodule );

// wrap views created by this section

Expand Down
88 changes: 88 additions & 0 deletions python/src/section/14/LegendreCoefficients.python.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// system includes
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

// local includes
#include "ENDFtk/section/14.hpp"
#include "definitions.hpp"
#include "views.hpp"

// namespace aliases
namespace python = pybind11;

namespace mf14 {

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

// type aliases
using Section = njoy::ENDFtk::section::Type< 14 >;
using Component = Section::LegendreCoefficients;

// wrap views created by this section

// create the component
python::class_< Component > component(

module,
"LegendreCoefficients",
"MF14 section - an angular distribution given as Legendre coefficients"
);

// wrap the section
component
.def(

python::init< double, std::vector< double >&& >(),
python::arg( "energy" ), python::arg( "coefficients" ),
"Initialise the component\n\n"
"Arguments:\n"
" self the component\n"
" energy the incident energy\n"
" coefficients the Legendre coefficients"
)
.def_property_readonly(

"E",
&Component::E,
"The incident energy for which the angular distribution is given"
)
.def_property_readonly(

"incident_energy",
&Component::incidentEnergy,
"The incident energy for which the angular distribution is given"
)
.def_property_readonly(

"NL",
&Component::NL,
"The Legendre order for the angular distribution"
)
.def_property_readonly(

"legendre_order",
&Component::legendreOrder,
"The Legendre order for the angular distribution"
)
.def_property_readonly(

"A",
[] ( const Component& self ) -> DoubleRange
{ return self.A(); },
"The Legendre coefficients in the distribution (a0 is not present and\n"
"assumed to be equal to 1)"
)
.def_property_readonly(

"coefficients",
[] ( const Component& self ) -> DoubleRange
{ return self.coefficients(); },
"The Legendre coefficients in the distribution (a0 is not present and\n"
"assumed to be equal to 1)"
);

// add standard component definitions
addStandardComponentDefinitions< Component >( component );
}

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

// local includes
#include "ENDFtk/section/14.hpp"
#include "definitions.hpp"
#include "views.hpp"

// namespace aliases
namespace python = pybind11;

namespace mf14 {

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

// type aliases
using Section = njoy::ENDFtk::section::Type< 14 >;
using Component = Section::TabulatedDistribution;

// wrap views created by this section

// create the component
python::class_< Component > component(

module,
"TabulatedDistribution",
"MF14 section - an angular distribution given as a tabulated function"
);

// wrap the section
component
.def(

python::init< double, std::vector< long >&&, std::vector< long >&&,
std::vector< double >&&, std::vector< double >&& >(),
python::arg( "energy" ), python::arg( "boundaries" ),
python::arg( "interpolants" ), python::arg( "cosines" ),
python::arg( "probabilities" ),
"Initialise the component\n\n"
"Arguments:\n"
" self the component\n"
" incident the incident energy value\n"
" boundaries the interpolation range boundaries\n"
" interpolants the interpolation types for each range\n"
" cosines the cosine values\n"
" probabilities the probability values"
)
.def_property_readonly(

"E",
&Component::E,
"The incident energy for which the angular distribution is given"
)
.def_property_readonly(

"incident_energy",
&Component::incidentEnergy,
"The incident energy for which the angular distribution is given"
)
.def_property_readonly(

"MU",
[] ( const Component& self ) -> DoubleRange
{ return self.MU(); },
"The cosine values"
)
.def_property_readonly(

"cosines",
[] ( const Component& self ) -> DoubleRange
{ return self.cosines(); },
"The cosine values"
)
.def_property_readonly(

"F",
[] ( const Component& self ) -> DoubleRange
{ return self.F(); },
"The distribution probabilities"
)
.def_property_readonly(

"probabilities",
[] ( const Component& self ) -> DoubleRange
{ return self.probabilities(); },
"The distribution probabilities"
);

// add standard tab1 definitions
addStandardTableDefinitions< Component >( component );

// add standard component definitions
addStandardComponentDefinitions< Component >( component );
}

} // namespace mf14
68 changes: 68 additions & 0 deletions python/test/Test_ENDFtk_MF14_LegendreCoefficients.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# standard imports
import unittest

# third party imports

# local imports
from ENDFtk.MF14 import LegendreCoefficients

class Test_ENDFtk_MF14_LegendreCoefficients( unittest.TestCase ) :
"""Unit test for the LegendreCoefficients class."""

chunk = ( ' 0.000000+0 1.000000-5 0 0 3 0922814 2 \n'
' 7.392510-5 8.477139-9 1.17106-13 922814 2 \n' )

invalid = ( ' 0.000000+0 1.000000-5 0 0 2 0922814 2 \n'
' 7.392510-5 8.477139-9 1.17106-13 922814 2 \n' )

def test_component( self ) :

def verify_chunk( self, chunk ) :

# verify content
self.assertAlmostEqual( 1e-5, chunk.E )
self.assertAlmostEqual( 1e-5, chunk.incident_energy )
self.assertEqual( 3, chunk.NL )
self.assertEqual( 3, chunk.legendre_order )
self.assertEqual( 3, len( chunk.A ) )
self.assertEqual( 3, len( chunk.coefficients ) )
self.assertAlmostEqual( 7.392510e-5 , chunk.A[0] )
self.assertAlmostEqual( 8.477139e-9, chunk.A[1] )
self.assertAlmostEqual( 1.17106e-13, chunk.A[2] )
self.assertAlmostEqual( 7.392510e-5 , chunk.coefficients[0] )
self.assertAlmostEqual( 8.477139e-9, chunk.coefficients[1] )
self.assertAlmostEqual( 1.17106e-13, chunk.coefficients[2] )

self.assertEqual( 2, chunk.NC )

# verify string
self.assertEqual( self.chunk, chunk.to_string( 9228, 14, 2 ) )

# the data is given explicitly
chunk = LegendreCoefficients( energy = 1e-5,
coefficients = [ 7.392510e-5, 8.477139e-9,
1.17106e-13 ] )

verify_chunk( self, chunk )

# the data is read from a string
chunk = LegendreCoefficients.from_string( self.chunk, 9228, 14, 2 )

verify_chunk( self, chunk )

# the data is copied
copy = LegendreCoefficients( chunk )

verify_chunk( self, copy )

def test_failures( self ) :

print( '\n' )

with self.assertRaises( Exception ) :

chunk = LegendreCoefficients.from_string( self.invalid, 9228, 14, 2 )

if __name__ == '__main__' :

unittest.main()
88 changes: 88 additions & 0 deletions python/test/Test_ENDFtk_MF14_TabulatedDistribution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# standard imports
import unittest

# third party imports

# local imports
from ENDFtk.MF14 import TabulatedDistribution

class Test_ENDFtk_MF4_TabulatedDistribution( unittest.TestCase ) :
"""Unit test for the TabulatedDistribution class."""

chunk = ( ' 0.000000+0 1.000000-5 0 0 1 3922814 2 \n'
' 3 2 922814 2 \n'
'-1.000000+0 0.000000+0 0.000000+0 1.000000+0 1.000000+0 0.000000+0922814 2 \n' )

invalid = ( ' 0.000000+0 1.000000-5 0 0 2 3922814 2 \n'
' 3 2 922814 2 \n'
'-1.000000+0 0.000000+0 0.000000+0 1.000000+0 1.000000+0 0.000000+0922814 2 \n' )

def test_component( self ) :

def verify_chunk( self, chunk ) :

# verify content
self.assertAlmostEqual( 1e-5, chunk.E )
self.assertAlmostEqual( 1e-5, chunk.incident_energy )
self.assertEqual( 3, chunk.NP )
self.assertEqual( 1, chunk.NR )
self.assertEqual( 1, len( chunk.boundaries ) )
self.assertEqual( 1, len( chunk.interpolants ) )
self.assertEqual( 3, chunk.boundaries[0] )
self.assertEqual( 2, chunk.interpolants[0] )
self.assertEqual( 3, len( chunk.cosines ) )
self.assertAlmostEqual( -1.0 , chunk.MU[0] )
self.assertAlmostEqual( 0.0, chunk.MU[1] )
self.assertAlmostEqual( 1.0, chunk.MU[2] )
self.assertAlmostEqual( -1.0 , chunk.cosines[0] )
self.assertAlmostEqual( 0.0, chunk.cosines[1] )
self.assertAlmostEqual( 1.0, chunk.cosines[2] )
self.assertEqual( 3, len( chunk.probabilities ) )
self.assertAlmostEqual( 0.0 , chunk.F[0] )
self.assertAlmostEqual( 1.0, chunk.F[1] )
self.assertAlmostEqual( 0.0, chunk.F[2] )
self.assertAlmostEqual( 0.0 , chunk.probabilities[0] )
self.assertAlmostEqual( 1.0, chunk.probabilities[1] )
self.assertAlmostEqual( 0.0, chunk.probabilities[2] )

self.assertEqual( 3, chunk.NC )

# verify string
self.assertEqual( self.chunk, chunk.to_string( 9228, 14, 2 ) )

# the data is given explicitly
chunk = TabulatedDistribution( energy = 1e-5,
boundaries = [ 3 ], interpolants = [ 2 ],
cosines = [ -1.0, 0.0, 1.0 ], probabilities = [ 0.0, 1.0, 0.0 ] )

verify_chunk( self, chunk )

# the data is read from a string
chunk = TabulatedDistribution.from_string( self.chunk, 9228, 14, 2 )

verify_chunk( self, chunk )

# the data is copied
copy = TabulatedDistribution( chunk )

verify_chunk( self, copy )

def test_failures( self ) :

print( '\n' )

# wrong boundaries
with self.assertRaises( Exception ) :

chunk = TabulatedDistribution(
energy = 1e-5,
boundaries = [ 4 ], interpolants = [ 2 ],
cosines = [ -1.0, 0.0, 1.0 ], probabilities = [ 0.0, 1.0, 0.0 ] )

with self.assertRaises( Exception ) :

chunk = TabulatedDistribution.from_string( self.invalid, 9228, 14, 2 )

if __name__ == '__main__' :

unittest.main()
Loading