Skip to content

Commit

Permalink
Merge Pull Request #252 from E3SM-Project/EKAT/bartgol/units-microfix
Browse files Browse the repository at this point in the history
Automatically Merged using E3SM Pull Request AutoTester
PR Title: Micro fixes to Units
PR Author: bartgol
  • Loading branch information
E3SM-Bot authored Sep 13, 2022
2 parents b816c94 + d744750 commit 03ac1e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ekat/util/ekat_rational_constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct RationalConstant {
template<typename IntType,
typename = typename std::enable_if<std::is_integral<IntType>::value>::type>
constexpr RationalConstant (const IntType n)
: RationalConstant (n,1)
: RationalConstant (n,static_cast<IntType>(1))
{
// Nothing to do here
}
Expand Down
7 changes: 6 additions & 1 deletion src/ekat/util/ekat_units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "ekat/util/ekat_string_utils.hpp"

#include <array>
#include <limits>

namespace ekat
{
Expand Down Expand Up @@ -91,9 +92,13 @@ class Units {

constexpr Units& operator= (const Units&) = default;

static Units nondimensional () {
static constexpr Units nondimensional () {
return Units(ScalingFactor::one());
}
static constexpr Units invalid () {
constexpr auto infty = std::numeric_limits<RationalConstant::iType>::max();
return ScalingFactor(-infty)*nondimensional();
}

void set_string (const char* name) {
m_name = name;
Expand Down

0 comments on commit 03ac1e0

Please sign in to comment.