Skip to content
Snippets Groups Projects
Commit 00496a50 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Use emplace_back for some of vector.push_back ops.

clang-tidy modernize-use-emplace check.
parent ab630b4f
No related branches found
No related tags found
No related merge requests found
...@@ -53,8 +53,7 @@ DirectConditionGenerator::directToSurfaceNodes(const MeshLib::Mesh& mesh, ...@@ -53,8 +53,7 @@ DirectConditionGenerator::directToSurfaceNodes(const MeshLib::Mesh& mesh,
{ {
double val(raster->getValueAtPoint(*surface_node)); double val(raster->getValueAtPoint(*surface_node));
val = (val == no_data) ? 0 : val; val = (val == no_data) ? 0 : val;
_direct_values.push_back( _direct_values.emplace_back(surface_node->getID(), val);
std::make_pair(surface_node->getID(), val));
} }
delete raster; delete raster;
......
...@@ -22,7 +22,7 @@ namespace IO ...@@ -22,7 +22,7 @@ namespace IO
void PVDFile::addVTUFile(const std::string &vtu_fname, double timestep) void PVDFile::addVTUFile(const std::string &vtu_fname, double timestep)
{ {
_datasets.push_back(std::make_pair(timestep, vtu_fname)); _datasets.emplace_back(timestep, vtu_fname);
std::ofstream fh(_pvd_filename.c_str()); std::ofstream fh(_pvd_filename.c_str());
if (!fh) { if (!fh) {
......
...@@ -184,19 +184,21 @@ std::unique_ptr<Process> createHeatTransportBHEProcess( ...@@ -184,19 +184,21 @@ std::unique_ptr<Process> createHeatTransportBHEProcess(
if (bhe_type == "1U") if (bhe_type == "1U")
{ {
bhes.push_back(BHE::createBHE1U(bhe_config, curves)); bhes.emplace_back(BHE::createBHE1U(bhe_config, curves));
continue; continue;
} }
if (bhe_type == "CXA") if (bhe_type == "CXA")
{ {
bhes.push_back(BHE::createBHECoaxial<BHE::BHE_CXA>(bhe_config, curves)); bhes.emplace_back(
BHE::createBHECoaxial<BHE::BHE_CXA>(bhe_config, curves));
continue; continue;
} }
if (bhe_type == "CXC") if (bhe_type == "CXC")
{ {
bhes.push_back(BHE::createBHECoaxial<BHE::BHE_CXC>(bhe_config, curves)); bhes.emplace_back(
BHE::createBHECoaxial<BHE::BHE_CXC>(bhe_config, curves));
continue; continue;
} }
OGS_FATAL("Unknown BHE type '%s'.", bhe_type.c_str()); OGS_FATAL("Unknown BHE type '%s'.", bhe_type.c_str());
......
...@@ -186,7 +186,7 @@ void findFracutreIntersections( ...@@ -186,7 +186,7 @@ void findFracutreIntersections(
matIDs[1] = matid; // slave matIDs[1] = matid; // slave
} }
} }
vec_branch_nodeID_matIDs.push_back(std::make_pair(nodeID, matIDs)); vec_branch_nodeID_matIDs.emplace_back(nodeID, matIDs);
} }
else else
{ {
...@@ -195,8 +195,7 @@ void findFracutreIntersections( ...@@ -195,8 +195,7 @@ void findFracutreIntersections(
vec_matID_counts.rbegin()->first); vec_matID_counts.rbegin()->first);
matIDs[1] = std::max(vec_matID_counts.begin()->first, matIDs[1] = std::max(vec_matID_counts.begin()->first,
vec_matID_counts.rbegin()->first); vec_matID_counts.rbegin()->first);
vec_junction_nodeID_matIDs.push_back( vec_junction_nodeID_matIDs.emplace_back(nodeID, matIDs);
std::make_pair(nodeID, matIDs));
} }
} }
......
...@@ -90,7 +90,7 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables( ...@@ -90,7 +90,7 @@ std::vector<std::reference_wrapper<ProcessVariable>> findProcessVariables(
for (std::string const& var_name : var_names) for (std::string const& var_name : var_names)
{ {
vars.push_back(findVariableByName(variables, var_name, tag)); vars.emplace_back(findVariableByName(variables, var_name, tag));
cached_var_names.push_back(var_name); cached_var_names.push_back(var_name);
} }
......
...@@ -52,7 +52,7 @@ struct Medium ...@@ -52,7 +52,7 @@ struct Medium
{ {
for (auto p : phases_) for (auto p : phases_)
{ {
phases.push_back(Phase(p)); phases.emplace_back(p);
} }
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment