From 70ef67adf428e2b514f691b5a0e6d5e41c8de159 Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Sun, 18 Aug 2024 10:53:02 -0600 Subject: [PATCH 1/4] Adding placeholder create functions and placeholder tests for reactions and targets --- src/dryad/format/ace.hpp | 6 ++ .../electroatomic/createProjectileTarget.hpp | 35 ++++++++++ .../ace/electroatomic/createReactions.hpp | 34 ++++++++++ .../photoatomic/createProjectileTarget.hpp | 35 ++++++++++ .../ace/photoatomic/createReactions.hpp | 34 ++++++++++ src/dryad/format/ace/test/CMakeLists.txt | 4 ++ .../createProjectileTarget.test.cpp | 65 +++++++++++++++++++ .../electroatomic/createReactions.test.cpp | 56 ++++++++++++++++ .../createProjectileTarget.test.cpp | 65 +++++++++++++++++++ .../test/photoatomic/createReactions.test.cpp | 56 ++++++++++++++++ 10 files changed, 390 insertions(+) create mode 100644 src/dryad/format/ace/electroatomic/createProjectileTarget.hpp create mode 100644 src/dryad/format/ace/electroatomic/createReactions.hpp create mode 100644 src/dryad/format/ace/photoatomic/createProjectileTarget.hpp create mode 100644 src/dryad/format/ace/photoatomic/createReactions.hpp create mode 100644 src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp create mode 100644 src/dryad/format/ace/test/electroatomic/createReactions.test.cpp create mode 100644 src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp create mode 100644 src/dryad/format/ace/test/photoatomic/createReactions.test.cpp diff --git a/src/dryad/format/ace.hpp b/src/dryad/format/ace.hpp index 5f55f53..ed9bd8b 100644 --- a/src/dryad/format/ace.hpp +++ b/src/dryad/format/ace.hpp @@ -1,7 +1,13 @@ #include "dryad/format/ace/createTabulatedScatteringFunction.hpp" #include "dryad/format/ace/photoatomic/createReactionNumbers.hpp" +#include "dryad/format/ace/photoatomic/createPartialReactionNumbers.hpp" #include "dryad/format/ace/photoatomic/createTabulatedCrossSections.hpp" +#include "dryad/format/ace/photoatomic/createReactions.hpp" +#include "dryad/format/ace/photoatomic/createProjectileTarget.hpp" #include "dryad/format/ace/electroatomic/createReactionNumbers.hpp" +#include "dryad/format/ace/electroatomic/createPartialReactionNumbers.hpp" #include "dryad/format/ace/electroatomic/createTabulatedCrossSections.hpp" +#include "dryad/format/ace/electroatomic/createReactions.hpp" +#include "dryad/format/ace/electroatomic/createProjectileTarget.hpp" diff --git a/src/dryad/format/ace/electroatomic/createProjectileTarget.hpp b/src/dryad/format/ace/electroatomic/createProjectileTarget.hpp new file mode 100644 index 0000000..c8ec035 --- /dev/null +++ b/src/dryad/format/ace/electroatomic/createProjectileTarget.hpp @@ -0,0 +1,35 @@ +#ifndef NJOY_DRYAD_FORMAT_ACE_ELECTROATOMIC_CREATEPROJECTILETARGET +#define NJOY_DRYAD_FORMAT_ACE_ELECTROATOMIC_CREATEPROJECTILETARGET + +// system includes +#include + +// other includes +#include "tools/Log.hpp" +#include "dryad/ProjectileTarget.hpp" +#include "dryad/format/ace/electroatomic/createReactions.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +namespace njoy { +namespace dryad { +namespace format { +namespace ace { +namespace electroatomic { + + /** + * @brief Create a ProjectileTarget for electroatomic data + */ + ProjectileTarget createProjectileTarget( const ACEtk::PhotoatomicTable& table ) { + + return ProjectileTarget( id::ParticleID( "e-" ), id::ParticleID( table.ZAID() ), + InteractionType::Atomic, + createReactions( table ) ); + } + +} // electroatomic namespace +} // ace namespace +} // format namespace +} // dryad namespace +} // njoy namespace + +#endif diff --git a/src/dryad/format/ace/electroatomic/createReactions.hpp b/src/dryad/format/ace/electroatomic/createReactions.hpp new file mode 100644 index 0000000..3a3107b --- /dev/null +++ b/src/dryad/format/ace/electroatomic/createReactions.hpp @@ -0,0 +1,34 @@ +#ifndef NJOY_DRYAD_FORMAT_ACE_ELECTROATOMIC_CREATEREACTIONS +#define NJOY_DRYAD_FORMAT_ACE_ELECTROATOMIC_CREATEREACTIONS + +// system includes +#include + +// other includes +#include "tools/Log.hpp" +#include "dryad/Reaction.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +namespace njoy { +namespace dryad { +namespace format { +namespace ace { +namespace electroatomic { + + /** + * @brief Create the reactions for electroatomic data + */ + std::vector< Reaction > createReactions( const ACEtk::PhotoatomicTable& table ) { + + std::vector< Reaction > reactions; + + return reactions; + } + +} // electroatomic namespace +} // ace namespace +} // format namespace +} // dryad namespace +} // njoy namespace + +#endif diff --git a/src/dryad/format/ace/photoatomic/createProjectileTarget.hpp b/src/dryad/format/ace/photoatomic/createProjectileTarget.hpp new file mode 100644 index 0000000..02fc0a8 --- /dev/null +++ b/src/dryad/format/ace/photoatomic/createProjectileTarget.hpp @@ -0,0 +1,35 @@ +#ifndef NJOY_DRYAD_FORMAT_ACE_PHOTOATOMIC_CREATEPROJECTILETARGET +#define NJOY_DRYAD_FORMAT_ACE_PHOTOATOMIC_CREATEPROJECTILETARGET + +// system includes +#include + +// other includes +#include "tools/Log.hpp" +#include "dryad/ProjectileTarget.hpp" +#include "dryad/format/ace/photoatomic/createReactions.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +namespace njoy { +namespace dryad { +namespace format { +namespace ace { +namespace photoatomic { + + /** + * @brief Create a ProjectileTarget for photoatomic data + */ + ProjectileTarget createProjectileTarget( const ACEtk::PhotoatomicTable& table ) { + + return ProjectileTarget( id::ParticleID( "g" ), id::ParticleID( table.ZAID() ), + InteractionType::Atomic, + createReactions( table ) ); + } + +} // electroatomic namespace +} // ace namespace +} // format namespace +} // dryad namespace +} // njoy namespace + +#endif diff --git a/src/dryad/format/ace/photoatomic/createReactions.hpp b/src/dryad/format/ace/photoatomic/createReactions.hpp new file mode 100644 index 0000000..18f73fd --- /dev/null +++ b/src/dryad/format/ace/photoatomic/createReactions.hpp @@ -0,0 +1,34 @@ +#ifndef NJOY_DRYAD_FORMAT_ACE_PHOTOATOMIC_CREATEREACTIONS +#define NJOY_DRYAD_FORMAT_ACE_PHOTOATOMIC_CREATEREACTIONS + +// system includes +#include + +// other includes +#include "tools/Log.hpp" +#include "dryad/Reaction.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +namespace njoy { +namespace dryad { +namespace format { +namespace ace { +namespace photoatomic { + + /** + * @brief Create the reactions for photoatomic data + */ + std::vector< Reaction > createReactions( const ACEtk::PhotoatomicTable& table ) { + + std::vector< Reaction > reactions; + + return reactions; + } + +} // electroatomic namespace +} // ace namespace +} // format namespace +} // dryad namespace +} // njoy namespace + +#endif diff --git a/src/dryad/format/ace/test/CMakeLists.txt b/src/dryad/format/ace/test/CMakeLists.txt index 1f9915c..3c677fb 100644 --- a/src/dryad/format/ace/test/CMakeLists.txt +++ b/src/dryad/format/ace/test/CMakeLists.txt @@ -3,7 +3,11 @@ add_cpp_test( format.ace.createTabulatedScatteringFunction createTabula add_cpp_test( format.ace.electroatomic.createReactionNumbers electroatomic/createReactionNumbers.test.cpp ) add_cpp_test( format.ace.electroatomic.createPartialReactionNumbers electroatomic/createPartialReactionNumbers.test.cpp ) add_cpp_test( format.ace.electroatomic.createTabulatedCrossSections electroatomic/createTabulatedCrossSections.test.cpp ) +add_cpp_test( format.ace.electroatomic.createReactions electroatomic/createReactions.test.cpp ) +add_cpp_test( format.ace.electroatomic.createProjectileTarget electroatomic/createProjectileTarget.test.cpp ) add_cpp_test( format.ace.photoatomic.createReactionNumbers photoatomic/createReactionNumbers.test.cpp ) add_cpp_test( format.ace.photoatomic.createPartialReactionNumbers photoatomic/createPartialReactionNumbers.test.cpp ) add_cpp_test( format.ace.photoatomic.createTabulatedCrossSections photoatomic/createTabulatedCrossSections.test.cpp ) +add_cpp_test( format.ace.photoatomic.createReactions photoatomic/createReactions.test.cpp ) +add_cpp_test( format.ace.photoatomic.createProjectileTarget photoatomic/createProjectileTarget.test.cpp ) diff --git a/src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp b/src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp new file mode 100644 index 0000000..e7baf80 --- /dev/null +++ b/src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp @@ -0,0 +1,65 @@ +// include Catch2 +#include +#include +using Catch::Matchers::WithinRel; + +// what we are testing +#include "dryad/format/ace/electroatomic/createProjectileTarget.hpp" + +// other includes +#include "ACEtk/fromFile.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +// convenience typedefs +using namespace njoy::dryad; + +SCENARIO( "createProjectileTarget" ) { + + GIVEN( "instances of PhotoatomicTable" ) { + + WHEN( "an mcplib84 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.84p" ) ); + + THEN( "a ProjectileTarget can be derived" ) { + + ProjectileTarget H0 = format::ace::electroatomic::createProjectileTarget( table ); + + CHECK( id::ParticleID( "e-" ) == H0.projectileIdentifier() ); + CHECK( id::ParticleID( "1000.84p" ) == H0.targetIdentifier() ); + + CHECK( InteractionType::Atomic == H0.interactionType() ); + } // THEN + } // WHEN + + WHEN( "an eprdata12 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.12p" ) ); + + THEN( "a ProjectileTarget can be derived" ) { + + ProjectileTarget H0 = format::ace::electroatomic::createProjectileTarget( table ); + + CHECK( id::ParticleID( "e-" ) == H0.projectileIdentifier() ); + CHECK( id::ParticleID( "1000.12p" ) == H0.targetIdentifier() ); + + CHECK( InteractionType::Atomic == H0.interactionType() ); + } // THEN + } // WHEN + + WHEN( "an eprdata14 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.14p" ) ); + + THEN( "a ProjectileTarget can be derived" ) { + + ProjectileTarget H0 = format::ace::electroatomic::createProjectileTarget( table ); + + CHECK( id::ParticleID( "e-" ) == H0.projectileIdentifier() ); + CHECK( id::ParticleID( "1000.14p" ) == H0.targetIdentifier() ); + + CHECK( InteractionType::Atomic == H0.interactionType() ); + } // THEN + } // WHEN + } // GIVEN +} // SCENARIO diff --git a/src/dryad/format/ace/test/electroatomic/createReactions.test.cpp b/src/dryad/format/ace/test/electroatomic/createReactions.test.cpp new file mode 100644 index 0000000..aa8e8a3 --- /dev/null +++ b/src/dryad/format/ace/test/electroatomic/createReactions.test.cpp @@ -0,0 +1,56 @@ +// include Catch2 +#include +#include +using Catch::Matchers::WithinRel; + +// what we are testing +#include "dryad/format/ace/electroatomic/createReactions.hpp" + +// other includes +#include "ACEtk/fromFile.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +// convenience typedefs +using namespace njoy::dryad; + +SCENARIO( "createReactions" ) { + + GIVEN( "instances of PhotoatomicTable" ) { + + WHEN( "an mcplib84 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.84p" ) ); + + THEN( "reactions can be derived" ) { + + auto reactions = format::ace::electroatomic::createReactions( table ); + + CHECK( 0 == reactions.size() ); + } // THEN + } // WHEN + + WHEN( "an eprdata12 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.12p" ) ); + + THEN( "reactions can be derived" ) { + + auto reactions = format::ace::electroatomic::createReactions( table ); + + CHECK( 0 == reactions.size() ); + } // THEN + } // WHEN + + WHEN( "an eprdata14 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.14p" ) ); + + THEN( "reactions can be derived" ) { + + auto reactions = format::ace::electroatomic::createReactions( table ); + + CHECK( 0 == reactions.size() ); + } // THEN + } // WHEN + } // GIVEN +} // SCENARIO diff --git a/src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp b/src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp new file mode 100644 index 0000000..90c2343 --- /dev/null +++ b/src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp @@ -0,0 +1,65 @@ +// include Catch2 +#include +#include +using Catch::Matchers::WithinRel; + +// what we are testing +#include "dryad/format/ace/photoatomic/createProjectileTarget.hpp" + +// other includes +#include "ACEtk/fromFile.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +// convenience typedefs +using namespace njoy::dryad; + +SCENARIO( "createProjectileTarget" ) { + + GIVEN( "instances of PhotoatomicTable" ) { + + WHEN( "an mcplib84 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.84p" ) ); + + THEN( "a ProjectileTarget can be derived" ) { + + ProjectileTarget H0 = format::ace::photoatomic::createProjectileTarget( table ); + + CHECK( id::ParticleID( "g" ) == H0.projectileIdentifier() ); + CHECK( id::ParticleID( "1000.84p" ) == H0.targetIdentifier() ); + + CHECK( InteractionType::Atomic == H0.interactionType() ); + } // THEN + } // WHEN + + WHEN( "an eprdata12 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.12p" ) ); + + THEN( "a ProjectileTarget can be derived" ) { + + ProjectileTarget H0 = format::ace::photoatomic::createProjectileTarget( table ); + + CHECK( id::ParticleID( "g" ) == H0.projectileIdentifier() ); + CHECK( id::ParticleID( "1000.12p" ) == H0.targetIdentifier() ); + + CHECK( InteractionType::Atomic == H0.interactionType() ); + } // THEN + } // WHEN + + WHEN( "an eprdata14 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.14p" ) ); + + THEN( "a ProjectileTarget can be derived" ) { + + ProjectileTarget H0 = format::ace::photoatomic::createProjectileTarget( table ); + + CHECK( id::ParticleID( "g" ) == H0.projectileIdentifier() ); + CHECK( id::ParticleID( "1000.14p" ) == H0.targetIdentifier() ); + + CHECK( InteractionType::Atomic == H0.interactionType() ); + } // THEN + } // WHEN + } // GIVEN +} // SCENARIO diff --git a/src/dryad/format/ace/test/photoatomic/createReactions.test.cpp b/src/dryad/format/ace/test/photoatomic/createReactions.test.cpp new file mode 100644 index 0000000..088881b --- /dev/null +++ b/src/dryad/format/ace/test/photoatomic/createReactions.test.cpp @@ -0,0 +1,56 @@ +// include Catch2 +#include +#include +using Catch::Matchers::WithinRel; + +// what we are testing +#include "dryad/format/ace/photoatomic/createReactions.hpp" + +// other includes +#include "ACEtk/fromFile.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +// convenience typedefs +using namespace njoy::dryad; + +SCENARIO( "createReactions" ) { + + GIVEN( "instances of PhotoatomicTable" ) { + + WHEN( "an mcplib84 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.84p" ) ); + + THEN( "reactions can be derived" ) { + + auto reactions = format::ace::photoatomic::createReactions( table ); + + CHECK( 0 == reactions.size() ); + } // THEN + } // WHEN + + WHEN( "an eprdata12 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.12p" ) ); + + THEN( "reactions can be derived" ) { + + auto reactions = format::ace::photoatomic::createReactions( table ); + + CHECK( 0 == reactions.size() ); + } // THEN + } // WHEN + + WHEN( "an eprdata14 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.14p" ) ); + + THEN( "reactions can be derived" ) { + + auto reactions = format::ace::photoatomic::createReactions( table ); + + CHECK( 0 == reactions.size() ); + } // THEN + } // WHEN + } // GIVEN +} // SCENARIO From b4d1a34dd41fc26da44093fb86064f2b5ed01532 Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Sun, 18 Aug 2024 13:03:32 -0600 Subject: [PATCH 2/4] Adding tests for electroatomic reactions and ProjectileTarget --- .../ace/electroatomic/createReactions.hpp | 26 + .../createProjectileTarget.test.cpp | 117 +++++ .../electroatomic/createReactions.test.cpp | 49 +- .../test_verification_functions.hpp | 456 ++++++++++++++++++ 4 files changed, 646 insertions(+), 2 deletions(-) create mode 100644 src/dryad/format/ace/test/electroatomic/test_verification_functions.hpp diff --git a/src/dryad/format/ace/electroatomic/createReactions.hpp b/src/dryad/format/ace/electroatomic/createReactions.hpp index 3a3107b..bf91a8f 100644 --- a/src/dryad/format/ace/electroatomic/createReactions.hpp +++ b/src/dryad/format/ace/electroatomic/createReactions.hpp @@ -7,6 +7,9 @@ // other includes #include "tools/Log.hpp" #include "dryad/Reaction.hpp" +#include "dryad/format/ace/electroatomic/createReactionNumbers.hpp" +#include "dryad/format/ace/electroatomic/createPartialReactionNumbers.hpp" +#include "dryad/format/ace/electroatomic/createTabulatedCrossSections.hpp" #include "ACEtk/PhotoatomicTable.hpp" namespace njoy { @@ -22,6 +25,29 @@ namespace electroatomic { std::vector< Reaction > reactions; + auto numbers = createReactionNumbers( table ); + auto partialNumbers = createPartialReactionNumbers( table ); + auto xs = createTabulatedCrossSections( table ); + auto size = numbers.size(); + + for ( std::size_t index = 0; index < size; ++index ) { + + id::ReactionID id( std::to_string( numbers[index] ) ); + if ( partialNumbers[index].size() == 0 ) { + + reactions.emplace_back( std::move( id ), std::move( xs[index] ) ); + } + else { + + std::vector< id::ReactionID > partials( partialNumbers[index].size() ); + std::transform( partialNumbers[index].begin(), partialNumbers[index].end(), + partials.begin(), + [] ( auto&& number ) { return std::to_string( number ); } ); + + reactions.emplace_back( std::move( id ), std::move( partials ), std::move( xs[index] ) ); + } + } + return reactions; } diff --git a/src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp b/src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp index e7baf80..17d4e44 100644 --- a/src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp +++ b/src/dryad/format/ace/test/electroatomic/createProjectileTarget.test.cpp @@ -13,6 +13,9 @@ using Catch::Matchers::WithinRel; // convenience typedefs using namespace njoy::dryad; +// include common test verification functions +#include "test_verification_functions.hpp" + SCENARIO( "createProjectileTarget" ) { GIVEN( "instances of PhotoatomicTable" ) { @@ -44,6 +47,56 @@ SCENARIO( "createProjectileTarget" ) { CHECK( id::ParticleID( "1000.12p" ) == H0.targetIdentifier() ); CHECK( InteractionType::Atomic == H0.interactionType() ); + + CHECK( true == H0.isLinearised() ); + + CHECK( std::nullopt == H0.resonances() ); + + CHECK( true == H0.hasReaction( id::ReactionID( "501" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "522" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "526" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "527" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "528" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "534" ) ) ); + CHECK( false == H0.hasReaction( id::ReactionID( "some unknown reaction" ) ) ); + + CHECK( 6 == H0.reactions().size() ); + + auto total = H0.reactions()[0]; + verifyEprdata12ElectronTotalReaction( total ); + + auto tionisation = H0.reactions()[1]; + verifyEprdata12ElectronTotalIonisationReaction( tionisation ); + + auto telastic = H0.reactions()[2]; + verifyEprdata12ElectronTotalElasticReaction( telastic ); + + auto bremsstrahlung = H0.reactions()[3]; + verifyEprdata12ElectronBremsstrahlungReaction( bremsstrahlung ); + + auto excitation = H0.reactions()[4]; + verifyEprdata12ElectronExcitationReaction( excitation ); + + auto ionisation = H0.reactions()[5]; + verifyEprdata12ElectronIonisationReaction( ionisation ); + + total = H0.reaction( id::ReactionID( "501" ) ); + verifyEprdata12ElectronTotalReaction( total ); + + tionisation = H0.reaction( id::ReactionID( "522" ) ); + verifyEprdata12ElectronTotalIonisationReaction( tionisation ); + + telastic = H0.reaction( id::ReactionID( "526" ) ); + verifyEprdata12ElectronTotalElasticReaction( telastic ); + + bremsstrahlung = H0.reaction( id::ReactionID( "527" ) ); + verifyEprdata12ElectronBremsstrahlungReaction( bremsstrahlung ); + + excitation = H0.reaction( id::ReactionID( "528" ) ); + verifyEprdata12ElectronExcitationReaction( excitation ); + + ionisation = H0.reaction( id::ReactionID( "534" ) ); + verifyEprdata12ElectronIonisationReaction( ionisation ); } // THEN } // WHEN @@ -59,6 +112,70 @@ SCENARIO( "createProjectileTarget" ) { CHECK( id::ParticleID( "1000.14p" ) == H0.targetIdentifier() ); CHECK( InteractionType::Atomic == H0.interactionType() ); + + CHECK( true == H0.isLinearised() ); + + CHECK( std::nullopt == H0.resonances() ); + + CHECK( true == H0.hasReaction( id::ReactionID( "501" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "522" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "525" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "526" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "527" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "528" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "534" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "-526" ) ) ); + CHECK( false == H0.hasReaction( id::ReactionID( "some unknown reaction" ) ) ); + + CHECK( 8 == H0.reactions().size() ); + + auto total = H0.reactions()[0]; + verifyEprdata14ElectronTotalReaction( total ); + + auto tionisation = H0.reactions()[1]; + verifyEprdata14ElectronTotalIonisationReaction( tionisation ); + + auto elastic = H0.reactions()[2]; + verifyEprdata14ElectronLargeAngleElasticReaction( elastic ); + + auto telastic = H0.reactions()[3]; + verifyEprdata14ElectronTotalElasticReaction( telastic ); + + auto bremsstrahlung = H0.reactions()[4]; + verifyEprdata14ElectronBremsstrahlungReaction( bremsstrahlung ); + + auto excitation = H0.reactions()[5]; + verifyEprdata14ElectronExcitationReaction( excitation ); + + auto ionisation = H0.reactions()[6]; + verifyEprdata14ElectronIonisationReaction( ionisation ); + + auto deficit = H0.reactions()[7]; + verifyEprdata14ElectronElasticReactionDeficit( deficit ); + + total = H0.reaction( id::ReactionID( "501" ) ); + verifyEprdata14ElectronTotalReaction( total ); + + tionisation = H0.reaction( id::ReactionID( "522" ) ); + verifyEprdata14ElectronTotalIonisationReaction( tionisation ); + + elastic = H0.reaction( id::ReactionID( "525" ) ); + verifyEprdata14ElectronLargeAngleElasticReaction( elastic ); + + telastic = H0.reaction( id::ReactionID( "526" ) ); + verifyEprdata14ElectronTotalElasticReaction( telastic ); + + bremsstrahlung = H0.reaction( id::ReactionID( "527" ) ); + verifyEprdata14ElectronBremsstrahlungReaction( bremsstrahlung ); + + excitation = H0.reaction( id::ReactionID( "528" ) ); + verifyEprdata14ElectronExcitationReaction( excitation ); + + ionisation = H0.reaction( id::ReactionID( "534" ) ); + verifyEprdata14ElectronIonisationReaction( ionisation ); + + deficit = H0.reaction( id::ReactionID( "-526" ) ); + verifyEprdata14ElectronElasticReactionDeficit( deficit ); } // THEN } // WHEN } // GIVEN diff --git a/src/dryad/format/ace/test/electroatomic/createReactions.test.cpp b/src/dryad/format/ace/test/electroatomic/createReactions.test.cpp index aa8e8a3..ecbcada 100644 --- a/src/dryad/format/ace/test/electroatomic/createReactions.test.cpp +++ b/src/dryad/format/ace/test/electroatomic/createReactions.test.cpp @@ -13,6 +13,9 @@ using Catch::Matchers::WithinRel; // convenience typedefs using namespace njoy::dryad; +// include common test verification functions +#include "test_verification_functions.hpp" + SCENARIO( "createReactions" ) { GIVEN( "instances of PhotoatomicTable" ) { @@ -37,7 +40,25 @@ SCENARIO( "createReactions" ) { auto reactions = format::ace::electroatomic::createReactions( table ); - CHECK( 0 == reactions.size() ); + CHECK( 6 == reactions.size() ); + + auto total = reactions[0]; + verifyEprdata12ElectronTotalReaction( total ); + + auto tionisation = reactions[1]; + verifyEprdata12ElectronTotalIonisationReaction( tionisation ); + + auto telastic = reactions[2]; + verifyEprdata12ElectronTotalElasticReaction( telastic ); + + auto bremsstrahlung = reactions[3]; + verifyEprdata12ElectronBremsstrahlungReaction( bremsstrahlung ); + + auto excitation = reactions[4]; + verifyEprdata12ElectronExcitationReaction( excitation ); + + auto ionisation = reactions[5]; + verifyEprdata12ElectronIonisationReaction( ionisation ); } // THEN } // WHEN @@ -49,7 +70,31 @@ SCENARIO( "createReactions" ) { auto reactions = format::ace::electroatomic::createReactions( table ); - CHECK( 0 == reactions.size() ); + CHECK( 8 == reactions.size() ); + + auto total = reactions[0]; + verifyEprdata14ElectronTotalReaction( total ); + + auto tionisation = reactions[1]; + verifyEprdata14ElectronTotalIonisationReaction( tionisation ); + + auto elastic = reactions[2]; + verifyEprdata14ElectronLargeAngleElasticReaction( elastic ); + + auto telastic = reactions[3]; + verifyEprdata14ElectronTotalElasticReaction( telastic ); + + auto bremsstrahlung = reactions[4]; + verifyEprdata12ElectronBremsstrahlungReaction( bremsstrahlung ); + + auto excitation = reactions[5]; + verifyEprdata12ElectronExcitationReaction( excitation ); + + auto ionisation = reactions[6]; + verifyEprdata12ElectronIonisationReaction( ionisation ); + + auto deficit = reactions[7]; + verifyEprdata14ElectronElasticReactionDeficit( deficit ); } // THEN } // WHEN } // GIVEN diff --git a/src/dryad/format/ace/test/electroatomic/test_verification_functions.hpp b/src/dryad/format/ace/test/electroatomic/test_verification_functions.hpp new file mode 100644 index 0000000..8af601d --- /dev/null +++ b/src/dryad/format/ace/test/electroatomic/test_verification_functions.hpp @@ -0,0 +1,456 @@ +void verifyEprdata12ElectronTotalReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "501" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 4 == partials.size() ); + CHECK( id::ReactionID( "526" ) == partials[0] ); + CHECK( id::ReactionID( "527" ) == partials[1] ); + CHECK( id::ReactionID( "528" ) == partials[2] ); + CHECK( id::ReactionID( "534" ) == partials[3] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 274896029.7832, WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 164334.9906341, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12ElectronTotalIonisationReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "522" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 1 == partials.size() ); + CHECK( id::ReactionID( "534" ) == partials[0] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 8.289240e+4, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12ElectronTotalElasticReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "526" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 2.748960e+8, WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 1.311760e-5, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12ElectronBremsstrahlungReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "527" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 2.978320e+1, WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 9.906210e-1, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12ElectronExcitationReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "528" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 8.144160e+4, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12ElectronIonisationReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "534" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 8.289240e+4, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronTotalReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "501" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 5 == partials.size() ); + CHECK( id::ReactionID( "525" ) == partials[0] ); + CHECK( id::ReactionID( "527" ) == partials[1] ); + CHECK( id::ReactionID( "528" ) == partials[2] ); + CHECK( id::ReactionID( "534" ) == partials[3] ); + CHECK( id::ReactionID( "-526" ) == partials[4] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 274896029.7832, WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 164334.9906341, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronTotalIonisationReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "522" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 1 == partials.size() ); + CHECK( id::ReactionID( "534" ) == partials[0] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 8.289240e+4, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronLargeAngleElasticReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "525" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 2.748960e+8, WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 4.33534e-10, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronTotalElasticReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "526" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 2 == partials.size() ); + CHECK( id::ReactionID( "525" ) == partials[0] ); + CHECK( id::ReactionID( "-526" ) == partials[1] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 2.748960e+8, WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 1.298710e+4, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronBremsstrahlungReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "527" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 2.978320e+1, WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 9.906210e-1, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronExcitationReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "528" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 8.144160e+4, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronIonisationReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "534" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 8.289240e+4, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14ElectronElasticReactionDeficit( const Reaction& reaction ) { + + CHECK( id::ReactionID( "-526" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 10., WithinRel( reaction.crossSection().lowerEnergyLimit() ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit() ) ); + CHECK( 342 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 342 == reaction.crossSection().energies().size() ); + CHECK( 342 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 10., WithinRel( reaction.crossSection().energies()[0] ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[341] ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0] ) ); + CHECK_THAT( 12987.0999999996, WithinRel( reaction.crossSection().values()[341] ) ); + CHECK( 341 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} From cd1fcad260dd8167f22b476766237329d46dcf73 Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Sun, 18 Aug 2024 13:52:33 -0600 Subject: [PATCH 3/4] Adding tests for photoatomic reactions and ProjectileTarget --- .../ace/photoatomic/createReactions.hpp | 26 + .../createProjectileTarget.test.cpp | 147 ++++- .../test/photoatomic/createReactions.test.cpp | 60 +- .../test_verification_functions.hpp | 550 ++++++++++++++++++ 4 files changed, 779 insertions(+), 4 deletions(-) create mode 100644 src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp diff --git a/src/dryad/format/ace/photoatomic/createReactions.hpp b/src/dryad/format/ace/photoatomic/createReactions.hpp index 18f73fd..de02bf4 100644 --- a/src/dryad/format/ace/photoatomic/createReactions.hpp +++ b/src/dryad/format/ace/photoatomic/createReactions.hpp @@ -7,6 +7,9 @@ // other includes #include "tools/Log.hpp" #include "dryad/Reaction.hpp" +#include "dryad/format/ace/photoatomic/createReactionNumbers.hpp" +#include "dryad/format/ace/photoatomic/createPartialReactionNumbers.hpp" +#include "dryad/format/ace/photoatomic/createTabulatedCrossSections.hpp" #include "ACEtk/PhotoatomicTable.hpp" namespace njoy { @@ -22,6 +25,29 @@ namespace photoatomic { std::vector< Reaction > reactions; + auto numbers = createReactionNumbers( table ); + auto partialNumbers = createPartialReactionNumbers( table ); + auto xs = createTabulatedCrossSections( table ); + auto size = numbers.size(); + + for ( std::size_t index = 0; index < size; ++index ) { + + id::ReactionID id( std::to_string( numbers[index] ) ); + if ( partialNumbers[index].size() == 0 ) { + + reactions.emplace_back( std::move( id ), std::move( xs[index] ) ); + } + else { + + std::vector< id::ReactionID > partials( partialNumbers[index].size() ); + std::transform( partialNumbers[index].begin(), partialNumbers[index].end(), + partials.begin(), + [] ( auto&& number ) { return std::to_string( number ); } ); + + reactions.emplace_back( std::move( id ), std::move( partials ), std::move( xs[index] ) ); + } + } + return reactions; } diff --git a/src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp b/src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp index 90c2343..d9174da 100644 --- a/src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp +++ b/src/dryad/format/ace/test/photoatomic/createProjectileTarget.test.cpp @@ -13,6 +13,9 @@ using Catch::Matchers::WithinRel; // convenience typedefs using namespace njoy::dryad; +// include common test verification functions +#include "test_verification_functions.hpp" + SCENARIO( "createProjectileTarget" ) { GIVEN( "instances of PhotoatomicTable" ) { @@ -29,6 +32,49 @@ SCENARIO( "createProjectileTarget" ) { CHECK( id::ParticleID( "1000.84p" ) == H0.targetIdentifier() ); CHECK( InteractionType::Atomic == H0.interactionType() ); + + CHECK( true == H0.isLinearised() ); + + CHECK( std::nullopt == H0.resonances() ); + + CHECK( true == H0.hasReaction( id::ReactionID( "501" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "502" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "504" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "516" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "522" ) ) ); + CHECK( false == H0.hasReaction( id::ReactionID( "some unknown reaction" ) ) ); + + CHECK( 5 == H0.reactions().size() ); + + auto total = H0.reactions()[0]; + verifyMcplib84PhotonTotalReaction( total ); + + auto coherent = H0.reactions()[1]; + verifyMcplib84PhotonCoherentReaction( coherent ); + + auto incoherent = H0.reactions()[2]; + verifyMcplib84PhotonIncoherentReaction( incoherent ); + + auto pair = H0.reactions()[3]; + verifyMcplib84PhotonPairProductionReaction( pair ); + + auto photoelectric = H0.reactions()[4]; + verifyMcplib84PhotonTotalPhotoElectricReaction( photoelectric ); + + total = H0.reaction( id::ReactionID( "501" ) ); + verifyMcplib84PhotonTotalReaction( total ); + + coherent = H0.reaction( id::ReactionID( "502" ) ); + verifyMcplib84PhotonCoherentReaction( coherent ); + + incoherent = H0.reaction( id::ReactionID( "504" ) ); + verifyMcplib84PhotonIncoherentReaction( incoherent ); + + pair = H0.reaction( id::ReactionID( "516" ) ); + verifyMcplib84PhotonPairProductionReaction( pair ); + + photoelectric = H0.reaction( id::ReactionID( "522" ) ); + verifyMcplib84PhotonTotalPhotoElectricReaction( photoelectric ); } // THEN } // WHEN @@ -44,6 +90,56 @@ SCENARIO( "createProjectileTarget" ) { CHECK( id::ParticleID( "1000.12p" ) == H0.targetIdentifier() ); CHECK( InteractionType::Atomic == H0.interactionType() ); + + CHECK( true == H0.isLinearised() ); + + CHECK( std::nullopt == H0.resonances() ); + + CHECK( true == H0.hasReaction( id::ReactionID( "501" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "502" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "504" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "516" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "522" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "534" ) ) ); + CHECK( false == H0.hasReaction( id::ReactionID( "some unknown reaction" ) ) ); + + CHECK( 6 == H0.reactions().size() ); + + auto total = H0.reactions()[0]; + verifyEprdata12PhotonTotalReaction( total ); + + auto coherent = H0.reactions()[1]; + verifyEprdata12PhotonCoherentReaction( coherent ); + + auto incoherent = H0.reactions()[2]; + verifyEprdata12PhotonIncoherentReaction( incoherent ); + + auto pair = H0.reactions()[3]; + verifyEprdata12PhotonPairProductionReaction( pair ); + + auto tphotoelectric = H0.reactions()[4]; + verifyEprdata12PhotonTotalPhotoElectricReaction( tphotoelectric ); + + auto photoelectric = H0.reactions()[5]; + verifyEprdata12PhotonPhotoElectricReaction( photoelectric ); + + total = H0.reaction( id::ReactionID( "501" ) ); + verifyEprdata12PhotonTotalReaction( total ); + + coherent = H0.reaction( id::ReactionID( "502" ) ); + verifyEprdata12PhotonCoherentReaction( coherent ); + + incoherent = H0.reaction( id::ReactionID( "504" ) ); + verifyEprdata12PhotonIncoherentReaction( incoherent ); + + pair = H0.reaction( id::ReactionID( "516" ) ); + verifyEprdata12PhotonPairProductionReaction( pair ); + + tphotoelectric = H0.reaction( id::ReactionID( "522" ) ); + verifyEprdata12PhotonTotalPhotoElectricReaction( tphotoelectric ); + + photoelectric = H0.reaction( id::ReactionID( "534" ) ); + verifyEprdata12PhotonPhotoElectricReaction( photoelectric ); } // THEN } // WHEN @@ -59,7 +155,56 @@ SCENARIO( "createProjectileTarget" ) { CHECK( id::ParticleID( "1000.14p" ) == H0.targetIdentifier() ); CHECK( InteractionType::Atomic == H0.interactionType() ); - } // THEN + + CHECK( true == H0.isLinearised() ); + + CHECK( std::nullopt == H0.resonances() ); + + CHECK( true == H0.hasReaction( id::ReactionID( "501" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "502" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "504" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "516" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "522" ) ) ); + CHECK( true == H0.hasReaction( id::ReactionID( "534" ) ) ); + CHECK( false == H0.hasReaction( id::ReactionID( "some unknown reaction" ) ) ); + + CHECK( 6 == H0.reactions().size() ); + + auto total = H0.reactions()[0]; + verifyEprdata14PhotonTotalReaction( total ); + + auto coherent = H0.reactions()[1]; + verifyEprdata14PhotonCoherentReaction( coherent ); + + auto incoherent = H0.reactions()[2]; + verifyEprdata14PhotonIncoherentReaction( incoherent ); + + auto pair = H0.reactions()[3]; + verifyEprdata14PhotonPairProductionReaction( pair ); + + auto tphotoelectric = H0.reactions()[4]; + verifyEprdata14PhotonTotalPhotoElectricReaction( tphotoelectric ); + + auto photoelectric = H0.reactions()[5]; + verifyEprdata14PhotonPhotoElectricReaction( photoelectric ); + + total = H0.reaction( id::ReactionID( "501" ) ); + verifyEprdata14PhotonTotalReaction( total ); + + coherent = H0.reaction( id::ReactionID( "502" ) ); + verifyEprdata14PhotonCoherentReaction( coherent ); + + incoherent = H0.reaction( id::ReactionID( "504" ) ); + verifyEprdata14PhotonIncoherentReaction( incoherent ); + + pair = H0.reaction( id::ReactionID( "516" ) ); + verifyEprdata14PhotonPairProductionReaction( pair ); + + tphotoelectric = H0.reaction( id::ReactionID( "522" ) ); + verifyEprdata14PhotonTotalPhotoElectricReaction( tphotoelectric ); + + photoelectric = H0.reaction( id::ReactionID( "534" ) ); + verifyEprdata14PhotonPhotoElectricReaction( photoelectric ); } // THEN } // WHEN } // GIVEN } // SCENARIO diff --git a/src/dryad/format/ace/test/photoatomic/createReactions.test.cpp b/src/dryad/format/ace/test/photoatomic/createReactions.test.cpp index 088881b..72eb01b 100644 --- a/src/dryad/format/ace/test/photoatomic/createReactions.test.cpp +++ b/src/dryad/format/ace/test/photoatomic/createReactions.test.cpp @@ -13,6 +13,9 @@ using Catch::Matchers::WithinRel; // convenience typedefs using namespace njoy::dryad; +// include common test verification functions +#include "test_verification_functions.hpp" + SCENARIO( "createReactions" ) { GIVEN( "instances of PhotoatomicTable" ) { @@ -25,7 +28,22 @@ SCENARIO( "createReactions" ) { auto reactions = format::ace::photoatomic::createReactions( table ); - CHECK( 0 == reactions.size() ); + CHECK( 5 == reactions.size() ); + + auto total = reactions[0]; + verifyMcplib84PhotonTotalReaction( total ); + + auto coherent = reactions[1]; + verifyMcplib84PhotonCoherentReaction( coherent ); + + auto incoherent = reactions[2]; + verifyMcplib84PhotonIncoherentReaction( incoherent ); + + auto pair = reactions[3]; + verifyMcplib84PhotonPairProductionReaction( pair ); + + auto photoelectric = reactions[4]; + verifyMcplib84PhotonTotalPhotoElectricReaction( photoelectric ); } // THEN } // WHEN @@ -37,7 +55,25 @@ SCENARIO( "createReactions" ) { auto reactions = format::ace::photoatomic::createReactions( table ); - CHECK( 0 == reactions.size() ); + CHECK( 6 == reactions.size() ); + + auto total = reactions[0]; + verifyEprdata12PhotonTotalReaction( total ); + + auto coherent = reactions[1]; + verifyEprdata12PhotonCoherentReaction( coherent ); + + auto incoherent = reactions[2]; + verifyEprdata12PhotonIncoherentReaction( incoherent ); + + auto pair = reactions[3]; + verifyEprdata12PhotonPairProductionReaction( pair ); + + auto tphotoelectric = reactions[4]; + verifyEprdata12PhotonTotalPhotoElectricReaction( tphotoelectric ); + + auto photoelectric = reactions[5]; + verifyEprdata12PhotonPhotoElectricReaction( photoelectric ); } // THEN } // WHEN @@ -49,7 +85,25 @@ SCENARIO( "createReactions" ) { auto reactions = format::ace::photoatomic::createReactions( table ); - CHECK( 0 == reactions.size() ); + CHECK( 6 == reactions.size() ); + + auto total = reactions[0]; + verifyEprdata14PhotonTotalReaction( total ); + + auto coherent = reactions[1]; + verifyEprdata14PhotonCoherentReaction( coherent ); + + auto incoherent = reactions[2]; + verifyEprdata14PhotonIncoherentReaction( incoherent ); + + auto pair = reactions[3]; + verifyEprdata14PhotonPairProductionReaction( pair ); + + auto tphotoelectric = reactions[4]; + verifyEprdata14PhotonTotalPhotoElectricReaction( tphotoelectric ); + + auto photoelectric = reactions[5]; + verifyEprdata14PhotonPhotoElectricReaction( photoelectric ); } // THEN } // WHEN } // GIVEN diff --git a/src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp b/src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp new file mode 100644 index 0000000..32b14aa --- /dev/null +++ b/src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp @@ -0,0 +1,550 @@ +void verifyMcplib84PhotonTotalReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "501" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 4 == partials.size() ); + CHECK( id::ReactionID( "502" ) == partials[0] ); + CHECK( id::ReactionID( "504" ) == partials[1] ); + CHECK( id::ReactionID( "516" ) == partials[2] ); + CHECK( id::ReactionID( "522" ) == partials[3] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1000., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 278 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 278 == reaction.crossSection().energies().size() ); + CHECK( 278 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1000., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[277], 1e-10 ) ); + CHECK_THAT( 1.207455e+1, WithinRel( reaction.crossSection().values()[0], 1e-6 ) ); + CHECK_THAT( 2.071804e-2, WithinRel( reaction.crossSection().values()[277], 1e-6 ) ); + CHECK( 277 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyMcplib84PhotonCoherentReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "502" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1000., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 278 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 278 == reaction.crossSection().energies().size() ); + CHECK( 278 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1000., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[277], 1e-10 ) ); + CHECK_THAT( 5.817904841e-1, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 4.62616e-16, WithinRel( reaction.crossSection().values()[277], 1e-10 ) ); + CHECK( 277 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyMcplib84PhotonIncoherentReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "504" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1000., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 278 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 278 == reaction.crossSection().energies().size() ); + CHECK( 278 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1000., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[277], 1e-10 ) ); + CHECK_THAT( 8.434300e-2, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 1.704200e-5, WithinRel( reaction.crossSection().values()[277], 1e-10 ) ); + CHECK( 277 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyMcplib84PhotonPairProductionReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "516" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1000., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 278 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 278 == reaction.crossSection().energies().size() ); + CHECK( 278 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1000., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[277], 1e-10 ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 2.070100e-2, WithinRel( reaction.crossSection().values()[277], 1e-10 ) ); + CHECK( 277 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyMcplib84PhotonTotalPhotoElectricReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "522" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1000., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 278 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 278 == reaction.crossSection().energies().size() ); + CHECK( 278 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1000., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[277], 1e-10 ) ); + CHECK_THAT( 11.408415496, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 7.73600e-15, WithinRel( reaction.crossSection().values()[277], 1e-10 ) ); + CHECK( 277 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12PhotonTotalReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "501" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 4 == partials.size() ); + CHECK( id::ReactionID( "502" ) == partials[0] ); + CHECK( id::ReactionID( "504" ) == partials[1] ); + CHECK( id::ReactionID( "516" ) == partials[2] ); + CHECK( id::ReactionID( "534" ) == partials[3] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 9.983176e-6, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 2.0718042e-2, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12PhotonCoherentReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "502" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 9.887553e-6, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 4.62616e-16, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12PhotonIncoherentReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "504" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 9.562300e-8, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 1.704200e-5, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12PhotonPairProductionReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "516" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 2.070100e-2, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12PhotonTotalPhotoElectricReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "522" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 1 == partials.size() ); + CHECK( id::ReactionID( "534" ) == partials[0] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 7.73600e-15, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata12PhotonPhotoElectricReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "534" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 7.73600e-15, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14PhotonTotalReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "501" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 4 == partials.size() ); + CHECK( id::ReactionID( "502" ) == partials[0] ); + CHECK( id::ReactionID( "504" ) == partials[1] ); + CHECK( id::ReactionID( "516" ) == partials[2] ); + CHECK( id::ReactionID( "534" ) == partials[3] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 9.983176e-6, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 2.0718042e-2, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14PhotonCoherentReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "502" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 9.887553e-6, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 4.62616e-16, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14PhotonIncoherentReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "504" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 9.562300e-8, WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 1.704200e-5, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14PhotonPairProductionReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "516" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 2.070100e-2, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14PhotonTotalPhotoElectricReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "522" ) == reaction.identifier() ); + CHECK( ReactionType::Summation == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt != reaction.partialReactionIdentifiers() ); + auto partials = reaction.partialReactionIdentifiers().value(); + CHECK( 1 == partials.size() ); + CHECK( id::ReactionID( "534" ) == partials[0] ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 7.73600e-15, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} + +void verifyEprdata14PhotonPhotoElectricReaction( const Reaction& reaction ) { + + CHECK( id::ReactionID( "534" ) == reaction.identifier() ); + CHECK( ReactionType::Primary == reaction.type() ); + CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.isLinearised() ); + + CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); + + CHECK( std::nullopt == reaction.massDifferenceQValue() ); + CHECK( std::nullopt == reaction.reactionQValue() ); + + CHECK_THAT( 1., WithinRel( reaction.crossSection().lowerEnergyLimit(), 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().upperEnergyLimit(), 1e-10 ) ); + CHECK( 647 == reaction.crossSection().numberPoints() ); + CHECK( 1 == reaction.crossSection().numberRegions() ); + CHECK( 647 == reaction.crossSection().energies().size() ); + CHECK( 647 == reaction.crossSection().values().size() ); + CHECK( 1 == reaction.crossSection().boundaries().size() ); + CHECK( 1 == reaction.crossSection().interpolants().size() ); + CHECK_THAT( 1., WithinRel( reaction.crossSection().energies()[0], 1e-10 ) ); + CHECK_THAT( 1e+11, WithinRel( reaction.crossSection().energies()[646], 1e-10 ) ); + CHECK_THAT( 0., WithinRel( reaction.crossSection().values()[0], 1e-10 ) ); + CHECK_THAT( 7.73600e-15, WithinRel( reaction.crossSection().values()[646], 1e-10 ) ); + CHECK( 646 == reaction.crossSection().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); + CHECK( true == reaction.crossSection().isLinearised() ); + + CHECK( 0 == reaction.products().size() ); +} From b76a324a39edf8b30c0a6049b8203bac85adced2 Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Sun, 18 Aug 2024 19:32:16 -0600 Subject: [PATCH 4/4] Adding photoatomic reaction products --- cmake/unit_testing_python.cmake | 2 +- .../photoatomic/createReactionProducts.hpp | 67 +++++ .../ace/photoatomic/createReactions.hpp | 8 +- src/dryad/format/ace/test/CMakeLists.txt | 1 + .../createReactionProducts.test.cpp | 255 ++++++++++++++++++ .../test_verification_functions.hpp | 195 +++++++++++++- 6 files changed, 513 insertions(+), 15 deletions(-) create mode 100644 src/dryad/format/ace/photoatomic/createReactionProducts.hpp create mode 100644 src/dryad/format/ace/test/photoatomic/createReactionProducts.test.cpp diff --git a/cmake/unit_testing_python.cmake b/cmake/unit_testing_python.cmake index f90b5e4..9aa6297 100644 --- a/cmake/unit_testing_python.cmake +++ b/cmake/unit_testing_python.cmake @@ -22,7 +22,7 @@ endfunction() message( STATUS "Adding dryad Python unit testing" ) -add_python_test( id.ElementID id/Test_dryad_id_ElementID.py ) +add_python_test( id.ElementID id/Test_dryad_id_ElementID.py ) add_python_test( TabulatedMultiplicity Test_dryad_TabulatedMultiplicity.py ) add_python_test( TabulatedAverageEnergy Test_dryad_TabulatedAverageEnergy.py ) diff --git a/src/dryad/format/ace/photoatomic/createReactionProducts.hpp b/src/dryad/format/ace/photoatomic/createReactionProducts.hpp new file mode 100644 index 0000000..3b765d3 --- /dev/null +++ b/src/dryad/format/ace/photoatomic/createReactionProducts.hpp @@ -0,0 +1,67 @@ +#ifndef NJOY_DRYAD_FORMAT_ACE_PHOTOATOMIC_CREATEREACTIONPRODUCTS +#define NJOY_DRYAD_FORMAT_ACE_PHOTOATOMIC_CREATEREACTIONPRODUCTS + +// system includes +#include + +// other includes +#include "tools/Log.hpp" +#include "dryad/ReactionProduct.hpp" +#include "dryad/format/ace/createTabulatedScatteringFunction.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +namespace njoy { +namespace dryad { +namespace format { +namespace ace { +namespace photoatomic { + + /** + * @brief Create partial reaction numbers for photoatomic data + */ + std::vector< std::vector< ReactionProduct > > + createReactionProducts( const ACEtk::PhotoatomicTable& table ) { + + std::vector< std::vector< ReactionProduct > > products; + + // total - MT501 + products.push_back( {} ); + + // coherent scattering - MT502 + products.push_back( {} ); + products.back().emplace_back( + id::ParticleID( "g" ), 1, + CoherentDistributionData( ReferenceFrame::CentreOfMass, + createTabulatedScatteringFunction( table.coherentFormFactorBlock() ) ) ); + + // incoherent scattering - MT504 + products.push_back( {} ); + products.back().emplace_back( + id::ParticleID( "g" ), 1, + IncoherentDistributionData( ReferenceFrame::CentreOfMass, + createTabulatedScatteringFunction( table.incoherentScatteringFunctionBlock() ) ) ); + + // pair production - MT516 (sum of MT515 and MT517) + products.push_back( {} ); + + // photoelectric - MT522 (sum of MT534 and up) + products.push_back( {} ); + if ( table.electronPhotonRelaxationFormat() > 0 ) { + + for ( std::size_t index = 1; index <= table.numberElectronSubshells(); ++index ) { + + // partial: subshell photoelectric - MT534 and up + products.push_back( {} ); + } + } + + return products; + } + +} // photoatomic namespace +} // ace namespace +} // format namespace +} // dryad namespace +} // njoy namespace + +#endif diff --git a/src/dryad/format/ace/photoatomic/createReactions.hpp b/src/dryad/format/ace/photoatomic/createReactions.hpp index de02bf4..058c6c2 100644 --- a/src/dryad/format/ace/photoatomic/createReactions.hpp +++ b/src/dryad/format/ace/photoatomic/createReactions.hpp @@ -10,6 +10,7 @@ #include "dryad/format/ace/photoatomic/createReactionNumbers.hpp" #include "dryad/format/ace/photoatomic/createPartialReactionNumbers.hpp" #include "dryad/format/ace/photoatomic/createTabulatedCrossSections.hpp" +#include "dryad/format/ace/photoatomic/createReactionProducts.hpp" #include "ACEtk/PhotoatomicTable.hpp" namespace njoy { @@ -28,6 +29,7 @@ namespace photoatomic { auto numbers = createReactionNumbers( table ); auto partialNumbers = createPartialReactionNumbers( table ); auto xs = createTabulatedCrossSections( table ); + auto products = createReactionProducts( table ); auto size = numbers.size(); for ( std::size_t index = 0; index < size; ++index ) { @@ -35,7 +37,8 @@ namespace photoatomic { id::ReactionID id( std::to_string( numbers[index] ) ); if ( partialNumbers[index].size() == 0 ) { - reactions.emplace_back( std::move( id ), std::move( xs[index] ) ); + reactions.emplace_back( std::move( id ), std::move( xs[index] ), + std::move( products[index] ) ); } else { @@ -44,7 +47,8 @@ namespace photoatomic { partials.begin(), [] ( auto&& number ) { return std::to_string( number ); } ); - reactions.emplace_back( std::move( id ), std::move( partials ), std::move( xs[index] ) ); + reactions.emplace_back( std::move( id ), std::move( partials ), std::move( xs[index] ), + std::move( products[index] ) ); } } diff --git a/src/dryad/format/ace/test/CMakeLists.txt b/src/dryad/format/ace/test/CMakeLists.txt index 3c677fb..1ebf3fa 100644 --- a/src/dryad/format/ace/test/CMakeLists.txt +++ b/src/dryad/format/ace/test/CMakeLists.txt @@ -9,5 +9,6 @@ add_cpp_test( format.ace.electroatomic.createProjectileTarget electroatomi add_cpp_test( format.ace.photoatomic.createReactionNumbers photoatomic/createReactionNumbers.test.cpp ) add_cpp_test( format.ace.photoatomic.createPartialReactionNumbers photoatomic/createPartialReactionNumbers.test.cpp ) add_cpp_test( format.ace.photoatomic.createTabulatedCrossSections photoatomic/createTabulatedCrossSections.test.cpp ) +add_cpp_test( format.ace.photoatomic.createReactionProducts photoatomic/createReactionProducts.test.cpp ) add_cpp_test( format.ace.photoatomic.createReactions photoatomic/createReactions.test.cpp ) add_cpp_test( format.ace.photoatomic.createProjectileTarget photoatomic/createProjectileTarget.test.cpp ) diff --git a/src/dryad/format/ace/test/photoatomic/createReactionProducts.test.cpp b/src/dryad/format/ace/test/photoatomic/createReactionProducts.test.cpp new file mode 100644 index 0000000..4cb4cd2 --- /dev/null +++ b/src/dryad/format/ace/test/photoatomic/createReactionProducts.test.cpp @@ -0,0 +1,255 @@ +// include Catch2 +#include +#include +using Catch::Matchers::WithinRel; + +// what we are testing +#include "dryad/format/ace/photoatomic/createReactionProducts.hpp" + +// other includes +#include "ACEtk/fromFile.hpp" +#include "ACEtk/PhotoatomicTable.hpp" + +// convenience typedefs +using namespace njoy::dryad; + +SCENARIO( "createReactionProducts" ) { + + GIVEN( "instances of PhotoatomicTable" ) { + + WHEN( "an mcplib84 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.84p" ) ); + + THEN( "reaction products can be derived" ) { + + auto products = format::ace::photoatomic::createReactionProducts( table ); + + CHECK( 5 == products.size() ); + + CHECK( 0 == products[0].size() ); + + CHECK( 1 == products[1].size() ); + CHECK( id::ParticleID( "g" ) == products[1][0].identifier() ); + CHECK( true == products[1][0].isLinearised() ); + CHECK( false == products[1][0].hasAverageEnergy() ); + CHECK( true == products[1][0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( products[1][0].multiplicity() ) ); + auto multiplicity = std::get< int >( products[1][0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == products[1][0].averageEnergy() ); + CHECK( std::nullopt != products[1][0].distributionData() ); + CHECK( true == std::holds_alternative< CoherentDistributionData >( products[1][0].distributionData().value() ) ); + auto coherent = std::get< CoherentDistributionData >( products[1][0].distributionData().value() ); + CHECK( DistributionDataType::Coherent == coherent.type() ); + CHECK( ReferenceFrame::CentreOfMass == coherent.frame() ); + CHECK( false == coherent.hasAnomolousFormFactor() ); + CHECK_THAT( 0., WithinRel( coherent.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 6., WithinRel( coherent.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 55 == coherent.scatteringFunction().inverseLengths().size() ); + CHECK( 55 == coherent.scatteringFunction().values().size() ); + CHECK( 1 == coherent.scatteringFunction().boundaries().size() ); + CHECK( 1 == coherent.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( coherent.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 6., WithinRel( coherent.scatteringFunction().inverseLengths()[54] ) ); + CHECK_THAT( 1., WithinRel( coherent.scatteringFunction().values()[0] ) ); + CHECK_THAT( 6.282400e-6, WithinRel( coherent.scatteringFunction().values()[54] ) ); + CHECK( 54 == coherent.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == coherent.scatteringFunction().interpolants()[0] ); + CHECK( true == coherent.scatteringFunction().isLinearised() ); + CHECK( std::nullopt == coherent.realAnomolousFormFactor() ); + CHECK( std::nullopt == coherent.imaginaryAnomolousFormFactor() ); + + CHECK( 1 == products[2].size() ); + CHECK( id::ParticleID( "g" ) == products[2][0].identifier() ); + CHECK( true == products[2][0].isLinearised() ); + CHECK( false == products[2][0].hasAverageEnergy() ); + CHECK( true == products[2][0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( products[2][0].multiplicity() ) ); + multiplicity = std::get< int >( products[2][0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == products[2][0].averageEnergy() ); + CHECK( std::nullopt != products[2][0].distributionData() ); + CHECK( true == std::holds_alternative< IncoherentDistributionData >( products[2][0].distributionData().value() ) ); + auto incoherent = std::get< IncoherentDistributionData >( products[2][0].distributionData().value() ); + CHECK( DistributionDataType::Incoherent == incoherent.type() ); + CHECK( ReferenceFrame::CentreOfMass == incoherent.frame() ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 8., WithinRel( incoherent.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 21 == incoherent.scatteringFunction().inverseLengths().size() ); + CHECK( 21 == incoherent.scatteringFunction().values().size() ); + CHECK( 1 == incoherent.scatteringFunction().boundaries().size() ); + CHECK( 1 == incoherent.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 8., WithinRel( incoherent.scatteringFunction().inverseLengths()[20] ) ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().values()[0] ) ); + CHECK_THAT( 1., WithinRel( incoherent.scatteringFunction().values()[20] ) ); + CHECK( 20 == incoherent.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == incoherent.scatteringFunction().interpolants()[0] ); + CHECK( true == incoherent.scatteringFunction().isLinearised() ); + + CHECK( 0 == products[3].size() ); + + CHECK( 0 == products[4].size() ); + } // THEN + } // WHEN + + WHEN( "an eprdata12 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.12p" ) ); + + THEN( "reaction products can be derived" ) { + + auto products = format::ace::photoatomic::createReactionProducts( table ); + + CHECK( 6 == products.size() ); + + CHECK( 0 == products[0].size() ); + + CHECK( 1 == products[1].size() ); + CHECK( id::ParticleID( "g" ) == products[1][0].identifier() ); + CHECK( true == products[1][0].isLinearised() ); + CHECK( false == products[1][0].hasAverageEnergy() ); + CHECK( true == products[1][0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( products[1][0].multiplicity() ) ); + auto multiplicity = std::get< int >( products[1][0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == products[1][0].averageEnergy() ); + CHECK( std::nullopt != products[1][0].distributionData() ); + CHECK( true == std::holds_alternative< CoherentDistributionData >( products[1][0].distributionData().value() ) ); + auto coherent = std::get< CoherentDistributionData >( products[1][0].distributionData().value() ); + CHECK( DistributionDataType::Coherent == coherent.type() ); + CHECK( ReferenceFrame::CentreOfMass == coherent.frame() ); + CHECK( false == coherent.hasAnomolousFormFactor() ); + CHECK_THAT( 0., WithinRel( coherent.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( coherent.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 90 == coherent.scatteringFunction().inverseLengths().size() ); + CHECK( 90 == coherent.scatteringFunction().values().size() ); + CHECK( 1 == coherent.scatteringFunction().boundaries().size() ); + CHECK( 1 == coherent.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( coherent.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( coherent.scatteringFunction().inverseLengths()[89] ) ); + CHECK_THAT( 1., WithinRel( coherent.scatteringFunction().values()[0] ) ); + CHECK_THAT( 8.18290e-39, WithinRel( coherent.scatteringFunction().values()[89] ) ); + CHECK( 89 == coherent.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == coherent.scatteringFunction().interpolants()[0] ); + CHECK( true == coherent.scatteringFunction().isLinearised() ); + CHECK( std::nullopt == coherent.realAnomolousFormFactor() ); + CHECK( std::nullopt == coherent.imaginaryAnomolousFormFactor() ); + + CHECK( 1 == products[2].size() ); + CHECK( id::ParticleID( "g" ) == products[2][0].identifier() ); + CHECK( true == products[2][0].isLinearised() ); + CHECK( false == products[2][0].hasAverageEnergy() ); + CHECK( true == products[2][0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( products[2][0].multiplicity() ) ); + multiplicity = std::get< int >( products[2][0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == products[2][0].averageEnergy() ); + CHECK( std::nullopt != products[2][0].distributionData() ); + CHECK( true == std::holds_alternative< IncoherentDistributionData >( products[2][0].distributionData().value() ) ); + auto incoherent = std::get< IncoherentDistributionData >( products[2][0].distributionData().value() ); + CHECK( DistributionDataType::Incoherent == incoherent.type() ); + CHECK( ReferenceFrame::CentreOfMass == incoherent.frame() ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( incoherent.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 94 == incoherent.scatteringFunction().inverseLengths().size() ); + CHECK( 94 == incoherent.scatteringFunction().values().size() ); + CHECK( 1 == incoherent.scatteringFunction().boundaries().size() ); + CHECK( 1 == incoherent.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( incoherent.scatteringFunction().inverseLengths()[93] ) ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().values()[0] ) ); + CHECK_THAT( 1., WithinRel( incoherent.scatteringFunction().values()[93] ) ); + CHECK( 93 == incoherent.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == incoherent.scatteringFunction().interpolants()[0] ); + CHECK( true == incoherent.scatteringFunction().isLinearised() ); + + CHECK( 0 == products[3].size() ); + + CHECK( 0 == products[4].size() ); + + CHECK( 0 == products[5].size() ); + } // THEN + } // WHEN + + WHEN( "an eprdata14 formatted table is given" ) { + + njoy::ACEtk::PhotoatomicTable table( njoy::ACEtk::fromFile( "1000.14p" ) ); + + THEN( "reaction products can be derived" ) { + + auto products = format::ace::photoatomic::createReactionProducts( table ); + + CHECK( 6 == products.size() ); + + CHECK( 0 == products[0].size() ); + + CHECK( 1 == products[1].size() ); + CHECK( id::ParticleID( "g" ) == products[1][0].identifier() ); + CHECK( true == products[1][0].isLinearised() ); + CHECK( false == products[1][0].hasAverageEnergy() ); + CHECK( true == products[1][0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( products[1][0].multiplicity() ) ); + auto multiplicity = std::get< int >( products[1][0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == products[1][0].averageEnergy() ); + CHECK( std::nullopt != products[1][0].distributionData() ); + CHECK( true == std::holds_alternative< CoherentDistributionData >( products[1][0].distributionData().value() ) ); + auto coherent = std::get< CoherentDistributionData >( products[1][0].distributionData().value() ); + CHECK( DistributionDataType::Coherent == coherent.type() ); + CHECK( ReferenceFrame::CentreOfMass == coherent.frame() ); + CHECK( false == coherent.hasAnomolousFormFactor() ); + CHECK_THAT( 0., WithinRel( coherent.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( coherent.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 90 == coherent.scatteringFunction().inverseLengths().size() ); + CHECK( 90 == coherent.scatteringFunction().values().size() ); + CHECK( 1 == coherent.scatteringFunction().boundaries().size() ); + CHECK( 1 == coherent.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( coherent.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( coherent.scatteringFunction().inverseLengths()[89] ) ); + CHECK_THAT( 1., WithinRel( coherent.scatteringFunction().values()[0] ) ); + CHECK_THAT( 8.18290e-39, WithinRel( coherent.scatteringFunction().values()[89] ) ); + CHECK( 89 == coherent.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == coherent.scatteringFunction().interpolants()[0] ); + CHECK( true == coherent.scatteringFunction().isLinearised() ); + CHECK( std::nullopt == coherent.realAnomolousFormFactor() ); + CHECK( std::nullopt == coherent.imaginaryAnomolousFormFactor() ); + + CHECK( 1 == products[2].size() ); + CHECK( id::ParticleID( "g" ) == products[2][0].identifier() ); + CHECK( true == products[2][0].isLinearised() ); + CHECK( false == products[2][0].hasAverageEnergy() ); + CHECK( true == products[2][0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( products[2][0].multiplicity() ) ); + multiplicity = std::get< int >( products[2][0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == products[2][0].averageEnergy() ); + CHECK( std::nullopt != products[2][0].distributionData() ); + CHECK( true == std::holds_alternative< IncoherentDistributionData >( products[2][0].distributionData().value() ) ); + auto incoherent = std::get< IncoherentDistributionData >( products[2][0].distributionData().value() ); + CHECK( DistributionDataType::Incoherent == incoherent.type() ); + CHECK( ReferenceFrame::CentreOfMass == incoherent.frame() ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( incoherent.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 94 == incoherent.scatteringFunction().inverseLengths().size() ); + CHECK( 94 == incoherent.scatteringFunction().values().size() ); + CHECK( 1 == incoherent.scatteringFunction().boundaries().size() ); + CHECK( 1 == incoherent.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( incoherent.scatteringFunction().inverseLengths()[93] ) ); + CHECK_THAT( 0., WithinRel( incoherent.scatteringFunction().values()[0] ) ); + CHECK_THAT( 1., WithinRel( incoherent.scatteringFunction().values()[93] ) ); + CHECK( 93 == incoherent.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == incoherent.scatteringFunction().interpolants()[0] ); + CHECK( true == incoherent.scatteringFunction().isLinearised() ); + + CHECK( 0 == products[3].size() ); + + CHECK( 0 == products[4].size() ); + + CHECK( 0 == products[5].size() ); + } // THEN + } // WHEN + } // GIVEN +} // SCENARIO diff --git a/src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp b/src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp index 32b14aa..b171148 100644 --- a/src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp +++ b/src/dryad/format/ace/test/photoatomic/test_verification_functions.hpp @@ -39,7 +39,7 @@ void verifyMcplib84PhotonCoherentReaction( const Reaction& reaction ) { CHECK( id::ReactionID( "502" ) == reaction.identifier() ); CHECK( ReactionType::Primary == reaction.type() ); - CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.hasProducts() ); CHECK( true == reaction.isLinearised() ); CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); @@ -63,14 +63,44 @@ void verifyMcplib84PhotonCoherentReaction( const Reaction& reaction ) { CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); CHECK( true == reaction.crossSection().isLinearised() ); - CHECK( 0 == reaction.products().size() ); + CHECK( 1 == reaction.products().size() ); + + CHECK( id::ParticleID( "g" ) == reaction.products()[0].identifier() ); + CHECK( true == reaction.products()[0].isLinearised() ); + CHECK( false == reaction.products()[0].hasAverageEnergy() ); + CHECK( true == reaction.products()[0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( reaction.products()[0].multiplicity() ) ); + auto multiplicity = std::get< int >( reaction.products()[0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == reaction.products()[0].averageEnergy() ); + CHECK( std::nullopt != reaction.products()[0].distributionData() ); + CHECK( true == std::holds_alternative< CoherentDistributionData >( reaction.products()[0].distributionData().value() ) ); + auto data = std::get< CoherentDistributionData >( reaction.products()[0].distributionData().value() ); + CHECK( DistributionDataType::Coherent == data.type() ); + CHECK( ReferenceFrame::CentreOfMass == data.frame() ); + CHECK( false == data.hasAnomolousFormFactor() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 6., WithinRel( data.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 55 == data.scatteringFunction().inverseLengths().size() ); + CHECK( 55 == data.scatteringFunction().values().size() ); + CHECK( 1 == data.scatteringFunction().boundaries().size() ); + CHECK( 1 == data.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 6., WithinRel( data.scatteringFunction().inverseLengths()[54] ) ); + CHECK_THAT( 1., WithinRel( data.scatteringFunction().values()[0] ) ); + CHECK_THAT( 6.282400e-6, WithinRel( data.scatteringFunction().values()[54] ) ); + CHECK( 54 == data.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == data.scatteringFunction().interpolants()[0] ); + CHECK( true == data.scatteringFunction().isLinearised() ); + CHECK( std::nullopt == data.realAnomolousFormFactor() ); + CHECK( std::nullopt == data.imaginaryAnomolousFormFactor() ); } void verifyMcplib84PhotonIncoherentReaction( const Reaction& reaction ) { CHECK( id::ReactionID( "504" ) == reaction.identifier() ); CHECK( ReactionType::Primary == reaction.type() ); - CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.hasProducts() ); CHECK( true == reaction.isLinearised() ); CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); @@ -94,7 +124,34 @@ void verifyMcplib84PhotonIncoherentReaction( const Reaction& reaction ) { CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); CHECK( true == reaction.crossSection().isLinearised() ); - CHECK( 0 == reaction.products().size() ); + CHECK( 1 == reaction.products().size() ); + + CHECK( id::ParticleID( "g" ) == reaction.products()[0].identifier() ); + CHECK( true == reaction.products()[0].isLinearised() ); + CHECK( false == reaction.products()[0].hasAverageEnergy() ); + CHECK( true == reaction.products()[0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( reaction.products()[0].multiplicity() ) ); + auto multiplicity = std::get< int >( reaction.products()[0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == reaction.products()[0].averageEnergy() ); + CHECK( std::nullopt != reaction.products()[0].distributionData() ); + CHECK( true == std::holds_alternative< IncoherentDistributionData >( reaction.products()[0].distributionData().value() ) ); + auto data = std::get< IncoherentDistributionData >( reaction.products()[0].distributionData().value() ); + CHECK( DistributionDataType::Incoherent == data.type() ); + CHECK( ReferenceFrame::CentreOfMass == data.frame() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 8., WithinRel( data.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 21 == data.scatteringFunction().inverseLengths().size() ); + CHECK( 21 == data.scatteringFunction().values().size() ); + CHECK( 1 == data.scatteringFunction().boundaries().size() ); + CHECK( 1 == data.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 8., WithinRel( data.scatteringFunction().inverseLengths()[20] ) ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().values()[0] ) ); + CHECK_THAT( 1., WithinRel( data.scatteringFunction().values()[20] ) ); + CHECK( 20 == data.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == data.scatteringFunction().interpolants()[0] ); + CHECK( true == data.scatteringFunction().isLinearised() ); } void verifyMcplib84PhotonPairProductionReaction( const Reaction& reaction ) { @@ -200,7 +257,7 @@ void verifyEprdata12PhotonCoherentReaction( const Reaction& reaction ) { CHECK( id::ReactionID( "502" ) == reaction.identifier() ); CHECK( ReactionType::Primary == reaction.type() ); - CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.hasProducts() ); CHECK( true == reaction.isLinearised() ); CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); @@ -224,14 +281,44 @@ void verifyEprdata12PhotonCoherentReaction( const Reaction& reaction ) { CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); CHECK( true == reaction.crossSection().isLinearised() ); - CHECK( 0 == reaction.products().size() ); + CHECK( 1 == reaction.products().size() ); + + CHECK( id::ParticleID( "g" ) == reaction.products()[0].identifier() ); + CHECK( true == reaction.products()[0].isLinearised() ); + CHECK( false == reaction.products()[0].hasAverageEnergy() ); + CHECK( true == reaction.products()[0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( reaction.products()[0].multiplicity() ) ); + auto multiplicity = std::get< int >( reaction.products()[0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == reaction.products()[0].averageEnergy() ); + CHECK( std::nullopt != reaction.products()[0].distributionData() ); + CHECK( true == std::holds_alternative< CoherentDistributionData >( reaction.products()[0].distributionData().value() ) ); + auto data = std::get< CoherentDistributionData >( reaction.products()[0].distributionData().value() ); + CHECK( DistributionDataType::Coherent == data.type() ); + CHECK( ReferenceFrame::CentreOfMass == data.frame() ); + CHECK( false == data.hasAnomolousFormFactor() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 90 == data.scatteringFunction().inverseLengths().size() ); + CHECK( 90 == data.scatteringFunction().values().size() ); + CHECK( 1 == data.scatteringFunction().boundaries().size() ); + CHECK( 1 == data.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().inverseLengths()[89] ) ); + CHECK_THAT( 1., WithinRel( data.scatteringFunction().values()[0] ) ); + CHECK_THAT( 8.18290e-39, WithinRel( data.scatteringFunction().values()[89] ) ); + CHECK( 89 == data.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == data.scatteringFunction().interpolants()[0] ); + CHECK( true == data.scatteringFunction().isLinearised() ); + CHECK( std::nullopt == data.realAnomolousFormFactor() ); + CHECK( std::nullopt == data.imaginaryAnomolousFormFactor() ); } void verifyEprdata12PhotonIncoherentReaction( const Reaction& reaction ) { CHECK( id::ReactionID( "504" ) == reaction.identifier() ); CHECK( ReactionType::Primary == reaction.type() ); - CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.hasProducts() ); CHECK( true == reaction.isLinearised() ); CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); @@ -255,7 +342,34 @@ void verifyEprdata12PhotonIncoherentReaction( const Reaction& reaction ) { CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); CHECK( true == reaction.crossSection().isLinearised() ); - CHECK( 0 == reaction.products().size() ); + CHECK( 1 == reaction.products().size() ); + + CHECK( id::ParticleID( "g" ) == reaction.products()[0].identifier() ); + CHECK( true == reaction.products()[0].isLinearised() ); + CHECK( false == reaction.products()[0].hasAverageEnergy() ); + CHECK( true == reaction.products()[0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( reaction.products()[0].multiplicity() ) ); + auto multiplicity = std::get< int >( reaction.products()[0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == reaction.products()[0].averageEnergy() ); + CHECK( std::nullopt != reaction.products()[0].distributionData() ); + CHECK( true == std::holds_alternative< IncoherentDistributionData >( reaction.products()[0].distributionData().value() ) ); + auto data = std::get< IncoherentDistributionData >( reaction.products()[0].distributionData().value() ); + CHECK( DistributionDataType::Incoherent == data.type() ); + CHECK( ReferenceFrame::CentreOfMass == data.frame() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 94 == data.scatteringFunction().inverseLengths().size() ); + CHECK( 94 == data.scatteringFunction().values().size() ); + CHECK( 1 == data.scatteringFunction().boundaries().size() ); + CHECK( 1 == data.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().inverseLengths()[93] ) ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().values()[0] ) ); + CHECK_THAT( 1., WithinRel( data.scatteringFunction().values()[93] ) ); + CHECK( 93 == data.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == data.scatteringFunction().interpolants()[0] ); + CHECK( true == data.scatteringFunction().isLinearised() ); } void verifyEprdata12PhotonPairProductionReaction( const Reaction& reaction ) { @@ -395,7 +509,7 @@ void verifyEprdata14PhotonCoherentReaction( const Reaction& reaction ) { CHECK( id::ReactionID( "502" ) == reaction.identifier() ); CHECK( ReactionType::Primary == reaction.type() ); - CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.hasProducts() ); CHECK( true == reaction.isLinearised() ); CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); @@ -419,14 +533,44 @@ void verifyEprdata14PhotonCoherentReaction( const Reaction& reaction ) { CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); CHECK( true == reaction.crossSection().isLinearised() ); - CHECK( 0 == reaction.products().size() ); + CHECK( 1 == reaction.products().size() ); + + CHECK( id::ParticleID( "g" ) == reaction.products()[0].identifier() ); + CHECK( true == reaction.products()[0].isLinearised() ); + CHECK( false == reaction.products()[0].hasAverageEnergy() ); + CHECK( true == reaction.products()[0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( reaction.products()[0].multiplicity() ) ); + auto multiplicity = std::get< int >( reaction.products()[0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == reaction.products()[0].averageEnergy() ); + CHECK( std::nullopt != reaction.products()[0].distributionData() ); + CHECK( true == std::holds_alternative< CoherentDistributionData >( reaction.products()[0].distributionData().value() ) ); + auto data = std::get< CoherentDistributionData >( reaction.products()[0].distributionData().value() ); + CHECK( DistributionDataType::Coherent == data.type() ); + CHECK( ReferenceFrame::CentreOfMass == data.frame() ); + CHECK( false == data.hasAnomolousFormFactor() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 90 == data.scatteringFunction().inverseLengths().size() ); + CHECK( 90 == data.scatteringFunction().values().size() ); + CHECK( 1 == data.scatteringFunction().boundaries().size() ); + CHECK( 1 == data.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().inverseLengths()[89] ) ); + CHECK_THAT( 1., WithinRel( data.scatteringFunction().values()[0] ) ); + CHECK_THAT( 8.18290e-39, WithinRel( data.scatteringFunction().values()[89] ) ); + CHECK( 89 == data.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == data.scatteringFunction().interpolants()[0] ); + CHECK( true == data.scatteringFunction().isLinearised() ); + CHECK( std::nullopt == data.realAnomolousFormFactor() ); + CHECK( std::nullopt == data.imaginaryAnomolousFormFactor() ); } void verifyEprdata14PhotonIncoherentReaction( const Reaction& reaction ) { CHECK( id::ReactionID( "504" ) == reaction.identifier() ); CHECK( ReactionType::Primary == reaction.type() ); - CHECK( false == reaction.hasProducts() ); + CHECK( true == reaction.hasProducts() ); CHECK( true == reaction.isLinearised() ); CHECK( std::nullopt == reaction.partialReactionIdentifiers() ); @@ -450,7 +594,34 @@ void verifyEprdata14PhotonIncoherentReaction( const Reaction& reaction ) { CHECK( InterpolationType::LinearLinear == reaction.crossSection().interpolants()[0] ); CHECK( true == reaction.crossSection().isLinearised() ); - CHECK( 0 == reaction.products().size() ); + CHECK( 1 == reaction.products().size() ); + + CHECK( id::ParticleID( "g" ) == reaction.products()[0].identifier() ); + CHECK( true == reaction.products()[0].isLinearised() ); + CHECK( false == reaction.products()[0].hasAverageEnergy() ); + CHECK( true == reaction.products()[0].hasDistributionData() ); + CHECK( true == std::holds_alternative< int >( reaction.products()[0].multiplicity() ) ); + auto multiplicity = std::get< int >( reaction.products()[0].multiplicity() ); + CHECK( 1 == multiplicity ); + CHECK( std::nullopt == reaction.products()[0].averageEnergy() ); + CHECK( std::nullopt != reaction.products()[0].distributionData() ); + CHECK( true == std::holds_alternative< IncoherentDistributionData >( reaction.products()[0].distributionData().value() ) ); + auto data = std::get< IncoherentDistributionData >( reaction.products()[0].distributionData().value() ); + CHECK( DistributionDataType::Incoherent == data.type() ); + CHECK( ReferenceFrame::CentreOfMass == data.frame() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().lowerInverseLengthLimit() ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().upperInverseLengthLimit() ) ); + CHECK( 94 == data.scatteringFunction().inverseLengths().size() ); + CHECK( 94 == data.scatteringFunction().values().size() ); + CHECK( 1 == data.scatteringFunction().boundaries().size() ); + CHECK( 1 == data.scatteringFunction().interpolants().size() ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().inverseLengths()[0] ) ); + CHECK_THAT( 1e+9, WithinRel( data.scatteringFunction().inverseLengths()[93] ) ); + CHECK_THAT( 0., WithinRel( data.scatteringFunction().values()[0] ) ); + CHECK_THAT( 1., WithinRel( data.scatteringFunction().values()[93] ) ); + CHECK( 93 == data.scatteringFunction().boundaries()[0] ); + CHECK( InterpolationType::LinearLinear == data.scatteringFunction().interpolants()[0] ); + CHECK( true == data.scatteringFunction().isLinearised() ); } void verifyEprdata14PhotonPairProductionReaction( const Reaction& reaction ) {