Skip to content

Commit 8a00108

Browse files
committed
Small follow-up fixes for error report function changes.
1 parent 9eee303 commit 8a00108

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Common/include/basic_types/ad_structure.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,14 @@ inline void SetTagErrorCallback(struct ErrorReport* report) {}
304304
* \brief Reset the error counter in an ErrorReport.
305305
* \param[in] report - the ErrorReport whose error counter is resetted.
306306
*/
307-
inline void ResetErrorCounter(struct ErrorReport* report) {}
307+
inline void ResetErrorCounter(struct ErrorReport& report) {}
308308

309309
/*!
310-
* \brief Get a pointer to the error counter of an ErrorReport.
310+
* \brief Get the error count of an ErrorReport.
311311
* \param[in] report - the ErrorReport whose pointer to its error counter is returned.
312-
* \return Pointer to the error counter.
312+
* \return Value of the error counter.
313313
*/
314-
inline unsigned long* GetErrorCount(struct ErrorReport* report) { return NULL; }
314+
inline unsigned long GetErrorCount(ErrorReport& report) { return 0; }
315315

316316
/*!
317317
* \brief Pushes back the current tape position to the tape position's vector.
@@ -721,7 +721,7 @@ FORCEINLINE void ResumePreaccumulation(bool wasActive) {
721721

722722
struct ErrorReport {
723723
unsigned long ErrorCounter = 0;
724-
std::ofstream* out = &std::cout;
724+
std::ofstream* out = nullptr;
725725
};
726726

727727
FORCEINLINE void ResetErrorCounter(ErrorReport& report) { report.ErrorCounter = 0; }
@@ -730,7 +730,7 @@ FORCEINLINE void SetDebugReportFile(struct ErrorReport* report, std::ofstream* o
730730
report->out = output_file;
731731
}
732732

733-
FORCEINLINE unsigned long& GetErrorCount(ErrorReport& report) { return report->ErrorCounter; }
733+
FORCEINLINE unsigned long GetErrorCount(ErrorReport& report) { return report.ErrorCounter; }
734734

735735
#ifdef CODI_TAG_TAPE
736736

SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ void CDiscAdjMultizoneDriver::DebugRun() {
240240
std::ofstream out1("run1_process" + to_string(rank) + ".out");
241241
std::ofstream out2("run2_process" + to_string(rank) + ".out");
242242

243-
AD::ResetErrorCounter(&error_report);
243+
AD::ResetErrorCounter(error_report);
244244
AD::SetDebugReportFile(&error_report, &out1);
245245

246246
/*--- This recording will assign the initial (same) tag to each registered variable.
@@ -268,7 +268,7 @@ void CDiscAdjMultizoneDriver::DebugRun() {
268268
}
269269
DebugRun_ScreenOutput(error_report);
270270

271-
AD::ResetErrorCounter(&error_report);
271+
AD::ResetErrorCounter(error_report);
272272
AD::SetDebugReportFile(&error_report, &out2);
273273

274274
/*--- This recording repeats the initial recording with a different tag.
@@ -298,11 +298,11 @@ void CDiscAdjMultizoneDriver::DebugRun() {
298298

299299
void CDiscAdjMultizoneDriver::DebugRun_ScreenOutput(struct AD::ErrorReport& error_report) {
300300

301+
int num_errors = AD::GetErrorCount(error_report);
301302
int total_errors = 0;
302303
std::vector<int> process_error(size);
303-
304-
SU2_MPI::Allreduce(AD::GetErrorCount(&error_report), &total_errors, 1, MPI_INT, MPI_SUM, SU2_MPI::GetComm());
305-
SU2_MPI::Gather(AD::GetErrorCount(&error_report), 1, MPI_INT, process_error.data(), 1, MPI_INT, 0, SU2_MPI::GetComm());
304+
SU2_MPI::Allreduce(&num_errors, &total_errors, 1, MPI_INT, MPI_SUM, SU2_MPI::GetComm());
305+
SU2_MPI::Gather(&num_errors, 1, MPI_INT, process_error.data(), 1, MPI_INT, 0, SU2_MPI::GetComm());
306306

307307
if (rank == MASTER_NODE) {
308308
std::cout << "\nTotal number of detected tape inconsistencies: " << total_errors << std::endl;

0 commit comments

Comments
 (0)