Skip to content

Commit

Permalink
shrink the variant in all the translation units
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahm-LANL committed Oct 12, 2023
1 parent fd42d5a commit 58a4f98
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 18 deletions.
4 changes: 1 addition & 3 deletions test/eos_unit_test_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ inline std::string demangle(const char *name) { return name; }
#include <ports-of-call/portability.hpp>
#include <singularity-eos/eos/eos.hpp>

using singularity::EOS;

PORTABLE_INLINE_FUNCTION bool isClose(Real a, Real b, Real eps = 5e-2) {
return fabs(b - a) / (fabs(a + b) + 1e-20) <= eps;
}
Expand All @@ -74,7 +72,7 @@ inline void array_compare(int num, X &&x, Y &&y, Z &&z, ZT &&ztrue, XN xname, YN
}

template<typename E1, typename E2>
inline void compare_two_eoss(const EOS &&test_e, const EOS &&ref_e) {
inline void compare_two_eoss(const E1 &&test_e, const E2 &&ref_e) {
// compare all individual member functions with 1 as inputs,
// this function is meant to catch mis-implementations of
// modifiers that can be initialized in such a way as to
Expand Down
10 changes: 4 additions & 6 deletions test/profile_eos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <spiner/interpolation.hpp>

#include <singularity-eos/eos/eos.hpp>
#include <singularity-eos/eos/eos_builder.hpp>
#include <type_traits>

using namespace singularity;
Expand Down Expand Up @@ -67,6 +66,7 @@ inline double get_duration(Function function) {
TODO(JMM): Only profiles Pressure call
and does not accept lambdas.
*/
template<typename EOS>
inline void get_timing(int ncycles, const ivec &ncells_1d, const double rho_min,
const double rho_max, const double T_min, const double T_max,
const std::string &name, EOS &eos_h) {
Expand Down Expand Up @@ -220,11 +220,9 @@ int main(int argc, char *argv[]) {
<< "Please note that timings are for 1 node and 1 GPU respectively.\n"
<< "Beginning profiling..." << std::endl;

EOSBuilder::EOSType type = EOSBuilder::EOSType::IdealGas;
EOSBuilder::params_t params;
params["Cv"].emplace<Real>(1e7 * 0.716); // specific heat in ergs/(g K)
params["gm1"].emplace<Real>(0.4); // gamma - 1
EOS eos = EOSBuilder::buildEOS(type, params);
constexpr Real Cv = 1e7 * 0.716; // specific heat in ergs/(g K)
constexpr Real gm1 = 0.4; // gamma - 1
auto eos = singularity::IdealGas(gm1, Cv);
get_timing(ncycles, ncells_1d, RHO_MIN, RHO_MAX, T_MIN, T_MAX, "IdealGas", eos);

std::cout << "Done." << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_gruneisen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <singularity-eos/eos/eos.hpp>
#include <test/eos_unit_test_helpers.hpp>

using singularity::EOS;
using singularity::Gruneisen;
using EOS = singularity::Variant<Gruneisen>;

PORTABLE_INLINE_FUNCTION Real QuadFormulaMinus(Real a, Real b, Real c) {
return (-b - std::sqrt(b * b - 4 * a * c)) / (2 * a);
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_ideal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

#include <test/eos_unit_test_helpers.hpp>

using singularity::EOS;
using singularity::IdealGas;
using EOS = singularity::Variant<IdealGas>;

SCENARIO("Ideal gas entropy", "[IdealGas][Entropy]") {
GIVEN("Parameters for an ideal gas with entropy reference states") {
Expand Down
5 changes: 3 additions & 2 deletions test/test_eos_noble_abel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#include <singularity-eos/eos/eos.hpp>
#include <test/eos_unit_test_helpers.hpp>

using singularity::EOS;
using singularity::NobleAbel;
using singularity::IdealGas;
using EOS = singularity::Variant<IdealGas, NobleAbel>;

SCENARIO("NobleAbel1", "[NobleAbel][NobleAbel1]") {
GIVEN("Parameters for a NobleAbel EOS") {
Expand Down Expand Up @@ -361,7 +362,7 @@ SCENARIO("Recover Ideal Gas from NobleAbel", "[NobleAbel][NobleAbel4]") {
// Create the EOS
EOS host_eos = NobleAbel(gm1, Cv, bb, qq);
EOS eos = host_eos.GetOnDevice();
EOS ideal_eos = singularity::IdealGas(gm1, Cv);
EOS ideal_eos = IdealGas(gm1, Cv);
GIVEN("Densities and energies") {
constexpr int num = 1;
#ifdef PORTABILITY_STRATEGY_KOKKOS
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_sap_polynomial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <singularity-eos/eos/eos.hpp>
#include <test/eos_unit_test_helpers.hpp>

using singularity::EOS;
using singularity::SAP_Polynomial;
using EOS = singularity::Variant<SAP_Polynomial>;

SCENARIO("SAP_Polynomial EOS", "Check if eos returns expected values") {
GIVEN("Parameters for a SAP_Polynomial EOS") {
Expand Down
5 changes: 3 additions & 2 deletions test/test_eos_stiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
#include <singularity-eos/eos/eos.hpp>
#include <test/eos_unit_test_helpers.hpp>

using singularity::EOS;
using singularity::StiffGas;
using singularity::IdealGas;
using EOS = singularity::Variant<IdealGas, StiffGas>;

SCENARIO("StiffGas1", "[StiffGas][StiffGas1]") {
GIVEN("Parameters for a StiffGas EOS") {
Expand Down Expand Up @@ -362,7 +363,7 @@ SCENARIO("Recover Ideal Gas from Stiff Gas", "[StiffGas][StiffGas4]") {
// Create the EOS
EOS host_eos = StiffGas(gm1, Cv, Pinf, qq);
EOS eos = host_eos.GetOnDevice();
EOS ideal_eos = singularity::IdealGas(gm1, Cv);
EOS ideal_eos = IdealGas(gm1, Cv);
GIVEN("Densities and energies") {
constexpr int num = 1;
#ifdef PORTABILITY_STRATEGY_KOKKOS
Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

#include <test/eos_unit_test_helpers.hpp>

using singularity::EOS;
using singularity::IdealGas;
using EOS = singularity::Variant<IdealGas>;

SCENARIO("Vector EOS", "[VectorEOS][IdealGas]") {

Expand Down
2 changes: 1 addition & 1 deletion test/test_eos_vinet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <singularity-eos/eos/eos.hpp>
#include <test/eos_unit_test_helpers.hpp>

using singularity::EOS;
using singularity::Vinet;
using EOS = singularity::Variant<Vinet>;

SCENARIO("Vinet EOS rho sie", "[VectorEOS][VinetEOS]") {
GIVEN("Parameters for a Vinet EOS") {
Expand Down
1 change: 1 addition & 0 deletions test/test_math_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <test/eos_unit_test_helpers.hpp>

SCENARIO("EOS Variant Type", "[Variant][EOS]") {
using singularity::EOS;
// print out the eos type
std::cout << demangle(typeid(EOS).name()) << std::endl;
}
Expand Down

0 comments on commit 58a4f98

Please sign in to comment.