Skip to content

Commit

Permalink
change container
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Jun 28, 2024
1 parent 10080be commit 26f9dde
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
*/

#pragma once
#include <map>
#include <string>
#include <vector>

namespace Antares
{
class HydroErrorsCollector
Expand All @@ -31,10 +30,10 @@ class HydroErrorsCollector
HydroErrorsCollector() = default;
void Collect(const std::string& area_name, const std::string& message);
void Collect(const std::string& message);
bool CheckForFatalErrors() const;
void CheckForFatalErrors() const;

private:
std::unordered_map<std::string, uint> area_errors_counter_;
std::map<std::string, unsigned int> area_errors_counter_;
bool errors_limit_reached_ = false;
bool stop_ = false;
// std::vector<std::string> fatal_errors_;
Expand Down
6 changes: 3 additions & 3 deletions src/solver/hydro/management/HydroErrorsCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ void HydroErrorsCollector::Collect(const std::string& area_name, const std::stri
{
logs.error() << "In Area " << area_name << " " << message;
area_errors_counter_[area_name]++;
errors_limit_reached_ = area_errors_counter_[area] > 10;
errors_limit_reached_ = area_errors_counter_[area_name] > 10;
stop_ = true;

if (errors_limit_reached_)
{
throw FatalError("Hydro validation has failed !")
throw FatalError("Hydro validation has failed !");
}
}

Expand All @@ -29,7 +29,7 @@ void HydroErrorsCollector::CheckForFatalErrors() const
{
if (stop_ || errors_limit_reached_)
{
throw FatalError("Hydro validation has failed !")
throw FatalError("Hydro validation has failed !");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/solver/hydro/management/HydroInputsChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void HydroInputsChecker::CheckFinalReservoirLevelsConfiguration(uint year)
});
} // End function CheckFinalReservoirLevelsConfiguration

bool HydroInputsChecker::CheckForFatalErrors() const
void HydroInputsChecker::CheckForFatalErrors() const
{
errorCollector_.CheckForFatalErrors();
}
Expand Down

0 comments on commit 26f9dde

Please sign in to comment.