Cater for empty fipnum vectors in output code.

Due to loadbalancing this vector might be empty under some circumstances.
Hence the old code would dereference the end iterator which is a bug.
This commit is contained in:
Markus Blatt 2019-03-22 15:14:08 +01:00
parent d0bacde369
commit 831f41c0e3

View File

@ -854,7 +854,11 @@ public:
void outputFipLog(std::map<std::string, double>& miscSummaryData, std::map<std::string, std::vector<double>>& regionData, const bool substep)
{
const auto& comm = simulator_.gridView().comm();
size_t ntFip = *std::max_element(fipnum_.begin(), fipnum_.end());
auto maxElement = std::max_element(fipnum_.begin(), fipnum_.end());
size_t ntFip = 0;
if ( maxElement != fipnum_.end() ) {
ntFip = *maxElement;
}
ntFip = comm.max(ntFip);
// sum values over each region