Skip to content

Commit e06c46e

Browse files
committed
Merge branch 'feature/tsl-part6' into 'develop'
Feature/tsl part6 See merge request njoy/dryad!142
2 parents e733756 + 38b2821 commit e06c46e

File tree

15 files changed

+4647
-1
lines changed

15 files changed

+4647
-1
lines changed

cmake/unit_testing.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ add_cpp_test( dryad.resonances.CompoundSystem
8282
add_cpp_test( dryad.thermal.TabulatedDebyeWallerIntegral dryad/thermal/TabulatedDebyeWallerIntegral.test.cpp )
8383
add_cpp_test( dryad.thermal.TabulatedEffectiveTemperature dryad/thermal/TabulatedEffectiveTemperature.test.cpp )
8484
add_cpp_test( dryad.thermal.IncoherentElasticScattering dryad/thermal/IncoherentElasticScattering.test.cpp )
85+
add_cpp_test( dryad.thermal.TabulatedScatteringFunction dryad/thermal/TabulatedScatteringFunction.test.cpp )
8586

8687
add_cpp_test( dryad.Documentation dryad/Documentation.test.cpp )
8788

cmake/unit_testing_python.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ add_python_test( dryad.resonances.CompoundSystem dryad/res
7070

7171
add_python_test( dryad.thermal.TabulatedDebyeWallerIntegral dryad/thermal/Test_TabulatedDebyeWallerIntegral.py )
7272
add_python_test( dryad.thermal.TabulatedEffectiveTemperature dryad/thermal/Test_TabulatedEffectiveTemperature.py )
73+
add_python_test( dryad.thermal.TabulatedScatteringFunction dryad/thermal/Test_TabulatedScatteringFunction.py )
7374
add_python_test( dryad.thermal.IncoherentElasticScattering dryad/thermal/Test_IncoherentElasticScattering.py )
7475

7576
add_python_test( dryad.Documentation dryad/Test_Documentation.py )

docs/src/dryad/resonances.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ resonances
77
:maxdepth: 1
88
:caption: Classes:
99

10+
resonances/FrohnerBackground
11+
resonances/SammyBackground
1012
resonances/TabulatedBackground
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. currentmodule:: njoy.dryad.resonances
2+
3+
FrohnerBackground
4+
=================
5+
6+
This function represents the Frohner parametrisation of the background for a channel.
7+
8+
Constructor
9+
~~~~~~~~~~~
10+
.. autosummary::
11+
:toctree: generated/
12+
13+
FrohnerBackground
14+
15+
Read-only Attributes
16+
~~~~~~~~~~~~~~~~~~~~
17+
.. autosummary::
18+
:toctree: generated/
19+
20+
~FrohnerBackground.distant_level_parameter
21+
~FrohnerBackground.pole_strength
22+
~FrohnerBackground.average_radiation_width
23+
~FrohnerBackground.lower_singularity
24+
~FrohnerBackground.upper_singularity
25+
26+
Methods
27+
~~~~~~~
28+
29+
.. autosummary::
30+
:toctree: generated/
31+
32+
~FrohnerBackground.__call__
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. currentmodule:: njoy.dryad.resonances
2+
3+
SammyBackground
4+
===============
5+
6+
This function represents the SAMMY parametrisation of the background for a channel.
7+
8+
Constructor
9+
~~~~~~~~~~~
10+
.. autosummary::
11+
:toctree: generated/
12+
13+
SammyBackground
14+
15+
Read-only Attributes
16+
~~~~~~~~~~~~~~~~~~~~
17+
.. autosummary::
18+
:toctree: generated/
19+
20+
~SammyBackground.polynomial_coefficients
21+
~SammyBackground.logarithmic_coefficients
22+
~SammyBackground.lower_singularity
23+
~SammyBackground.upper_singularity
24+
25+
Methods
26+
~~~~~~~
27+
28+
.. autosummary::
29+
:toctree: generated/
30+
31+
~SammyBackground.__call__

docs/src/dryad/thermal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ thermal
1010
thermal/TabulatedDebyeWallerIntegral
1111
thermal/IncoherentElasticScattering
1212
thermal/TabulatedEffectiveTemperature
13+
thermal/TabulatedScatteringFunction
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. currentmodule:: njoy.dryad.thermal
2+
3+
TabulatedScatteringFunction
4+
===========================
5+
6+
General information about this concept
7+
8+
Constructor
9+
~~~~~~~~~~~
10+
.. autosummary::
11+
:toctree: generated/
12+
13+
TabulatedScatteringFunction
14+
15+
Read-only Attributes
16+
~~~~~~~~~~~~~~~~~~~~
17+
.. autosummary::
18+
:toctree: generated/
19+
20+
~TabulatedScatteringFunction.momentum_transfers
21+
~TabulatedScatteringFunction.values
22+
~TabulatedScatteringFunction.interpolants
23+
~TabulatedScatteringFunction.boundaries
24+
~TabulatedScatteringFunction.number_points
25+
~TabulatedScatteringFunction.number_regions
26+
~TabulatedScatteringFunction.lower_momentum_transfer_limit
27+
~TabulatedScatteringFunction.upper_momentum_transfer_limit
28+
~TabulatedScatteringFunction.is_linearised
29+
30+
Methods
31+
~~~~~~~
32+
33+
.. autosummary::
34+
:toctree: generated/
35+
36+
~TabulatedScatteringFunction.__call__
37+
~TabulatedScatteringFunction.linearise

python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ if(njoy.python)
4747
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal.python.cpp
4848
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/TabulatedDebyeWallerIntegral.python.cpp
4949
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/TabulatedEffectiveTemperature.python.cpp
50+
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/TabulatedScatteringFunction.python.cpp
5051
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/thermal/IncoherentElasticScattering.python.cpp
5152
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/covariance.python.cpp
5253
${CMAKE_CURRENT_SOURCE_DIR}/src/dryad/covariance/ScalingType.python.cpp

python/src/dryad/thermal.python.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace thermal {
1313
// declarations - components
1414
void wrapTabulatedDebyeWallerIntegral( python::module& );
1515
void wrapTabulatedEffectiveTemperature( python::module& );
16+
void wrapTabulatedScatteringFunction( python::module& );
1617

1718
void wrapIncoherentElasticScattering( python::module& );
1819
}
@@ -29,6 +30,7 @@ void wrapThermal( python::module& module ) {
2930
// components
3031
thermal::wrapTabulatedDebyeWallerIntegral( submodule );
3132
thermal::wrapTabulatedEffectiveTemperature( submodule );
33+
thermal::wrapTabulatedScatteringFunction( submodule );
3234

3335
thermal::wrapIncoherentElasticScattering( submodule );
3436
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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/thermal/TabulatedScatteringFunction.hpp"
8+
9+
// namespace aliases
10+
namespace python = pybind11;
11+
12+
namespace dryad {
13+
namespace thermal {
14+
15+
void wrapTabulatedScatteringFunction( python::module& module ) {
16+
17+
// type aliases
18+
using Component = njoy::dryad::thermal::TabulatedScatteringFunction;
19+
using InterpolationType = njoy::dryad::InterpolationType;
20+
21+
// wrap views created by this component
22+
23+
// create the component
24+
python::class_< Component > component(
25+
26+
module,
27+
"TabulatedScatteringFunction",
28+
"A tabulated scattering function S(alpha)\n\n"
29+
"Parameters\n"
30+
"----------\n"
31+
" momentum_transfers : list of float\n"
32+
" the momentum transfer values\n"
33+
" values : list of float\n"
34+
" the scattering function values\n"
35+
" boundaries : list of int\n"
36+
" the boundaries of the interpolation regions\n"
37+
" interpolants : list of njoy.dryad.InterpolationType\n"
38+
" the interpolation types of the interpolation regions\n"
39+
" interpolant : njoy.dryad.InterpolationType, default njoy.dryad.InterpolationType.LinearLinear\n"
40+
" the interpolation type (default lin-lin)"
41+
);
42+
43+
// wrap the component
44+
component
45+
.def(
46+
47+
python::init< std::vector< double >, std::vector< double >,
48+
std::vector< std::size_t >,
49+
std::vector< InterpolationType > >(),
50+
python::arg( "momentum_transfers" ), python::arg( "values" ),
51+
python::arg( "boundaries" ), python::arg( "interpolants" ),
52+
"Initialise the scattering function table with multiple interpolation zones"
53+
)
54+
.def(
55+
56+
python::init< std::vector< double >, std::vector< double >,
57+
InterpolationType >(),
58+
python::arg( "momentum_transfers" ), python::arg( "values" ),
59+
python::arg( "interpolant" ) = InterpolationType::LinearLinear,
60+
"Initialise the scattering function table with a single interpolation zone"
61+
)
62+
.def_property_readonly(
63+
64+
"momentum_transfers",
65+
&Component::momentumTransfers,
66+
"The momentum transfer values"
67+
)
68+
.def_property_readonly(
69+
70+
"values",
71+
&Component::values,
72+
"The scattering function values"
73+
)
74+
.def_property_readonly(
75+
76+
"lower_momentum_transfer_limit",
77+
&Component::lowerMomentumTransferLimit,
78+
"The lower momentum transfer limit"
79+
)
80+
.def_property_readonly(
81+
82+
"upper_momentum_transfer_limit",
83+
&Component::upperMomentumTransferLimit,
84+
"The upper momentum transfer limit"
85+
)
86+
.def(
87+
88+
"__call__",
89+
[] ( const Component& self, double momentumTransfer ) -> decltype(auto)
90+
{ return self( momentumTransfer ); },
91+
python::arg( "momentum_transfer" ),
92+
"Evaluate the scattering function for a given momentum transfer value\n\n"
93+
"Parameters\n"
94+
"----------\n"
95+
" momentum_transfer : float\n"
96+
" the momentum transfer value"
97+
);
98+
99+
// add standard equality comparison definitions
100+
addStandardEqualityComparisonDefinitions< Component >( component );
101+
102+
// add standard tabulated data definitions
103+
addStandardTabulatedDefinitions< Component >( component );
104+
105+
// add standard copy definitions
106+
addStandardCopyDefinitions< Component >( component );
107+
}
108+
109+
} // thermal namespace
110+
} // dryad namespace

0 commit comments

Comments
 (0)