Skip to content

Commit

Permalink
Fix initialization and API issues
Browse files Browse the repository at this point in the history
  • Loading branch information
amirroth committed Jul 20, 2024
1 parent a242572 commit bf4b914
Show file tree
Hide file tree
Showing 6 changed files with 290 additions and 322 deletions.
478 changes: 159 additions & 319 deletions src/EnergyPlus/FluidProperties.cc

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/EnergyPlus/FluidProperties.hh
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,8 @@ struct FluidData : BaseGlobalStruct
{

for (int i = 1; i <= refrigs.isize(); ++i) delete refrigs(i);
for (int i = 1; i <= glycolsRaw.isize(); ++i) delete refrigs(i);
for (int i = 1; i <= glycols.isize(); ++i) delete refrigs(i);
for (int i = 1; i <= glycolsRaw.isize(); ++i) delete glycolsRaw(i);
for (int i = 1; i <= glycols.isize(); ++i) delete glycols(i);

new (this) FluidData();
}
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/SetPointManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ struct SetPointManagerData : BaseGlobalStruct
InitSetPointManagersOneTimeFlag2 = true;

for (int iSPM = 1; iSPM <= (int)spms.size(); ++iSPM) {
delete spms[iSPM];
delete spms(iSPM);
}
spms.deallocate();
spmMap.clear();
Expand Down
100 changes: 100 additions & 0 deletions src/EnergyPlus/UtilityRoutines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,56 @@ void ShowRecurringSevereErrorAtEnd(EnergyPlusData &state,
state, " ** Severe ** " + Message, MsgIndex, ReportMaxOf, ReportMinOf, ReportSumOf, ReportMaxUnits, ReportMinUnits, ReportSumUnits);
}

void ShowRecurringSevereErrorAtEnd(EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
int &MsgIndex, // Recurring message index, if zero, next available index is assigned
Real64 const val,
std::string const &units // optional char string (<=15 length) of units for sum value
)
{

// SUBROUTINE INFORMATION:
// AUTHOR Michael J. Witte
// DATE WRITTEN August 2004

// PURPOSE OF THIS SUBROUTINE:
// This subroutine stores a recurring ErrorMessage with a Severe designation
// for output at the end of the simulation with automatic tracking of number
// of occurrences and optional tracking of associated min, max, and sum values

// METHODOLOGY EMPLOYED:
// Calls StoreRecurringErrorMessage utility routine.

// Using/Aliasing
using namespace DataStringGlobals;
using namespace DataErrorTracking;

// INTERFACE BLOCK SPECIFICATIONS
// Use for recurring "severe" error messages shown once at end of simulation
// with count of occurrences and optional max, min, sum

for (int Loop = 1; Loop <= SearchCounts; ++Loop) {
if (has(Message, MessageSearch[Loop])) {
++state.dataErrTracking->MatchCounts(Loop);
break;
}
}
bool bNewMessageFound = true;
for (int Loop = 1; Loop <= state.dataErrTracking->NumRecurringErrors; ++Loop) {
if (Util::SameString(state.dataErrTracking->RecurringErrors(Loop).Message, " ** Severe ** " + Message)) {
bNewMessageFound = false;
MsgIndex = Loop;
break;
}
}
if (bNewMessageFound) {
MsgIndex = 0;
}

++state.dataErrTracking->TotalSevereErrors;
StoreRecurringErrorMessage(state, " ** Severe ** " + Message, MsgIndex, val, val, _, units, units, "");
}

void ShowRecurringWarningErrorAtEnd(EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
int &MsgIndex, // Recurring message index, if zero, next available index is assigned
Expand Down Expand Up @@ -1286,6 +1336,56 @@ void ShowRecurringWarningErrorAtEnd(EnergyPlusData &state,
state, " ** Warning ** " + Message, MsgIndex, ReportMaxOf, ReportMinOf, ReportSumOf, ReportMaxUnits, ReportMinUnits, ReportSumUnits);
}

