Use vector::empty() instead of size() to test for entries.

This commit is contained in:
Markus Blatt 2020-12-07 20:24:03 +01:00
parent 07e676371e
commit b6c1a1533c
2 changed files with 4 additions and 4 deletions

View File

@ -840,8 +840,8 @@ namespace Opm {
const auto& perf_data = this->well_perf_data_[wellID];
// Cater for case where local part might have no perforations.
const int pvtreg = perf_data.size() ?
pvt_region_idx_[perf_data.front().cell_index] : 0;
const int pvtreg = perf_data.empty() ?
0 : pvt_region_idx_[perf_data.front().cell_index];
const auto& parallel_well_info = *local_parallel_well_info_[wellID];
auto global_pvtreg = parallel_well_info.broadcastFirstPerforationValue(pvtreg);

View File

@ -377,8 +377,8 @@ namespace Opm
: (prod_controls.cmode == Well::ProducerCMode::GRUP);
const double inj_surf_rate = well.isInjector() ? inj_controls.surface_rate : 0.0; // To avoid a "maybe-uninitialized" warning.
const double local_pressure = well_perf_data_[w].size() ?
cellPressures[well_perf_data_[w][0].cell_index] : 0;
const double local_pressure = well_perf_data_[w].empty() ?
0 : cellPressures[well_perf_data_[w][0].cell_index];
const double global_pressure = well_info.broadcastFirstPerforationValue(local_pressure);
if (well.getStatus() == Well::Status::STOP) {
// Stopped well: