Skip to content

Commit e2ca1c1

Browse files
committed
Adding interface functions to LAW=2
1 parent a8b5c30 commit e2ca1c1

File tree

5 files changed

+84
-0
lines changed

5 files changed

+84
-0
lines changed

ReleaseNotes.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Given here are some release notes for ENDFtk.
44
## [ENDFtk v1.1.1](https://github.com/njoy/ENDFtk/pull/xxx)
55
This update removes the regions() and pairs() interface functions on the TAB1 record interface functions that are unused. The removal of these interface functions has no impact on the Python interface as these interface functions were not included on the Python side. Miscellaneous documentation updates were made as well.
66

7+
This update also adds NBT(), INT(), boundaries(), interpolants(), NR(), numberInterpolationRegions() on a number of ENDFtk objects that mimic the behaviour of a TAB1 record but that are not actual TAB1 records:
8+
- TwoBodyScattering::TabulatedDistribution in MF6 and MF26
9+
710
In addition, the following issues were corrected:
811
- A minor bug in the rectangular matrix covariance block was corrected. The values for the row and column energies are lifted out of a larger array using the std::ranges::take and std::ranges::drop function. For the column energies, we forgot to properly end the sequence. As a result, the end() iterator of the range did not point to the end of the column energies but to the end of the covariance values, which is now corrected.
912
- In MF8 MT457 DiscreteSpectrum, NT=8 (which can occur for electrons, i.e. STYP=8), was explicitly disallowed by ENDFtk. This was corrected and a new constructor reflecting this usage was added as well.

python/src/section/6/LAW2/TabulatedDistribution.python.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ void wrapTabulatedDistribution( python::module& module, python::module& ) {
111111
);
112112

113113
// add standard component definitions
114+
addStandardInterpolationTableDefinitions< Component >( component );
114115
addStandardComponentDefinitions< Component >( component );
115116
}
116117

python/test/MF6/LAW2/Test_ENDFtk_MF6_LAW2_TabulatedDistribution.py

+22
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ def verify_chunk_lang12( self, chunk ) :
5050
self.assertAlmostEqual( 4., chunk.probabilities[1] )
5151
self.assertAlmostEqual( 6., chunk.probabilities[2] )
5252

53+
self.assertEqual( 1, chunk.NR )
54+
self.assertEqual( 1, chunk.number_interpolation_regions )
55+
self.assertEqual( 1, len( chunk.INT ) )
56+
self.assertEqual( 1, len( chunk.NBT ) )
57+
self.assertEqual( 2, chunk.INT[0] )
58+
self.assertEqual( 3, chunk.NBT[0] )
59+
self.assertEqual( 1, len( chunk.interpolants ) )
60+
self.assertEqual( 1, len( chunk.boundaries ) )
61+
self.assertEqual( 2, chunk.interpolants[0] )
62+
self.assertEqual( 3, chunk.boundaries[0] )
63+
5364
self.assertEqual( 2, chunk.NC )
5465

5566
# verify string
@@ -82,6 +93,17 @@ def verify_chunk_lang14( self, chunk ) :
8293
self.assertAlmostEqual( 4., chunk.probabilities[1] )
8394
self.assertAlmostEqual( 6., chunk.probabilities[2] )
8495

96+
self.assertEqual( 1, chunk.NR )
97+
self.assertEqual( 1, chunk.number_interpolation_regions )
98+
self.assertEqual( 1, len( chunk.INT ) )
99+
self.assertEqual( 1, len( chunk.NBT ) )
100+
self.assertEqual( 4, chunk.INT[0] )
101+
self.assertEqual( 3, chunk.NBT[0] )
102+
self.assertEqual( 1, len( chunk.interpolants ) )
103+
self.assertEqual( 1, len( chunk.boundaries ) )
104+
self.assertEqual( 4, chunk.interpolants[0] )
105+
self.assertEqual( 3, chunk.boundaries[0] )
106+
85107
self.assertEqual( 2, chunk.NC )
86108

87109
# verify string

src/ENDFtk/section/6/DiscreteTwoBodyScattering/TabulatedDistribution.hpp

+36
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,42 @@ class ENDFTK_PYTHON_EXPORT TabulatedDistribution : protected ListRecord {
9090
return this->F();
9191
}
9292

93+
/**
94+
* @brief Return the number of interpolation ranges
95+
*/
96+
static constexpr long NR() { return 1; }
97+
98+
/**
99+
* @brief Return the number of interpolation ranges
100+
*/
101+
static constexpr long numberInterpolationRegions() { return NR(); }
102+
103+
/**
104+
* @brief Return the interpolants
105+
*/
106+
auto INT() const {
107+
108+
return ranges::cpp20::views::single( this->LANG() - 10 );
109+
}
110+
111+
/**
112+
* @brief Return the interpolants
113+
*/
114+
auto interpolants() const { return this->INT(); }
115+
116+
/**
117+
* @brief Return the boundaries
118+
*/
119+
auto NBT() const {
120+
121+
return ranges::cpp20::views::single( this->numberCosineValues() );
122+
}
123+
124+
/**
125+
* @brief Return the boundaries
126+
*/
127+
auto boundaries() const { return this->NBT(); }
128+
93129
using ListRecord::NC;
94130
using ListRecord::print;
95131
};

src/ENDFtk/section/6/DiscreteTwoBodyScattering/TabulatedDistribution/test/TabulatedDistribution.test.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,17 @@ void verifyChunkLANG12( const TabulatedDistribution& chunk ) {
223223
CHECK_THAT( 4., WithinRel( chunk.probabilities()[1] ) );
224224
CHECK_THAT( 6., WithinRel( chunk.probabilities()[2] ) );
225225

226+
CHECK( 1 == chunk.NR() );
227+
CHECK( 1 == chunk.numberInterpolationRegions() );
228+
CHECK( 1 == chunk.INT().size() );
229+
CHECK( 1 == chunk.interpolants().size() );
230+
CHECK( 1 == chunk.NBT().size() );
231+
CHECK( 1 == chunk.boundaries().size() );
232+
CHECK( 2 == chunk.INT()[0] );
233+
CHECK( 2 == chunk.interpolants()[0] );
234+
CHECK( 3 == chunk.NBT()[0] );
235+
CHECK( 3 == chunk.boundaries()[0] );
236+
226237
CHECK( 2 == chunk.NC() );
227238
}
228239

@@ -258,6 +269,17 @@ void verifyChunkLANG14( const TabulatedDistribution& chunk ) {
258269
CHECK_THAT( 4., WithinRel( chunk.probabilities()[1] ) );
259270
CHECK_THAT( 6., WithinRel( chunk.probabilities()[2] ) );
260271

272+
CHECK( 1 == chunk.NR() );
273+
CHECK( 1 == chunk.numberInterpolationRegions() );
274+
CHECK( 1 == chunk.INT().size() );
275+
CHECK( 1 == chunk.interpolants().size() );
276+
CHECK( 1 == chunk.NBT().size() );
277+
CHECK( 1 == chunk.boundaries().size() );
278+
CHECK( 4 == chunk.INT()[0] );
279+
CHECK( 4 == chunk.interpolants()[0] );
280+
CHECK( 3 == chunk.NBT()[0] );
281+
CHECK( 3 == chunk.boundaries()[0] );
282+
261283
CHECK( 2 == chunk.NC() );
262284
}
263285

0 commit comments

Comments
 (0)