Skip to content

Commit

Permalink
Go back to using Clang Format 10, should pass happily now
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar authored and jmarrec committed Dec 22, 2023
1 parent a59310a commit ce006a6
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 265 deletions.
2 changes: 1 addition & 1 deletion src/ConvertInputFormat/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static constexpr std::array<std::string_view, static_cast<int>(OutputTypes::Num)

static constexpr auto outputTypeExperimentalStart = OutputTypes::CBOR;

template <typename... Args> void displayMessage(std::string_view str_format, Args &&...args)
template <typename... Args> void displayMessage(std::string_view str_format, Args &&... args)
{
fmt::print(std::cout, str_format, args...);
std::cout.write("\n", 1);
Expand Down
16 changes: 8 additions & 8 deletions src/EnergyPlus/EPVector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ private:
bool m_allocated{false};
};

template <typename T> [[nodiscard]] bool allocated(EPVector<T> const &v) noexcept
template <typename T>[[nodiscard]] bool allocated(EPVector<T> const &v) noexcept
{
return v.allocated();
}

template <typename T> [[nodiscard]] auto isize(const EPVector<T> &v) noexcept
template <typename T>[[nodiscard]] auto isize(const EPVector<T> &v) noexcept
{
return v.isize();
}
Expand All @@ -294,7 +294,7 @@ template <typename T> [[nodiscard]] auto isize(const EPVector<T> &v) noexcept
return std::count_if(values.cbegin(), values.cend(), [](bool v) { return v; });
}

template <typename T> [[nodiscard]] EPVector<T> pack(EPVector<T> const &v, EPVector<bool> const &mask)
template <typename T>[[nodiscard]] EPVector<T> pack(EPVector<T> const &v, EPVector<bool> const &mask)
{
EPVector<T> r;
r.reserve(mask.size());
Expand All @@ -306,7 +306,7 @@ template <typename T> [[nodiscard]] EPVector<T> pack(EPVector<T> const &v, EPVec
return r;
}

template <typename T> [[nodiscard]] Array1D<T> pack(Array1<T> const &a, EPVector<bool> const &mask)
template <typename T>[[nodiscard]] Array1D<T> pack(Array1<T> const &a, EPVector<bool> const &mask)
{
Array1D<T> r;
r.reserve(mask.size());
Expand All @@ -318,17 +318,17 @@ template <typename T> [[nodiscard]] Array1D<T> pack(Array1<T> const &a, EPVector
return r;
}

template <typename T> [[nodiscard]] T magnitude_squared(const EPVector<T> &v)
template <typename T>[[nodiscard]] T magnitude_squared(const EPVector<T> &v)
{
return std::inner_product(v.begin(), v.end(), v.begin(), T{});
}

template <typename T, typename V> [[nodiscard]] T dot(const EPVector<T> &u, const V &v)
template <typename T, typename V>[[nodiscard]] T dot(const EPVector<T> &u, const V &v)
{
return std::inner_product(u.begin(), u.end(), v.begin(), T{});
}

template <typename Element, typename Member> [[nodiscard]] Member maxval(EPVector<Element> const &a, Member Element::*pmem)
template <typename Element, typename Member>[[nodiscard]] Member maxval(EPVector<Element> const &a, Member Element::*pmem)
{
Member v(a.empty() ? std::numeric_limits<Member>::lowest() : a(1).*pmem);
for (int i = 2, e = a.isize(); i <= e; ++i) {
Expand All @@ -343,7 +343,7 @@ template <typename Element, typename Member> inline Member sum(EPVector<Element>
return std::accumulate(c.cbegin(), c.cend(), 0.0, [&pmem](const Member &sum, const Element &e) { return sum + e.*pmem; });
}

template <typename T> [[nodiscard]] T maxval(EPVector<T> const &a)
template <typename T>[[nodiscard]] T maxval(EPVector<T> const &a)
{
auto max = std::max_element(a.begin(), a.end());
if (max == a.end()) {
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/FileSystem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ namespace FileSystem {
is_any<T, std::unique_ptr<fs::path>, std::unique_ptr<fmt::ostream>, std::unique_ptr<std::ostream>, std::unique_ptr<FILE *>>::value;

template <class T, FileTypes fileType>
inline constexpr bool enable_json_v =
is_all_json_type(fileType) && is_any<T, nlohmann::json>::value && !is_any<T, std::string_view, std::string, char *>::value;
inline constexpr bool enable_json_v = is_all_json_type(fileType) && is_any<T, nlohmann::json>::value &&
!is_any<T, std::string_view, std::string, char *>::value;

template <FileTypes fileType> void writeFile(fs::path const &filePath, const std::string_view data)
{
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/HeatBalanceKivaManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state)

Real64 surfHeight = Surfaces(wl).get_average_height(state);
// round to avoid numerical precision differences
surfHeight = std::round((surfHeight) * 1000.0) / 1000.0;
surfHeight = std::round((surfHeight)*1000.0) / 1000.0;

if (combinationMap.count({Surfaces(wl).Construction, surfHeight}) == 0) {
// create new combination
Expand Down
9 changes: 5 additions & 4 deletions src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ namespace HeatPumpWaterToWaterCOOLING {
MaxPartLoadRat(0.0), OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0),
SourceSideDesignMassFlow(0.0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0),
SourceSideUACoeff(0.0), LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0),
PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), MustRun(false), SourcePlantLoc{},
LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), QSource(0.0), QSourceEnergy(0.0),
LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), Running(0),
LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true), beginEnvironFlag(true)
PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false),
MustRun(false), SourcePlantLoc{}, LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0),
QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0),
SourceSideWaterOutletTemp(0.0), Running(0), LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true),
beginEnvironFlag(true)
{
}