void ShowRecurringWarningErrorAtEnd(EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
int &MsgIndex, // Recurring message index, if zero, next available index is assigned
Real64 const val,
std::string const &units // optional char string (<=15 length) of units for sum value
)
{

// SUBROUTINE INFORMATION:
// AUTHOR Michael J. Witte
// DATE WRITTEN August 2004

// PURPOSE OF THIS SUBROUTINE:
// This subroutine stores a recurring ErrorMessage with a Warning designation
// for output at the end of the simulation with automatic tracking of number
// of occurrences and optional tracking of associated min, max, and sum values

// METHODOLOGY EMPLOYED:
// Calls StoreRecurringErrorMessage utility routine.

// Using/Aliasing
using namespace DataStringGlobals;
using namespace DataErrorTracking;

// INTERFACE BLOCK SPECIFICATIONS
// Use for recurring "warning" error messages shown once at end of simulation
// with count of occurrences and optional max, min, sum

for (int Loop = 1; Loop <= SearchCounts; ++Loop) {
if (has(Message, MessageSearch[Loop])) {
++state.dataErrTracking->MatchCounts(Loop);
break;
}
}
bool bNewMessageFound = true;
for (int Loop = 1; Loop <= state.dataErrTracking->NumRecurringErrors; ++Loop) {
if (Util::SameString(state.dataErrTracking->RecurringErrors(Loop).Message, " ** Warning ** " + Message)) {
bNewMessageFound = false;
MsgIndex = Loop;
break;
}
}
if (bNewMessageFound) {
MsgIndex = 0;
}

++state.dataErrTracking->TotalWarningErrors;
StoreRecurringErrorMessage(state, " ** Warning ** " + Message, MsgIndex, val, val, _, units, units, "");
}

void ShowRecurringContinueErrorAtEnd(EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
int &MsgIndex, // Recurring message index, if zero, next available index is assigned
Expand Down
16 changes: 16 additions & 0 deletions src/EnergyPlus/UtilityRoutines.hh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ void ShowWarningMessage(EnergyPlusData &state,
OptionalOutputFileRef OutUnit1 = {},
OptionalOutputFileRef OutUnit2 = {});

void ShowRecurringSevereErrorAtEnd(
EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
int &MsgIndex, // Recurring message index, if zero, next available index is assigned
Real64 const val, // Track and report the max of the values passed to this argument
std::string const &units
);

void ShowRecurringSevereErrorAtEnd(
EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
Expand All @@ -175,6 +183,14 @@ void ShowRecurringSevereErrorAtEnd(
std::string const &ReportSumUnits = "" // optional char string (<=15 length) of units for sum value
);

void ShowRecurringWarningErrorAtEnd(
EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
int &MsgIndex, // Recurring message index, if zero, next available index is assigned
Real64 const val,
std::string const &units // optional char string (<=15 length) of units for sum value
);

void ShowRecurringWarningErrorAtEnd(
EnergyPlusData &state,
std::string const &Message, // Message automatically written to "error file" at end of simulation
Expand Down
12 changes: 12 additions & 0 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array1S.hh
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ public: // Assignment: Array

public: // Assignment: Value

template< typename U, Size s, class = typename std::enable_if< std::is_assignable< T&, U >::value >::type >
Array1S &
operator =( std::array< U, s > const & a )
{
assert( size_ == s );
auto r( a.begin() );
for ( int i = 1; i <= u_; ++i, ++r ) {
operator ()( i ) = *r;
}
return *this;
}

// Initializer List Assignment Template
template< typename U, class = typename std::enable_if< std::is_assignable< T&, U >::value >::type >
Array1S &
Expand Down

1 comment on commit bf4b914

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

FluidAPI (amirroth) - x86_64-MacOS-10.18-clang-15.0.0: OK (3636 of 3644 tests passed, 49 test warnings)

Messages:\n

  • 22 tests had: ESO small diffs.
  • 15 tests had: MTR small diffs.
  • 10 tests had: EIO diffs.
  • 10 tests had: Table small diffs.
  • 30 tests had: ERR diffs.
  • 1 test had: Table string diffs.

Failures:\n

integration Test Summary

  • Passed: 787
  • Failed: 7

regression Test Summary

  • Passed: 790
  • Failed: 1

Build Badge Test Badge

Please sign in to comment.