Skip to content

Commit

Permalink
Fix copyright and Save() method
Browse files Browse the repository at this point in the history
  • Loading branch information
brryan committed Sep 28, 2024
1 parent b7668f2 commit 6d3317d
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 20 deletions.
2 changes: 1 addition & 1 deletion singularity-opac/constants/constants.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion singularity-opac/neutrinos/brt_neutrinos.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion singularity-opac/neutrinos/gray_opacity_neutrinos.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 7 additions & 1 deletion singularity-opac/neutrinos/mean_neutrino_variant.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion singularity-opac/neutrinos/neutrino_variant.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 7 additions & 1 deletion singularity-opac/neutrinos/non_cgs_neutrinos.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion singularity-opac/neutrinos/spiner_opac_neutrinos.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -63,6 +63,7 @@ class SpinerOpacity {
public:
using PC = pc;
using DataBox = Spiner::DataBox<Real>;

static constexpr Real EPS = 10.0 * std::numeric_limits<Real>::min();
static constexpr Real Hz2MeV = pc::h / (1e6 * pc::eV);
static constexpr Real MeV2Hz = 1 / Hz2MeV;
Expand Down
2 changes: 1 addition & 1 deletion singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion singularity-opac/photons/gray_opacity_photons.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
22 changes: 14 additions & 8 deletions singularity-opac/photons/mean_photon_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<decltype(opac)>::PC;
return singularity::GetRuntimePhysicalConstants(PC());
},
opac_);
}

PORTABLE_INLINE_FUNCTION Real
PlanckMeanAbsorptionCoefficient(const Real rho, const Real temp) const {
return mpark::visit(
Expand All @@ -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<decltype(opac)>::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
Expand Down
6 changes: 6 additions & 0 deletions singularity-opac/photons/non_cgs_photons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion singularity-opac/photons/photon_variant.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 2 additions & 1 deletion test/test_mean_opacities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6d3317d

Please sign in to comment.