mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -854,7 +854,11 @@ public:
|
|||||||
void outputFipLog(std::map<std::string, double>& miscSummaryData, std::map<std::string, std::vector<double>>& regionData, const bool substep)
|
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();
|
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);
|
ntFip = comm.max(ntFip);
|
||||||
|
|
||||||
// sum values over each region
|
// sum values over each region
|
||||||
|
|||||||
Reference in New Issue
Block a user