Skip to content

Commit

Permalink
Fix linux build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mbadams5 committed Aug 23, 2021
1 parent 3adde66 commit c4821b9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 35 deletions.
5 changes: 2 additions & 3 deletions src/EnergyPlus/CurveManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2181,10 +2181,9 @@ namespace CurveManager {
};
NormalizationMethod normalizeMethod = NM_NONE;
if (fields.count("normalization_method")) {
if (UtilityRoutines::SameString(static_cast<const std::string &>(fields.at("normalization_method")), "DIVISORONLY")) {
if (UtilityRoutines::SameString(fields.at("normalization_method").get<std::string>(), "DIVISORONLY")) {
normalizeMethod = NM_DIVISOR_ONLY;
} else if (UtilityRoutines::SameString(static_cast<const std::string &>(fields.at("normalization_method")),
"AUTOMATICWITHDIVISOR")) {
} else if (UtilityRoutines::SameString(fields.at("normalization_method").get<std::string>(), "AUTOMATICWITHDIVISOR")) {
normalizeMethod = NM_AUTO_WITH_DIVISOR;
}
}
Expand Down
34 changes: 16 additions & 18 deletions src/EnergyPlus/FileSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,14 @@ namespace FileSystem {
}

std::string_view fopen_mode;
switch (mode) {
case std::ios_base::in:
fopen_mode = "r"; break;
case std::ios_base::binary:
fopen_mode = "b"; break;
case std::ios_base::in | std::ios_base::binary:
fopen_mode = "rb"; break;
default:
throw FatalError(fmt::format("ERROR - readFile: Bad openmode argument. Must be std::ios_base::in or std::ios_base::binary"));
if (mode == std::ios_base::in) {
fopen_mode = "r";
} else if (mode == std::ios_base::binary) {
fopen_mode = "b";
} else if (mode == (std::ios_base::in | std::ios_base::binary)) {
fopen_mode = "rb";
} else {
throw FatalError(fmt::format("ERROR - readFile: Bad openmode argument. Must be std::ios_base::in or std::ios_base::binary"));
}

auto close_file = [](FILE* f){fclose(f);};
Expand Down Expand Up @@ -394,15 +393,14 @@ namespace FileSystem {
}

std::string_view fopen_mode;
switch (mode) {
case std::ios_base::in:
fopen_mode = "r"; break;
case std::ios_base::binary:
fopen_mode = "b"; break;
case std::ios_base::in | std::ios_base::binary:
fopen_mode = "rb"; break;
default:
throw FatalError(fmt::format("ERROR - readFile: Bad openmode argument. Must be std::ios_base::in or std::ios_base::binary"));
if (mode == std::ios_base::in) {
fopen_mode = "r";
} else if (mode == std::ios_base::binary) {
fopen_mode = "b";
} else if (mode == (std::ios_base::in | std::ios_base::binary)) {
fopen_mode = "rb";
} else {
throw FatalError(fmt::format("ERROR - readFile: Bad openmode argument. Must be std::ios_base::in or std::ios_base::binary"));
}

auto close_file = [](FILE* f){fclose(f);};
Expand Down
8 changes: 6 additions & 2 deletions src/EnergyPlus/IOFiles.hh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace {

namespace fmt {
template <>
struct fmt::formatter<DoubleWrapper> {
struct formatter<DoubleWrapper> {
fmt::detail::dynamic_format_specs<char> specs_;
fmt::memory_buffer buffer = fmt::memory_buffer();

Expand Down Expand Up @@ -441,6 +441,10 @@ inline constexpr bool is_fortran_syntax(const std::string_view format_str) {
return false;
}

class InputOutputFile;
template <FormatSyntax formatSyntax = FormatSyntax::Fortran, typename... Args>
void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args);

inline constexpr FormatSyntax check_syntax(const std::string_view format_str) {
if (is_fortran_syntax(format_str)) {
return FormatSyntax::Fortran;
Expand Down Expand Up @@ -847,7 +851,7 @@ void print(std::ostream &os, std::string_view format_str, Args &&... args)
}
}

template <FormatSyntax formatSyntax = FormatSyntax::Fortran, typename... Args>
template <FormatSyntax formatSyntax, typename... Args>
void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args)
{
auto *outputStream = [&]() -> std::ostream * {
Expand Down
24 changes: 12 additions & 12 deletions tst/EnergyPlus/unit/UnitarySystem.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17309,8 +17309,8 @@ TEST_F(EnergyPlusFixture, WaterCoil_getCoilWaterSystemInputDataTest)
EXPECT_EQ(thisSys.UnitType, "CoilSystem:Cooling:Water");
EXPECT_EQ(thisSys.Name, "COIL SYSTEM WATER");
EXPECT_EQ(thisSys.m_minAirToWaterTempOffset, 2.0);
EXPECT_EQ(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None);
EXPECT_EQ(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint);
EXPECT_TRUE(compare_enums(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None));
EXPECT_TRUE(compare_enums(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint));
EXPECT_EQ(thisSys.m_CoolingCoilType_Num, DataHVACGlobals::Coil_CoolingWater);
EXPECT_EQ(thisSys.m_CoolingCoilName, "WATER COOLING COIL");
EXPECT_TRUE(thisSys.m_CoolCoilExists);
Expand Down Expand Up @@ -17394,8 +17394,8 @@ TEST_F(EnergyPlusFixture, DetailedWaterCoil_getCoilWaterSystemInputDataTest)
EXPECT_EQ(thisSys.UnitType, "CoilSystem:Cooling:Water");
EXPECT_EQ(thisSys.Name, "COIL SYSTEM WATER");
EXPECT_EQ(thisSys.m_minAirToWaterTempOffset, 2.0);
EXPECT_EQ(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::CoolReheat);
EXPECT_EQ(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint);
EXPECT_TRUE(compare_enums(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::CoolReheat));
EXPECT_TRUE(compare_enums(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint));
EXPECT_EQ(thisSys.m_CoolingCoilType_Num, DataHVACGlobals::Coil_CoolingWaterDetailed);
EXPECT_EQ(thisSys.m_CoolingCoilName, "WATER COOLING COIL");
EXPECT_TRUE(thisSys.m_CoolCoilExists);
Expand Down Expand Up @@ -17495,8 +17495,8 @@ TEST_F(EnergyPlusFixture, HXAssistedWaterCoil_getCoilWaterSystemInputDataTest)
EXPECT_EQ(thisSys.UnitType, "CoilSystem:Cooling:Water");
EXPECT_EQ(thisSys.Name, "COIL SYSTEM WATER");
EXPECT_EQ(thisSys.m_minAirToWaterTempOffset, 2.0);
EXPECT_EQ(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::CoolReheat);
EXPECT_EQ(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint);
EXPECT_TRUE(compare_enums(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::CoolReheat));
EXPECT_TRUE(compare_enums(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint));
EXPECT_EQ(thisSys.m_CoolingCoilType_Num, DataHVACGlobals::Coil_CoolingWater);
EXPECT_EQ(thisSys.m_CoolingCoilName, "WATER COOLING COIL");
EXPECT_TRUE(thisSys.m_CoolCoilExists);
Expand Down Expand Up @@ -17687,8 +17687,8 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_ControlStatusTest)
EXPECT_EQ(thisSys.UnitType, "CoilSystem:Cooling:Water");
EXPECT_EQ(thisSys.Name, "COIL SYSTEM WATER");
EXPECT_EQ(thisSys.m_minAirToWaterTempOffset, 2.0);
EXPECT_EQ(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None);
EXPECT_EQ(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint);
EXPECT_TRUE(compare_enums(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None));
EXPECT_TRUE(compare_enums(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint));
EXPECT_EQ(thisSys.m_CoolingCoilType_Num, DataHVACGlobals::Coil_CoolingWater);
EXPECT_EQ(thisSys.m_CoolingCoilName, "WATER COOLING COIL");
EXPECT_TRUE(thisSys.m_CoolCoilExists);
Expand Down Expand Up @@ -17937,8 +17937,8 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_CalcTest)
EXPECT_EQ(thisSys.UnitType, "CoilSystem:Cooling:Water");
EXPECT_EQ(thisSys.Name, "COIL SYSTEM WATER");
EXPECT_EQ(thisSys.m_minAirToWaterTempOffset, 2.0);
EXPECT_EQ(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None);
EXPECT_EQ(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint);
EXPECT_TRUE(compare_enums(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None));
EXPECT_TRUE(compare_enums(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint));
EXPECT_EQ(thisSys.m_CoolingCoilType_Num, DataHVACGlobals::Coil_CoolingWater);
EXPECT_EQ(thisSys.m_CoolingCoilName, "WATER COOLING COIL");
EXPECT_TRUE(thisSys.m_CoolCoilExists);
Expand Down Expand Up @@ -18210,8 +18210,8 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop)
EXPECT_EQ(thisSys.UnitType, "CoilSystem:Cooling:Water");
EXPECT_EQ(thisSys.Name, "COIL SYSTEM WATER");
EXPECT_EQ(thisSys.m_minAirToWaterTempOffset, 2.0);
EXPECT_EQ(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None);
EXPECT_EQ(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint);
EXPECT_TRUE(compare_enums(thisSys.m_DehumidControlType_Num, UnitarySys::DehumCtrlType::None));
EXPECT_TRUE(compare_enums(thisSys.m_ControlType, UnitarySys::ControlType::Setpoint));
EXPECT_EQ(thisSys.m_CoolingCoilType_Num, DataHVACGlobals::Coil_CoolingWater);
EXPECT_EQ(thisSys.m_CoolingCoilName, "WATER COOLING COIL");
EXPECT_TRUE(thisSys.m_CoolCoilExists);
Expand Down

3 comments on commit c4821b9

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improved_file_reading (mbadams5) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: Build Failed

Failures:\n

API Test Summary

  • Failed: 8
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 730

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improved_file_reading (mbadams5) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: Build Failed

Failures:\n

API Test Summary

  • Failed: 8
  • notrun: 3

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improved_file_reading (mbadams5) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: Build Failed

Failures:\n

integration Test Summary

  • Passed: 2
  • Failed: 729

Build Badge Test Badge Coverage Badge

Please sign in to comment.