Expand Down
18 changes: 9 additions & 9 deletions src/EnergyPlus/IOFiles.hh
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ inline constexpr bool is_fortran_syntax(const std::string_view format_str)

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

inline constexpr FormatSyntax check_syntax(const std::string_view format_str)
{
Expand Down Expand Up @@ -613,7 +613,7 @@ public:
private:
std::unique_ptr<std::iostream> os;
bool print_to_dev_null = false;
template <FormatSyntax, typename... Args> friend void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args);
template <FormatSyntax, typename... Args> friend void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args);
friend class IOFiles;
};

Expand Down Expand Up @@ -805,7 +805,7 @@ public:
}
};

template <typename... Args> void vprint(std::ostream &os, std::string_view format_str, const Args &...args)
template <typename... Args> void vprint(std::ostream &os, std::string_view format_str, const Args &... args)
{
// assert(os.good());
auto buffer = fmt::memory_buffer();
Expand All @@ -817,7 +817,7 @@ template <typename... Args> void vprint(std::ostream &os, std::string_view forma
os.write(buffer.data(), buffer.size());
}

template <typename... Args> std::string vprint(std::string_view format_str, const Args &...args)
template <typename... Args> std::string vprint(std::string_view format_str, const Args &... args)
{
auto buffer = fmt::memory_buffer();
try {
Expand Down Expand Up @@ -851,19 +851,19 @@ template <typename... Args> std::string vprint(std::string_view format_str, cons
//

namespace {
template <typename... Args> void print_fortran_syntax(std::ostream &os, std::string_view format_str, const Args &...args)
template <typename... Args> void print_fortran_syntax(std::ostream &os, std::string_view format_str, const Args &... args)
{
EnergyPlus::vprint<std::conditional_t<std::is_same_v<double, Args>, DoubleWrapper, Args>...>(os, format_str, args...);
}

template <typename... Args> std::string format_fortran_syntax(std::string_view format_str, const Args &...args)
template <typename... Args> std::string format_fortran_syntax(std::string_view format_str, const Args &... args)
{
return EnergyPlus::vprint<std::conditional_t<std::is_same_v<double, Args>, DoubleWrapper, Args>...>(format_str, args...);
}
} // namespace

template <FormatSyntax formatSyntax = FormatSyntax::Fortran, typename... Args>
void print(std::ostream &os, std::string_view format_str, Args &&...args)
void print(std::ostream &os, std::string_view format_str, Args &&... args)
{
if constexpr (formatSyntax == FormatSyntax::Fortran) {
print_fortran_syntax(os, format_str, args...);
Expand All @@ -874,7 +874,7 @@ void print(std::ostream &os, std::string_view format_str, Args &&...args)
}
}

template <FormatSyntax formatSyntax, typename... Args> void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args)
template <FormatSyntax formatSyntax, typename... Args> void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args)
{
auto *outputStream = [&]() -> std::ostream * {
if (outputFile.os) {
Expand All @@ -897,7 +897,7 @@ template <FormatSyntax formatSyntax, typename... Args> void print(InputOutputFil
}
}

template <FormatSyntax formatSyntax = FormatSyntax::Fortran, typename... Args> std::string format(std::string_view format_str, Args &&...args)
template <FormatSyntax formatSyntax = FormatSyntax::Fortran, typename... Args> std::string format(std::string_view format_str, Args &&... args)
{
if constexpr (formatSyntax == FormatSyntax::Fortran) {
return format_fortran_syntax(format_str, args...);
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/PoweredInductionUnits.hh
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ namespace PoweredInductionUnits {
OutAirNode(0), HCoilInAirNode(0), ControlCompTypeNum(0), CompErrIndex(0), Mixer_Num(0), Fan_Num(0), Fan_Index(0), FanAvailSchedPtr(0),
HCoilType(HtgCoilType::Invalid), HCoil_PlantType(DataPlant::PlantEquipmentType::Invalid), HCoil_Index(0), HCoil_FluidIndex(0),
MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0),
MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), HotControlOffset(0.0),
HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0), SensCoolEnergy(0.0),
CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0)
MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0),
HotControlOffset(0.0), HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0),
SensCoolEnergy(0.0), CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/StringUtilities.hh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ inline auto nth_occurrence(std::string_view input_str, char const search_char, s
return pos;
}

template <typename... Param> bool readList(std::string_view input, Param &&...param)
template <typename... Param> bool readList(std::string_view input, Param &&... param)
{
if constexpr (std::conjunction_v<std::is_same<double &, Param>...> || std::conjunction_v<std::is_same<int &, Param>...>) {
size_t index = 0;
Expand Down
Loading

0 comments on commit ce006a6

Please sign in to comment.