Skip to content

Commit

Permalink
Merge Pull Request #253 from E3SM-Project/EKAT/bartgol/units-classes-…
Browse files Browse the repository at this point in the history
…mods

Automatically Merged using E3SM Pull Request AutoTester
PR Title: Removed pointless const, which prevented assignment
PR Author: bartgol
  • Loading branch information
E3SM-Bot authored Sep 19, 2022
2 parents 03ac1e0 + 4dc8381 commit 741edc4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/ekat/util/ekat_rational_constant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ struct RationalConstant {

using iType = long long;

const iType num;
const iType den;
iType num;
iType den;

// No default
RationalConstant () = delete;
Expand Down Expand Up @@ -65,6 +65,7 @@ struct RationalConstant {
// Nothing to do here
}
constexpr RationalConstant (const RationalConstant&) = default;
constexpr RationalConstant& operator= (const RationalConstant&) = default;

constexpr RationalConstant operator- () const {
return RationalConstant(-num,den);
Expand Down
6 changes: 4 additions & 2 deletions src/ekat/util/ekat_scaling_factor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace ekat
{

struct ScalingFactor {
const RationalConstant base;
const RationalConstant exp;
RationalConstant base;
RationalConstant exp;

ScalingFactor () = delete;
constexpr ScalingFactor (const RationalConstant& s)
Expand All @@ -29,6 +29,8 @@ struct ScalingFactor {

constexpr ScalingFactor (const ScalingFactor&) = default;

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

static constexpr ScalingFactor one () { return ScalingFactor(1); }
static constexpr ScalingFactor zero () { return ScalingFactor(0); }

Expand Down
6 changes: 3 additions & 3 deletions src/ekat/util/ekat_units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ class Units {

friend std::string to_string(const Units&);

const ScalingFactor m_scaling;
const std::array<RationalConstant,7> m_units;
ScalingFactor m_scaling;
std::array<RationalConstant,7> m_units;

const char* m_name;
const char* m_name;
};

// === Operators/functions overload === //
Expand Down

0 comments on commit 741edc4

Please sign in to comment.