diff --git a/internal/test_util/libcode/vx_nc_util/test_pressure_levels.cc b/internal/test_util/libcode/vx_nc_util/test_pressure_levels.cc index 4826f467de..5cfb87537e 100644 --- a/internal/test_util/libcode/vx_nc_util/test_pressure_levels.cc +++ b/internal/test_util/libcode/vx_nc_util/test_pressure_levels.cc @@ -31,20 +31,20 @@ int main(int argc, char *argv[]) { map > variable_levels; vector u_levels; - u_levels.push_back("P1000"); - u_levels.push_back("P800"); - u_levels.push_back("P500"); + u_levels.emplace_back("P1000"); + u_levels.emplace_back("P800"); + u_levels.emplace_back("P500"); variable_levels["U"] = u_levels; vector v_levels; - v_levels.push_back("P1000"); - v_levels.push_back("P900"); - v_levels.push_back("P700"); - v_levels.push_back("P500"); - v_levels.push_back("P300"); - v_levels.push_back("P100"); - v_levels.push_back("P50"); - v_levels.push_back("P10"); + v_levels.emplace_back("P1000"); + v_levels.emplace_back("P900"); + v_levels.emplace_back("P700"); + v_levels.emplace_back("P500"); + v_levels.emplace_back("P300"); + v_levels.emplace_back("P100"); + v_levels.emplace_back("P50"); + v_levels.emplace_back("P10"); variable_levels["V"] = v_levels; for (map >::iterator i = variable_levels.begin(); diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc index a4323a23b1..23151b38da 100644 --- a/src/basic/vx_config/config_util.cc +++ b/src/basic/vx_config/config_util.cc @@ -816,7 +816,7 @@ vector parse_conf_llpnt_mask(Dictionary *dict) { } // Add current MaskLatLon to the vector - v.push_back(m); + v.emplace_back(m); } return v; diff --git a/src/basic/vx_config/threshold.cc b/src/basic/vx_config/threshold.cc index ef650ef2c0..5567be566e 100644 --- a/src/basic/vx_config/threshold.cc +++ b/src/basic/vx_config/threshold.cc @@ -1317,7 +1317,7 @@ void Simple_Node::get_simple_nodes(vector &v) const { -v.push_back(*this); +v.emplace_back(*this); return; diff --git a/src/basic/vx_log/string_array.cc b/src/basic/vx_log/string_array.cc index fe6f42689a..eb54a62353 100644 --- a/src/basic/vx_log/string_array.cc +++ b/src/basic/vx_log/string_array.cc @@ -255,7 +255,7 @@ void StringArray::add(const std::string text) { -s.push_back(text); +s.emplace_back(text); Sorted = false; @@ -277,7 +277,7 @@ void StringArray::add_uniq(const std::string text) if(!has(text)) { - s.push_back(text); + s.emplace_back(text); Sorted = false; @@ -323,7 +323,7 @@ for(int i=0; isecond); + _offsetLftEdge.emplace_back(m_iterator->second); } // Store max_x_by_y map as _offsetRgtEdge vector for(m_iterator = max_x_by_y.begin(); m_iterator != max_x_by_y.end(); m_iterator++) { - _offsetRgtEdge.push_back(m_iterator->second); + _offsetRgtEdge.emplace_back(m_iterator->second); } // Store max_y_by_x map as _offsetTopEdge vector for(m_iterator = max_y_by_x.begin(); m_iterator != max_y_by_x.end(); m_iterator++) { - _offsetTopEdge.push_back(m_iterator->second); + _offsetTopEdge.emplace_back(m_iterator->second); } // Store min_y_by_x map as _offsetBotEdge vector for(m_iterator = min_y_by_x.begin(); m_iterator != min_y_by_x.end(); m_iterator++) { - _offsetBotEdge.push_back(m_iterator->second); + _offsetBotEdge.emplace_back(m_iterator->second); } return; diff --git a/src/basic/vx_util/GridTemplate.h b/src/basic/vx_util/GridTemplate.h index ed58165f4d..acb4db1703 100644 --- a/src/basic/vx_util/GridTemplate.h +++ b/src/basic/vx_util/GridTemplate.h @@ -88,12 +88,12 @@ class GridTemplate { // Access methods inline void addOffset(const GridOffset &offset) { - _offsetList.push_back(new GridOffset(offset.x_offset, + _offsetList.emplace_back(new GridOffset(offset.x_offset, offset.y_offset)); } inline void addOffset(const int x_offset, const int y_offset) { - _offsetList.push_back(new GridOffset(x_offset, y_offset)); + _offsetList.emplace_back(new GridOffset(x_offset, y_offset)); } int size(void) const { diff --git a/src/basic/vx_util/ascii_header.cc b/src/basic/vx_util/ascii_header.cc index 162a9954b5..d9a6f205af 100644 --- a/src/basic/vx_util/ascii_header.cc +++ b/src/basic/vx_util/ascii_header.cc @@ -450,7 +450,7 @@ void AsciiHeader::read(const char *version) { header_line.set_col_names(line[3]); // Store the current line - Headers.push_back(header_line); + Headers.emplace_back(header_line); } // Store the version we just loaded diff --git a/src/basic/vx_util/crc_array.h b/src/basic/vx_util/crc_array.h index 0eea7d529c..30d7b877b7 100644 --- a/src/basic/vx_util/crc_array.h +++ b/src/basic/vx_util/crc_array.h @@ -470,7 +470,7 @@ void CRC_Array::add(const T & k) extend(Nelements + 1, false); -e.push_back(k); +e.emplace_back(k); Nelements++; @@ -494,7 +494,7 @@ int j; for (j=0; j<(a.Nelements); ++j) { - e.push_back(a.e[j]); + e.emplace_back(a.e[j]); Nelements++; diff --git a/src/basic/vx_util/data_line.cc b/src/basic/vx_util/data_line.cc index 2ad88c5d55..f76dfeeb8a 100644 --- a/src/basic/vx_util/data_line.cc +++ b/src/basic/vx_util/data_line.cc @@ -348,7 +348,7 @@ size_t len, tpos = std::string::npos; if (0 == Line.find_first_not_of(Delimiter)) { // no leading delimiter ++count; - Items.push_back(Line.substr(pos, Line.find_first_of(Delimiter, pos) - pos)); + Items.emplace_back(Line.substr(pos, Line.find_first_of(Delimiter, pos) - pos)); } while ((tpos = Line.substr(pos).find_first_of(Delimiter)) != std::string::npos) { len = Line.substr(pos+tpos).find_first_not_of(Delimiter); @@ -357,7 +357,7 @@ while ((tpos = Line.substr(pos).find_first_of(Delimiter)) != std::string::npos) pos += tpos + len; ++count; - Items.push_back(Line.substr(pos, Line.find_first_of(Delimiter, pos) - pos)); + Items.emplace_back(Line.substr(pos, Line.find_first_of(Delimiter, pos) - pos)); } N_items = count; @@ -408,7 +408,7 @@ sregex_token_iterator end; // while (it != end) { - Items.push_back(*it); + Items.emplace_back(*it); ++it; } @@ -416,7 +416,7 @@ while (it != end) { // Append empty item if string ends with a delimiter // -if ( Delimiter.find(Line.back()) != string::npos ) Items.push_back(""); +if ( Delimiter.find(Line.back()) != string::npos ) Items.emplace_back(""); N_items = Items.size(); @@ -504,7 +504,7 @@ for( i=0; i::iterator it = RecList.begin(); ...) @@ -954,7 +954,7 @@ void MetGrib2DataFile::read_grib2_record_list() { } // add the record to the list - RecList.push_back(rec); + RecList.emplace_back(rec); // build data structure for U/V wind pairs string rec_mag = build_magic(rec).text(); diff --git a/src/libcode/vx_data2d_ugrid/ugrid_file.cc b/src/libcode/vx_data2d_ugrid/ugrid_file.cc index 4a2e22c909..6289029ba7 100644 --- a/src/libcode/vx_data2d_ugrid/ugrid_file.cc +++ b/src/libcode/vx_data2d_ugrid/ugrid_file.cc @@ -599,7 +599,7 @@ bool UGridFile::find_nc_vinfo_list(const char *var_name, { vinfo_list.clear(); for (int i = 0; i < Nvars; i++) { - if (Var[i].name.startswith(var_name)) vinfo_list.push_back(&Var[i]); + if (Var[i].name.startswith(var_name)) vinfo_list.emplace_back(&Var[i]); } return vinfo_list.size() > 0; } diff --git a/src/libcode/vx_grid/unstructured_grid.cc b/src/libcode/vx_grid/unstructured_grid.cc index 1e318f5075..3784d74063 100644 --- a/src/libcode/vx_grid/unstructured_grid.cc +++ b/src/libcode/vx_grid/unstructured_grid.cc @@ -387,7 +387,7 @@ void UnstructuredData::build_tree() { for (int i=0; iinsert(points_XYZ_km[i], n); n++; lat_checksum += (i+1) * y_km; @@ -483,7 +483,7 @@ void UnstructuredData::set_points(int count, const double *_lon, const double *_ n_face = count; points_lonlat.reserve(count); for (int i=0; i= UGRID_DEBUG_LEVEL) mlog << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredData::set_points(int, double *, double *) first (" @@ -505,7 +505,7 @@ void UnstructuredData::set_points(int count, const double *_lon, const double *_ n_face = count; points_XYZ.reserve(count); for (int i=0; i= UGRID_DEBUG_LEVEL) mlog << Debug(UGRID_DEBUG_LEVEL) << "UnstructuredData::set_points(int, double *lon, double *lat, double *alt) first (" @@ -535,7 +535,7 @@ void UnstructuredData::set_points(int count, const std::vector &poi n_face = count; points_lonlat.reserve(count); for (int i=0; i= UGRID_DEBUG_LEVEL) mlog << Debug(UGRID_DEBUG_LEVEL) << method_name << " first: (" @@ -565,7 +565,7 @@ void UnstructuredData::set_points(int count, const std::vector &points n_face = count; points_XYZ.reserve(count); for (int i=0; i= UGRID_DEBUG_LEVEL) { int last_i = count - 1; diff --git a/src/libcode/vx_nc_util/nc_utils.cc b/src/libcode/vx_nc_util/nc_utils.cc index 36b71cd509..177febf1df 100644 --- a/src/libcode/vx_nc_util/nc_utils.cc +++ b/src/libcode/vx_nc_util/nc_utils.cc @@ -1051,8 +1051,8 @@ char get_char_val(NcVar *var, const int index) { // // Retrieve the character array value from the NetCDF variable. // - start.push_back(index); - count.push_back(1); + start.emplace_back(index); + count.emplace_back(1); var->getVar(start, count, &k); return k; @@ -1097,10 +1097,10 @@ ConcatString* get_string_val(NcVar *var, const int index, // // Retrieve the character array value from the NetCDF variable. // - start.push_back(index); - start.push_back(0); - count.push_back(1); - count.push_back(len); + start.emplace_back(index); + start.emplace_back(0); + count.emplace_back(1); + count.emplace_back(len); var->getVar(start, count, &tmp_str); // @@ -1147,8 +1147,8 @@ int get_int_var(NcVar * var, const int index) { exit(1); } - start.push_back(index); - count.push_back(1); + start.emplace_back(index); + count.emplace_back(1); var->getVar(start, count, &k); } @@ -1194,8 +1194,8 @@ double get_nc_time(NcVar * var, const int index) { char *tmp_buf = new char[512]; int dataType = GET_NC_TYPE_ID_P(var); - start.push_back(index); - count.push_back(1); + start.emplace_back(index); + count.emplace_back(1); tmp_buf[0] = 0; switch (dataType) { @@ -1217,8 +1217,8 @@ double get_nc_time(NcVar * var, const int index) { case NC_CHAR: if (2 == get_dim_count(var)) { buf_len = get_dim_size(var, 1); - start.push_back(0); - count.push_back(buf_len); + start.emplace_back(0); + count.emplace_back(buf_len); } for (int i=0; igetVar(start, count, tmp_buf); @@ -1289,8 +1289,8 @@ float get_float_var(NcVar * var, const int index) { exit(1); } - start.push_back(index); - count.push_back(1); + start.emplace_back(index); + count.emplace_back(1); var->getVar(start, count, &k); } @@ -2980,8 +2980,8 @@ NcVar add_var(NcFile *nc, const string &var_name, const NcType ncType, NcVar add_var(NcFile *nc, const string &var_name, const NcType ncType, const NcDim ncDim1, const NcDim ncDim2, const int deflate_level) { vector ncDims; - ncDims.push_back(ncDim1); - ncDims.push_back(ncDim2); + ncDims.emplace_back(ncDim1); + ncDims.emplace_back(ncDim2); return add_var(nc, var_name, ncType, ncDims, deflate_level); } @@ -2990,9 +2990,9 @@ NcVar add_var(NcFile *nc, const string &var_name, const NcType ncType, NcVar add_var(NcFile *nc, const string &var_name, const NcType ncType, const NcDim ncDim1, const NcDim ncDim2, const NcDim ncDim3, const int deflate_level) { vector ncDims; - ncDims.push_back(ncDim1); - ncDims.push_back(ncDim2); - ncDims.push_back(ncDim3); + ncDims.emplace_back(ncDim1); + ncDims.emplace_back(ncDim2); + ncDims.emplace_back(ncDim3); return add_var(nc, var_name, ncType, ncDims, deflate_level); } @@ -3002,10 +3002,10 @@ NcVar add_var(NcFile *nc, const string &var_name, const NcType ncType, const NcDim ncDim1, const NcDim ncDim2, const NcDim ncDim3, const NcDim ncDim4, const int deflate_level) { vector ncDims; - ncDims.push_back(ncDim1); - ncDims.push_back(ncDim2); - ncDims.push_back(ncDim3); - ncDims.push_back(ncDim4); + ncDims.emplace_back(ncDim1); + ncDims.emplace_back(ncDim2); + ncDims.emplace_back(ncDim3); + ncDims.emplace_back(ncDim4); return add_var(nc, var_name, ncType, ncDims, deflate_level); } diff --git a/src/libcode/vx_nc_util/write_netcdf.cc b/src/libcode/vx_nc_util/write_netcdf.cc index e156f85ce7..bc58c31230 100644 --- a/src/libcode/vx_nc_util/write_netcdf.cc +++ b/src/libcode/vx_nc_util/write_netcdf.cc @@ -165,8 +165,8 @@ void write_netcdf_latlon_2d(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, vector lon_data(grid.nx()*grid.ny()); // Define Variables - dims.push_back(*lat_dim); - dims.push_back(*lon_dim); + dims.emplace_back(*lat_dim); + dims.emplace_back(*lon_dim); lat_var = add_var(f_out, "lat", ncFloat, dims); lon_var = add_var(f_out, "lon", ncFloat, dims); @@ -213,8 +213,8 @@ void write_netcdf_grid_weight(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, vector wgt_data(wgt_dp.nx()*wgt_dp.ny()); // Define Variables - dims.push_back(*lat_dim); - dims.push_back(*lon_dim); + dims.emplace_back(*lat_dim); + dims.emplace_back(*lon_dim); wgt_var = add_var(f_out, "grid_weight", ncFloat, dims); // Add variable attributes @@ -248,8 +248,8 @@ void write_netcdf_grid_weight(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, } // Write the weights - count.push_back(wgt_dp.ny()); - count.push_back(wgt_dp.nx()); + count.emplace_back(wgt_dp.ny()); + count.emplace_back(wgt_dp.nx()); put_nc_data_with_dims(&wgt_var, wgt_data.data(), wgt_dp.ny(), wgt_dp.nx()); // Clean up diff --git a/src/libcode/vx_series_data/series_pdf.cc b/src/libcode/vx_series_data/series_pdf.cc index f9d9765a35..a9efa08c04 100644 --- a/src/libcode/vx_series_data/series_pdf.cc +++ b/src/libcode/vx_series_data/series_pdf.cc @@ -32,7 +32,7 @@ void init_pdf( vector& pdf) { for(int k = 0; k < n; k++) { - pdf.push_back(0); + pdf.emplace_back(0); } } @@ -46,7 +46,7 @@ void init_pdf( int n = (max - min) / delta; for(int k = 0; k < n; k++) { - pdf.push_back(0); + pdf.emplace_back(0); } } @@ -58,7 +58,7 @@ void init_joint_pdf( vector& pdf) { for(int k = 0; k < n_A * n_B; k++) { - pdf.push_back(0); + pdf.emplace_back(0); } } @@ -146,9 +146,9 @@ void write_nc_pdf( vector bin_mid; for(int k = 0; k < pdf.size(); k++) { - bin_min.push_back(min + delta * k); - bin_max.push_back(min + delta * (k + 1)); - bin_mid.push_back(min + delta * (k + 0.5)); + bin_min.emplace_back(min + delta * k); + bin_max.emplace_back(min + delta * (k + 1)); + bin_mid.emplace_back(min + delta * (k + 0.5)); } ConcatString var_name = info.name(); diff --git a/src/libcode/vx_shapedata/mode_conf_info.cc b/src/libcode/vx_shapedata/mode_conf_info.cc index 73970d8531..8b7056017f 100644 --- a/src/libcode/vx_shapedata/mode_conf_info.cc +++ b/src/libcode/vx_shapedata/mode_conf_info.cc @@ -704,7 +704,7 @@ void ModeConfInfo::config_set_all_percentile_thresholds(const std::vectorobs_cat == 1) c_olfh++; else count_diagonal++; } - seeps_mprs.push_back(seeps_mpr); + seeps_mprs.emplace_back(seeps_mpr); } if (count > 0) { @@ -1860,7 +1860,7 @@ void compute_seeps_density_vector(const PairDataPoint *pd, SeepsAggScore *seeps, if (seeps_idx < seeps_cnt) seeps_cnt = seeps_idx; density_vector.reserve(seeps_cnt); for(int j=0; j(obs_key, val) ); ret = true; diff --git a/src/libcode/vx_statistics/pair_data_ensemble.cc b/src/libcode/vx_statistics/pair_data_ensemble.cc index 0d80abce1a..6f6a0972dd 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.cc +++ b/src/libcode/vx_statistics/pair_data_ensemble.cc @@ -766,7 +766,7 @@ void PairDataEnsemble::compute_ssvar() { string ssvar_min = str_format("%.5e", j*ssvar_bin_size).contents(); if( !bins.count(ssvar_min) ){ ssvar_pt_list pts; - pts.push_back(pt); + pts.emplace_back(pt); bins[ssvar_min] = pts; // Print warning for too many bins @@ -779,7 +779,7 @@ void PairDataEnsemble::compute_ssvar() { } } else { - bins[ssvar_min].push_back(pt); + bins[ssvar_min].emplace_back(pt); } } // end for i diff --git a/src/libcode/vx_statistics/pair_data_point.cc b/src/libcode/vx_statistics/pair_data_point.cc index 85595d69d3..f913767739 100644 --- a/src/libcode/vx_statistics/pair_data_point.cc +++ b/src/libcode/vx_statistics/pair_data_point.cc @@ -120,7 +120,7 @@ void PairDataPoint::extend(int n) { f_na.extend(n); for (int idx=seeps_mpr.size(); idxfirst.getHeaderType(), calc->getType(), @@ -371,25 +371,25 @@ vector< SummaryCalc* > SummaryObs::getSummaryCalculators(const TimeSummaryInfo & // Create the calculator specified if (type == "mean") { - calculators.push_back(new SummaryCalcMean); + calculators.emplace_back(new SummaryCalcMean); } else if (type == "stdev") { - calculators.push_back(new SummaryCalcStdev); + calculators.emplace_back(new SummaryCalcStdev); } else if (type == "min") { - calculators.push_back(new SummaryCalcMin); + calculators.emplace_back(new SummaryCalcMin); } else if (type == "max") { - calculators.push_back(new SummaryCalcMax); + calculators.emplace_back(new SummaryCalcMax); } else if (type == "range") { - calculators.push_back(new SummaryCalcRange); + calculators.emplace_back(new SummaryCalcRange); } else if (type == "median") { - calculators.push_back(new SummaryCalcMedian); + calculators.emplace_back(new SummaryCalcMedian); } else if (type == "sum") { - calculators.push_back(new SummaryCalcSum); + calculators.emplace_back(new SummaryCalcSum); // Check for vld_thresh = 1.0 if (!is_eq(info.vld_thresh, 1.0)) { @@ -400,7 +400,7 @@ vector< SummaryCalc* > SummaryObs::getSummaryCalculators(const TimeSummaryInfo & } } else if (type[0] == 'p') { - calculators.push_back(new SummaryCalcPercentile(type)); + calculators.emplace_back(new SummaryCalcPercentile(type)); } } @@ -446,7 +446,7 @@ vector< TimeSummaryInterval > SummaryObs::getTimeIntervals( { // See if the current time is within the defined time intervals if (isInTimeInterval(interval_time, info.beg, info.end)) { - time_intervals.push_back(TimeSummaryInterval(interval_time, info.width_beg, info.width_end)); + time_intervals.emplace_back(TimeSummaryInterval(interval_time, info.width_beg, info.width_end)); } // Increment the current time @@ -516,7 +516,7 @@ bool SummaryObs::addObservationObj(const Observation &obs) bool result = false; // Do not filter by grib_code or obs_var here - observations.push_back(obs); + observations.emplace_back(obs); const ConcatString var_name = obs.getVarName(); const ConcatString var_units = obs.getVarUnits(); diff --git a/src/libcode/vx_tc_util/diag_file.cc b/src/libcode/vx_tc_util/diag_file.cc index 71cd94a81b..9df6e14d8c 100644 --- a/src/libcode/vx_tc_util/diag_file.cc +++ b/src/libcode/vx_tc_util/diag_file.cc @@ -372,7 +372,7 @@ void DiagFile::read_cira_rt(const ConcatString &path, // Store the name and values else { DiagName.add(cs); - DiagVal.push_back(data); + DiagVal.emplace_back(data); } } // end while @@ -524,7 +524,7 @@ void DiagFile::read_ships_rt(const ConcatString &path, // Store the name and values else { DiagName.add(cs); - DiagVal.push_back(data); + DiagVal.emplace_back(data); } } // end while diff --git a/src/libcode/vx_tc_util/gen_shape_info.cc b/src/libcode/vx_tc_util/gen_shape_info.cc index fc25d93502..a7013d4875 100644 --- a/src/libcode/vx_tc_util/gen_shape_info.cc +++ b/src/libcode/vx_tc_util/gen_shape_info.cc @@ -359,7 +359,7 @@ bool GenShapeInfoArray::add(const GenShapeInfo &gsi, bool check_dup) { } // end if // Store the genesis shape object - GenShape.push_back(gsi); + GenShape.emplace_back(gsi); return true; } diff --git a/src/libcode/vx_tc_util/genesis_info.cc b/src/libcode/vx_tc_util/genesis_info.cc index 104554884b..3f37b866fc 100644 --- a/src/libcode/vx_tc_util/genesis_info.cc +++ b/src/libcode/vx_tc_util/genesis_info.cc @@ -93,7 +93,7 @@ GenesisEventInfo parse_conf_genesis_event_info(Dictionary *dict) { // Conf: category (optional) sa = dict->lookup_string_array(conf_key_category, false); for(i=0; iinit()); LeadTime.add(fgi->genesis_lead()); - FcstGen.push_back(fgi); - BestGen.push_back((GenesisInfo *) 0); - GenDiff.push_back(diff); + FcstGen.emplace_back(fgi); + BestGen.emplace_back((GenesisInfo *) 0); + GenDiff.emplace_back(diff); return; } @@ -296,9 +296,9 @@ void PairDataGenesis::add_best_gen(const GenesisInfo *bgi, BestStormId.add(bgi->storm_id()); InitTime.add(init_ut); LeadTime.add(bgi->genesis_time() - init_ut); - FcstGen.push_back((GenesisInfo *) 0); - BestGen.push_back(bgi); - GenDiff.push_back(diff); + FcstGen.emplace_back((GenesisInfo *) 0); + BestGen.emplace_back(bgi); + GenDiff.emplace_back(diff); } } @@ -326,9 +326,9 @@ void PairDataGenesis::add_gen_pair(const GenesisInfo *fgi, BestStormId.add(bgi->storm_id()); InitTime.add(fgi->init()); LeadTime.add(fgi->genesis_lead()); - FcstGen.push_back(fgi); - BestGen.push_back(bgi); - GenDiff.push_back(diff); + FcstGen.emplace_back(fgi); + BestGen.emplace_back(bgi); + GenDiff.emplace_back(diff); } return; diff --git a/src/libcode/vx_tc_util/prob_info_array.cc b/src/libcode/vx_tc_util/prob_info_array.cc index 0caaa7ed73..a42eeb39d0 100644 --- a/src/libcode/vx_tc_util/prob_info_array.cc +++ b/src/libcode/vx_tc_util/prob_info_array.cc @@ -255,7 +255,7 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { else { ProbRIRWInfo ri; ri.add(l, dland, check_dup); - ProbRIRW.push_back(ri); + ProbRIRW.emplace_back(ri); status = true; } break; @@ -287,7 +287,7 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { << " line with no predicted genesis location.\n"; } else { - ProbGen.push_back(gi); + ProbGen.emplace_back(gi); status = true; } } @@ -306,14 +306,14 @@ bool ProbInfoArray::add(const ATCFProbLine &l, double dland, bool check_dup) { //////////////////////////////////////////////////////////////////////// void ProbInfoArray::add(const ProbRIRWInfo &rirw) { - ProbRIRW.push_back(rirw); + ProbRIRW.emplace_back(rirw); return; } //////////////////////////////////////////////////////////////////////// void ProbInfoArray::add(const ProbGenInfo &gi) { - ProbGen.push_back(gi); + ProbGen.emplace_back(gi); return; } diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc index 94aeaa01fd..ed64e6d604 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.cc +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.cc @@ -434,7 +434,7 @@ const ProbRIRWPairInfo & ProbRIRWPairInfoArray::operator[](int n) const { void ProbRIRWPairInfoArray::add(const ProbRIRWPairInfo &p) { - Pairs.push_back(p); + Pairs.emplace_back(p); return; } @@ -447,7 +447,7 @@ bool ProbRIRWPairInfoArray::add(const ProbRIRWInfo &p, const TrackInfo &t) { // Attempt to set a new pair if(!pair.set(p, t)) return false; - Pairs.push_back(pair); + Pairs.emplace_back(pair); return true; } diff --git a/src/libcode/vx_tc_util/track_info.cc b/src/libcode/vx_tc_util/track_info.cc index c287d47f9a..d2e6561294 100644 --- a/src/libcode/vx_tc_util/track_info.cc +++ b/src/libcode/vx_tc_util/track_info.cc @@ -834,7 +834,7 @@ void TrackInfoArray::assign(const TrackInfoArray &t) { clear(); - for(i=0; i counts; - counts.push_back(1); + counts.emplace_back(1); for(int i = 0; i < track_lines.n(); i++) { vector offsets; - offsets.push_back(i); + offsets.emplace_back(i); string line = track_lines[i]; const char* str = line.c_str(); track_line_var.putVar(offsets, counts, &str); @@ -66,10 +66,10 @@ void write_tc_track_lat_lon(NcFile* nc_out, } vector offsets; - offsets.push_back(0); + offsets.emplace_back(0); vector counts; - counts.push_back(track.n_points()); + counts.emplace_back(track.n_points()); track_lat_var.putVar(offsets, counts, track_lat_data.data()); track_lon_var.putVar(offsets, counts, track_lon_data.data()); @@ -86,8 +86,8 @@ void write_tc_track_point(NcFile* nc_out, vector offsets; vector counts; - offsets.push_back(0); - counts.push_back(1); + offsets.emplace_back(0); + counts.emplace_back(1); // Write track point values for lat, lon, vmax, and mslp @@ -144,10 +144,10 @@ void write_tc_rmw(NcFile* nc_out, } vector offsets; - offsets.push_back(0); + offsets.emplace_back(0); vector counts; - counts.push_back(track.n_points()); + counts.emplace_back(track.n_points()); track_mrd_var.putVar(offsets, counts, track_mrd_data.data()); @@ -419,9 +419,9 @@ void def_tc_lat_lon(NcFile* nc_out, NcVar& lat_var, NcVar& lon_var) { vector dims; - dims.push_back(track_point_dim); - dims.push_back(range_dim); - dims.push_back(azimuth_dim); + dims.emplace_back(track_point_dim); + dims.emplace_back(range_dim); + dims.emplace_back(azimuth_dim); lat_var = nc_out->addVar("lat", ncDouble, dims); lon_var = nc_out->addVar("lon", ncDouble, dims); @@ -469,10 +469,10 @@ void write_tc_valid_time(NcFile* nc_out, const int& i_point, vector counts; offsets.clear(); - offsets.push_back(i_point); + offsets.emplace_back(i_point); counts.clear(); - counts.push_back(1); + counts.emplace_back(1); // Valid time, as a formatted string unix_to_yyyymmdd_hhmmss(ut, cs); @@ -499,10 +499,10 @@ void write_tc_lead_time(NcFile* nc_out, const int& i_point, vector counts; offsets.clear(); - offsets.push_back(i_point); + offsets.emplace_back(i_point); counts.clear(); - counts.push_back(1); + counts.emplace_back(1); // Lead time, as a formatted string sec_to_hhmmss(sec, cs); @@ -524,15 +524,15 @@ void def_tc_variables(NcFile* nc_out, map& data_vars) { vector dims; - dims.push_back(track_point_dim); - dims.push_back(range_dim); - dims.push_back(azimuth_dim); + dims.emplace_back(track_point_dim); + dims.emplace_back(range_dim); + dims.emplace_back(azimuth_dim); vector dims_3d; - dims_3d.push_back(track_point_dim); - dims_3d.push_back(pressure_dim); - dims_3d.push_back(range_dim); - dims_3d.push_back(azimuth_dim); + dims_3d.emplace_back(track_point_dim); + dims_3d.emplace_back(pressure_dim); + dims_3d.emplace_back(range_dim); + dims_3d.emplace_back(azimuth_dim); for (map >::iterator i = variable_levels.begin(); i != variable_levels.end(); ++i) { @@ -568,9 +568,9 @@ void def_tc_data(NcFile* nc_out, NcVar& data_var, VarInfo* data_info) { vector dims; - dims.push_back(track_point_dim); - dims.push_back(range_dim); - dims.push_back(azimuth_dim); + dims.emplace_back(track_point_dim); + dims.emplace_back(range_dim); + dims.emplace_back(azimuth_dim); ConcatString var_name = data_info->name_attr(); var_name.add("_"); @@ -593,10 +593,10 @@ void def_tc_data_3d(NcFile* nc_out, NcVar& data_var, VarInfo* data_info) { vector dims; - dims.push_back(track_point_dim); - dims.push_back(pressure_dim); - dims.push_back(range_dim); - dims.push_back(azimuth_dim); + dims.emplace_back(track_point_dim); + dims.emplace_back(pressure_dim); + dims.emplace_back(range_dim); + dims.emplace_back(azimuth_dim); data_var = nc_out->addVar( data_info->name_attr(), ncDouble, dims); @@ -615,8 +615,8 @@ void def_tc_azi_mean_data(NcFile* nc_out, NcVar& data_var, VarInfo* data_info) { vector dims; - dims.push_back(track_point_dim); - dims.push_back(range_dim); + dims.emplace_back(track_point_dim); + dims.emplace_back(range_dim); ConcatString var_name = data_info->name_attr(); var_name.add("_"); @@ -640,14 +640,14 @@ void write_tc_data(NcFile* nc_out, const TcrmwGrid& grid, vector counts; offsets.clear(); - offsets.push_back(i_point); - offsets.push_back(0); - offsets.push_back(0); + offsets.emplace_back(i_point); + offsets.emplace_back(0); + offsets.emplace_back(0); counts.clear(); - counts.push_back(1); - counts.push_back(grid.range_n()); - counts.push_back(grid.azimuth_n()); + counts.emplace_back(1); + counts.emplace_back(grid.range_n()); + counts.emplace_back(grid.azimuth_n()); var.putVar(offsets, counts, data); } @@ -662,14 +662,14 @@ void write_tc_data_rev(NcFile* nc_out, const TcrmwGrid& grid, vector data_rev(grid.range_n() * grid.azimuth_n()); offsets.clear(); - offsets.push_back(i_point); - offsets.push_back(0); - offsets.push_back(0); + offsets.emplace_back(i_point); + offsets.emplace_back(0); + offsets.emplace_back(0); counts.clear(); - counts.push_back(1); - counts.push_back(grid.range_n()); - counts.push_back(grid.azimuth_n()); + counts.emplace_back(1); + counts.emplace_back(grid.range_n()); + counts.emplace_back(grid.azimuth_n()); for(int ir = 0; ir < grid.range_n(); ir++) { for(int ia = 0; ia < grid.azimuth_n(); ia++) { @@ -695,12 +695,12 @@ void write_tc_azi_mean_data(NcFile* nc_out, const TcrmwGrid& grid, vector data_azi_mean(grid.range_n(), 0.0); offsets.clear(); - offsets.push_back(i_point); - offsets.push_back(0); + offsets.emplace_back(i_point); + offsets.emplace_back(0); counts.clear(); - counts.push_back(1); - counts.push_back(grid.range_n()); + counts.emplace_back(1); + counts.emplace_back(grid.range_n()); for(int ir = 0; ir < grid.range_n(); ir++) { data_azi_mean[ir] = 0.; @@ -743,16 +743,16 @@ extern void write_tc_pressure_level_data( vector data_rev(grid.range_n() * grid.azimuth_n()); offsets_3d.clear(); - offsets_3d.push_back(i_point); - offsets_3d.push_back(i_level); - offsets_3d.push_back(0); - offsets_3d.push_back(0); + offsets_3d.emplace_back(i_point); + offsets_3d.emplace_back(i_level); + offsets_3d.emplace_back(0); + offsets_3d.emplace_back(0); counts_3d.clear(); - counts_3d.push_back(1); - counts_3d.push_back(1); - counts_3d.push_back(grid.range_n()); - counts_3d.push_back(grid.azimuth_n()); + counts_3d.emplace_back(1); + counts_3d.emplace_back(1); + counts_3d.emplace_back(grid.range_n()); + counts_3d.emplace_back(grid.azimuth_n()); for(int ir = 0; ir < grid.range_n(); ir++) { for(int ia = 0; ia < grid.azimuth_n(); ia++) { diff --git a/src/libcode/vx_time_series/compute_swinging_door.cc b/src/libcode/vx_time_series/compute_swinging_door.cc index 5e8d04629f..c833d11d63 100644 --- a/src/libcode/vx_time_series/compute_swinging_door.cc +++ b/src/libcode/vx_time_series/compute_swinging_door.cc @@ -42,7 +42,7 @@ bool compute_swinging_door_slopes(const TimeArray &valid_times, vector< SDObservation > obs; for (int i = 0; i < valid_times.n_elements(); ++i) - obs.push_back(SDObservation((time_t)valid_times[i], data_values[i])); + obs.emplace_back(SDObservation((time_t)valid_times[i], data_values[i])); // Calculate the ramps @@ -152,7 +152,7 @@ bool compute_swinging_door_ramps(const vector< SDObservation > &observations, // Save the end point of the previous corridor SDObservation ramp_end(end_time, end_ramp_value); - ramps.push_back(pair< SDObservation, SDObservation >(ramp_start, ramp_end)); + ramps.emplace_back(pair< SDObservation, SDObservation >(ramp_start, ramp_end)); // Save the values for the next corridor @@ -174,7 +174,7 @@ bool compute_swinging_door_ramps(const vector< SDObservation > &observations, // doors instead. SDObservation ramp_end(end_time, end_value); - ramps.push_back(pair< SDObservation, SDObservation >(ramp_start, ramp_end)); + ramps.emplace_back(pair< SDObservation, SDObservation >(ramp_start, ramp_end)); return true; } diff --git a/src/tools/core/mode/mode_superobject.cc b/src/tools/core/mode/mode_superobject.cc index 83421799c5..4caee4ddb3 100644 --- a/src/tools/core/mode/mode_superobject.cc +++ b/src/tools/core/mode/mode_superobject.cc @@ -98,8 +98,8 @@ static void _debug_shape_examine(const string &name, const ShapeData &sd, vector::iterator vi; vi = find(values.begin(), values.end(), v); if (vi == values.end()) { - values.push_back(v); - count.push_back(1); + values.emplace_back(v); + count.emplace_back(1); } else { auto ii = (int) (vi - values.begin()); count[ii] = count[ii] + 1; diff --git a/src/tools/core/mode/multivar_data.cc b/src/tools/core/mode/multivar_data.cc index b0979e3b45..6c4b6f69b5 100644 --- a/src/tools/core/mode/multivar_data.cc +++ b/src/tools/core/mode/multivar_data.cc @@ -129,7 +129,7 @@ void MultiVarData1::_print_summary(const string &name, int *data, const ShapeDat for (int i=0; i<_nx*_ny; ++i) { if (data[i] > 0) { if (find(values.begin(), values.end(), data[i]) == values.end()) { - values.push_back(data[i]); + values.emplace_back(data[i]); } } } @@ -327,8 +327,8 @@ static void _debug_shape_examine(const string &name, const ShapeData &sd, int n vector::iterator vi; vi = find(values.begin(), values.end(), v); if (vi == values.end()) { - values.push_back(v); - count.push_back(1); + values.emplace_back(v); + count.emplace_back(1); } else { int ii = vi - values.begin(); count[ii] = count[ii] + 1; diff --git a/src/tools/core/mode/multivar_frontend.cc b/src/tools/core/mode/multivar_frontend.cc index 77d9882eb0..ec1cc1950f 100644 --- a/src/tools/core/mode/multivar_frontend.cc +++ b/src/tools/core/mode/multivar_frontend.cc @@ -131,10 +131,10 @@ int MultivarFrontEnd::run(const StringArray & Argv) SimpleObjects OO; _create_simple_objects(ModeDataType::MvMode_Fcst, "forecast", ir, it, n_fcst_files, fcst_filenames, fcstInput, f_calc, OF); - fcstSimple.push_back(OF); + fcstSimple.emplace_back(OF); _create_simple_objects(ModeDataType::MvMode_Obs, "obs", ir, it, n_obs_files, obs_filenames, obsInput, o_calc, OO); - obsSimple.push_back(OO); + obsSimple.emplace_back(OO); } } } @@ -144,10 +144,10 @@ int MultivarFrontEnd::run(const StringArray & Argv) SimpleObjects OO; _create_simple_objects(ModeDataType::MvMode_Fcst, "forecast", ir, ir, n_fcst_files, fcst_filenames, fcstInput, f_calc, OF); - fcstSimple.push_back(OF); + fcstSimple.emplace_back(OF); _create_simple_objects(ModeDataType::MvMode_Obs, "obs", ir, ir, n_obs_files, obs_filenames, obsInput, o_calc, OO); - obsSimple.push_back(OO); + obsSimple.emplace_back(OO); } } @@ -488,11 +488,11 @@ void MultivarFrontEnd::_read_input(const string &name, int index, ModeDataType t if (type == ModeDataType::MvMode_Fcst) { config.process_config_field(ft, other_t, type, index); f->data_plane(*(config.Fcst->var_info), dp); - fcstInput.push_back(ModeInputData(name, dp, g)); + fcstInput.emplace_back(ModeInputData(name, dp, g)); } else { config.process_config_field(other_t, ft, type, index); f->data_plane(*(config.Obs->var_info), dp); - obsInput.push_back(ModeInputData(name, dp, g)); + obsInput.emplace_back(ModeInputData(name, dp, g)); } delete f; @@ -527,7 +527,7 @@ void MultivarFrontEnd::_create_simple_objects(ModeDataType dtype, const std::str MultiVarData *mvdi = _create_simple_multivar_data(dtype, rIndex, tIndex, j, n_files, filenames[j], input[j]); mvdi->print(); - O._mvd.push_back(mvdi); + O._mvd.emplace_back(mvdi); } O.setSuper(dtype == ModeDataType::MvMode_Fcst, n_files, do_clusters, calc); } diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index e5c3a62fe8..d7f64f2348 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -2256,7 +2256,7 @@ void add_stat_data(const ConcatString &var_name, // Store the new NcVarData object stat_data[var_name] = data; - stat_data_keys.push_back(var_name); + stat_data_keys.emplace_back(var_name); return; } diff --git a/src/tools/core/stat_analysis/aggr_stat_line.cc b/src/tools/core/stat_analysis/aggr_stat_line.cc index 98df91caad..f7b9ccaf72 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.cc +++ b/src/tools/core/stat_analysis/aggr_stat_line.cc @@ -3424,7 +3424,7 @@ void aggr_seeps_mpr_lines(LineDataFile &f, STATAnalysisJob &job, // Allocated here but deallocated by PairDataPoint SeepsScore *score = new SeepsScore; *score = cur.seeps_mpr; - m[key].pd.seeps_mpr.push_back(score); + m[key].pd.seeps_mpr.emplace_back(score); // // Keep track of the unique header column entries diff --git a/src/tools/core/stat_analysis/skill_score_index_job.cc b/src/tools/core/stat_analysis/skill_score_index_job.cc index 88bc450900..3c54ff827f 100644 --- a/src/tools/core/stat_analysis/skill_score_index_job.cc +++ b/src/tools/core/stat_analysis/skill_score_index_job.cc @@ -131,21 +131,21 @@ void SSIndexJobInfo::add_term(const STATAnalysisJob &fcst_term, n_term++; // Add the jobs - fcst_job.push_back(fcst_term); - ref_job.push_back(ref_term); + fcst_job.emplace_back(fcst_term); + ref_job.emplace_back(ref_term); // Add the input line type for each job - job_lt.push_back(string_to_statlinetype(fcst_term.line_type[0].c_str())); + job_lt.emplace_back(string_to_statlinetype(fcst_term.line_type[0].c_str())); // Add partial sums SL1L2Info sl1l2_info; - fcst_sl1l2.push_back(sl1l2_info); - ref_sl1l2.push_back(sl1l2_info); + fcst_sl1l2.emplace_back(sl1l2_info); + ref_sl1l2.emplace_back(sl1l2_info); // Add contingency tables CTSInfo cts_info; - fcst_cts.push_back(cts_info); - ref_cts.push_back(cts_info); + fcst_cts.emplace_back(cts_info); + ref_cts.emplace_back(cts_info); // Add line counters n_fcst_lines.add(0); diff --git a/src/tools/core/stat_analysis/stat_analysis_job.cc b/src/tools/core/stat_analysis/stat_analysis_job.cc index b3a9eb12cb..c4a786b11f 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.cc +++ b/src/tools/core/stat_analysis/stat_analysis_job.cc @@ -653,7 +653,7 @@ void do_job_aggr_stat(const ConcatString &jobstring, LineDataFile &f, // in_lt = string_to_statlinetype(job.line_type[0].c_str()); for(i=0; i &observations, vector< pair< SDObservation, SDObservation > >::const_iterator ramp; for (ramp = ramps.begin(); ramp != ramps.end(); ++ramp) { - compressed_observations.push_back(ramp->first); - compressed_observations.push_back(ramp->second); + compressed_observations.emplace_back(ramp->first); + compressed_observations.emplace_back(ramp->second); } return true; diff --git a/src/tools/other/ascii2nc/airnow_handler.cc b/src/tools/other/ascii2nc/airnow_handler.cc index 5cae0a391c..f96a838429 100644 --- a/src/tools/other/ascii2nc/airnow_handler.cc +++ b/src/tools/other/ascii2nc/airnow_handler.cc @@ -990,7 +990,7 @@ vector parseHourlyAqobsLine(const string &asciiLine, bool &ok) break; } else { string token = remainder.substr(0, i1); - tokens.push_back(token); + tokens.emplace_back(token); remainder = remainder.substr(i1+1); } } diff --git a/src/tools/other/ascii2nc/airnow_locations.cc b/src/tools/other/ascii2nc/airnow_locations.cc index e8d09647b8..669dbe5625 100644 --- a/src/tools/other/ascii2nc/airnow_locations.cc +++ b/src/tools/other/ascii2nc/airnow_locations.cc @@ -98,12 +98,12 @@ bool AirnowLocations::initialize(const string &fileName) vector::const_iterator it; it = find(monitoringSiteFullAqsid.begin(), monitoringSiteFullAqsid.end(), fullaqsid); if (it == monitoringSiteFullAqsid.end()) { - monitoringSiteAqsid.push_back(aqsid); - monitoringSiteFullAqsid.push_back(fullaqsid); - monitoringSiteStationId.push_back(stationid); - monitoringSiteLat.push_back(lat); - monitoringSiteLon.push_back(lon); - monitoringSiteElev.push_back(elev); + monitoringSiteAqsid.emplace_back(aqsid); + monitoringSiteFullAqsid.emplace_back(fullaqsid); + monitoringSiteStationId.emplace_back(stationid); + monitoringSiteLat.emplace_back(lat); + monitoringSiteLon.emplace_back(lon); + monitoringSiteElev.emplace_back(elev); } else { int index = (int)(it - monitoringSiteFullAqsid.begin()); string aqsid2 = monitoringSiteAqsid[index]; diff --git a/src/tools/other/ascii2nc/ascii2nc.cc b/src/tools/other/ascii2nc/ascii2nc.cc index 5a7a5f5195..32843eb4a9 100644 --- a/src/tools/other/ascii2nc/ascii2nc.cc +++ b/src/tools/other/ascii2nc/ascii2nc.cc @@ -216,7 +216,7 @@ int met_main(int argc, char *argv[]) { // Store the input ASCII file name and the output NetCDF file name // for (int i = 0; i < cline.n() - 1; ++i) - asfile_list.push_back((string)cline[i]); + asfile_list.emplace_back((string)cline[i]); ncfile = cline[cline.n() - 1]; // diff --git a/src/tools/other/ascii2nc/file_handler.cc b/src/tools/other/ascii2nc/file_handler.cc index 61901cc5b8..82bf9d7e53 100644 --- a/src/tools/other/ascii2nc/file_handler.cc +++ b/src/tools/other/ascii2nc/file_handler.cc @@ -319,7 +319,7 @@ bool FileHandler::_addObservations(const Observation &obs) } // Save obs because the obs vector is sorted after time summary - _observations.push_back(obs); + _observations.emplace_back(obs); if (do_summary) summary_obs.addObservationObj(obs); else { ConcatString var_name = obs.getVarName(); diff --git a/src/tools/other/ascii2nc/ndbc_handler.cc b/src/tools/other/ascii2nc/ndbc_handler.cc index 1de6c26b9d..d856e668a9 100644 --- a/src/tools/other/ascii2nc/ndbc_handler.cc +++ b/src/tools/other/ascii2nc/ndbc_handler.cc @@ -99,20 +99,20 @@ NdbcHandler::NdbcHandler(const string &program_name) : // NOTE these will be used as index values in the observations // 0 = wind dir, 1 = wind speed, etc. // - column.push_back(Column(hdr_wind_dir)); - column.push_back(Column(hdr_wind_speed)); - column.push_back(Column(hdr_gust_speed)); - column.push_back(Column(hdr_wave_height)); - column.push_back(Column(hdr_dominant_wave_period)); - column.push_back(Column(hdr_average_wave_period)); - column.push_back(Column(hdr_dominant_wave_direction)); - column.push_back(Column(hdr_sea_level_pressure)); - column.push_back(Column(hdr_air_temp)); - column.push_back(Column(hdr_sea_surface_temp)); - column.push_back(Column(hdr_dewpoint)); - column.push_back(Column(hdr_visibility)); - column.push_back(Column(hdr_pressure_tendency)); - column.push_back(Column(hdr_tide)); + column.emplace_back(Column(hdr_wind_dir)); + column.emplace_back(Column(hdr_wind_speed)); + column.emplace_back(Column(hdr_gust_speed)); + column.emplace_back(Column(hdr_wave_height)); + column.emplace_back(Column(hdr_dominant_wave_period)); + column.emplace_back(Column(hdr_average_wave_period)); + column.emplace_back(Column(hdr_dominant_wave_direction)); + column.emplace_back(Column(hdr_sea_level_pressure)); + column.emplace_back(Column(hdr_air_temp)); + column.emplace_back(Column(hdr_sea_surface_temp)); + column.emplace_back(Column(hdr_dewpoint)); + column.emplace_back(Column(hdr_visibility)); + column.emplace_back(Column(hdr_pressure_tendency)); + column.emplace_back(Column(hdr_tide)); numMissingStations = 0; } diff --git a/src/tools/other/ascii2nc/ndbc_locations.cc b/src/tools/other/ascii2nc/ndbc_locations.cc index bc111e7d05..3e06464e87 100644 --- a/src/tools/other/ascii2nc/ndbc_locations.cc +++ b/src/tools/other/ascii2nc/ndbc_locations.cc @@ -105,10 +105,10 @@ bool NdbcLocations::initialize(const string &fName) // store lower case only, for later comparisons std::transform(stationId.begin(), stationId.end(), stationId.begin(), ::tolower); - StationId.push_back(stationId); - Lat.push_back(lat); - Lon.push_back(lon); - Elev.push_back(elev); + StationId.emplace_back(stationId); + Lat.emplace_back(lat); + Lon.emplace_back(lon); + Elev.emplace_back(elev); } locFile.close(); return true; diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc index 52281061fd..2d507d1f56 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.cc @@ -267,7 +267,7 @@ void GenEnsProdConfInfo::process_config(GrdFileType etype, StringArray * ens_fil // Conf: ensemble_flag ens_info->nc_info = parse_nc_info(&i_edict); - ens_input.push_back(ens_info); + ens_input.emplace_back(ens_info); } // end for i // Conf: ens.ens_thresh diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index e2d2580436..777d002020 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -679,7 +679,7 @@ void get_shapefile_records() { << "Using shape number " << i << " with " << pr.n_points << " points.\n"; pr.toggle_longitudes(); - shape_recs.push_back(pr); + shape_recs.emplace_back(pr); } } @@ -1354,7 +1354,7 @@ static void apply_shape_mask(DataPlane & dp) { vector poly_list; for(const auto& cur_rec: shape_recs) { poly.set(cur_rec, grid); - poly_list.push_back(poly); + poly_list.emplace_back(poly); } // Check grid points @@ -1807,7 +1807,7 @@ static void set_type(const StringArray & a) { StringArray sa; sa.parse_css(a[0]); for(int i=0; ifile_type()); + file_types.emplace_back(data_mtddf->file_type()); // Store the grid data_grid = data_mtddf->grid(); @@ -412,8 +412,8 @@ void setup_histograms(void) { VarInfo *data_info = conf_info.data_info[i_var]; // Initialize variable min and max values - var_mins.push_back(bad_data_double); - var_maxs.push_back(bad_data_double); + var_mins.emplace_back(bad_data_double); + var_maxs.emplace_back(bad_data_double); // Find bin ranges NumArray range = data_info->range(); @@ -430,9 +430,9 @@ void setup_histograms(void) { bin_max.clear(); bin_mid.clear(); for(int k=0; kn_bins()); - data_var_dims.push_back(var_dim); + data_var_dims.emplace_back(var_dim); // Define histogram bins ConcatString var_min_name = var_name; @@ -607,7 +607,7 @@ void setup_nc_file(void) { NcDim var_dim = data_var_dims[i_var]; NcVar hist_var = add_var(nc_out, hist_name, ncInt64, var_dim, deflate_level); - hist_vars.push_back(hist_var); + hist_vars.emplace_back(hist_var); // Add variable attributes cs << cs_erase << "Histogram of " << var_name << " values"; @@ -651,12 +651,12 @@ void setup_nc_file(void) { NcDim joint_dim = data_var_dims[j_var]; vector dims; dims.clear(); - dims.push_back(var_dim); - dims.push_back(joint_dim); + dims.emplace_back(var_dim); + dims.emplace_back(joint_dim); NcVar hist_var = add_var(nc_out, hist_name, ncInt64, dims, deflate_level); - joint_hist_vars.push_back(hist_var); + joint_hist_vars.emplace_back(hist_var); // Add variable attributes cs << cs_erase @@ -732,10 +732,10 @@ void write_joint_histograms(void) { offsets.clear(); counts.clear(); - offsets.push_back(0); - offsets.push_back(0); - counts.push_back(data_info->n_bins()); - counts.push_back(joint_info->n_bins()); + offsets.emplace_back(0); + offsets.emplace_back(0); + counts.emplace_back(data_info->n_bins()); + counts.emplace_back(joint_info->n_bins()); NcVar hist_var = joint_hist_vars[i_hist]; hist_var.putVar(offsets, counts, hist); @@ -850,7 +850,7 @@ void usage() { //////////////////////////////////////////////////////////////////////// void set_data_files(const StringArray & a) { - data_files.push_back(a); + data_files.emplace_back(a); if(data_files.size() > 0) multiple_data_sources = true; } diff --git a/src/tools/other/gsi_tools/gsidens2orank.cc b/src/tools/other/gsi_tools/gsidens2orank.cc index d7d4b5bee4..b4aeeb2249 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.cc +++ b/src/tools/other/gsi_tools/gsidens2orank.cc @@ -264,7 +264,7 @@ void process_conv_data(ConvData &d, int i_mem) { add_key(key); // Store the current pair data - conv_data.push_back(d); + conv_data.emplace_back(d); // Store the current observation info ClimoPntInfo cpi(bad_data_double, bad_data_double, @@ -424,7 +424,7 @@ void process_rad_data(RadData &d, int i_mem) { add_key(key); // Store the current pair data - rad_data.push_back(d); + rad_data.emplace_back(d); // Store the current observation info ClimoPntInfo cpi(bad_data_double, bad_data_double, diff --git a/src/tools/other/ioda2nc/ioda2nc.cc b/src/tools/other/ioda2nc/ioda2nc.cc index 6e2d57c25b..4e19fd2794 100644 --- a/src/tools/other/ioda2nc/ioda2nc.cc +++ b/src/tools/other/ioda2nc/ioda2nc.cc @@ -670,8 +670,8 @@ void process_ioda_file(int i_pb) { << "processing \"" << raw_var_names[idx] << "\" variable!\n"; obs_var = get_var(f_in, raw_var_names[idx].c_str(), obs_group_name); if (IS_INVALID_NC(obs_var)) obs_var = get_var(f_in, raw_var_names[idx].c_str(), derived_obs_group_name); - v_qc_data.push_back(qc_data); - v_obs_data.push_back(obs_data); + v_qc_data.emplace_back(qc_data); + v_obs_data.emplace_back(obs_data); unit_attr.clear(); desc_attr.clear(); if(IS_VALID_NC(obs_var)) { @@ -1129,7 +1129,7 @@ void addObservation(const float *obs_arr, const ConcatString &hdr_typ, obs_arr[2], obs_arr[3], obs_arr[4], (0addObservationObj(obs); return; } diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index 8831dde2aa..6a976eddb4 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -265,7 +265,7 @@ void process_command_line(int argc, char **argv) { // Store the input MADIS file name and the output NetCDF file name // for (i = 0; i < cline.n() - 1; ++i) - md_files.push_back((string)cline[i]); + md_files.emplace_back((string)cline[i]); ncfile = cline[cline.n() - 1]; conf_info.read_config(DEFAULT_CONFIG_FILENAME, config_filename.text()); @@ -649,7 +649,7 @@ int process_obs(const int in_gc, const float conversion, obs_arr[2], obs_arr[3], obs_arr[4], var_name); - obs_vector.push_back(obs); + obs_vector.emplace_back(obs); if (do_summary) summary_obs->addObservationObj(obs); i_obs++; diff --git a/src/tools/other/mode_graphics/cgraph_font.cc b/src/tools/other/mode_graphics/cgraph_font.cc index 0b34cdc0d2..982e60d958 100644 --- a/src/tools/other/mode_graphics/cgraph_font.cc +++ b/src/tools/other/mode_graphics/cgraph_font.cc @@ -521,7 +521,7 @@ void CgFontCollection::add(const CgFont & f) extend(Nelements + 1); -e.push_back(f); +e.emplace_back(f); ++Nelements; @@ -542,7 +542,7 @@ if ( have_it(f) ) return; extend(Nelements + 1); -e.push_back(f); +e.emplace_back(f); ++Nelements; diff --git a/src/tools/other/mode_time_domain/mtd_read_data.cc b/src/tools/other/mode_time_domain/mtd_read_data.cc index a48357b1f6..279b26c64d 100644 --- a/src/tools/other/mode_time_domain/mtd_read_data.cc +++ b/src/tools/other/mode_time_domain/mtd_read_data.cc @@ -78,7 +78,7 @@ for (j=0; j<(filenames.n()); ++j) { } - valid_times.push_back(plane.valid()); + valid_times.emplace_back(plane.valid()); if ( j == 0 ) { @@ -114,10 +114,10 @@ unixtime dt_start; vector dtVector; dt_start = valid_times[1] - valid_times[0]; -dtVector.push_back(dt_start); +dtVector.emplace_back(dt_start); for (size_t k=2; kaddObservationObj(obs); return; } @@ -3056,7 +3056,7 @@ int combine_tqz_and_uv(map pqtzuv_map_tq, it!=pqtzuv_map_merged.end(); ++it) { float *new_pqtzuv = new float[mxr8vt]; for (int i=0; isecond[i]; - pqtzuv_merged_array.push_back(new_pqtzuv); + pqtzuv_merged_array.emplace_back(new_pqtzuv); } if(mlog.verbosity_level() >= PBL_DEBUG_LEVEL) { diff --git a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc index 4a06fd3e89..7f08758a86 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc @@ -308,7 +308,7 @@ bool PlotPointObsOpt::add(const Observation &obs) { // Update the set of locations n_obs++; - if(!has(cur_loc)) locations.push_back(cur_loc); + if(!has(cur_loc)) locations.emplace_back(cur_loc); return true; } @@ -525,7 +525,7 @@ void PlotPointObsConfInfo::process_config( // Parse each array entry for(i=0; in_entries(); i++) { opt.process_config(*((*dict)[i]->dict_value())); - point_opts.push_back(opt); + point_opts.emplace_back(opt); // Check for a colorbar if(opt.fill_plot_info.flag && opt.fill_plot_info.colorbar_flag) { diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc index 5a5c6f908a..ebb023f33c 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc @@ -205,19 +205,19 @@ void setup() { // Get dimension coordinates vector start; vector count; - start.push_back(0); + start.emplace_back(0); ConcatString s; NcVar range_var = get_nc_var(nc_in, "range"); count.clear(); - count.push_back(n_range); + count.emplace_back(n_range); range_coord.resize(n_range); range_var.getVar(start, count, range_coord.data()); NcVar azimuth_var = get_nc_var(nc_in, "azimuth"); count.clear(); - count.push_back(n_azimuth); + count.emplace_back(n_azimuth); azimuth_coord.resize(n_azimuth); azimuth_var.getVar(start, count, azimuth_coord.data()); get_att_value_string(&azimuth_var, "units", s); @@ -225,7 +225,7 @@ void setup() { NcVar level_var = get_nc_var(nc_in, level_name.c_str()); count.clear(); - count.push_back(n_level); + count.emplace_back(n_level); level_coord.resize(n_level); level_var.getVar(start, count, level_coord.data()); get_att_value_string(&level_var, "units", s); @@ -233,16 +233,16 @@ void setup() { // Read variable information for(int i_var = 0; i_var < conf_info.get_n_data(); i_var++) { - data_names.push_back(conf_info.data_info[i_var]->name().string()); + data_names.emplace_back(conf_info.data_info[i_var]->name().string()); NcVar var = get_nc_var( nc_in, conf_info.data_info[i_var]->name().c_str()); int n_dim = get_dim_count(&var) - 1; - data_n_dims.push_back(n_dim); + data_n_dims.emplace_back(n_dim); ConcatString s; get_att_value_string(&var, "long_name", s); - data_long_names.push_back(s.string()); + data_long_names.emplace_back(s.string()); get_att_value_string(&var, "units", s); - data_units.push_back(s.string()); + data_units.emplace_back(s.string()); } // Initialize statistical data cube lists @@ -268,11 +268,11 @@ void setup() { data_max_2d->set_constant(-1.0e6); data_min_2d->set_constant(1.0e6); - data_counts.push_back(data_count_2d); - data_means.push_back(data_mean_2d); - data_stdevs.push_back(data_stdev_2d); - data_mins.push_back(data_min_2d); - data_maxs.push_back(data_max_2d); + data_counts.emplace_back(data_count_2d); + data_means.emplace_back(data_mean_2d); + data_stdevs.emplace_back(data_stdev_2d); + data_mins.emplace_back(data_min_2d); + data_maxs.emplace_back(data_max_2d); } if (data_n_dims[i_var] == 3) { // Size data cubes @@ -294,11 +294,11 @@ void setup() { data_max_3d->set_constant(-1.0e6); data_min_3d->set_constant(1.0e6); - data_counts.push_back(data_count_3d); - data_means.push_back(data_mean_3d); - data_stdevs.push_back(data_stdev_3d); - data_mins.push_back(data_min_3d); - data_maxs.push_back(data_max_3d); + data_counts.emplace_back(data_count_3d); + data_means.emplace_back(data_mean_3d); + data_stdevs.emplace_back(data_stdev_3d); + data_mins.emplace_back(data_min_3d); + data_maxs.emplace_back(data_max_3d); } } } @@ -323,20 +323,20 @@ void process_files() { vector count_2d; vector start_3d; vector count_3d; - start_2d.push_back(0); - start_2d.push_back(0); - start_2d.push_back(0); - count_2d.push_back(1); - count_2d.push_back(n_range); - count_2d.push_back(n_azimuth); - start_3d.push_back(0); - start_3d.push_back(0); - start_3d.push_back(0); - start_3d.push_back(0); - count_3d.push_back(1); - count_3d.push_back(n_level); - count_3d.push_back(n_range); - count_3d.push_back(n_azimuth); + start_2d.emplace_back(0); + start_2d.emplace_back(0); + start_2d.emplace_back(0); + count_2d.emplace_back(1); + count_2d.emplace_back(n_range); + count_2d.emplace_back(n_azimuth); + start_3d.emplace_back(0); + start_3d.emplace_back(0); + start_3d.emplace_back(0); + start_3d.emplace_back(0); + count_3d.emplace_back(1); + count_3d.emplace_back(n_level); + count_3d.emplace_back(n_range); + count_3d.emplace_back(n_azimuth); for(int i_file = 0; i_file < data_files.n_elements(); i_file++) { mlog << Debug(1) << "Processing " @@ -439,13 +439,13 @@ void write_stats() { level_dim = add_dim(nc_out, level_name, n_level); vector dims_2d; - dims_2d.push_back(range_dim); - dims_2d.push_back(azimuth_dim); + dims_2d.emplace_back(range_dim); + dims_2d.emplace_back(azimuth_dim); vector dims_3d; - dims_3d.push_back(level_dim); - dims_3d.push_back(range_dim); - dims_3d.push_back(azimuth_dim); + dims_3d.emplace_back(level_dim); + dims_3d.emplace_back(range_dim); + dims_3d.emplace_back(azimuth_dim); NcVar level_var = nc_out->addVar(level_name, ncDouble, level_dim); NcVar range_var = nc_out->addVar("range", ncDouble, range_dim); @@ -455,10 +455,10 @@ void write_stats() { vector count_range; vector count_azimuth; vector count_level; - offset.push_back(0); - count_level.push_back(n_level); - count_range.push_back(n_range); - count_azimuth.push_back(n_azimuth); + offset.emplace_back(0); + count_level.emplace_back(n_level); + count_range.emplace_back(n_range); + count_azimuth.emplace_back(n_azimuth); for (int r = 0; r < n_range; r++) { range_coord[r] = r; @@ -478,17 +478,17 @@ void write_stats() { vector offset_3d; vector count_3d; - offset_2d.push_back(0); - offset_2d.push_back(0); - count_2d.push_back(n_range); - count_2d.push_back(n_azimuth); + offset_2d.emplace_back(0); + offset_2d.emplace_back(0); + count_2d.emplace_back(n_range); + count_2d.emplace_back(n_azimuth); - offset_3d.push_back(0); - offset_3d.push_back(0); - offset_3d.push_back(0); - count_3d.push_back(n_level); - count_3d.push_back(n_range); - count_3d.push_back(n_azimuth); + offset_3d.emplace_back(0); + offset_3d.emplace_back(0); + offset_3d.emplace_back(0); + count_3d.emplace_back(n_level); + count_3d.emplace_back(n_range); + count_3d.emplace_back(n_azimuth); for(int i_var = 0; i_var < data_names.size(); i_var++) { if (data_n_dims[i_var] == 2) { @@ -726,9 +726,9 @@ void read_nc_tracks(NcFile* nc_in) { for(int i = 0; i < n_track_line; i++) { offsets.clear(); - offsets.push_back(i); + offsets.emplace_back(i); counts.clear(); - counts.push_back(1); + counts.emplace_back(1); char* track_line_str; track_lines_var.getVar(offsets, counts, &track_line_str); diff --git a/src/tools/tc_utils/tc_diag/python_tc_diag.cc b/src/tools/tc_utils/tc_diag/python_tc_diag.cc index f7791d8bcf..aaa75ecc8e 100644 --- a/src/tools/tc_utils/tc_diag/python_tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/python_tc_diag.cc @@ -431,7 +431,7 @@ bool parse_python_string_value_map(PyObject *dict, else { mlog << Debug(5) << "Adding to map \"" << key_str << "\" = " << val << "\n"; - k.push_back(key_str); + k.emplace_back(key_str); m[key_str] = val; } } // end while diff --git a/src/tools/tc_utils/tc_diag/tc_diag.cc b/src/tools/tc_utils/tc_diag/tc_diag.cc index 00abca8909..d021b5008b 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag.cc @@ -988,7 +988,7 @@ void process_fields(const TrackInfoArray &tracks, // Make a local VarInfo copy to store the valid time vi = vi_factory.new_copy(di.var_info_ptr[i]); vi->set_valid(vld_ut); - vi_list.push_back(vi); + vi_list.emplace_back(vi); } // Read all data at the same time if they are all in the same file @@ -1017,7 +1017,7 @@ void process_fields(const TrackInfoArray &tracks, if(!status) dp.clear(); // Append current DataPlane to the vector - dp_list.push_back(dp); + dp_list.emplace_back(dp); } // end for i } @@ -1140,7 +1140,7 @@ void process_out_files(const TrackInfoArray& tracks) { } // Update list of domain-specific temp files - domain_tmp_file_list.push_back(&tmp_file_map[tmp_key]); + domain_tmp_file_list.emplace_back(&tmp_file_map[tmp_key]); // Store the diagnostics for each track point out_file_map[out_key].add_tmp_file_info(tmp_file_map[tmp_key], @@ -1302,7 +1302,7 @@ void copy_time_vars(NcFile *to_nc, NcFile *from_nc, int i_time) { if(!has_var(to_nc, var_names[i].c_str())) { vector dims; for(j=0; jaddVar(var_names[i], ncDouble, dims); copy_nc_atts(&from_var, &new_var); @@ -1318,15 +1318,15 @@ void copy_time_vars(NcFile *to_nc, NcFile *from_nc, int i_time) { for(j=0; j &k_src, if(diag_list.n() > 0 && !diag_list.has(*it)) continue; // Store this key - if(add_keys) k_dst.push_back(*it); + if(add_keys) k_dst.emplace_back(*it); // Add new destination map entry, if needed if(m_dst.count(*it) == 0) { @@ -1716,10 +1716,10 @@ void OutFileInfo::write_nc_domain_info(const DomainInfo &di) { vector dims; vector offsets; - offsets.push_back(0); + offsets.emplace_back(0); vector counts; - counts.push_back(1); + counts.emplace_back(1); ConcatString name(di.domain); name << "_domain"; @@ -1749,13 +1749,13 @@ void OutFileInfo::write_nc_diag_vals(const string &name, // Setup dimensions vector dims; - dims.push_back(vld_dim); + dims.emplace_back(vld_dim); vector offsets; - offsets.push_back(0); + offsets.emplace_back(0); vector counts; - counts.push_back(get_dim_size(&vld_dim)); + counts.emplace_back(get_dim_size(&vld_dim)); // Define new variable NcVar diag_var = nc_diag_out->addVar(name, ncDouble, dims); @@ -1785,16 +1785,16 @@ void OutFileInfo::write_nc_diag_prs_vals(const string &name, // Setup dimensions vector dims; - dims.push_back(vld_dim); - dims.push_back(prs_dim); + dims.emplace_back(vld_dim); + dims.emplace_back(prs_dim); vector offsets; - offsets.push_back(0); - offsets.push_back(0); + offsets.emplace_back(0); + offsets.emplace_back(0); vector counts; - counts.push_back(get_dim_size(&vld_dim)); - counts.push_back(get_dim_size(&prs_dim)); + counts.emplace_back(get_dim_size(&vld_dim)); + counts.emplace_back(get_dim_size(&prs_dim)); // Add variable attributes NcVar diag_var = nc_diag_out->addVar(name, ncDouble, dims); @@ -2295,10 +2295,10 @@ void TmpFileInfo::write_nc_data(const VarInfo *vi, const DataPlane &dp_in, // Setup dimensions vector dims; - dims.push_back(vld_dim); - if(is_prs) dims.push_back(prs_dim); - dims.push_back(rng_dim); - dims.push_back(azi_dim); + dims.emplace_back(vld_dim); + if(is_prs) dims.emplace_back(prs_dim); + dims.emplace_back(rng_dim); + dims.emplace_back(azi_dim); // Create the output variable name ConcatString var_name; diff --git a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc index 0ef7d137b7..ad2d1b8a6f 100644 --- a/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc +++ b/src/tools/tc_utils/tc_diag/tc_diag_conf_info.cc @@ -306,7 +306,7 @@ void TCDiagConfInfo::process_config(GrdFileType file_type, // Conf: field.name and field.level VarInfo *vi = vi_factory.new_var_info(file_type); vi->set_dict(i_dict); - var_info.push_back(vi); + var_info.emplace_back(vi); // Unique list of requested pressure levels if(vi->level().type() == LevelType_Pres) { @@ -326,7 +326,7 @@ void TCDiagConfInfo::process_config(GrdFileType file_type, // Store domain-specific VarInfo pointers for(j=0; j dmap) { } // Store new entry - domain_info.push_back(di); + domain_info.emplace_back(di); } // Make sure all -data domains appear in the config file diff --git a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc index 115dad74f6..9ea7691c78 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen_conf_info.cc @@ -773,14 +773,14 @@ void TCGenConfInfo::process_config() { // If no filters are specified, use the top-level settings if(dict->n_entries() == 0) { vx_opt.process_config(Conf); - VxOpt.push_back(vx_opt); + VxOpt.emplace_back(vx_opt); } // Loop through the array entries else { for(i=0; in_entries(); i++) { vx_opt.clear(); vx_opt.process_config(*((*dict)[i]->dict_value())); - VxOpt.push_back(vx_opt); + VxOpt.emplace_back(vx_opt); } } @@ -1380,10 +1380,10 @@ void ProbGenPCTInfo::add_probgen(const ProbGenInfo &pgi, int index, } // Update map entries - ProbGenMap[lead_hr].push_back(&pgi); - ProbIdxMap[lead_hr].push_back(index); - BestGenMap[lead_hr].push_back(bgi); - BestEvtMap[lead_hr].push_back(is_event); + ProbGenMap[lead_hr].emplace_back(&pgi); + ProbIdxMap[lead_hr].emplace_back(index); + BestGenMap[lead_hr].emplace_back(bgi); + BestEvtMap[lead_hr].emplace_back(is_event); // Increment counts if(is_event) PCTMap[lead_hr].pct.inc_event (prob); @@ -1435,10 +1435,10 @@ void ProbGenPCTInfo::add_genshape(const GenShapeInfo &gsi, int index, } // Update map entries - GenShapeMap[lead_hr].push_back(&gsi); - ProbIdxMap[lead_hr].push_back(index); - BestGenMap[lead_hr].push_back(bgi); - BestEvtMap[lead_hr].push_back(is_event); + GenShapeMap[lead_hr].emplace_back(&gsi); + ProbIdxMap[lead_hr].emplace_back(index); + BestGenMap[lead_hr].emplace_back(bgi); + BestEvtMap[lead_hr].emplace_back(is_event); // Increment counts if(is_event) PCTMap[lead_hr].pct.inc_event (gsi.prob_val(index)); diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 2dfe8afd6e..0c5a5facc1 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -612,7 +612,7 @@ void setup_nc_file() { data_info = conf_info.data_info[i_var]; mlog << Debug(4) << "Processing field: " << data_info->magic_str() << "\n"; string fname = data_info->name_attr(); - variable_levels[fname].push_back(data_info->level_attr()); + variable_levels[fname].emplace_back(data_info->level_attr()); variable_long_names[fname] = data_info->long_name_attr(); variable_units[fname] = data_info->units_attr(); wind_converter.update_input(fname, data_info->units_attr());