Make incoherent XS polymorphic in MixedElasticAE

This commit is contained in:
Paul Romano 2021-10-20 06:53:20 -05:00
parent edf023adb9
commit 4e611f59b9
3 changed files with 6 additions and 6 deletions

View file

@ -160,7 +160,7 @@ public:
//
//! \param[in] group HDF5 group
explicit MixedElasticAE(
hid_t group, const CoherentElasticXS& coh_xs, const Tabulated1D& incoh_xs);
hid_t group, const CoherentElasticXS& coh_xs, const Function1D& incoh_xs);
//! Sample distribution for an angle and energy
//! \param[in] E_in Incoming energy in [eV]
@ -175,7 +175,7 @@ private:
unique_ptr<AngleEnergy> incoherent_dist_; //!< Incoherent distribution
const CoherentElasticXS& coherent_xs_; //!< Ref. to coherent XS
const Tabulated1D& incoherent_xs_; //!< Ref. to incoherent XS
const Function1D& incoherent_xs_; //!< Polymorphic ref. to incoherent XS
};
} // namespace openmc

View file

@ -337,7 +337,7 @@ void IncoherentInelasticAE::sample(
//==============================================================================
MixedElasticAE::MixedElasticAE(
hid_t group, const CoherentElasticXS& coh_xs, const Tabulated1D& incoh_xs)
hid_t group, const CoherentElasticXS& coh_xs, const Function1D& incoh_xs)
: coherent_dist_(coh_xs), coherent_xs_(coh_xs), incoherent_xs_(incoh_xs)
{
// Read incoherent elastic distribution
@ -347,8 +347,9 @@ MixedElasticAE::MixedElasticAE(
if (temp == "incoherent_elastic") {
incoherent_dist_ = make_unique<IncoherentElasticAE>(incoherent_group);
} else if (temp == "incoherent_elastic_discrete") {
auto xs = dynamic_cast<const Tabulated1D*>(&incoh_xs);
incoherent_dist_ =
make_unique<IncoherentElasticAEDiscrete>(incoherent_group, incoh_xs.x());
make_unique<IncoherentElasticAEDiscrete>(incoherent_group, xs->x());
}
close_group(incoherent_group);
}

View file

@ -221,8 +221,7 @@ ThermalData::ThermalData(hid_t group)
auto mixed_xs = dynamic_cast<Sum1D*>(elastic_.xs.get());
const auto& coh_xs =
dynamic_cast<const CoherentElasticXS*>(mixed_xs->functions(0).get());
const auto& incoh_xs =
dynamic_cast<const Tabulated1D*>(mixed_xs->functions(1).get());
const auto& incoh_xs = mixed_xs->functions(1).get();
// Create mixed elastic distribution
elastic_.distribution =