From 6d3317d9b74958d550773e50d33d6847957d0441 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Fri, 27 Sep 2024 20:09:32 -0600 Subject: [PATCH] Fix copyright and Save() method --- singularity-opac/constants/constants.hpp | 2 +- singularity-opac/neutrinos/brt_neutrinos.hpp | 2 +- .../neutrinos/gray_opacity_neutrinos.hpp | 2 +- .../neutrinos/mean_neutrino_variant.hpp | 8 ++++++- .../neutrinos/neutrino_variant.hpp | 2 +- .../neutrinos/non_cgs_neutrinos.hpp | 8 ++++++- .../neutrinos/spiner_opac_neutrinos.hpp | 3 ++- .../neutrinos/tophat_emissivity_neutrinos.hpp | 2 +- .../epbremsstrahlung_opacity_photons.hpp | 2 +- .../photons/gray_opacity_photons.hpp | 2 +- .../photons/mean_photon_variant.hpp | 22 ++++++++++++------- singularity-opac/photons/non_cgs_photons.hpp | 6 +++++ singularity-opac/photons/photon_variant.hpp | 2 +- test/test_mean_opacities.cpp | 3 ++- 14 files changed, 46 insertions(+), 20 deletions(-) diff --git a/singularity-opac/constants/constants.hpp b/singularity-opac/constants/constants.hpp index 58feff9..b99fe95 100644 --- a/singularity-opac/constants/constants.hpp +++ b/singularity-opac/constants/constants.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/singularity-opac/neutrinos/brt_neutrinos.hpp b/singularity-opac/neutrinos/brt_neutrinos.hpp index 35b086a..9138084 100644 --- a/singularity-opac/neutrinos/brt_neutrinos.hpp +++ b/singularity-opac/neutrinos/brt_neutrinos.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/singularity-opac/neutrinos/gray_opacity_neutrinos.hpp b/singularity-opac/neutrinos/gray_opacity_neutrinos.hpp index 93c6d15..830615e 100644 --- a/singularity-opac/neutrinos/gray_opacity_neutrinos.hpp +++ b/singularity-opac/neutrinos/gray_opacity_neutrinos.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/singularity-opac/neutrinos/mean_neutrino_variant.hpp b/singularity-opac/neutrinos/mean_neutrino_variant.hpp index d6c77c3..488085b 100644 --- a/singularity-opac/neutrinos/mean_neutrino_variant.hpp +++ b/singularity-opac/neutrinos/mean_neutrino_variant.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. @@ -101,6 +101,12 @@ class MeanVariant { inline void Finalize() noexcept { return mpark::visit([](auto &opac) { return opac.Finalize(); }, opac_); } + +#ifdef SPINER_USE_HDF + void Save(const std::string &filename) const { + return mpark::visit([=](auto &opac) { return opac.Save(filename); }, opac_); + } +#endif }; } // namespace impl diff --git a/singularity-opac/neutrinos/neutrino_variant.hpp b/singularity-opac/neutrinos/neutrino_variant.hpp index 8e3a745..5736077 100644 --- a/singularity-opac/neutrinos/neutrino_variant.hpp +++ b/singularity-opac/neutrinos/neutrino_variant.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/singularity-opac/neutrinos/non_cgs_neutrinos.hpp b/singularity-opac/neutrinos/non_cgs_neutrinos.hpp index 4167f72..400cb2b 100644 --- a/singularity-opac/neutrinos/non_cgs_neutrinos.hpp +++ b/singularity-opac/neutrinos/non_cgs_neutrinos.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. @@ -266,6 +266,12 @@ class MeanNonCGSUnits { PORTABLE_INLINE_FUNCTION int nlambda() const noexcept { return mean_opac_.nlambda(); } +#ifdef SPINER_USE_HDF + void Save(const std::string &filename) const { + return mean_opac_.Save(filename); + } +#endif + PORTABLE_INLINE_FUNCTION Real PlanckMeanAbsorptionCoefficient(const Real rho, const Real temp, const Real Ye, diff --git a/singularity-opac/neutrinos/spiner_opac_neutrinos.hpp b/singularity-opac/neutrinos/spiner_opac_neutrinos.hpp index 2b26dbd..906bb20 100644 --- a/singularity-opac/neutrinos/spiner_opac_neutrinos.hpp +++ b/singularity-opac/neutrinos/spiner_opac_neutrinos.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. @@ -63,6 +63,7 @@ class SpinerOpacity { public: using PC = pc; using DataBox = Spiner::DataBox; + static constexpr Real EPS = 10.0 * std::numeric_limits::min(); static constexpr Real Hz2MeV = pc::h / (1e6 * pc::eV); static constexpr Real MeV2Hz = 1 / Hz2MeV; diff --git a/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp b/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp index 2831052..bfb024b 100644 --- a/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp +++ b/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp b/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp index 077f629..725681d 100644 --- a/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp +++ b/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2022. Triad National Security, LLC. All rights reserved. This +// © 2022-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/singularity-opac/photons/gray_opacity_photons.hpp b/singularity-opac/photons/gray_opacity_photons.hpp index c6bb1a0..dcca68c 100644 --- a/singularity-opac/photons/gray_opacity_photons.hpp +++ b/singularity-opac/photons/gray_opacity_photons.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/singularity-opac/photons/mean_photon_variant.hpp b/singularity-opac/photons/mean_photon_variant.hpp index 857efc3..a259db4 100644 --- a/singularity-opac/photons/mean_photon_variant.hpp +++ b/singularity-opac/photons/mean_photon_variant.hpp @@ -69,6 +69,16 @@ class MeanVariant { opac_); } + PORTABLE_INLINE_FUNCTION RuntimePhysicalConstants + GetRuntimePhysicalConstants() const { + return mpark::visit( + [=](const auto &opac) { + using PC = typename std::decay_t::PC; + return singularity::GetRuntimePhysicalConstants(PC()); + }, + opac_); + } + PORTABLE_INLINE_FUNCTION Real PlanckMeanAbsorptionCoefficient(const Real rho, const Real temp) const { return mpark::visit( @@ -90,15 +100,11 @@ class MeanVariant { return mpark::visit([](auto &opac) { return opac.Finalize(); }, opac_); } - PORTABLE_INLINE_FUNCTION RuntimePhysicalConstants - GetRuntimePhysicalConstants() const { - return mpark::visit( - [=](const auto &opac) { - using PC = typename std::decay_t::PC; - return singularity::GetRuntimePhysicalConstants(PC()); - }, - opac_); +#ifdef SPINER_USE_HDF + void Save(const std::string &filename) const { + return mpark::visit([=](auto &opac) { return opac.Save(filename); }, opac_); } +#endif }; } // namespace impl diff --git a/singularity-opac/photons/non_cgs_photons.hpp b/singularity-opac/photons/non_cgs_photons.hpp index e22c3e7..e128cf9 100644 --- a/singularity-opac/photons/non_cgs_photons.hpp +++ b/singularity-opac/photons/non_cgs_photons.hpp @@ -254,6 +254,12 @@ class MeanNonCGSUnits { PORTABLE_INLINE_FUNCTION int nlambda() const noexcept { return mean_opac_.nlambda(); } +#ifdef SPINER_USE_HDF + void Save(const std::string &filename) const { + return mean_opac_.Save(filename); + } +#endif + PORTABLE_INLINE_FUNCTION Real PlanckMeanAbsorptionCoefficient(const Real rho, const Real temp) const { const Real alpha = mean_opac_.PlanckMeanAbsorptionCoefficient( diff --git a/singularity-opac/photons/photon_variant.hpp b/singularity-opac/photons/photon_variant.hpp index ef53b4d..3386b8d 100644 --- a/singularity-opac/photons/photon_variant.hpp +++ b/singularity-opac/photons/photon_variant.hpp @@ -1,5 +1,5 @@ // ====================================================================== -// © 2021. Triad National Security, LLC. All rights reserved. This +// © 2021-2024. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. diff --git a/test/test_mean_opacities.cpp b/test/test_mean_opacities.cpp index 026114a..ad0fa40 100644 --- a/test/test_mean_opacities.cpp +++ b/test/test_mean_opacities.cpp @@ -447,7 +447,8 @@ TEST_CASE("Mean photon opacities", "[MeanPhotons]") { #ifdef SPINER_USE_HDF THEN("We can save to disk and reload") { mean_opac.Save(grayname); - photons::MeanOpacityCGS mean_opac_host_load(grayname); + photons::MeanOpacity mean_opac_host_load = + photons::impl::MeanOpacity(grayname); AND_THEN("The reloaded table matches the gray opacities") { auto mean_opac_load = mean_opac_host_load.GetOnDevice();