@@ -244,16 +244,18 @@ void SensitivityTally::init_results()
244244{
245245 int n_scores = 1 ;
246246 int n_filter_bins = model::tally_sens[sens_].n_bins_ ;
247- results_ = xt::empty<double >({n_filter_bins, n_scores, 3 });
248- previous_results_ = xt::empty<double >({n_filter_bins, n_scores, 1 });
247+ results_ = tensor::Tensor<double >({static_cast <size_t >(n_filter_bins),
248+ static_cast <size_t >(n_scores), size_t {3 }});
249+ previous_results_ = tensor::Tensor<double >({static_cast <size_t >(n_filter_bins),
250+ static_cast <size_t >(n_scores), size_t {1 }});
249251}
250252
251253void SensitivityTally::reset ()
252254{
253255 n_realizations_ = 0 ;
254256 if (results_.size () != 0 ) {
255- xt::view ( results_, xt::all ()) = 0.0 ;
256- xt::view ( previous_results_, xt::all ()) = 0.0 ;
257+ results_. fill ( 0.0 ) ;
258+ previous_results_. fill ( 0.0 ) ;
257259 }
258260}
259261
@@ -357,7 +359,7 @@ TallySensitivity::TallySensitivity(pugi::xml_node node)
357359
358360 // ADD LOGIC TO SET THE SCORE TYPE
359361 auto reaction = get_node_value (node, " reaction" );
360- sens_reaction = reaction_type (reaction);
362+ sens_reaction = reaction_tally_mt (reaction);
361363
362364 } else if (variable_str == " multipole" ) {
363365 variable = SensitivityVariable::MULTIPOLE;
@@ -522,9 +524,9 @@ score_track_sensitivity(Particle& p, double distance)
522524 switch (sens.sens_reaction ) {
523525 case SCORE_TOTAL:
524526 if (sens.sens_nuclide >=0 || sens.sens_element >=0 ){
525- if (p.type () == ParticleType::neutron ) {
527+ if (p.type (). is_neutron () ) {
526528 macro_xs = p.neutron_xs (sens.sens_nuclide ).total * atom_density;
527- } else if (p.type () == ParticleType::photon ) {
529+ } else if (p.type (). is_photon () ) {
528530 macro_xs = p.photon_xs (sens.sens_element ).total * atom_density;
529531 }
530532 } else {
@@ -533,38 +535,38 @@ score_track_sensitivity(Particle& p, double distance)
533535 break ;
534536 case SCORE_SCATTER:
535537 if (sens.sens_nuclide >=0 || sens.sens_element >=0 ){
536- if (p.type () == ParticleType::neutron ) {
538+ if (p.type (). is_neutron () ) {
537539 macro_xs = (p.neutron_xs (sens.sens_nuclide ).total
538540 - p.neutron_xs (sens.sens_nuclide ).absorption ) * atom_density;
539541 } else {
540542 macro_xs = (p.photon_xs (sens.sens_element ).coherent
541543 + p.photon_xs (sens.sens_element ).incoherent ) * atom_density;
542544 }
543545 } else {
544- if (p.type () == ParticleType::neutron ) {
546+ if (p.type (). is_neutron () ) {
545547 macro_xs = p.macro_xs ().total - p.macro_xs ().absorption ;
546548 } else {
547549 macro_xs = p.macro_xs ().coherent + p.macro_xs ().incoherent ;
548550 }
549551 }
550552 break ;
551553 case ELASTIC:
552- if (sens.sens_nuclide >= 0 && p.type () == ParticleType::neutron ) {
554+ if (sens.sens_nuclide >= 0 && p.type (). is_neutron () ) {
553555 if (p.neutron_xs (sens.sens_nuclide ).elastic == CACHE_INVALID)
554556 data::nuclides[sens.sens_nuclide ]->calculate_elastic_xs (p);
555557 macro_xs = p.neutron_xs (sens.sens_nuclide ).elastic * atom_density;
556558 }
557559 break ;
558560 case SCORE_ABSORPTION:
559561 if (sens.sens_nuclide >=0 || sens.sens_element >=0 ){
560- if (p.type () == ParticleType::neutron ) {
562+ if (p.type (). is_neutron () ) {
561563 macro_xs = p.neutron_xs (sens.sens_nuclide ).absorption * atom_density;
562564 } else {
563565 const auto & xs = p.photon_xs (sens.sens_element );
564566 macro_xs = (xs.total - xs.coherent - xs.incoherent ) * atom_density;
565567 }
566568 } else {
567- if (p.type () == ParticleType::neutron ) {
569+ if (p.type (). is_neutron () ) {
568570 macro_xs = p.macro_xs ().absorption ;
569571 } else {
570572 macro_xs = p.macro_xs ().photoelectric + p.macro_xs ().pair_production ;
@@ -602,7 +604,7 @@ score_track_sensitivity(Particle& p, double distance)
602604 case N_3N: m = 4 ; break ;
603605 case N_4N: m = 5 ; break ;
604606 }
605- if (sens.sens_nuclide >= 0 && p.type () == ParticleType::neutron ) {
607+ if (sens.sens_nuclide >= 0 && p.type (). is_neutron () ) {
606608 macro_xs = p.neutron_xs (sens.sens_nuclide ).reaction [m] * atom_density;
607609 }
608610 break ;
@@ -618,7 +620,7 @@ score_track_sensitivity(Particle& p, double distance)
618620 atom_density = model::materials[p.material ()]->atom_density_ (j);
619621 }
620622
621- if (p.type () != ParticleType::photon ) continue ;
623+ if (! p.type (). is_photon () ) continue ;
622624
623625 if (sens.sens_element >= 0 ) {
624626 const auto & micro = p.photon_xs (sens.sens_element );
@@ -630,7 +632,7 @@ score_track_sensitivity(Particle& p, double distance)
630632 }
631633 break ;
632634 default :
633- if (sens.sens_nuclide >= 0 && p.type () == ParticleType::neutron ) {
635+ if (sens.sens_nuclide >= 0 && p.type (). is_neutron () ) {
634636 macro_xs = get_nuclide_xs_sens (p, sens.sens_nuclide , sens.sens_reaction ) * atom_density;
635637 }
636638 break ;
@@ -639,7 +641,7 @@ score_track_sensitivity(Particle& p, double distance)
639641 if (E >= sens.energy_bins_ .front () && E <= sens.energy_bins_ .back ()) {
640642 auto bin = lower_bound_index (sens.energy_bins_ .begin (), sens.energy_bins_ .end (), E);
641643 cumulative_sensitivities[bin] -= distance * macro_xs;
642- if (p.type () == ParticleType::neutron ) {
644+ if (p.type (). is_neutron () ) {
643645 cum_sens[bin] -= distance * macro_xs;
644646 }
645647 }
@@ -788,13 +790,13 @@ void score_collision_sensitivity(Particle& p)
788790 break ;
789791 case COHERENT:
790792 case INCOHERENT:
791- if (p.type () != ParticleType::photon ) continue ;
793+ if (! p.type (). is_photon () ) continue ;
792794 if (p.event_mt () != sens.sens_reaction ) continue ;
793795 score = 1.0 ;
794796 break ;
795797 case PHOTOELECTRIC:
796798 case PAIR_PROD:
797- if (p.type () != ParticleType::photon ) continue ;
799+ if (! p.type (). is_photon () ) continue ;
798800 if (p.event_mt () != sens.sens_reaction ) continue ;
799801 score = 0.0 ;
800802 break ;
@@ -808,7 +810,7 @@ void score_collision_sensitivity(Particle& p)
808810 if (E >= sens.energy_bins_ .front () && E <= sens.energy_bins_ .back ()) {
809811 auto bin = lower_bound_index (sens.energy_bins_ .begin (), sens.energy_bins_ .end (), E);
810812 cumulative_sensitivities[bin] += score;
811- if (p.type () == ParticleType::neutron ) {
813+ if (p.type (). is_neutron () ) {
812814 cum_sens[bin] += score;
813815 }
814816 }
@@ -887,7 +889,7 @@ double get_photon_yield(int i_nuclide, const Particle& p, int score_bin)
887889 return 0.0 ;
888890 // double yield = (*rx.products_[0].yield_)(E_in);
889891 for (int j = 0 ; j < rx.products_ .size (); ++j) {
890- if (rx.products_ [j].particle_ == ParticleType::photon ) {
892+ if (rx.products_ [j].particle_ . is_photon () ) {
891893
892894 // pprod_xs = xs * (*rx.products_[j].yield_)(p.E());
893895 pyld = (*rx.products_ [j].yield_ )(p.E ());
@@ -905,7 +907,7 @@ void score_pprod_sensitivity(Particle& p)
905907 // Void material cannot be perturbed, it will not affect sensitivities.
906908 if (p.material () == MATERIAL_VOID) return ;
907909
908- if (p.type () == ParticleType::photon ) return ;
910+ if (p.type (). is_photon () ) return ;
909911
910912 // Only scattering events produce secondary photons
911913 if (p.event () != TallyEvent::SCATTER) return ;
0 commit comments