Skip to content

Commit 7b7b00b

Browse files
committed
Changing the ZAP type to an int in MF26
1 parent bad9fc2 commit 7b7b00b

File tree

9 files changed

+27
-24
lines changed

9 files changed

+27
-24
lines changed

python/src/section/26/Multiplicity.python.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void wrapMultiplicity( python::module& module, python::module& ) {
3232
component
3333
.def(
3434

35-
python::init< double, double, int,
35+
python::init< int, double, int,
3636
std::vector< long >&&, std::vector< long >&&,
3737
std::vector< double >&&, std::vector< double >&& >(),
3838
python::arg( "zap" ), python::arg( "awi" ), python::arg( "law" ),

python/test/MF26/Test_ENDFtk_MF26_ReactionProduct.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def test_component( self ) :
5151
def verify_chunk_law1( self, chunk ) :
5252

5353
# verify content
54-
self.assertAlmostEqual( 1000., chunk.ZAP )
54+
self.assertEqual( 1000, chunk.ZAP )
5555
self.assertAlmostEqual( 0.9992414, chunk.AWI )
5656
self.assertEqual( 1, chunk.LAW )
5757

58-
self.assertAlmostEqual( 1000., chunk.multiplicity.ZAP )
58+
self.assertEqual( 1000, chunk.multiplicity.ZAP )
5959
self.assertAlmostEqual( 0.9992414, chunk.multiplicity.AWI )
6060
self.assertEqual( 1, chunk.multiplicity.LAW )
6161

@@ -121,7 +121,7 @@ def verify_chunk_law1( self, chunk ) :
121121
self.assertEqual( self.chunk_law1, chunk.to_string( 100, 26, 525 ) )
122122

123123
# the data is given explicitly
124-
multiplicity = Multiplicity( zap = 1000., awi = 0.9992414, law = 1,
124+
multiplicity = Multiplicity( zap = 1000, awi = 0.9992414, law = 1,
125125
boundaries = [ 2 ], interpolants = [ 4 ],
126126
energies = [ 10., 1e+11 ],
127127
multiplicities = [ 1., 1. ] )

python/test/MF26/Test_ENDFtk_MF26_Section.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def verify_chunk( self, chunk ) :
4747
products = chunk.reaction_products
4848
self.assertEqual( 1, len( products ) )
4949

50-
self.assertAlmostEqual( 1000., products[0].ZAP )
50+
self.assertEqual( 1000, products[0].ZAP )
5151
self.assertAlmostEqual( 0.9992414, products[0].AWI )
5252
self.assertEqual( 1, products[0].LAW )
5353

54-
self.assertAlmostEqual( 1000., products[0].multiplicity.ZAP )
54+
self.assertEqual( 1000, products[0].multiplicity.ZAP )
5555
self.assertAlmostEqual( 0.9992414, products[0].multiplicity.AWI )
5656
self.assertEqual( 1, products[0].multiplicity.LAW )
5757

src/ENDFtk/section/26/Multiplicity.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ class Multiplicity : protected TabulationRecord {
1919
/**
2020
* @brief Return the ZA identifier of the reaction product
2121
*/
22-
double ZAP() const { return TabulationRecord::C1(); }
22+
int ZAP() const {
23+
24+
return static_cast< int >( std::round( TabulationRecord::C1() ) );
25+
}
2326

2427
/**
2528
* @brief Return the ZA identifier of the reaction product

src/ENDFtk/section/26/Multiplicity/src/ctor.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
* @param[in] energies the x values
1010
* @param[in] multiplicities the function values
1111
*/
12-
Multiplicity( double zap, double awi, long law,
12+
Multiplicity( int zap, double awi, long law,
1313
std::vector< long >&& boundaries,
1414
std::vector< long >&& interpolants,
1515
std::vector< double >&& energies,
1616
std::vector< double >&& multiplicities )
17-
try : TabulationRecord( zap, awi, 0, law,
17+
try : TabulationRecord( static_cast< double >( zap ), awi, 0, law,
1818
std::move( boundaries ),
1919
std::move( interpolants ),
2020
std::move( energies ),

src/ENDFtk/section/26/Multiplicity/test/Multiplicity.test.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SCENARIO( "Multiplicity" ) {
2525

2626
WHEN( "the data is given explicitly" ) {
2727

28-
double zap = 11.;
28+
int zap = 11;
2929
double awi = 5.438673E-4;
3030
long law = 2;
3131
std::vector< long > boundaries = { 2 };
@@ -84,7 +84,7 @@ SCENARIO( "Multiplicity" ) {
8484

8585
// no need to test every possibility (TAB1 takes care of tests)
8686

87-
double zap = 11.;
87+
int zap = 11;
8888
double awi = 5.438673E-4;
8989
long law = 2;
9090
std::vector< long > wrongBoundaries = { 4, 2 };
@@ -129,8 +129,8 @@ std::string chunk() {
129129

130130
void verifyChunk( const Multiplicity& chunk ) {
131131

132-
CHECK_THAT( 11., WithinRel( chunk.ZAP() ) );
133-
CHECK_THAT( 11., WithinRel( chunk.productIdentifier() ) );
132+
CHECK( 11 == chunk.ZAP() );
133+
CHECK( 11 == chunk.productIdentifier() );
134134
CHECK_THAT( 5.438673e-4, WithinRel( chunk.AWI() ) );
135135
CHECK_THAT( 5.438673e-4, WithinRel( chunk.projectileWeightRatio() ) );
136136
CHECK( 2 == chunk.LAW() );

src/ENDFtk/section/26/ReactionProduct.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class ReactionProduct {
2828
/**
2929
* @brief Return the ZA identifier of the reaction product
3030
*/
31-
double ZAP() const { return this->multiplicity_.ZAP(); }
31+
int ZAP() const { return this->multiplicity_.ZAP(); }
3232

3333
/**
3434
* @brief Return the ZA identifier of the reaction product
3535
*/
36-
double productIdentifier() const { return this->ZAP(); }
36+
int productIdentifier() const { return this->ZAP(); }
3737

3838
/**
3939
* @brief Return the atomic weight ratio of the projectile

src/ENDFtk/section/26/ReactionProduct/test/ReactionProduct.test.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ SCENARIO( "ReactionProduct" ) {
4444
WHEN( "the data is given explicitly" ) {
4545

4646
Multiplicity multiplicity(
47-
1000., .9992414, 1, { 2 }, { 4 },
47+
1000, .9992414, 1, { 2 }, { 4 },
4848
{ 10., 1e+11 },
4949
{ 1., 1. } );
5050
Distribution distribution =
@@ -106,7 +106,7 @@ SCENARIO( "ReactionProduct" ) {
106106
WHEN( "the data is given explicitly" ) {
107107

108108
Multiplicity multiplicity(
109-
1000., .9992414, 2, { 2 }, { 4 },
109+
1000, .9992414, 2, { 2 }, { 4 },
110110
{ 10., 1e+11 },
111111
{ 1., 1. } );
112112
Distribution distribution =
@@ -161,7 +161,7 @@ SCENARIO( "ReactionProduct" ) {
161161

162162
WHEN( "the data is given explicitly" ) {
163163

164-
Multiplicity multiplicity( 11., 5.438673E-4, 8, { 2 }, { 2 },
164+
Multiplicity multiplicity( 11, 5.438673E-4, 8, { 2 }, { 2 },
165165
{ 10., 1.e+11 }, { 1., 1. } );
166166
Distribution distribution = EnergyTransfer( { 2 }, { 2 },
167167
{ 10., 1.e+11 },
@@ -210,7 +210,7 @@ SCENARIO( "ReactionProduct" ) {
210210
GIVEN( "an inconsistent LAW between the Multiplicity and the Distribution" ) {
211211

212212
Multiplicity multiplicity(
213-
1000., .9992414, 2, { 2 }, { 4 },
213+
1000, .9992414, 2, { 2 }, { 4 },
214214
{ 10., 1e+11 },
215215
{ 1., 1. } );
216216
Distribution distribution =
@@ -432,11 +432,11 @@ std::string chunkWithLAW8() {
432432

433433
void verifyChunkWithLAW8( const ReactionProduct& chunk ) {
434434

435-
CHECK_THAT( 11, WithinRel( chunk.ZAP() ) );
435+
CHECK( 11 == chunk.ZAP() );
436436
CHECK_THAT( 5.438673e-4, WithinRel( chunk.AWI() ) );
437437
CHECK( 8 == chunk.LAW() );
438438

439-
CHECK_THAT( 11, WithinRel( chunk.multiplicity().ZAP() ) );
439+
CHECK( 11 == chunk.multiplicity().ZAP() );
440440
CHECK_THAT( 5.438673e-4, WithinRel( chunk.multiplicity().AWI() ) );
441441

442442
CHECK( 8 == chunk.multiplicity().LAW() );

src/ENDFtk/section/26/test/26.test.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ SCENARIO( "section::Type< 26 >" ) {
4343
ReactionProduct(
4444

4545
// multiplicity
46-
{ 1000., .9992414, 1, { 2 }, { 4 },
46+
{ 1000, .9992414, 1, { 2 }, { 4 },
4747
{ 10., 1e+11 },
4848
{ 1., 1. } },
4949
// distribution
@@ -175,11 +175,11 @@ void verifyChunk( const section::Type< 26 >& chunk ) {
175175
auto products = chunk.reactionProducts();
176176
CHECK( 1 == products.size() );
177177

178-
CHECK_THAT( 1000., WithinRel( products[0].ZAP() ) );
178+
CHECK( 1000 == products[0].ZAP() );
179179
CHECK_THAT( 0.9992414, WithinRel( products[0].AWI() ) );
180180
CHECK( 1 == products[0].LAW() );
181181

182-
CHECK_THAT( 1000., WithinRel( products[0].multiplicity().ZAP() ) );
182+
CHECK( 1000 == products[0].multiplicity().ZAP() );
183183
CHECK_THAT( 0.9992414, WithinRel( products[0].multiplicity().AWI() ) );
184184
CHECK( 1 == products[0].multiplicity().LAW() );
185185

0 commit comments

Comments
 (0)