Skip to content

Commit

Permalink
Adding coherent and incoherent distribution data
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed Aug 12, 2024
1 parent f025f5a commit 0082273
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 1 deletion.
89 changes: 89 additions & 0 deletions src/dryad/CoherentDistributionData.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#ifndef NJOY_DRYAD_COHERENTDISTRIBUTIONDATA
#define NJOY_DRYAD_COHERENTDISTRIBUTIONDATA

// system includes
#include <optional>

// other includes
#include "dryad/DistributionDataType.hpp"
#include "dryad/ReferenceFrame.hpp"
#include "dryad/TabulatedScatteringFunction.hpp"
#include "dryad/TabulatedFormFactor.hpp"

namespace njoy {
namespace dryad {

/**
* @class
* @brief The distribution data for coherent scattering in photoatomic interactions
*
* This representation is only available for a photoatomic ProjectileTarget.
*
* In this representation, a scattering function S(x,Z) and two optional form factor
* functions are defined which together with the Thompson cross section determine the
* double differential cross section.
*
* This corresponds with the coherent scattering function data given in
* MF27 MT502 and the form factors in MF27 MT505 and MT506.
*/
class IncoherentDistributionData {

/* fields */
ReferenceFrame frame_;
TabulatedScatteringFunction scattering_;
std::optional< TabulatedFormFactor > real_;
std::optional< TabulatedFormFactor > imaginary_;

public:

/* constructor */

#include "dryad/TwoBodyDistributionData/src/ctor.hpp"

/* methods */

/**
* @brief Return the distribution data type
*/
static constexpr DistributionDataType type() noexcept {

return DistributionDataType::Coherent;
}

/**
* @brief Return the reference frame
*/
const ReferenceFrame& frame() const noexcept {

return this->frame_;
}

/**
* @brief Return the scattering function
*/
const TabulatedScatteringFunction& scatteringFunction() const noexcept {

return this->scattering_;
}

/**
* @brief Return the real part of the anomolous form factor
*/
const std::optional< TabulatedFormFactor >& realAnomolousFormFactor() const noexcept {

return this->real_;
}

/**
* @brief Return the imaginary part of the anomolous form factor
*/
const std::optional< TabulatedFormFactor >& imaginaryAnomolousFormFactor() const noexcept {

return this->imaginary_;
}
};

} // dryad namespace
} // njoy namespace

#endif
58 changes: 58 additions & 0 deletions src/dryad/CoherentDistributionData/src/ctor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
private:

/**
* @brief Private constructor
*
* @param frame the reference frame of the distribution data
* @param scattering the scattering function
* @param real the optional real part of the anamolous form factor
* @param imaginary the optional imaginary part of the anamolous form factor
*/
CoherentDistributionData( ReferenceFrame&& frame,
TabulatedScatteringFunction&& scattering,
std::optional< TabulatedFormFactor >&& real,
std::optional< TabulatedFormFactor >&& imaginary > ) :
frame_( std::move( frame ) ), scattering_( std::move( scattering ) ),
real_( std::move( real ) ), imaginary_( std::move( imaginary ) ) {}

public:

//! @todo pybind11 variant needs default constructor workaround
#ifdef PYBIND11
/**
* @brief Default constructor - only enabled for pybind11
*/
CoherentDistributionData() = default;
#endif

CoherentDistributionData( const CoherentDistributionData& ) = default;
CoherentDistributionData( CoherentDistributionData&& ) = default;

CoherentDistributionData& operator=( const CoherentDistributionData& ) = default;
CoherentDistributionData& operator=( CoherentDistributionData&& ) = default;

/**
* @brief Constructor (no anomolous form factors)
*
* @param frame the reference frame of the distribution data
* @param scattering the scattering function
*/
CoherentDistributionData( ReferenceFrame frame,
TabulatedScatteringFunction scattering ) :
CoherentDistributionData( std::move( frame ), std::move( scattering ),
std::nullopt, std::nullopt ) {}

/**
* @brief Constructor (with anomolous form factors)
*
* @param frame the reference frame of the distribution data
* @param scattering the scattering function
* @param real the real part of the anamolous form factor
* @param imaginary the imaginary part of the anamolous form factor
*/
CoherentDistributionData( ReferenceFrame frame,
TabulatedScatteringFunction scattering,
TabulatedFormFactor real,
TabulatedFormFactor imaginary ) :
CoherentDistributionData( std::move( frame ), std::move( scattering ),
std::move( real ), std::move( imaginary ) ) {}
4 changes: 3 additions & 1 deletion src/dryad/DistributionDataType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ namespace dryad {
enum class DistributionDataType : short {

TwoBody, /**< The distribution data is given as two body scattering */
Uncorrelated /**< The distribution data is uncorrelated */
Uncorrelated, /**< The distribution data is uncorrelated */
Coherent, /**< The distribution data is for coherent scattering for photoatomic interactions */
Incoherent /**< The distribution data is for incoherent scattering for photoatomic interactions */
};

} // dryad namespace
Expand Down
70 changes: 70 additions & 0 deletions src/dryad/IncoherentDistributionData.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ifndef NJOY_DRYAD_INCOHERENTDISTRIBUTIONDATA
#define NJOY_DRYAD_INCOHERENTDISTRIBUTIONDATA

// system includes
#include <variant>

// other includes
#include "dryad/DistributionDataType.hpp"
#include "dryad/ReferenceFrame.hpp"
#include "dryad/TabulatedScatteringFunction.hpp"

namespace njoy {
namespace dryad {

/**
* @class
* @brief The distribution data for incoherent scattering in photoatomic interactions
*
* This representation is only available for a photoatomic ProjectileTarget.
*
* In this representation, a scattering function S(x,Z) is defined that
* together with the Klein-Nishina cross section determines the double
* differential cross section.
*
* This corresponds with the incoherent scattering function data given in
* MF27 MT504.
*/
class IncoherentDistributionData {

/* fields */
ReferenceFrame frame_;
TabulatedScatteringFunction scattering_;

public:

/* constructor */

#include "dryad/IncoherentDistributionData/src/ctor.hpp"

/* methods */

/**
* @brief Return the distribution data type
*/
static constexpr DistributionDataType type() noexcept {

return DistributionDataType::Incoherent;
}

/**
* @brief Return the reference frame
*/
const ReferenceFrame& frame() const noexcept {

return this->frame_;
}

/**
* @brief Return the scattering function
*/
const TabulatedScatteringFunction& scatteringFunction() const noexcept {

return this->scattering_;
}
};

} // dryad namespace
} // njoy namespace

#endif
23 changes: 23 additions & 0 deletions src/dryad/IncoherentDistributionData/src/ctor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! @todo pybind11 variant needs default constructor workaround
#ifdef PYBIND11
/**
* @brief Default constructor - only enabled for pybind11
*/
IncoherentDistributionData() = default;
#endif

IncoherentDistributionData( const IncoherentDistributionData& ) = default;
IncoherentDistributionData( IncoherentDistributionData&& ) = default;

IncoherentDistributionData& operator=( const IncoherentDistributionData& ) = default;
IncoherentDistributionData& operator=( IncoherentDistributionData&& ) = default;

/**
* @brief Constructor
*
* @param frame the reference frame of the distribution data
* @param scattering the scattering function
*/
IncoherentDistributionData( ReferenceFrame frame,
TabulatedScatteringFunction scattering ) :
frame_( std::move( frame ) ), scattering_( std::move( scattering ) ) {}

0 comments on commit 0082273

Please sign in to comment.