Skip to content

Commit cbc678d

Browse files
committed
Merge branch 'feature/tsl-part2' into 'develop'
Feature/tsl part2 See merge request njoy/dryad!118
2 parents 79599bc + 1664b3a commit cbc678d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1989
-22
lines changed

cmake/unit_testing.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ add_cpp_test( dryad.resonances.SpinGroup
7777
add_cpp_test( dryad.resonances.CompoundSystem dryad/resonances/CompoundSystem.test.cpp )
7878

7979
add_cpp_test( dryad.thermal.TabulatedDebyeWallerIntegral dryad/thermal/TabulatedDebyeWallerIntegral.test.cpp )
80+
add_cpp_test( dryad.thermal.IncoherentElasticScattering dryad/thermal/IncoherentElasticScattering.test.cpp )
8081

8182
add_cpp_test( dryad.Documentation dryad/Documentation.test.cpp )
8283

@@ -109,8 +110,10 @@ add_cpp_test( dryad.UncorrelatedDistributionData
109110
add_cpp_test( dryad.ReactionProduct dryad/ReactionProduct.test.cpp )
110111
add_cpp_test( dryad.TabulatedCrossSection dryad/TabulatedCrossSection.test.cpp )
111112
add_cpp_test( dryad.Reaction dryad/Reaction.test.cpp )
113+
112114
add_cpp_test( dryad.ProjectileTarget dryad/ProjectileTarget.test.cpp )
113115
add_cpp_test( dryad.AtomicRelaxation dryad/AtomicRelaxation.test.cpp )
116+
add_cpp_test( dryad.ThermalScattering dryad/ThermalScattering.test.cpp )
114117

115118
add_cpp_test( dryad.format.createIndex dryad/format/createIndex.test.cpp )
116119
add_cpp_test( dryad.format.createVector dryad/format/createVector.test.cpp )
@@ -181,6 +184,7 @@ add_cpp_test( dryad.format.endf.resonances.lrf7.createChannels
181184
add_cpp_test( dryad.format.endf.resonances.lrf7.createSpinGroups dryad/format/endf/resonances/lrf7/createSpinGroups.test.cpp )
182185
add_cpp_test( dryad.format.endf.resonances.lrf7.createCompoundSystem dryad/format/endf/resonances/lrf7/createCompoundSystem.test.cpp )
183186
add_cpp_test( dryad.format.endf.thermal.createTabulatedDebyeWallerIntegral dryad/format/endf/thermal/createTabulatedDebyeWallerIntegral.test.cpp )
187+
add_cpp_test( dryad.format.endf.thermal.createIncoherentElasticScattering dryad/format/endf/thermal/createIncoherentElasticScattering.test.cpp )
184188
add_cpp_test( dryad.format.endf.atomic.createElectronSubshellID dryad/format/endf/atomic/createElectronSubshellID.test.cpp )
185189
add_cpp_test( dryad.format.endf.atomic.createElectronSubshellConfiguration dryad/format/endf/atomic/createElectronSubshellConfiguration.test.cpp )
186190
add_cpp_test( dryad.format.endf.covariance.createMatrix dryad/format/endf/covariance/createMatrix.test.cpp )
@@ -208,6 +212,8 @@ add_cpp_test( dryad.format.endf.createProjectileTarget
208212
add_cpp_test( dryad.format.endf.createProjectileTargetFromFile dryad/format/endf/createProjectileTargetFromFile.test.cpp )
209213
add_cpp_test( dryad.format.endf.createAtomicRelaxation dryad/format/endf/createAtomicRelaxation.test.cpp )
210214
add_cpp_test( dryad.format.endf.createAtomicRelaxationFromFile dryad/format/endf/createAtomicRelaxationFromFile.test.cpp )
215+
add_cpp_test( dryad.format.endf.createThermalScattering dryad/format/endf/createThermalScattering.test.cpp )
216+
add_cpp_test( dryad.format.endf.createThermalScatteringFromFile dryad/format/endf/createThermalScatteringFromFile.test.cpp )
211217

212218
add_cpp_test( dryad.format.endf.createEndfIndex dryad/format/endf/createEndfIndex.test.cpp )
213219
add_cpp_test( dryad.format.endf.createEndfBoundaries dryad/format/endf/createEndfBoundaries.test.cpp )
@@ -222,8 +228,9 @@ add_cpp_test( dryad.format.endf.createAtomicRelaxationEndfFile
222228
add_cpp_test( dryad.format.endf.createProjectileTargetEndfFile dryad/format/endf/createProjectileTargetEndfFile.test.cpp )
223229

224230
add_cpp_test( dryad.format.gnds.convertEnergy dryad/format/gnds/convertEnergy.test.cpp )
225-
add_cpp_test( dryad.format.gnds.convertCrossSections dryad/format/gnds/convertCrossSections.test.cpp )
226231
add_cpp_test( dryad.format.gnds.convertEnergies dryad/format/gnds/convertEnergies.test.cpp )
232+
add_cpp_test( dryad.format.gnds.convertCrossSection dryad/format/gnds/convertCrossSection.test.cpp )
233+
add_cpp_test( dryad.format.gnds.convertCrossSections dryad/format/gnds/convertCrossSections.test.cpp )
227234
add_cpp_test( dryad.format.gnds.convertInverseEnergies dryad/format/gnds/convertInverseEnergies.test.cpp )
228235
add_cpp_test( dryad.format.gnds.convertInverseLengths dryad/format/gnds/convertInverseLengths.test.cpp )
229236
add_cpp_test( dryad.format.gnds.convertVarianceScalingFactors dryad/format/gnds/convertVarianceScalingFactors.test.cpp )
@@ -249,6 +256,7 @@ add_cpp_test( dryad.format.gnds.readArray
249256
add_cpp_test( dryad.format.gnds.resonances.createTabulatedRadius dryad/format/gnds/resonances/createTabulatedRadius.test.cpp )
250257
add_cpp_test( dryad.format.gnds.resonances.createRadius dryad/format/gnds/resonances/createRadius.test.cpp )
251258
add_cpp_test( dryad.format.gnds.thermal.createTabulatedDebyeWallerIntegral dryad/format/gnds/thermal/createTabulatedDebyeWallerIntegral.test.cpp )
259+
add_cpp_test( dryad.format.gnds.thermal.createIncoherentElasticScattering dryad/format/gnds/thermal/createIncoherentElasticScattering.test.cpp )
252260
add_cpp_test( dryad.format.gnds.readCovarianceMatrix dryad/format/gnds/readCovarianceMatrix.test.cpp )
253261
add_cpp_test( dryad.format.gnds.createPolynomialMultiplicity dryad/format/gnds/createPolynomialMultiplicity.test.cpp )
254262
add_cpp_test( dryad.format.gnds.createTabulatedMultiplicity dryad/format/gnds/createTabulatedMultiplicity.test.cpp )
@@ -275,6 +283,8 @@ add_cpp_test( dryad.format.gnds.createProjectileTarget
275283
add_cpp_test( dryad.format.gnds.createProjectileTargetFromFile dryad/format/gnds/createProjectileTargetFromFile.test.cpp )
276284
add_cpp_test( dryad.format.gnds.createAtomicRelaxation dryad/format/gnds/createAtomicRelaxation.test.cpp )
277285
add_cpp_test( dryad.format.gnds.createAtomicRelaxationFromFile dryad/format/gnds/createAtomicRelaxationFromFile.test.cpp )
286+
add_cpp_test( dryad.format.gnds.createThermalScattering dryad/format/gnds/createThermalScattering.test.cpp )
287+
add_cpp_test( dryad.format.gnds.createThermalScatteringFromFile dryad/format/endf/createThermalScatteringFromFile.test.cpp )
278288

279289
# reconr tests
280290

cmake/unit_testing_python.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ add_python_test( dryad.resonances.SpinGroup dryad/res
6666
add_python_test( dryad.resonances.CompoundSystem dryad/resonances/Test_CompoundSystem.py )
6767

6868
add_python_test( dryad.thermal.TabulatedDebyeWallerIntegral dryad/thermal/Test_TabulatedDebyeWallerIntegral.py )
69+
add_python_test( dryad.thermal.IncoherentElasticScattering dryad/thermal/Test_IncoherentElasticScattering.py )
6970

7071
add_python_test( dryad.Documentation dryad/Test_Documentation.py )
7172

@@ -100,6 +101,7 @@ add_python_test( dryad.Reaction dryad/Tes
100101

101102
add_python_test( dryad.ProjectileTarget dryad/Test_ProjectileTarget.py )
102103
add_python_test( dryad.AtomicRelaxation dryad/Test_AtomicRelaxation.py )
104+
add_python_test( dryad.ThermalScattering dryad/Test_ThermalScattering.py )
103105

104106
add_python_test( reconr.unionise_cross_sections reconr/Test_unionise_cross_sections.py )
105107
add_python_test( reconr.calculate_summation_cross_sections reconr/Test_calculate_summation_cross_sections.py )
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.. currentmodule:: njoy.dryad
22

3-
4-
AtomicRelaxation
3+
AtomicRelaxation
54
================
65

76
General information about the concept
@@ -28,7 +27,6 @@ Write to File
2827

2928
~AtomicRelaxation.to_endf_file
3029

31-
3230
Modifiable Attributes
3331
~~~~~~~~~~~~~~~~~~~~~
3432
.. autosummary::
@@ -38,23 +36,19 @@ Modifiable Attributes
3836
~AtomicRelaxation.element_identifier
3937
~AtomicRelaxation.subshells
4038

41-
42-
4339
Read-only Attributes
4440
~~~~~~~~~~~~~~~~~~~~
4541
.. autosummary::
4642
:toctree: generated/
4743

4844
~AtomicRelaxation.number_subshells
4945

50-
5146
Methods
5247
~~~~~~~
5348
.. autosummary::
5449
:toctree: generated/
5550

5651
~AtomicRelaxation.has_subshell
57-
~AtomicRelaxation.subshell
52+
~AtomicRelaxation.subshell
5853
~AtomicRelaxation.normalise
5954
~AtomicRelaxation.calculate_transition_energies
60-
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.. currentmodule:: njoy.dryad
2+
3+
ThermalScattering
4+
=================
5+
6+
Thermal scattering data
7+
8+
Constructor
9+
~~~~~~~~~~~
10+
.. autosummary::
11+
:toctree: generated/
12+
13+
ThermalScattering
14+
15+
Read from File
16+
~~~~~~~~~~~~~~
17+
.. autosummary::
18+
:toctree: generated/
19+
20+
~ThermalScattering.from_endf_file
21+
~ThermalScattering.from_gnds_file
22+
23+
Modifiable Attributes
24+
~~~~~~~~~~~~~~~~~~~~~
25+
.. autosummary::
26+
:toctree: generated/
27+
28+
~ThermalScattering.documentation
29+
~ThermalScattering.incoherent_elastic_scattering
30+
31+
Read-only Attributes
32+
~~~~~~~~~~~~~~~~~~~~
33+
.. autosummary::
34+
:toctree: generated/
35+
36+
~ThermalScattering.has_coherent_elastic_scattering
37+
~ThermalScattering.has_incoherent_elastic_scattering
38+
~ThermalScattering.has_elastic_scattering
39+
~ThermalScattering.has_inelastic_scattering

docs/src/dryad/dryad.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ The ``dryad`` module contains the data structures used throughout ``njoy``.
2525
:maxdepth: 1
2626
:caption: Atomic Modules:
2727

28+
AtomicRelaxation
2829
atomic
29-
atomic_relaxation
3030

3131
.. toctree::
3232
:maxdepth: 1
@@ -38,4 +38,5 @@ The ``dryad`` module contains the data structures used throughout ``njoy``.
3838
:maxdepth: 1
3939
:caption: Thermal scattering data:
4040

41+
ThermalScattering
4142
thermal

docs/src/dryad/thermal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ thermal
88
:caption: Classes:
99

1010
thermal/TabulatedDebyeWallerIntegral
11+
thermal/IncoherentElasticScattering
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. currentmodule:: njoy.dryad.thermal
2+
3+
IncoherentElasticScattering
4+
===========================
5+
6+
General information about this concept
7+
8+
Constructor
9+
~~~~~~~~~~~
10+
.. autosummary::
11+
:toctree: generated/
12+
13+
IncoherentElasticScattering
14+
15+
Read-only Attributes
16+
~~~~~~~~~~~~~~~~~~~~
17+
.. autosummary::
18+
:toctree: generated/
19+
20+
~IncoherentElasticScattering.bound_cross_section
21+
~IncoherentElasticScattering.debye_waller_integral

python/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ if(njoy.python)
4444
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/resonances/CompoundSystem.python.cpp
4545
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal.python.cpp
4646
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/TabulatedDebyeWallerIntegral.python.cpp
47+
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/IncoherentElasticScattering.python.cpp
4748
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/covariance.python.cpp
4849
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/covariance/ScalingType.python.cpp
4950
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/covariance/VarianceScaling.python.cpp
@@ -91,6 +92,7 @@ if(njoy.python)
9192
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/Reaction.python.cpp
9293
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/ProjectileTarget.python.cpp
9394
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/AtomicRelaxation.python.cpp
95+
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/ThermalScattering.python.cpp
9496
${CMAKE_CURRENT_SOURCE_DIR}/src/reconr.python.cpp
9597
${CMAKE_CURRENT_SOURCE_DIR}/src/reconr/wrapUnioniseCrossSections.python.cpp
9698
${CMAKE_CURRENT_SOURCE_DIR}/src/reconr/wrapCalculateSummationCrossSections.python.cpp

python/src/dryad.python.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ namespace dryad {
2323
void wrapReferenceFrame( python::module& );
2424
void wrapUniformDistributionType( python::module& );
2525

26+
// declarations - covariance data
27+
void wrapCovariance( python::module& );
28+
2629
// declarations - resonances
2730
void wrapResonances( python::module& );
2831

2932
// declarations - thermal
3033
void wrapThermal( python::module& );
31-
32-
// declarations - covariance data
33-
void wrapCovariance( python::module& );
34+
void wrapThermalScattering( python::module& );
3435

3536
// declarations - atomic data
3637
void wrapAtomic( python::module& );
@@ -100,15 +101,15 @@ void wrapDryad( python::module& module ) {
100101
// wrap components - identifiers
101102
dryad::wrapID( submodule );
102103

104+
// wrap components - covariance data
105+
dryad::wrapCovariance( submodule );
106+
103107
// wrap components - resonances
104108
dryad::wrapResonances( submodule );
105109

106110
// wrap components - thermal
107111
dryad::wrapThermal( submodule );
108112

109-
// wrap components - covariance data
110-
dryad::wrapCovariance( submodule );
111-
112113
// wrap components - atomic data
113114
dryad::wrapAtomic( submodule );
114115

@@ -149,4 +150,5 @@ void wrapDryad( python::module& module ) {
149150
// wrap components - top level
150151
dryad::wrapProjectileTarget( submodule );
151152
dryad::wrapAtomicRelaxation( submodule );
153+
dryad::wrapThermalScattering( submodule );
152154
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// system includes
2+
#include <pybind11/pybind11.h>
3+
#include <pybind11/stl.h>
4+
5+
// local includes
6+
#include "dryad/definitions.hpp"
7+
#include "njoy/dryad/ThermalScattering.hpp"
8+
#include "njoy/dryad/format/endf/createThermalScatteringFromFile.hpp"
9+
#include "njoy/dryad/format/gnds/createThermalScatteringFromFile.hpp"
10+
11+
// namespace aliases
12+
namespace python = pybind11;
13+
14+
namespace dryad {
15+
16+
void wrapThermalScattering( python::module& module ) {
17+
18+
// type aliases
19+
using Component = njoy::dryad::ThermalScattering;
20+
using Documentation = njoy::dryad::Documentation;
21+
using IncoherentElasticScattering = njoy::dryad::thermal::IncoherentElasticScattering;
22+
23+
// wrap views created by this component
24+
25+
// create the component
26+
python::class_< Component > component(
27+
28+
module,
29+
"ThermalScattering",
30+
"Thermal scattering data\n\n"
31+
"Parameters\n"
32+
"----------\n"
33+
" documentation : njoy.dryad.Documentation\n"
34+
" the documentation associated to the thermal sacttering data\n"
35+
" incoherent : njoy.dryad.thermal.IncoherentElasticScattering\n"
36+
" incoherent elastic scattering data (default: none)"
37+
);
38+
39+
// wrap the component
40+
component
41+
.def(
42+
43+
python::init< Documentation,
44+
std::optional< IncoherentElasticScattering > >(),
45+
python::arg( "documentation" ),
46+
python::arg( "incoherent" ) = std::nullopt,
47+
"Initialise the thermal scattering data with documentation"
48+
)
49+
.def(
50+
51+
python::init< std::optional< IncoherentElasticScattering > >(),
52+
python::arg( "incoherent" ) = std::nullopt,
53+
"Initialise the thermal scattering data without documentation"
54+
)
55+
.def_property(
56+
57+
"documentation",
58+
python::overload_cast<>( &Component::documentation, python::const_ ),
59+
python::overload_cast< Documentation >( &Component::documentation ),
60+
"The documentation"
61+
)
62+
.def_property(
63+
64+
"incoherent_elastic_scattering",
65+
python::overload_cast<>( &Component::incoherentElasticScattering, python::const_ ),
66+
python::overload_cast< std::optional< IncoherentElasticScattering > >( &Component::incoherentElasticScattering ),
67+
"The incoherent elastic data"
68+
)
69+
.def_property_readonly(
70+
71+
"has_coherent_elastic_scattering",
72+
&Component::hasCoherentElasticScattering,
73+
"Return whether or not there is coherent elastic scattering"
74+
)
75+
.def_property_readonly(
76+
77+
"has_incoherent_elastic_scattering",
78+
&Component::hasIncoherentElasticScattering,
79+
"Return whether or not there is incoherent elastic scattering"
80+
)
81+
.def_property_readonly(
82+
83+
"has_elastic_scattering",
84+
&Component::hasElasticScattering,
85+
"Return whether or not there is elastic scattering (coherent and/or incoherent)"
86+
)
87+
.def_property_readonly(
88+
89+
"has_inelastic_scattering",
90+
&Component::hasInelasticScattering,
91+
"Return whether or not there is inelastic scattering"
92+
)
93+
.def_static(
94+
95+
"from_endf_file",
96+
[] ( const std::string& filename ) -> decltype(auto) {
97+
98+
return njoy::dryad::format::endf::createThermalScatteringFromFile( filename );
99+
},
100+
python::arg( "filename" ),
101+
"Create ThermalScattering data from an ENDF file\n\n"
102+
"If there are multiple materials in the ENDF file, only the first material\n"
103+
"will be transformed into a ThermalScattering instance.\n\n"
104+
"Parameters\n"
105+
"----------\n"
106+
" filename : string\n"
107+
" the ENDF file name"
108+
)
109+
.def_static(
110+
111+
"from_gnds_file",
112+
[] ( const std::string& filename, const std::string& style ) -> decltype(auto) {
113+
114+
return njoy::dryad::format::gnds::createThermalScatteringFromFile( filename, style );
115+
},
116+
python::arg( "filename" ), python::arg( "style" ) = "eval",
117+
"Create ThermalScattering data from a GNDS file\n\n"
118+
"Parameters\n"
119+
"----------\n"
120+
" filename : string\n"
121+
" the GNDS file name\n"
122+
" style : string\n"
123+
" the GNDS style to process (default is eval)"
124+
);
125+
126+
// add standard equality comparison definitions
127+
addStandardEqualityComparisonDefinitions< Component >( component );
128+
129+
// add standard copy definitions
130+
addStandardCopyDefinitions< Component >( component );
131+
}
132+
133+
} // dryad namespace

0 commit comments

Comments
 (0)