tstTransitionSystem_Gen.cpp

./Core/ts/tests/tstTransitionSystem_Gen.cpp

#include <algorithm>
#include <iomanip>
#include "Nemesis/gtest/nemesis_gtest.hh"
#include "ScaleData/Core/Utils.h"
typedef std::vector<std::string> Vec_Str;
TEST( Species_Gen, Accessors )
{
const int ref_id = 92235;
const int ref_charge_number = 92;
const int ref_mass_number = 235;
const double ref_mass = 235.1;
const std::string ref_name = "SPECIES(92235)";
// basic setters
species.set_charge_number( ref_charge_number );
species.set_mass_number( ref_mass_number );
species.set_mass( ref_mass );
EXPECT_EQ( ref_charge_number, species.charge_number() );
EXPECT_EQ( ref_mass_number, species.mass_number() );
EXPECT_FLOAT_EQ( ref_mass, species.mass() );
// not allowed to set these
EXPECT_ANY_THROW( { species.set_id( ref_id ); } );
EXPECT_ANY_THROW( { species.set_name( ref_name ); } );
EXPECT_EQ( ref_id, species.id() );
EXPECT_EQ( ref_name, species.name() );
int id;
species.get_id( id );
EXPECT_EQ( ref_id, id );
std::string name;
species.get_name( name );
EXPECT_EQ( ref_name, name );
int mass_number;
species.get_mass_number( mass_number );
EXPECT_EQ( ref_mass_number, mass_number );
int charge_number;
species.get_charge_number( charge_number );
EXPECT_EQ( ref_charge_number, charge_number );
double mass;
species.get_mass( mass );
EXPECT_FLOAT_EQ( ref_mass, mass );
}
TEST( Species_Gen, Copies )
{
const int ref_charge_number = 92;
const int ref_mass_number = 235;
const double ref_mass = 235.1;
// basic setters
species.set_charge_number( ref_charge_number );
species.set_mass_number( ref_mass_number );
species.set_mass( ref_mass );
Origen::Species_Gen species2( species );
Origen::Species_Gen species3 = species;
// check that all are copies
EXPECT_EQ( ref_charge_number, species2.charge_number() );
EXPECT_EQ( ref_charge_number, species3.charge_number() );
EXPECT_EQ( ref_mass_number, species2.mass_number() );
EXPECT_EQ( ref_mass_number, species3.mass_number() );
EXPECT_EQ( ref_mass, species2.mass() );
EXPECT_EQ( ref_mass, species3.mass() );
// change one and see others not change
species3.set_mass( 235.9 );
EXPECT_FLOAT_EQ( ref_mass, species.mass() );
EXPECT_FLOAT_EQ( ref_mass, species2.mass() );
// check ids
EXPECT_EQ( species.id(), species2.id() );
EXPECT_EQ( species.id(), species3.id() );
// check mass
EXPECT_NE( species.mass(), species3.mass() );
}
TEST( Species_Gen, SmartPointers )
{
const int ref_charge_number = 92;
const int ref_mass_number = 235;
const double ref_mass = 235.1;
// basic setters
species->set_charge_number( ref_charge_number );
species->set_mass_number( ref_mass_number );
species->set_mass( ref_mass );
*dynamic_cast<Origen::Species_Gen*>( &( *species ) ) ) );
// smart pointer to same data
Origen::Species::SP species3 = species;
// check that data is the same
EXPECT_EQ( ref_charge_number, species->charge_number() );
EXPECT_EQ( ref_charge_number, species2->charge_number() );
EXPECT_EQ( ref_charge_number, species3->charge_number() );
// change copy and check the others don't change
species3->set_mass( 235.9 );
EXPECT_FLOAT_EQ( ref_mass, species2->mass() );
EXPECT_NE( ref_mass, species3->mass() );
EXPECT_NE( ref_mass, species->mass() );
// the real check of pointer locations
EXPECT_EQ( &( *species ), &( *species3 ) );
EXPECT_NE( &( *species ), &( *species2 ) );
// set 3=2
species3 = species2;
EXPECT_NE( &( *species ), &( *species2 ) );
// set 1=3
species = species3;
EXPECT_EQ( &( *species ), &( *species2 ) );
// all ids should be equal now
EXPECT_EQ( species->id(), species2->id() );
EXPECT_EQ( species->id(), species3->id() );
}
TEST( Species_Gen, InitAndErrors )
{
EXPECT_ERRORS( species );
species->set_charge_number( 45 );
species->set_mass_number( 108 );
EXPECT_ERRORS( species );
species->set_mass( 108.0 );
EXPECT_NO_ERRORS( species );
}
TEST( Field_Gen, Accessors )
{
{
field->set_species( species );
field->set_intensity( 1.e13 );
EXPECT_EQ( "NEUTRON", field->species()->name() ) << field->to_string();
EXPECT_FLOAT_EQ( 1.e13, field->intensity() )
<< field->to_json().toStyledString();
s = field->species();
EXPECT_SAME_ACCESSOR_RESULT( field, double, intensity );
EXPECT_TRUE( field->is_initialized() );
EXPECT_NO_ERRORS( field );
}
// testing that SP has preserved values
EXPECT_EQ( Origen::NEUTRON_MASS, s->mass() );
EXPECT_EQ( Origen::NEUTRON_MASS_NUMBER, s->mass_number() );
EXPECT_EQ( Origen::NEUTRON_CHARGE_NUMBER, s->charge_number() );
}
TEST( ChannelType_Decay, DataCheck )
{
// expects t to be channel type
EXPECT_DECAY_DELTA( ScaleData::Utils::DECAY_BETA_MINUS, 1, 0, "beta-" );
EXPECT_DECAY_DELTA( ScaleData::Utils::DECAY_BETA_PLUS, -1, 0, "beta+" );
EXPECT_DECAY_DELTA( ScaleData::Utils::DECAY_NEUTRON, 0, -1, "neutron" );
EXPECT_DECAY_DELTA( ScaleData::Utils::DECAY_PROTON, -1, -1, "proton" );
EXPECT_DECAY_DELTA( ScaleData::Utils::DECAY_GAMMA, 0, 0, "gamma" );
ScaleData::Utils::DECAY_ISOMERIC_TRANSITION, 0, 0, "i.t." );
EXPECT_DECAY_DELTA( ScaleData::Utils::DECAY_ALPHA, -2, -4, "alpha" );
// double
int a_bp = ScaleData::Utils::join_decay_mode_list(
ScaleData::Utils::chain_decay_modes(
2,
ScaleData::Utils::DECAY_ALPHA,
ScaleData::Utils::DECAY_BETA_PLUS ) );
EXPECT_DECAY_DELTA( a_bp, -3, -4, "alpha,beta+" );
// triple
int bm_p = ScaleData::Utils::join_decay_mode_list(
ScaleData::Utils::chain_decay_modes( 2,
ScaleData::Utils::DECAY_BETA_MINUS,
ScaleData::Utils::DECAY_PROTON ) );
EXPECT_DECAY_DELTA( bm_p, 0, -1, "beta-,p" );
}
TEST( ChannelType_Reac, DataCheck )
{
//! NOTE: additional supported reactions should be added here
EXPECT_REACTION_DELTA( 4, 0, 0, "n,n'" );
EXPECT_REACTION_DELTA( 16, 0, -1, "n,2n" );
EXPECT_REACTION_DELTA( 17, 0, -2, "n,3n" );
EXPECT_REACTION_DELTA( 18, 0, 1, "n,f" );
EXPECT_REACTION_DELTA( 22, -2, -4, "n,na" );
EXPECT_REACTION_DELTA( 23, -6, -12, "n,n3a" );
EXPECT_REACTION_DELTA( 24, -2, -5, "n,2na" );
EXPECT_REACTION_DELTA( 25, -2, -6, "n,3na" );
EXPECT_REACTION_DELTA( 28, -1, -1, "n,np" );
EXPECT_REACTION_DELTA( 29, -4, -8, "n,n2a" );
EXPECT_REACTION_DELTA( 32, -1, -2, "n,nd" );
EXPECT_REACTION_DELTA( 33, -1, -3, "n,nt" );
EXPECT_REACTION_DELTA( 34, -2, -3, "n,nhe-3" );
EXPECT_REACTION_DELTA( 37, 0, -3, "n,4n" );
EXPECT_REACTION_DELTA( 102, 0, 1, "n,g" );
EXPECT_REACTION_DELTA( 103, -1, 0, "n,p" );
EXPECT_REACTION_DELTA( 104, -1, -1, "n,d" );
EXPECT_REACTION_DELTA( 105, -1, -2, "n,t" );
EXPECT_REACTION_DELTA( 106, -2, -2, "n,he-3" );
EXPECT_REACTION_DELTA( 107, -2, -3, "n,a" );
EXPECT_REACTION_DELTA( 108, -4, -7, "n,2a" );
EXPECT_REACTION_DELTA( 111, -2, -1, "n,2p" );
EXPECT_REACTION_DELTA( 112, -3, -4, "n,pa" );
}
TEST( ChannelType_Decay, Throws )
{
// can't specify reaction with decay
EXPECT_ANY_THROW( {
t->set_reaction_mt( 102 );
} );
// can't specify field with decay
EXPECT_ANY_THROW( {
t->set_field( n );
} );
}
TEST( ChannelType_Reac, Throws )
{
// can't specify decay mode with reaction
EXPECT_ANY_THROW( {
t->set_decay_mode( 34 );
} );
}
TEST( ChannelType_Decay, CanonicalizeDecayMode )
{
EXPECT_EQ( 345, t->decay_mode() ) << t->to_string();
}
// various error conditions
TEST( ChannelType_Reac, InitAndErrors )
{
EXPECT_FALSE( t->is_initialized() );
EXPECT_FALSE( t->has_initialized_reaction_mt() );
EXPECT_TRUE( t->has_initialized_decay_mode() );
EXPECT_EQ( 0, t->decay_mode() );
// bad mts
t->set_reaction_mt( 2 );
EXPECT_TRUE( t->has_initialized_reaction_mt() );
t->set_reaction_mt( 27 );
t->set_reaction_mt( 101 );
// good mt but no field
t->set_reaction_mt( 102 );
EXPECT_FALSE( t->is_initialized() );
EXPECT_FALSE( t->has_initialized_field() );
// add field
t->set_field( neutron_field );
EXPECT_TRUE( t->has_initialized_field() );
EXPECT_TRUE( t->is_initialized() );
// should be golden
}
TEST( ChannelType_Decay, InitAndErrors )
{
// nasty decay mode
int bm_sf_p = ScaleData::Utils::join_decay_mode_list(
ScaleData::Utils::chain_decay_modes(
3,
ScaleData::Utils::DECAY_BETA_MINUS,
ScaleData::Utils::DECAY_SPONTANEOUS_FISSION,
ScaleData::Utils::DECAY_PROTON ) );
EXPECT_FALSE( t->is_initialized() );
EXPECT_FALSE( t->has_initialized_decay_mode() );
EXPECT_TRUE( t->has_initialized_reaction_mt() );
EXPECT_TRUE( t->has_initialized_field() );
EXPECT_EQ( -1, t->reaction_mt() );
ASSERT_TRUE( t->field() != nullptr );
// check field
{
t->get_field( field );
EXPECT_EQ( "NULL_FIELD", field->name() );
// note: can't do normal EXPECT_SAME_ACCESSOR_RESULT
// because decay doesn't store a smart pointer to
// a null field, it just creates it each time
}
// bad mts
t->set_decay_mode( bm_sf_p );
EXPECT_TRUE( t->has_initialized_decay_mode() );
t->set_decay_mode( 0 );
// std::cout << t->to_string() << std::endl;
t->set_decay_mode( 2 );
// should be golden
}
TEST( Nuclide_Gen, Accessors )
{
EXPECT_ERRORS( nuclide );
Origen::Species::SP species( new Origen::Species_Gen( 92, 235, 235.1 ) );
nuclide->set_species( species );
EXPECT_NO_ERRORS( species );
// std::cout << nuclide->to_string() << std::endl;
}
void get_channel_type_list_10( std::vector<Origen::ChannelType::SP>& list )
{
field->set_intensity( 1.0 );
// convenience for this block
list.push_back( SP( new Origen::ChannelType_Reac( field, 16 ) ) );
list.push_back( SP( new Origen::ChannelType_Reac( field, 17 ) ) );
list.push_back( SP( new Origen::ChannelType_Fiss( field ) ) );
list.push_back( SP( new Origen::ChannelType_Reac( field, 102 ) ) );
list.push_back( SP( new Origen::ChannelType_Reac( field, 103 ) ) );
list.push_back( SP( new Origen::ChannelType_Reac( field, 104 ) ) );
list.push_back( SP( new Origen::ChannelType_Reac( field, 105 ) ) );
list.push_back( SP( new Origen::ChannelType_Reac( field, 106 ) ) );
list.push_back( SP( new Origen::ChannelType_Reac( field, 107 ) ) );
list.push_back( SP( new Origen::ChannelType_Decay( 2 ) ) );
list.push_back( SP( new Origen::ChannelType_Decay( 3 ) ) );
}
TEST( Channel_Gen, InitAndErrors )
{
EXPECT_EQ( Origen::BAD_INT, channel->id() );
EXPECT_EQ( Origen::BAD_INT, channel->daughter_mass_number() );
EXPECT_EQ( Origen::BAD_INT, channel->daughter_charge_number() );
EXPECT_ERRORS( channel );
channel->set_channel_type( channel_type1 );
EXPECT_ERRORS( channel );
channel->set_parent( &*nuclide );
EXPECT_ERRORS( channel );
Origen::Species::SP species( new Origen::Species_Gen( 10, 20, 20.0 ) );
nuclide->set_species( species );
EXPECT_ERRORS( channel );
nuclide->set_system( &*system );
EXPECT_NO_ERRORS( nuclide );
// mode=0 gives no byproducts
channel->channel_type()->set_decay_mode( 0 );
EXPECT_NO_ERRORS( channel );
// decay constant
channel->set_decay_constant( Origen::BAD_DOUBLE );
EXPECT_ERRORS( channel );
// back to good
channel->set_decay_constant( 0.0 );
EXPECT_NO_ERRORS( channel );
// switch to reaction
Origen::Field::SP field = system->add_field( Origen::NEUTRON_FIELD );
new Origen::ChannelType_Reac( field, 102 ) );
channel->set_channel_type( channel_type );
channel->set_xs( Origen::BAD_DOUBLE );
EXPECT_ERRORS( channel );
// back to good
channel->set_xs( 12.0 );
channel->add_transition( 0 )->set_yield( 1.0 );
EXPECT_NO_ERRORS( channel );
EXPECT_TRUE( channel->to_string() != "" );
}
TEST( Channel_Gen, Coverage )
{
Origen::Nuclide::SP nuclide = ts.add_nuclide( 0, 92, 235 );
Origen::Channel::SP channel = nuclide->add_loss( 6 ); // decay
Origen::Transition::SP transition = channel->add_transition( 0 );
// Here we are checking that we have consistency with different
// ways of accessing things and setting things.
ASSERT_TRUE( transition != nullptr );
ASSERT_TRUE( channel->transition( 0 ) != nullptr );
EXPECT_EQ( transition, channel->transition( 0 ) );
channel->get_transition( 0, transition2 );
ASSERT_TRUE( transition2 != nullptr );
EXPECT_EQ( transition, transition2 );
// add some more transitions
transition = channel->add_transition( 1 );
transition2 = channel->add_transition( 2 );
EXPECT_EQ( transition, channel->add_transition( 1 ) );
transition2->set_yield( 0.33 );
channel->set_transition( transition2 );
EXPECT_EQ( 0.33, channel->transition( 2 )->yield() );
EXPECT_EQ( transition2, channel->transition( 2 ) );
channel->set_decay_constant( 0.1 );
channel->transition( 0 )->set_yield( 0.44 );
channel->transition( 1 )->set_yield( 0.23 );
nuclide->set_num( 2.0 );
// decay channel
// rate = num * decay_constant
// coeff = decay_constant
// decay transition
// rate = num * decay_constant * yield
// coeff = decay_constant * yield
{
EXPECT_FLOAT_EQ( 2.0 * 0.1, channel->rate() );
EXPECT_FLOAT_EQ( 0.1, channel->coeff() );
EXPECT_FLOAT_EQ( 2.0 * 0.1 * 0.23, channel->transition( 1 )->rate() );
EXPECT_FLOAT_EQ( 0.1 * 0.23, channel->transition( 1 )->coeff() );
}
channel = nuclide->add_loss( Origen::NEUTRON_FIELD, 27 );
channel->set_xs( 5.5 );
channel->channel_type()->field()->set_intensity( 13.7 );
// reaction channel
// rate = num * xs * intensity
// coeff = xs * intensity
// reaction transition
// rate = num * xs * intensity * yield
// coeff = xs * intensity * yield
{
EXPECT_FLOAT_EQ( 2.0 * 5.5 * 13.7, channel->rate() );
EXPECT_FLOAT_EQ( 5.5 * 13.7, channel->coeff() );
channel->add_transition( 0 )->set_yield( 0.55 );
EXPECT_FLOAT_EQ( 2.0 * 5.5 * 13.7 * 0.55,
channel->transition( 0 )->rate() );
EXPECT_FLOAT_EQ( 5.5 * 13.7 * 0.55, channel->transition( 0 )->coeff() );
}
// tests channel_type() vs. get_channel_type()
EXPECT_RETURN_EQ( channel, Origen::ChannelType::SP, channel_type );
channel->add_transition( 1 )->set_yield( 0.45 );
// tests transitions() vs. get_transitions()
// tests byproduct_transitions() vs. get_byproduct_transitions()
channel, Origen::Transition::SP, byproduct_transitions );
}
std::vector<int> get_library_nuclide_list()
{
static const int a[] = {
10001001, 10001002, 10001003, 10002003, 10002004, 10002005, 10002006,
10003006, 10003007, 10003008, 10004007, 10004008, 10004009, 10004010,
10004011, 10005010, 10005011, 10005012, 10006012, 10006013, 10006014,
10006015, 10007013, 10007014, 10007015, 10007016, 10008016, 10008017,
10008018, 10008019, 10009019, 10009020, 10010020, 10010021, 10010022,
10010023, 10011022, 10011023, 10011024, 11011024, 10011025, 10012024,
10012025, 10012026, 10012027, 10012028, 10013026, 10013027, 10013028,
10013029, 10013030, 10014028, 10014029, 10014030, 10014031, 10014032,
10015031, 10015032, 10015033, 10015034, 10016032, 10016033, 10016034,
10016035, 10016036, 10016037, 10017035, 10017036, 10017037, 10017038,
11017038, 10018036, 10018037, 10018038, 10018039, 10018040, 10018041,
10018042, 10019039, 10019040, 10019041, 10019042, 10019043, 10019044,
10020040, 10020041, 10020042, 10020043, 10020044, 10020045, 10020046,
10020047, 10020048, 10020049, 10021044, 11021044, 10021045, 11021045,
10021046, 11021046, 10021047, 10021048, 10021049, 10021050, 10022044,
10022045, 10022046, 10022047, 10022048, 10022049, 10022050, 10022051,
10023048, 10023049, 10023050, 10023051, 10023052, 10023053, 10023054,
10024048, 10024049, 10024050, 10024051, 10024052, 10024053, 10024054,
10024055, 10025052, 10025053, 10025054, 10025055, 10025056, 10025057,
10025058, 10026054, 10026055, 10026056, 10026057, 10026058, 10026059,
10026060, 10027055, 10027056, 10027057, 11027058, 10027058, 10027059,
10027060, 11027060, 10027061, 10027062, 10028056, 10028057, 10028058,
10028059, 10028060, 10028061, 10028062, 10028063, 10028064, 10028065,
10028066, 10029062, 10029063, 10029064, 10029065, 10029066, 10029067,
10030063, 10030064, 10030065, 10030066, 10030067, 10030068, 10030069,
11030069, 10030070, 10030071, 11030071, 10030072, 10031067, 10031068,
10031069, 10031070, 10031071, 10031072, 10032068, 10032069, 10032070,
10032071, 11032071, 10032072, 10032073, 10032074, 10032075, 11032075,
10032076, 10032077, 11032077, 10033071, 10033072, 10033073, 10033074,
10033075, 11033075, 10033076, 10033077, 10034072, 10034073, 10034074,
10034075, 10034076, 10034077, 11034077, 10034078, 10034079, 11034079,
10034080, 10034081, 11034081, 10034082, 10034083, 11034083, 10035076,
10035077, 11035077, 10035078, 10035079, 10035080, 11035080, 10035081,
10035082, 11035082, 10035083, 10036076, 10036077, 10036078, 10036079,
11036079, 10036080, 10036081, 11036081, 10036082, 10036083, 11036083,
10036084, 10036085, 11036085, 10036086, 10036087, 10036088, 10037082,
10037083, 10037084, 10037085, 10037086, 11037086, 10037087, 10037088,
10037089, 10038082, 10038083, 10038084, 10038085, 11038085, 10038086,
10038087, 11038087, 10038088, 10038089, 10038090, 10038091, 10038093,
10039086, 10039087, 11039087, 10039088, 10039089, 11039089, 10039090,
11039090, 10039091, 11039091, 10039092, 10039093, 11039093, 10039094,
10039096, 10040086, 10040087, 10040088, 10040089, 10040090, 10040091,
10040092, 10040093, 10040094, 10040095, 10040096, 10040097, 10041090,
10041091, 11041091, 10041092, 11041092, 10041093, 11041093, 10041094,
10041095, 11041095, 10041096, 10041097, 11041097, 10041098, 10041100,
10042092, 11042093, 10042093, 10042094, 10042095, 10042096, 10042097,
10042098, 10042099, 10042100, 10042101, 10043095, 11043095, 10043096,
10043097, 11043097, 10043098, 10043099, 11043099, 10043100, 10043101,
10044096, 10044097, 10044098, 10044099, 10044100, 10044101, 10044102,
10044103, 10044104, 10044105, 10044106, 10044107, 10045099, 11045099,
10045100, 10045101, 11045101, 10045102, 11045102, 10045103, 11045103,
10045104, 11045104, 10045105, 11045105, 10045106, 11045106, 10045107,
10046100, 10046101, 10046102, 10046103, 10046104, 10046105, 10046106,
10046107, 11046107, 10046108, 10046109, 11046109, 10046110, 10046111,
11046111, 10046112, 10047105, 10047106, 11047106, 10047107, 11047107,
10047108, 11047108, 10047109, 11047109, 10047110, 11047110, 10047111,
11047111, 10047112, 10048106, 10048107, 10048108, 10048109, 10048110,
10048111, 11048111, 10048112, 10048113, 11048113, 10048114, 10048115,
11048115, 10048116, 10048117, 11048117, 10048119, 10048121, 10049111,
10049112, 10049113, 11049113, 10049114, 11049114, 10049115, 11049115,
10049116, 11049116, 10049117, 11049117, 10049118, 10049119, 11049119,
10049120, 11049120, 10049121, 11049121, 10050112, 10050113, 11050113,
10050114, 10050115, 10050116, 10050117, 11050117, 10050118, 10050119,
11050119, 10050120, 10050121, 11050121, 10050122, 10050123, 11050123,
10050124, 10050125, 11050125, 10050126, 10051118, 10051119, 10051120,
11051120, 10051121, 10051122, 11051122, 10051123, 10051124, 11051124,
10051125, 10051126, 11051126, 10051127, 10052118, 10052119, 11052119,
10052120, 10052121, 11052121, 10052122, 10052123, 11052123, 10052124,
10052125, 11052125, 10052126, 10052127, 11052127, 10052128, 10052129,
11052129, 10052130, 10052131, 11052131, 10052132, 10053122, 10053123,
10053124, 10053125, 10053126, 10053127, 10053128, 10053129, 10053130,
11053130, 10053131, 10053132, 10053133, 10054122, 10054123, 10054124,
10054125, 11054125, 10054126, 10054127, 11054127, 10054128, 10054129,
11054129, 10054130, 10054131, 11054131, 10054132, 10054133, 11054133,
10054134, 10054135, 11054135, 10054136, 10054137, 10055128, 10055129,
10055130, 10055131, 10055132, 10055133, 10055134, 11055134, 10055135,
10055136, 10055137, 10055138, 10056128, 10056129, 10056130, 10056131,
11056131, 10056132, 10056133, 11056133, 10056134, 10056135, 11056135,
10056136, 11056136, 10056137, 11056137, 10056138, 10056139, 10056140,
10056141, 10057134, 10057135, 10057136, 10057137, 10057138, 10057139,
10057140, 10057141, 10058134, 10058135, 10058136, 10058137, 11058137,
10058138, 10058139, 11058139, 10058140, 10058141, 10058142, 10058143,
10058144, 10058145, 10059140, 10059141, 10059142, 11059142, 10059143,
10059144, 11059144, 10059145, 10060140, 10060141, 10060142, 10060143,
10060144, 10060145, 10060146, 10060147, 10060148, 10060149, 10060150,
10060151, 10061143, 10061144, 10061145, 10061146, 10061147, 10061148,
11061148, 10061149, 10061150, 10061151, 10061152, 10062144, 10062145,
10062146, 10062147, 10062148, 10062149, 10062150, 10062151, 10062152,
10062153, 10062154, 10062155, 10063145, 10063146, 10063147, 10063148,
10063149, 10063150, 11063150, 10063151, 10063152, 11063152, 10063153,
10063154, 10063155, 10063156, 10063157, 10064146, 10064147, 10064148,
10064149, 10064150, 10064151, 10064152, 10064153, 11064153, 10064154,
11064155, 10064155, 10064156, 10064157, 10064158, 10064159, 10064160,
10064161, 10064162, 10065152, 10065153, 10065154, 11065154, 10065155,
10065156, 11065156, 10065157, 10065158, 10065159, 10065160, 10065161,
10065162, 10066154, 10066155, 10066156, 10066157, 10066158, 10066159,
10066160, 10066161, 10066162, 10066163, 10066164, 10066165, 11066165,
10066166, 10067160, 11067160, 10067161, 10067163, 11067163, 10067164,
11067164, 10067165, 10067166, 11067166, 10068160, 10068161, 10068162,
10068163, 10068164, 10068165, 10068166, 10068167, 11068167, 10068168,
10068169, 10068170, 10068171, 10068172, 10069165, 10069166, 10069167,
10069168, 10069169, 10069170, 10069171, 10069172, 10069173, 10070166,
10070167, 10070168, 10070169, 10070170, 10070171, 10070172, 10070173,
10070174, 10070175, 11070175, 10070176, 10070177, 10071169, 10071170,
10071171, 10071172, 10071173, 10071174, 11071174, 10071175, 10071176,
11071176, 10071177, 11071177, 10072170, 10072171, 10072172, 10072173,
10072174, 10072175, 10072176, 10072177, 10072178, 11072178, 10072179,
11072179, 10072180, 11072180, 10072181, 10072182, 10073177, 10073178,
10073179, 11073180, 10073180, 10073181, 10073182, 11073182, 10073183,
10074178, 10074180, 10074181, 10074182, 11074183, 10074183, 10074184,
10074185, 11074185, 10074186, 10074187, 10074188, 10074189, 10075181,
10075182, 11075182, 10075183, 10075184, 11075184, 10075185, 10075186,
11075186, 10075187, 10075188, 11075188, 10075189, 10076182, 10076183,
10076184, 10076185, 10076186, 10076187, 10076188, 10076189, 11076189,
10076190, 11076190, 10076191, 11076191, 10076192, 10076193, 10076194,
10077185, 10077186, 10077188, 10077189, 11077189, 10077190, 10077191,
11077191, 10077192, 11077192, 10077193, 11077193, 10077194, 11077194,
10077196, 11077196, 10078188, 10078189, 10078190, 10078191, 10078192,
10078193, 11078193, 10078194, 10078195, 11078195, 10078196, 10078197,
11078197, 10078198, 10078199, 11078199, 10078200, 10079193, 10079194,
10079195, 11079195, 10079196, 10079197, 10079198, 11079198, 10079199,
11079199, 10079200, 11079200, 10080193, 11080193, 10080194, 10080195,
11080195, 10080196, 10080197, 11080197, 10080198, 10080199, 11080199,
10080200, 10080201, 10080202, 10080203, 10080204, 10080205, 10080206,
10081200, 10081201, 10081202, 10081203, 10081204, 10081205, 10081206,
10081207, 10082200, 10082202, 10082203, 10082204, 10082205, 11082205,
10082206, 10082207, 11082207, 10082208, 10082209, 10082210, 10083205,
10083206, 10083207, 10083208, 10083209, 10083210, 11083210, 10083211,
10084206, 10084207, 10084208, 10084209, 10084210, 10084211, 11084211,
20002003, 20002004, 20003006, 20003007, 20004007, 20006012, 20080206,
20081203, 20081205, 20081206, 20081207, 20081208, 20081209, 20081210,
20082203, 20082204, 20082205, 20082206, 20082207, 21082207, 20082208,
20082209, 20082210, 20082211, 20082212, 20082214, 20083206, 20083207,
20083208, 20083209, 21083210, 20083210, 20083211, 20083212, 21083212,
20083213, 20083214, 20084207, 20084208, 20084209, 20084210, 21084211,
20084211, 20084212, 20084213, 20084214, 20084215, 20084216, 20084218,
20085216, 20085217, 20085218, 20086216, 20086217, 20086218, 20086219,
20086220, 20086222, 20087220, 20087221, 20087222, 20087223, 20088220,
20088222, 20088223, 20088224, 20088225, 20088226, 20088227, 20088228,
20089224, 20089225, 20089226, 20089227, 20089228, 20090226, 20090227,
20090228, 20090229, 20090230, 20090231, 20090232, 20090233, 20090234,
20091228, 20091229, 20091230, 20091231, 20091232, 20091233, 21091234,
20091234, 20091235, 20092230, 20092231, 20092232, 20092233, 20092234,
20092235, 20092236, 20092237, 20092238, 20092239, 20092240, 20092241,
20093234, 20093235, 21093236, 20093236, 20093237, 20093238, 20093239,
21093240, 20093240, 20093241, 20094236, 21094237, 20094237, 20094238,
20094239, 20094240, 20094241, 20094242, 20094243, 20094244, 20094245,
20094246, 20094247, 20095239, 20095240, 20095241, 21095242, 20095242,
20095243, 21095244, 20095244, 20095245, 20095246, 20095247, 20096240,
20096241, 20096242, 20096243, 20096244, 20096245, 20096246, 20096247,
20096248, 20096249, 20096250, 20096251, 20097245, 20097246, 20097247,
20097248, 21097248, 20097249, 20097250, 20097251, 20098246, 20098248,
20098249, 20098250, 20098251, 20098252, 20098253, 20098254, 20098255,
20099251, 20099252, 20099253, 21099254, 20099254, 20099255, 30001003,
30002003, 30002004, 30026065, 30027065, 30028065, 30029065, 30024066,
30025066, 30026066, 30027066, 30028066, 30029066, 30030066, 30031066,
30032066, 30024067, 30025067, 30026067, 30027067, 30028067, 30029067,
30030067, 30031067, 30032067, 30025068, 30026068, 30027068, 30028068,
30029068, 31029068, 30030068, 30031068, 30032068, 30025069, 30026069,
30027069, 30028069, 30029069, 30030069, 31030069, 30031069, 30032069,
30033069, 30026070, 30027070, 30028070, 30029070, 31029070, 30030070,
30031070, 30032070, 30026071, 30027071, 30028071, 30029071, 30030071,
31030071, 30031071, 30032071, 31032071, 30033071, 30026072, 30027072,
30028072, 30029072, 30030072, 30031072, 30032072, 30033072, 30034072,
30027073, 30028073, 30029073, 30030073, 30031073, 30032073, 31032073,
30033073, 30034073, 31034073, 30027074, 30028074, 30029074, 30030074,
30031074, 31031074, 30032074, 30033074, 30034074, 30027075, 30028075,
30029075, 30030075, 30031075, 30032075, 31032075, 30033075, 31033075,
30034075, 30035075, 30028076, 30029076, 30030076, 30031076, 30032076,
30033076, 30034076, 30028077, 30029077, 30030077, 30031077, 30032077,
31032077, 30033077, 30034077, 31034077, 30035077, 31035077, 30036077,
30028078, 30029078, 30030078, 30031078, 30032078, 30033078, 30034078,
30035078, 30036078, 30029079, 30030079, 30031079, 30032079, 31032079,
30033079, 30034079, 31034079, 30035079, 31035079, 30036079, 31036079,
30037079, 30029080, 30030080, 30031080, 30032080, 30033080, 30034080,
30035080, 31035080, 30036080, 30030081, 30031081, 30032081, 31032081,
30033081, 30034081, 31034081, 30035081, 30036081, 31036081, 30037081,
30030082, 30031082, 30032082, 30033082, 31033082, 30034082, 30035082,
31035082, 30036082, 30030083, 30031083, 30032083, 30033083, 30034083,
31034083, 30035083, 30036083, 31036083, 30037083, 30038083, 30031084,
30032084, 30033084, 30034084, 30035084, 31035084, 30036084, 30037084,
30038084, 30031085, 30032085, 30033085, 30034085, 30035085, 30036085,
31036085, 30037085, 30038085, 31038085, 30039085, 30031086, 30032086,
30033086, 30034086, 30035086, 30036086, 30037086, 31037086, 30038086,
30032087, 30033087, 30034087, 30035087, 30036087, 30037087, 30038087,
31038087, 30039087, 31039087, 30040087, 30032088, 30033088, 30034088,
30035088, 30036088, 30037088, 30038088, 30039088, 30040088, 30032089,
30033089, 30034089, 30035089, 30036089, 30037089, 30038089, 30039089,
31039089, 30040089, 31040089, 30041089, 30033090, 30034090, 30035090,
30036090, 30037090, 31037090, 30038090, 30039090, 31039090, 30040090,
31040090, 30041090, 30042090, 30033091, 30034091, 30035091, 30036091,
30037091, 30038091, 30039091, 31039091, 30040091, 30041091, 31041091,
30042091, 30033092, 30034092, 30035092, 30036092, 30037092, 30038092,
30039092, 30040092, 30041092, 31041092, 30042092, 30034093, 30035093,
30036093, 30037093, 30038093, 30039093, 31039093, 30040093, 30041093,
31041093, 30042093, 31042093, 30043093, 30034094, 30035094, 30036094,
30037094, 30038094, 30039094, 30040094, 30041094, 31041094, 30042094,
30035095, 30036095, 30037095, 30038095, 30039095, 30040095, 30041095,
31041095, 30042095, 30043095, 31043095, 30044095, 30035096, 30036096,
30037096, 30038096, 30039096, 31039096, 30040096, 30041096, 30042096,
30043096, 30044096, 30035097, 30036097, 30037097, 30038097, 30039097,
31039097, 30040097, 30041097, 31041097, 30042097, 30043097, 31043097,
30044097, 30036098, 30037098, 30038098, 30039098, 31039098, 30040098,
30041098, 31041098, 30042098, 30043098, 30044098, 30036099, 30037099,
30038099, 30039099, 30040099, 30041099, 31041099, 30042099, 30043099,
31043099, 30044099, 30045099, 31045099, 30046099, 30036100, 30037100,
30038100, 30039100, 30040100, 30041100, 31041100, 30042100, 30043100,
30044100, 30037101, 30038101, 30039101, 30040101, 30041101, 30042101,
30043101, 30044101, 30045101, 31045101, 30046101, 30037102, 30038102,
30039102, 30040102, 30041102, 31041102, 30042102, 30043102, 31043102,
30044102, 30045102, 31045102, 30046102, 30038103, 30039103, 30040103,
30041103, 30042103, 30043103, 30044103, 30045103, 31045103, 30046103,
30047103, 30038104, 30039104, 30040104, 30041104, 31041104, 30042104,
30043104, 30044104, 30045104, 31045104, 30046104, 30038105, 30039105,
30040105, 30041105, 30042105, 30043105, 30044105, 30045105, 31045105,
30046105, 30047105, 31047105, 30048105, 30039106, 30040106, 30041106,
30042106, 30043106, 30044106, 30045106, 31045106, 30046106, 30047106,
31047106, 30048106, 30039107, 30040107, 30041107, 30042107, 30043107,
30044107, 30045107, 30046107, 31046107, 30047107, 31047107, 30048107,
30049107, 30039108, 30040108, 30041108, 30042108, 30043108, 30044108,
30045108, 31045108, 30046108, 30047108, 31047108, 30048108, 30040109,
30041109, 30042109, 30043109, 30044109, 30045109, 30046109, 31046109,
30047109, 31047109, 30048109, 30049109, 30040110, 30041110, 30042110,
30043110, 30044110, 30045110, 31045110, 30046110, 30047110, 31047110,
30048110, 30041111, 30042111, 30043111, 30044111, 30045111, 30046111,
31046111, 30047111, 31047111, 30048111, 31048111, 30049111, 31049111,
30050111, 30041112, 30042112, 30043112, 30044112, 30045112, 30046112,
30047112, 30048112, 30049112, 31049112, 30050112, 30041113, 30042113,
30043113, 30044113, 30045113, 30046113, 30047113, 31047113, 30048113,
31048113, 30049113, 31049113, 30050113, 31050113, 30051113, 30042114,
30043114, 30044114, 30045114, 30046114, 30047114, 30048114, 30049114,
31049114, 30050114, 30042115, 30043115, 30044115, 30045115, 30046115,
30047115, 31047115, 30048115, 31048115, 30049115, 31049115, 30050115,
30051115, 31051115, 30052115, 30043116, 30044116, 30045116, 30046116,
30047116, 31047116, 30048116, 30049116, 31049116, 30050116, 30043117,
30044117, 30045117, 30046117, 30047117, 31047117, 30048117, 31048117,
30049117, 31049117, 30050117, 31050117, 30051117, 30052117, 30043118,
30044118, 30045118, 30046118, 30047118, 31047118, 30048118, 30049118,
31049118, 30050118, 30051118, 31051118, 30052118, 30044119, 30045119,
30046119, 30047119, 30048119, 31048119, 30049119, 31049119, 30050119,
31050119, 30051119, 30052119, 30044120, 30045120, 30046120, 30047120,
31047120, 30048120, 30049120, 31049120, 30050120, 30051120, 31051120,
30052120, 30045121, 30046121, 30047121, 30048121, 31048121, 30049121,
31049121, 30050121, 31050121, 30051121, 30052121, 31052121, 30053121,
30045122, 30046122, 30047122, 31047122, 30048122, 30049122, 31049122,
30050122, 30051122, 31051122, 30052122, 30046123, 30047123, 30048123,
31048123, 30049123, 31049123, 30050123, 31050123, 30051123, 30052123,
31052123, 30053123, 30046124, 30047124, 30048124, 30049124, 31049124,
30050124, 30051124, 31051124, 30052124, 30053124, 30054124, 30047125,
30048125, 30049125, 31049125, 30050125, 31050125, 30051125, 30052125,
31052125, 30053125, 30054125, 31054125, 30047126, 30048126, 30049126,
31049126, 30050126, 30051126, 31051126, 30052126, 30053126, 30054126,
30047127, 30048127, 30049127, 31049127, 30050127, 31050127, 30051127,
30052127, 31052127, 30053127, 30054127, 31054127, 30055127, 30047128,
30048128, 30049128, 31049128, 30050128, 31050128, 30051128, 31051128,
30052128, 30053128, 30054128, 30047129, 30048129, 30049129, 31049129,
30050129, 31050129, 30051129, 30052129, 31052129, 30053129, 30054129,
31054129, 30055129, 30056129, 30047130, 30048130, 30049130, 31049130,
30050130, 31050130, 30051130, 31051130, 30052130, 30053130, 31053130,
30054130, 30048131, 30049131, 31049131, 30050131, 31050131, 30051131,
30052131, 31052131, 30053131, 30054131, 31054131, 30055131, 30056131,
30048132, 30049132, 30050132, 30051132, 31051132, 30052132, 30053132,
31053132, 30054132, 30055132, 30056132, 30049133, 30050133, 30051133,
30052133, 31052133, 30053133, 31053133, 30054133, 31054133, 30055133,
30056133, 30057133, 30049134, 30050134, 30051134, 31051134, 30052134,
30053134, 31053134, 30054134, 31054134, 30055134, 31055134, 30056134,
30049135, 30050135, 30051135, 30052135, 30053135, 30054135, 31054135,
30055135, 31055135, 30056135, 31056135, 30057135, 30058135, 30050136,
30051136, 30052136, 30053136, 31053136, 30054136, 30055136, 31055136,
30056136, 31056136, 30050137, 30051137, 30052137, 30053137, 30054137,
30055137, 30056137, 31056137, 30057137, 30058137, 30051138, 30052138,
30053138, 30054138, 30055138, 31055138, 30056138, 30057138, 30058138,
30051139, 30052139, 30053139, 30054139, 30055139, 30056139, 30057139,
30058139, 31058139, 30059139, 30052140, 30053140, 30054140, 30055140,
30056140, 30057140, 30058140, 30059140, 30060140, 30052141, 30053141,
30054141, 30055141, 30056141, 30057141, 30058141, 30059141, 30060141,
30061141, 30052142, 30053142, 30054142, 30055142, 30056142, 30057142,
30058142, 30059142, 31059142, 30060142, 30053143, 30054143, 30055143,
30056143, 30057143, 30058143, 30059143, 30060143, 30061143, 30062143,
31062143, 30053144, 30054144, 30055144, 30056144, 30057144, 30058144,
30059144, 31059144, 30060144, 30061144, 30062144, 30054145, 30055145,
30056145, 30057145, 30058145, 30059145, 30060145, 30061145, 30062145,
30054146, 30055146, 30056146, 30057146, 31057146, 30058146, 30059146,
30060146, 30061146, 30062146, 30054147, 30055147, 30056147, 30057147,
30058147, 30059147, 30060147, 30061147, 30062147, 30063147, 30064147,
30055148, 30056148, 30057148, 30058148, 30059148, 31059148, 30060148,
30061148, 31061148, 30062148, 30055149, 30056149, 30057149, 30058149,
30059149, 30060149, 30061149, 30062149, 30063149, 30064149, 30055150,
30056150, 30057150, 30058150, 30059150, 30060150, 30061150, 30062150,
30055151, 30056151, 30057151, 30058151, 30059151, 30060151, 30061151,
30062151, 30063151, 30064151, 30065151, 30056152, 30057152, 30058152,
30059152, 30060152, 30061152, 31061152, 30062152, 30063152, 31063152,
30064152, 30056153, 30057153, 30058153, 30059153, 30060153, 30061153,
30062153, 30063153, 30064153, 31064153, 30065153, 30057154, 30058154,
30059154, 30060154, 30061154, 31061154, 30062154, 30063154, 31063154,
30064154, 30057155, 30058155, 30059155, 30060155, 30061155, 30062155,
30063155, 30064155, 31064155, 30065155, 30066155, 30058156, 30059156,
30060156, 30061156, 30062156, 30063156, 30064156, 30065156, 31065156,
30066156, 30058157, 30059157, 30060157, 30061157, 30062157, 30063157,
30064157, 30065157, 30066157, 30059158, 30060158, 30061158, 30062158,
30063158, 30064158, 30065158, 31065158, 30066158, 30059159, 30060159,
30061159, 30062159, 30063159, 30064159, 30065159, 30066159, 30067159,
31067159, 30060160, 30061160, 30062160, 30063160, 30064160, 30065160,
30066160, 30060161, 30061161, 30062161, 30063161, 30064161, 30065161,
30066161, 30067161, 31067161, 30068161, 30061162, 30062162, 30063162,
30064162, 30065162, 30066162, 30067162, 31067162, 30068162, 30061163,
30062163, 30063163, 30064163, 30065163, 30066163, 30067163, 31067163,
30068163, 30062164, 30063164, 30064164, 30065164, 30066164, 30067164,
31067164, 30068164, 30062165, 30063165, 30064165, 30065165, 30066165,
31066165, 30067165, 30068165, 30069165, 30063166, 30064166, 30065166,
30066166, 30067166, 31067166, 30068166, 30069166, 30070166, 30063167,
30064167, 30065167, 30066167, 30067167, 30068167, 31068167, 30069167,
30070167, 30064168, 30065168, 30066168, 30067168, 30068168, 30069168,
30070168, 30064169, 30065169, 30066169, 30067169, 30068169, 30069169,
30070169, 31070169, 30071169, 31071169, 30065170, 30066170, 30067170,
31067170, 30068170, 30069170, 30070170, 30065171, 30066171, 30067171,
30068171, 30069171, 30070171, 30071171, 31071171, 30072171, 30066172,
30067172, 30068172, 30069172, 30070172, 30071172, 31071172, 30072172};
std::vector<int> ids( a, a + sizeof( a ) / sizeof( a[0] ) );
return ids;
}
void unique_nuclides( std::vector<int>& ids )
{
std::vector<int> all_ids = get_library_nuclide_list();
std::set<int> set;
int s, i, z, a;
for( size_t j = 0; j < all_ids.size(); ++j )
{
ScaleData::Utils::split_pizzzaaa( all_ids[j], s, i, z, a );
int izzzaaa;
ScaleData::Utils::join_pizzzaaa( izzzaaa, 0, i, z, a );
set.insert( izzzaaa );
}
ids.clear();
ids.assign( set.begin(), set.end() );
}
void fp_nuclides( std::vector<int>& ids )
{
std::vector<int> all_ids = get_library_nuclide_list();
std::set<int> set;
int s, i, z, a;
for( size_t j = 0; j < all_ids.size(); ++j )
{
ScaleData::Utils::split_pizzzaaa( all_ids[j], s, i, z, a );
if( s != 3 ) continue;
int izzzaaa;
ScaleData::Utils::join_pizzzaaa( izzzaaa, 0, i, z, a );
set.insert( izzzaaa );
}
ids.clear();
ids.assign( set.begin(), set.end() );
}
class TransitionSystem_Gen_Setup : public ::testing::Test
{
public:
std::vector<Origen::ChannelType::SP> ct_list;
std::vector<int> ids, fp_ids;
void SetUp()
{
fp_nuclides( fp_ids );
ref_num_transitions = 147089;
ref_num_nuclides = 4164;
max_isomeric_state = 1;
nt = 0;
int s, i, z, a;
for( size_t j = 0; j < ids.size(); ++j )
{
ScaleData::Utils::split_pizzzaaa( ids[j], s, i, z, a );
Check( s == 0 );
Origen::Species::SP species = ts.add_species( z, a );
Origen::Nuclide::SP nuclide = ts.add_nuclide( i, species );
for( size_t k = 0; k < ct_list.size(); ++k )
{
if( ct_list[k]->reaction_mt() == 18 )
{
if( z >= 90 )
{
nuclide->add_loss( ct_list[k] );
std::vector<Origen::Transition::SP> transitions;
transitions.reserve( fp_ids.size() );
for( size_t f = 0; f < fp_ids.size(); ++f )
{
ScaleData::Utils::split_pizzzaaa(
fp_ids[f], s, i, z, a );
ts.add_species( z, a );
ts.add_nuclide( i, pspecies );
new Origen::Transition_Gen( &*product ) );
transition->set_yield( 0.01 + f / 2000. );
transitions.push_back( transition );
}
channel->set_transitions( transitions );
EXPECT_EQ( static_cast<int>( transitions.size() ),
channel->num_transitions() );
nt += channel->num_transitions();
}
}
else
{
// test this channel first to see it gives a physical result
new Origen::Channel_Gen( ct_list[k] ) );
channel->set_parent( &*nuclide );
if( channel->daughter_mass_number() >= 1 &&
channel->daughter_charge_number() >= 1 &&
channel->daughter_mass_number() >=
channel->daughter_charge_number() )
{
channel->add_transition( 0 )->set_yield( 0.6 );
channel->add_transition( 1 )->set_yield( 0.4 );
nuclide->set_loss( channel );
EXPECT_EQ( max_isomeric_state + 1,
channel->num_transitions() )
<< channel->to_string();
nt += channel->num_transitions();
}
}
}
}
}
};
{
EXPECT_EQ( ref_num_transitions, nt ) << "num_transitions=" << nt
<< std::endl;
EXPECT_EQ( ref_num_nuclides, (int)ts.num_nuclides() );
}
{
EXPECT_EQ( ref_num_transitions, nt ) << "num_transitions=" << nt
<< std::endl;
EXPECT_EQ( ref_num_nuclides, (int)ts.num_nuclides() );
std::vector<Origen::Nuclide::SP> nuclides;
std::vector<Origen::Channel::SP> losses;
std::vector<Origen::Transition::SP> transitions;
nt = 0;
nuclides = ts.nuclides();
for( size_t j = 0; j < nuclides.size(); ++j )
{
nuclide = nuclides[j];
losses = nuclide->losses();
for( size_t k = 0; k < losses.size(); ++k )
{
channel = losses[k];
transitions = channel->transitions();
for( size_t f = 0; f < transitions.size(); ++f )
{
transition = transitions[f];
double yield = transition->yield();
(void)yield;
// std::cout << transition->yield() << std::endl;
++nt;
EXPECT_NO_ERRORS( transition );
}
EXPECT_NO_ERRORS( channel );
}
EXPECT_NO_ERRORS( nuclide );
}
EXPECT_EQ( ref_num_transitions, nt );
}
TEST_F( TransitionSystem_Gen_Setup, LoopVectorTiming )
{
EXPECT_EQ( ref_num_transitions, nt ) << "num_transitions=" << nt
<< std::endl;
EXPECT_EQ( ref_num_nuclides, (int)ts.num_nuclides() );
std::vector<Origen::Nuclide::SP> nuclides;
std::vector<Origen::Channel::SP> losses;
std::vector<Origen::Transition::SP> transitions;
nt = 0;
nuclides = ts.nuclides();
for( size_t j = 0; j < nuclides.size(); ++j )
{
nuclide = nuclides[j];
losses = nuclide->losses();
for( size_t k = 0; k < losses.size(); ++k )
{
channel = losses[k];
transitions = channel->transitions();
for( size_t f = 0; f < transitions.size(); ++f )
{
transition = transitions[f];
double yield = transition->yield();
(void)yield;
// std::cout << transition->yield() << std::endl;
++nt;
}
}
}
EXPECT_EQ( ref_num_transitions, nt );
}
{
EXPECT_EQ( ref_num_transitions, nt ) << "num_transitions=" << nt
<< std::endl;
EXPECT_EQ( ref_num_nuclides, (int)ts.num_nuclides() );
std::vector<Origen::Transition::SP> transitions;
// randomize ids
std::random_shuffle( ids.begin(), ids.end() );
// randomize mts
std::vector<int> ct_ids;
for( size_t i = 0; i < ct_list.size(); ++i )
{
ct_ids.push_back( ct_list[i]->id() );
}
std::random_shuffle( ct_ids.begin(), ct_ids.end() );
nt = 0;
for( size_t j = 0; j < ids.size(); ++j )
{
nuclide = ts.nuclide( ids[j] );
Check( nuclide != nullptr );
for( size_t k = 0; k < ct_ids.size(); ++k )
{
channel = nuclide->loss( ct_ids[k] );
if( channel == nullptr ) continue;
transitions = channel->transitions();
for( size_t f = 0; f < transitions.size(); ++f )
{
transition = transitions[f];
double yield = transition->yield();
(void)yield;
// std::cout << transition->yield() << std::endl;
++nt;
}
}
}
EXPECT_EQ( ref_num_transitions, nt );
}
TEST( TransitionSystem_Gen, CircularDependency )
{
// variables to be used below
// main transition system
// nuclide
n = ts->add_nuclide( 0, 92, 235 );
// species
s = n->species();
s->set_mass( 235.1 );
// field
f->set_intensity( 1.0 );
// channel type
// channel
c = n->add_loss( ct );
// set yield for transition to ground state
t = c->add_transition( 0 );
t->set_yield( 0.3 );
// This is how we keep from being able to store the weak pointer
// in a strong and have it deleted automatically and unexpectedly.
// Origen::TransitionSystem::SP ts2 = n->system();
// set yield for transition to first isomeric state
c->add_transition( 1 )->set_yield( 0.7 );
// set masses for U-233 and U-233 m
ts->add_nuclide( 0, 92, 233 )->species()->set_mass( 233.0 );
ts->add_nuclide( 1, 92, 233 )->species()->set_mass( 233.0 );
// add n,gamma
// get us back to U-235, introducing a circular dependency
ts->add_nuclide( 0, 92, 233 )
->add_loss( ct )
->add_transition( 0 )
->set_yield( 1.0 );
ts->add_nuclide( 0, 92, 234 )
->add_loss( ct )
->add_transition( 0 )
->set_yield( 1.0 );
// std::cout << ts->to_string() << std::endl;
}
TEST_F( TransitionSystem_Gen_Setup, PackedLibraryTiming )
{
// populate data
std::vector<double> coeff;
std::vector<int> loc;
std::vector<int> mts;
std::vector<int> num;
coeff.reserve( ref_num_transitions );
loc.reserve( ref_num_transitions );
mts.reserve( ref_num_transitions );
num.reserve( ref_num_nuclides );
{
nt = 0;
std::vector<Origen::Nuclide::SP> nuclides;
std::vector<Origen::Transition::WP> gains;
nuclides = ts.nuclides();
EXPECT_EQ( ref_num_nuclides, (int)nuclides.size() );
for( size_t j = 0; j < nuclides.size(); ++j )
{
nuclide = nuclides[j];
// std::cout << nuclide->id() << std::endl;
gains = nuclide->gains();
for( size_t k = 0; k < gains.size(); ++k )
{
transition = gains[k];
// std::cout << "##2 " <<
// transition->channel()->parent()->id() << "-->
// " <<
// transition->channel()->id()
// << "--> " <<
// transition->product()->id()
// << "--> " <<
// std::endl;
loc.push_back( transition->channel()->parent()->id() );
mts.push_back( transition->channel()->id() );
coeff.push_back( transition->coeff() );
++nt;
}
num.push_back( gains.size() );
}
// std::cout << "nt="<<nt<<std::endl;
}
EXPECT_EQ( ref_num_nuclides, static_cast<int>( num.size() ) );
EXPECT_EQ( ref_num_transitions, static_cast<int>( coeff.size() ) );
}
TEST( Nuclide_Gen, CoeffCheck )
{
Origen::Nuclide::SP fe56 = ts->add_nuclide( 0, 26, 56 );
Origen::Nuclide::SP fe57 = ts->add_nuclide( 0, 26, 57 );
Origen::Nuclide::SP fe57m = ts->add_nuclide( 1, 26, 57 );
double ref_intensity = 1e-10; //#/barn-s
// add a decay channel
fe57m->add_loss( ScaleData::Utils::DECAY_ISOMERIC_TRANSITION )
->set_decay_constant( 1e-2 );
// add a (n,g) channel
c = fe56->add_loss( Origen::NEUTRON_FIELD, 102 );
c->set_xs( 22 );
// add transition to ground (method 1)
t = c->add_transition( 0 );
t->set_yield( 0.97 );
// add transition to isomeric state 1 (method 2)
c->add_transition( 1 )->set_yield( 0.01 );
// add transitions to isomeric state 2 (method 3)
c->add_transition( 2, 0.02 );
// add a (n,2n) channel
fe56->add_loss( Origen::NEUTRON_FIELD, 16 )
->set_xs( 11 )
.add_transition( 0, 1.0 );
// check that the transition we added above created a new nuclide
ASSERT_TRUE( ts->nuclide( 2026057 ) != nullptr );
Origen::Nuclide::SP fe57m2 = ts->nuclide( 2026057 );
EXPECT_EQ( 0.0, fe57m2->decay_constant() );
// add transitions down to lower isomeric states from m2
c = fe57m2->add_loss( ScaleData::Utils::DECAY_ISOMERIC_TRANSITION );
c->set_decay_constant( 1e+5 );
c->add_transition( 0, 0.5 );
c->add_transition( 1, 0.5 );
// set flux intensity
ASSERT_TRUE( ts->field( Origen::NEUTRON_FIELD ) != nullptr );
f->set_intensity( ref_intensity );
// check field id
EXPECT_EQ( Origen::NEUTRON_FIELD, f->id() );
// check reaction channel id
c = fe56->loss( 102 );
ASSERT_TRUE( c != nullptr );
EXPECT_EQ( 102, c->id() );
// check decay channel id
c = fe57m->loss( -4 );
ASSERT_TRUE( c != nullptr );
EXPECT_EQ( -4, c->id() );
// verify that the (n,g) reaction has the same
EXPECT_FLOAT_EQ( ref_intensity, f->intensity() );
EXPECT_FLOAT_EQ( ref_intensity,
fe56->loss( 102 )->channel_type()->field()->intensity() );
ASSERT_TRUE( ts->nuclide( 26055 )->gain( 16, 26056 ) != nullptr );
EXPECT_FLOAT_EQ( 1.1e-09,
ts->nuclide( 26055 )->gain( 16, 26056 )->coeff() );
ASSERT_TRUE( ts->nuclide( 26057 )->gain( 102, 26056 ) != nullptr );
EXPECT_FLOAT_EQ( 2.134e-09,
ts->nuclide( 26057 )->gain( 102, 26056 )->coeff() );
ASSERT_TRUE( ts->nuclide( 1026057 )->gain( 102, 26056 ) != nullptr );
EXPECT_FLOAT_EQ( 2.2e-11,
ts->nuclide( 1026057 )->gain( 102, 26056 )->coeff() );
ASSERT_TRUE( ts->nuclide( 2026057 )->gain( 102, 26056 ) != nullptr );
EXPECT_FLOAT_EQ( 4.4e-11,
ts->nuclide( 2026057 )->gain( 102, 26056 )->coeff() );
ASSERT_TRUE( ts->nuclide( 26057 )->gain( -4, 2026057 ) != nullptr );
EXPECT_FLOAT_EQ( 50000,
ts->nuclide( 26057 )->gain( -4, 2026057 )->coeff() );
ASSERT_TRUE( ts->nuclide( 1026057 )->gain( -4, 2026057 ) != nullptr );
EXPECT_FLOAT_EQ( 50000,
ts->nuclide( 1026057 )->gain( -4, 2026057 )->coeff() );
}
TEST( TransitionSystem_Gen, Byproducts )
{
Origen::Nuclide::SP b10 = ts->add_nuclide( 0, 5, 10 );
b10->species()->set_mass( 10.01 );
f->set_intensity( 1.0 );
c = b10->add_loss( f, 107 );
c->set_xs( 50 );
c->add_transition( 0 )->set_yield( 1.0 );
c = b10->add_loss( f, 17 );
c->set_xs( 2.5 );
c->add_transition( 0 )->set_yield( 0.5 );
// we should have a neutron and alpha byproduct
ASSERT_TRUE( n != nullptr );
Origen::Nuclide::SP a = ts->byproduct( 2004 );
ASSERT_TRUE( a != nullptr );
// we should not have a deuteron
Origen::Nuclide::SP d = ts->byproduct( 1002 );
ASSERT_TRUE( d == nullptr );
EXPECT_EQ( 1u, n->gains().size() );
EXPECT_EQ( 1u, a->gains().size() );
EXPECT_EQ( 17, n->gains()[0]->channel()->channel_type()->reaction_mt() );
EXPECT_EQ( 107, a->gains()[0]->channel()->channel_type()->reaction_mt() );
EXPECT_FLOAT_EQ( 50, a->gains()[0]->coeff() );
EXPECT_FLOAT_EQ( 2.5 * 3, n->gains()[0]->coeff() );
}