* std::ofstream output (filename.c_str());
* data_out.write_vtu (output);
*
- * times_and_names.push_back (std::pair<double,std::string> (time, filename));
+ * times_and_names.emplace_back (time, filename);
* std::ofstream pvd_output ("solution.pvd");
* DataOutBase::write_pvd_record (pvd_output, times_and_names);
* }
* const unsigned int number_of_time_steps = 3;
* std::vector<std::vector<std::string > > piece_names(number_of_time_steps);
*
- * piece_names[0].push_back("subdomain_01.time_step_0.vtk");
- * piece_names[0].push_back("subdomain_02.time_step_0.vtk");
+ * piece_names[0].emplace_back("subdomain_01.time_step_0.vtk");
+ * piece_names[0].emplace_back("subdomain_02.time_step_0.vtk");
*
- * piece_names[1].push_back("subdomain_01.time_step_1.vtk");
- * piece_names[1].push_back("subdomain_02.time_step_1.vtk");
+ * piece_names[1].emplace_back("subdomain_01.time_step_1.vtk");
+ * piece_names[1].emplace_back("subdomain_02.time_step_1.vtk");
*
- * piece_names[2].push_back("subdomain_01.time_step_2.vtk");
- * piece_names[2].push_back("subdomain_02.time_step_2.vtk");
+ * piece_names[2].emplace_back("subdomain_01.time_step_2.vtk");
+ * piece_names[2].emplace_back("subdomain_02.time_step_2.vtk");
*
* std::ofstream visit_output ("master_file.visit");
*
* std::vector<std::pair<double,std::vector<std::string > > > times_and_piece_names(number_of_time_steps);
*
* times_and_piece_names[0].first = 0.0;
- * times_and_piece_names[0].second.push_back("subdomain_01.time_step_0.vtk");
- * times_and_piece_names[0].second.push_back("subdomain_02.time_step_0.vtk");
+ * times_and_piece_names[0].second.emplace_back("subdomain_01.time_step_0.vtk");
+ * times_and_piece_names[0].second.emplace_back("subdomain_02.time_step_0.vtk");
*
* times_and_piece_names[1].first = 0.5;
- * times_and_piece_names[1].second.push_back("subdomain_01.time_step_1.vtk");
- * times_and_piece_names[1].second.push_back("subdomain_02.time_step_1.vtk");
+ * times_and_piece_names[1].second.emplace_back("subdomain_01.time_step_1.vtk");
+ * times_and_piece_names[1].second.emplace_back("subdomain_02.time_step_1.vtk");
*
* times_and_piece_names[2].first = 1.0;
- * times_and_piece_names[2].second.push_back("subdomain_01.time_step_2.vtk");
- * times_and_piece_names[2].second.push_back("subdomain_02.time_step_2.vtk");
+ * times_and_piece_names[2].second.emplace_back("subdomain_01.time_step_2.vtk");
+ * times_and_piece_names[2].second.emplace_back("subdomain_02.time_step_2.vtk");
*
* std::ofstream visit_output ("master_file.visit");
*
scratch_data = new ScratchData(sample_scratch_data);
copy_data = new CopyData(sample_copy_data);
- typename ScratchAndCopyDataList::value_type
- new_scratch_object (scratch_data, copy_data, true);
- scratch_and_copy_data_list.push_back (new_scratch_object);
+ scratch_and_copy_data_list.emplace_back (scratch_data, copy_data, true);
}
}
numbers::invalid_size_type);
// push a new line to the end of the list
- lines.push_back (ConstraintLine());
+ lines.emplace_back ();
lines.back().line = line;
lines.back().inhomogeneity = 0.;
lines_cache[line_index] = lines.size()-1;
return;
}
- line_ptr->entries.push_back (std::make_pair(column,value));
+ line_ptr->entries.emplace_back (column, value);
}
else
{
const unsigned short constraint_loc = constr_ind[j]->second;
- new_constraint_indicator.push_back
- (std::pair<unsigned short,unsigned short> (m_index, constraint_loc));
+ new_constraint_indicator.emplace_back (m_index, constraint_loc);
for (unsigned int k=constraint_pool_row_index[constraint_loc];
k<constraint_pool_row_index[constraint_loc+1];
++k, ++glob_indices[j])
(dof_handlers, additional_data.level_mg_handler);
std::vector<hp::QCollection<1> > quad_hp;
- quad_hp.push_back (hp::QCollection<1>(quad));
+ quad_hp.emplace_back (quad);
internal_reinit(StaticMappingQ1<dim>::mapping, dof_handlers,constraints,
locally_owned_sets, quad_hp, additional_data);
(dof_handlers, additional_data.level_mg_handler);
std::vector<hp::QCollection<1> > quad_hp;
- quad_hp.push_back (hp::QCollection<1>(quad));
+ quad_hp.emplace_back (quad);
internal_reinit(mapping, dof_handlers,constraints,locally_owned_sets,
quad_hp, additional_data);
(dof_handler, additional_data.level_mg_handler);
std::vector<hp::QCollection<1> > quad_hp;
for (unsigned int q=0; q<quad.size(); ++q)
- quad_hp.push_back (hp::QCollection<1>(quad[q]));
+ quad_hp.emplace_back (quad[q]);
internal_reinit(StaticMappingQ1<dim>::mapping, dof_handler,constraint,
locally_owned_set, quad_hp, additional_data);
}
internal::MatrixFree::extract_locally_owned_index_sets
(dof_handler, additional_data.level_mg_handler);
std::vector<hp::QCollection<1> > quad_hp;
- quad_hp.push_back (hp::QCollection<1>(quad));
+ quad_hp.emplace_back (quad);
internal_reinit(StaticMappingQ1<dim>::mapping, dof_handler,constraint,
locally_owned_set, quad_hp, additional_data);
}
internal::MatrixFree::extract_locally_owned_index_sets
(dof_handler, additional_data.level_mg_handler);
std::vector<hp::QCollection<1> > quad_hp;
- quad_hp.push_back (hp::QCollection<1>(quad));
+ quad_hp.emplace_back (quad);
internal_reinit(mapping, dof_handler,constraint,
locally_owned_set, quad_hp, additional_data);
}
(dof_handler, additional_data.level_mg_handler);
std::vector<hp::QCollection<1> > quad_hp;
for (unsigned int q=0; q<quad.size(); ++q)
- quad_hp.push_back (hp::QCollection<1>(quad[q]));
+ quad_hp.emplace_back (quad[q]);
internal_reinit(mapping, dof_handler,constraint,locally_owned_set,
quad_hp, additional_data);
}
// find out whether we use a hp Quadrature or a standard quadrature
std::vector<hp::QCollection<1> > quad_hp;
for (unsigned int q=0; q<quad.size(); ++q)
- quad_hp.push_back (hp::QCollection<1>(quad[q]));
+ quad_hp.emplace_back (quad[q]);
internal_reinit (mapping,
dof_handler,
constraint, locally_owned_set, quad_hp, additional_data);
|| cell->subdomain_id() == subdomain_id)
{
Assert (cell->active(), ExcInternalError());
- cell_its.push_back (std::pair<unsigned int,unsigned int>
- (cell->level(), cell->index()));
+ cell_its.emplace_back (cell->level(), cell->index());
}
}
}
end_cell = tria.end(level);
for ( ; cell != end_cell; ++cell)
if (cell->level_subdomain_id() == my_pid)
- cell_level_index.push_back (std::pair<unsigned int,unsigned int>
- (cell->level(), cell->index()));
+ cell_level_index.emplace_back (cell->level(), cell->index());
}
}
}
* ... // compute error_estimator, which contains one value per cell
*
* std::vector<std::string> solution_names;
- * solution_names.push_back ("x-displacement");
- * solution_names.push_back ("y-displacement");
+ * solution_names.emplace_back ("x-displacement");
+ * solution_names.emplace_back ("y-displacement");
*
* DataOut<dim> data_out;
* data_out.attach_dof_handler (dof_handler);
* // first declare the vectors
* // to be used later
* std::vector<std::string> solution_names;
- * solution_names.push_back ("u");
- * solution_names.push_back ("v");
+ * solution_names.emplace_back ("u");
+ * solution_names.emplace_back ("v");
* data_out_stack.declare_data_vector (solution_names,
* DataOutStack<dim>::dof_vector);
* data_out_stack.declare_data_vector ("error",
// Put in the first point.
cells.push_back(cell);
- qpoints.push_back(std::vector<Point<dim> >(1, qp.get()));
- maps.push_back(std::vector<unsigned int> (1, 0));
+ qpoints.emplace_back(1, qp.get());
+ maps.emplace_back(1, 0);
}
VectorTools::ExcPointNotAvailableHere());
cells.push_back(my_pair.first);
- qpoints.push_back(std::vector<Point<dim> >(1, my_pair.second));
- maps.push_back(std::vector<unsigned int>(1, first_outside));
+ qpoints.emplace_back(1, my_pair.second);
+ maps.emplace_back(1, first_outside);
c++;
point_flags[first_outside] = true;
// And check if we can exit the loop now
std::vector<types::global_dof_index> dofs_on_face_vector (dofs_per_face);
- // Because CopyData objects are reused and that push_back is
+ // Because CopyData objects are reused and emplace_back is
// used, dof_is_on_face, cell_matrix, and cell_vector must be
// cleared before they are reused
copy_data.dof_is_on_face.clear();
if (boundary_functions.find(cell->face(face)->boundary_id()) !=
boundary_functions.end())
{
- copy_data.cell_matrix.push_back(FullMatrix<number> (copy_data.dofs_per_cell,
- copy_data.dofs_per_cell));
- copy_data.cell_vector.push_back(Vector<number> (copy_data.dofs_per_cell));
+ copy_data.cell_matrix.emplace_back(copy_data.dofs_per_cell,
+ copy_data.dofs_per_cell);
+ copy_data.cell_vector.emplace_back(copy_data.dofs_per_cell);
fe_values.reinit (cell, face);
if (fe_is_system)
cell->face(face)->get_dof_indices (dofs_on_face_vector);
// for each dof on the cell, have a flag whether it is on
// the face
- copy_data.dof_is_on_face.push_back(std::vector<bool> (copy_data.dofs_per_cell));
+ copy_data.dof_is_on_face.emplace_back(copy_data.dofs_per_cell);
// check for each of the dofs on this cell whether it is
// on the face
for (unsigned int i=0; i<copy_data.dofs_per_cell; ++i)
const FEFaceValues<dim,spacedim> &fe_values = x_fe_values.get_present_fe_values ();
- copy_data.cell_matrix.push_back(FullMatrix<number> (copy_data.dofs_per_cell,
- copy_data.dofs_per_cell));
- copy_data.cell_vector.push_back(Vector<number> (copy_data.dofs_per_cell));
+ copy_data.cell_matrix.emplace_back(copy_data.dofs_per_cell,
+ copy_data.dofs_per_cell);
+ copy_data.cell_vector.emplace_back(copy_data.dofs_per_cell);
if (fe_is_system)
// FE has several components
cell->active_fe_index());
// for each dof on the cell, have a
// flag whether it is on the face
- copy_data.dof_is_on_face.push_back(std::vector<bool> (copy_data.dofs_per_cell));
+ copy_data.dof_is_on_face.emplace_back(copy_data.dofs_per_cell);
// check for each of the dofs on this cell
// whether it is on the face
for (unsigned int i=0; i<copy_data.dofs_per_cell; ++i)
// Record the data set name, dimension, and allocate space for it
data_set_names.push_back(name);
data_set_dims.push_back(new_dim);
- data_sets.push_back(std::vector<double>(new_dim*num_verts));
+ data_sets.emplace_back(new_dim*num_verts);
// TODO: averaging, min/max, etc for merged vertices
for (i=0; i<filtered_points.size(); ++i)
GnuplotFlags::GnuplotFlags ()
{
- space_dimension_labels.push_back("x");
- space_dimension_labels.push_back("y");
- space_dimension_labels.push_back("z");
+ space_dimension_labels.emplace_back("x");
+ space_dimension_labels.emplace_back("y");
+ space_dimension_labels.emplace_back("z");
}
}
else if (r1 == ranges.end() || (r2->end+offset) < r1->begin)
{
- new_ranges.push_back(Range(r2->begin+offset,r2->end+offset));
+ new_ranges.emplace_back(r2->begin+offset, r2->end+offset);
++r2;
}
else
entries->put (get_current_full_path(entry) + path_separator + "documentation",
documentation);
- // clone the pattern and store its
- // index in the node
- patterns.push_back (std::shared_ptr<const Patterns::PatternBase>
- (pattern.clone()));
+ patterns.reserve (patterns.size() + 1);
+ patterns.emplace_back (pattern.clone());
entries->put (get_current_full_path(entry) + path_separator + "pattern",
static_cast<unsigned int>(patterns.size()-1));
// also store the description of
{
const std::string value = p->second.get<std::string>("value");
if (value.find('{') != std::string::npos)
- multiple_choices.push_back (Entry(subsection_path,
- demangle(p->first),
- value));
+ multiple_choices.emplace_back (subsection_path,
+ demangle(p->first),
+ value);
}
// then loop over all subsections
// indices and then push back new values. When we are done, copy the
// data to that field of the partitioner. This way, the variable
// ghost_targets will have exactly the size we need, whereas the
- // vector filled with push_back might actually be too long.
+ // vector filled with emplace_back might actually be too long.
unsigned int current_proc = 0;
ghost_indices_data.fill_index_vector (expanded_ghost_indices);
types::global_dof_index current_index = expanded_ghost_indices[0];
{
ghost_targets_temp[n_ghost_targets-1].second =
iterator - ghost_targets_temp[n_ghost_targets-1].second;
- ghost_targets_temp.push_back(std::pair<unsigned int,
- unsigned int>(current_proc,iterator));
+ ghost_targets_temp.emplace_back (current_proc, iterator);
n_ghost_targets++;
}
}
if (receive_buffer[i] > 0)
{
n_import_indices_data += receive_buffer[i];
- import_targets_temp.push_back(std::pair<unsigned int,
- unsigned int> (i, receive_buffer[i]));
+ import_targets_temp.emplace_back(i, receive_buffer[i]);
}
// copy, don't move, to get deterministic memory usage.
import_targets_data = import_targets_temp;
compressed_import_indices.back().second++;
else
{
- compressed_import_indices.push_back
- (std::pair<unsigned int,unsigned int>(new_index,new_index+1));
+ compressed_import_indices.emplace_back (new_index,new_index+1);
}
last_index = new_index;
}
PathSearch::initialize_classes()
{
std::vector<std::string> v;
- v.push_back(empty);
+ v.emplace_back();
path_lists.insert(map_type(std::string("PARAMETER"), v));
/*
path_lists.insert(map_type(std::string("MESH"), v));
v.clear();
- v.push_back(empty);
- v.push_back(std::string(".prm"));
+ v.emplace_back();
+ v.emplace_back(".prm");
suffix_lists.insert(map_type(std::string("PARAMETER"), v));
/*
// would require linking with the
// deal.II libraries.
v.clear();
- v.push_back(empty);
- v.push_back(std::string(".inp"));
- v.push_back(std::string(".xda"));
- v.push_back(std::string(".dbmesh"));
- v.push_back(std::string(".dat"));
- v.push_back(std::string(".plt"));
- v.push_back(std::string(".nc"));
- v.push_back(std::string(".msh"));
+ v.emplace_back();
+ v.emplace_back(".inp");
+ v.emplace_back(".xda");
+ v.emplace_back(".dbmesh");
+ v.emplace_back(".dat");
+ v.emplace_back(".plt");
+ v.emplace_back(".nc");
+ v.emplace_back(".msh");
suffix_lists.insert(map_type(std::string("MESH"), v));
}
// Add empty path and empty suffix
// for new class
std::vector<std::string> v;
- v.push_back(empty);
+ v.emplace_back();
path_lists.insert(map_type(cls, v));
suffix_lists.insert(map_type(cls, v));
}
p.reserve (points.size());
for (unsigned int i=0; i<points.size(); ++i)
- p.push_back (Polynomial<double> (points, i));
+ p.emplace_back (points, i);
return p;
}
std::vector<Point<2> > origins;
// Id of the corner with a
// singularity
- quads.push_back(QGaussOneOverR(n, 3, factor_out_singularity));
- quads.push_back(QGaussOneOverR(n, 2, factor_out_singularity));
- quads.push_back(QGaussOneOverR(n, 1, factor_out_singularity));
- quads.push_back(QGaussOneOverR(n, 0, factor_out_singularity));
-
- origins.push_back(Point<2>(0.,0.));
- origins.push_back(Point<2>(singularity[0],0.));
- origins.push_back(Point<2>(0.,singularity[1]));
+ quads.emplace_back(n, 3, factor_out_singularity);
+ quads.emplace_back(n, 2, factor_out_singularity);
+ quads.emplace_back(n, 1, factor_out_singularity);
+ quads.emplace_back(n, 0, factor_out_singularity);
+
+ origins.emplace_back(0., 0.);
+ origins.emplace_back(singularity[0], 0.);
+ origins.emplace_back(0., singularity[1]);
origins.push_back(singularity);
// Lexicographical ordering.
if (do_values)
values.push_back(1.);
if (do_grads)
- grads.push_back(Tensor<1,dim>());
+ grads.emplace_back();
if (do_grad_grads)
- grad_grads.push_back(Tensor<2,dim>());
+ grad_grads.emplace_back();
if (do_3rd_derivatives)
- third_derivatives.push_back(Tensor<3,dim>());
+ third_derivatives.emplace_back();
if (do_4th_derivatives)
- fourth_derivatives.push_back(Tensor<4,dim>());
+ fourth_derivatives.emplace_back();
}
for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
{
++vertex_touch_count[cell->vertex_index(v)];
- vertex_to_cell[cell->vertex_index(v)]
- .push_back (std::make_pair (cell, v));
+ vertex_to_cell[cell->vertex_index(v)].emplace_back (cell, v);
}
}
for (unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
{
++edge_touch_count[cell->line(l)->index()];
- edge_to_cell[cell->line(l)->index()]
- .push_back (std::make_pair (cell, l));
+ edge_to_cell[cell->line(l)->index()].emplace_back (cell, l);
}
}
unsigned int offset = attached_data_size+sizeof(CellStatus);
++n_attached_datas;
attached_data_size+=size;
- attached_data_pack_callbacks.push_back(
- std::pair<unsigned int, pack_callback_t> (offset, pack_callback)
- );
+ attached_data_pack_callbacks.emplace_back(offset, pack_callback);
return offset;
}
for (unsigned int i=0; i<data.second.size(); ++i)
if (component_mask[data.second[i]])
constant_mode_to_component_translation[data.second[i]].
- push_back(std::make_pair(n_constant_modes++,i));
+ emplace_back(n_constant_modes++, i);
AssertDimension(element_constant_modes.back().n_rows(),
element_constant_modes[0].n_rows());
}
const std::map<types::global_dof_index,float>::const_iterator
j = weights[row].find(col);
if ((j != weights[row].end()) && (j->second != 0))
- constraint_line.push_back (std::pair<types::global_dof_index,double>(representants[row],
- j->second));
+ constraint_line.emplace_back (representants[row], j->second);
};
constraints.add_entries (global_dof, constraint_line);
for (unsigned int i = 0;
i < std::min (fe_nedelec_other->degree, this->degree); ++i)
- identities.push_back (std::make_pair (i, i));
+ identities.emplace_back (i, i);
return identities;
}
for (unsigned int i = 0; i < p_min; ++i)
for (unsigned int j = 0; j < p_min - 1; ++j)
{
- identities.push_back (std::make_pair (i * (q - 1) + j,
- i * (p - 1) + j));
- identities.push_back (std::make_pair (i + (j + q - 1) * q,
- i + (j + p - 1) * p));
+ identities.emplace_back (i * (q - 1) + j, i * (p - 1) + j);
+ identities.emplace_back (i + (j + q - 1) * q, i + (j + p - 1) * p);
}
return identities;
if (std::fabs(this->unit_support_points[index_map_inverse[i+1]][0]-
fe_q_other->unit_support_points[index_map_inverse_other[j+1]][0])
< 1e-14)
- identities.push_back (std::make_pair(i,j));
+ identities.emplace_back (i, j);
return identities;
}
(std::fabs(this->unit_support_points[index_map_inverse[i2+1]][0]-
fe_q_other->unit_support_points[index_map_inverse_other[j2+1]][0])
< 1e-14))
- identities.push_back (std::make_pair(i1*(p-1)+i2,
- j1*(q-1)+j2));
+ identities.emplace_back (i1*(p-1)+i2, j1*(q-1)+j2);
return identities;
}
// dofs_per_line for each FE_Q_Hierarchical.
std::vector<std::pair<unsigned int, unsigned int> > res;
for (unsigned int i = 0; i < std::min(this_dpl,other_dpl); i++)
- res.push_back(std::make_pair (i, i));
+ res.emplace_back(i, i);
return res;
}
// dofs_per_line for each FE_Q_Hierarchical.
std::vector<std::pair<unsigned int, unsigned int> > res;
for (unsigned int i = 0; i < std::min(this_dpq,other_dpq); i++)
- res.push_back(std::make_pair (i, i));
+ res.emplace_back(i, i);
return res;
}
if (p==q)
for (unsigned int i=0; i<p+1; ++i)
- identities.push_back (std::make_pair(i,i));
+ identities.emplace_back (i, i);
else if (p%2==0 && q%2==0)
- identities.push_back(std::make_pair(p/2,q/2));
+ identities.emplace_back(p/2, q/2);
return identities;
}
if (p==q)
for (unsigned int i=0; i<p; ++i)
- identities.push_back (std::make_pair(i,i));
+ identities.emplace_back (i, i);
else if (p%2!=0 && q%2!=0)
- identities.push_back(std::make_pair(p/2, q/2));
+ identities.emplace_back (p/2, q/2);
return identities;
}
}
for (unsigned int i=0; i<base_identities.size(); ++i)
- identities.push_back
- (std::make_pair (base_identities[i].first + dof_offset,
- base_identities[i].second + dof_offset_other));
+ identities.emplace_back (base_identities[i].first + dof_offset,
+ base_identities[i].second + dof_offset_other);
// record the dofs treated above as already taken care of
dof_offset += base.template n_dofs_per_object<structdim>();
Point<3> x;
in >> x(0) >> x(1) >> x(2);
- vertices.push_back(Point<spacedim>());
+ vertices.emplace_back();
for (unsigned int d=0; d<spacedim; ++d)
vertices.back()(d) = x(d);
}
subcelldata.boundary_lines.size() == 0,
ExcNotImplemented());
- cells.push_back(CellData<dim>());
+ cells.emplace_back();
for (unsigned int j = 0; j < type; j++) //loop to feed data
in >> cells.back().vertices[j];
else if ( type == 4)
{
- subcelldata.boundary_quads.push_back(CellData<2>());
+ subcelldata.boundary_quads.emplace_back();
for (unsigned int j = 0; j < type; j++) //loop to feed the data to the boundary
in >> subcelldata.boundary_quads.back().vertices[j];
AssertThrow (subcelldata.boundary_lines.size() == 0,
ExcNotImplemented());
- cells.push_back(CellData<dim>());
+ cells.emplace_back();
for (unsigned int j = 0; j < type; j++) //loop to feed data
in >> cells.back().vertices[j];
{
//If this is encountered, the pointer comes out of the loop
//and starts processing boundaries.
- subcelldata.boundary_lines.push_back(CellData<1>());
+ subcelldata.boundary_lines.emplace_back();
for (unsigned int j = 0; j < type; j++) //loop to feed the data to the boundary
{
AssertThrow(in, ExcIO());
in >> x[0] >> x[1] >> x[2];
- vertices.push_back(Point<spacedim>());
+ vertices.emplace_back();
for (unsigned int d = 0; d < spacedim; d++)
vertices.back()(d) = x[d];
if ( (((type == 44)||(type == 94))&&(dim == 2)) || ((type == 115)&&(dim == 3)) ) // cell
{
- cells.push_back(CellData<dim>());
+ cells.emplace_back();
AssertThrow(in, ExcIO());
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; v++)
AssertThrow(in, ExcIO());
in >> dummy >> dummy >> dummy;
- subcelldata.boundary_lines.push_back(CellData<1>());
+ subcelldata.boundary_lines.emplace_back();
AssertThrow(in, ExcIO());
for (unsigned int v = 0; v < 2; v++)
}
else if ( ((type == 44)||(type == 94)) && (dim == 3) ) // boundary quad
{
- subcelldata.boundary_quads.push_back(CellData<2>());
+ subcelldata.boundary_quads.emplace_back();
AssertThrow(in, ExcIO());
for (unsigned int v = 0; v < 4; v++)
// found a cell
{
// allocate and read indices
- cells.push_back (CellData<dim>());
+ cells.emplace_back ();
for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
in >> cells.back().vertices[i];
else if ((cell_type == "line") && ((dim == 2) || (dim == 3)))
// boundary info
{
- subcelldata.boundary_lines.push_back (CellData<1>());
+ subcelldata.boundary_lines.emplace_back ();
in >> subcelldata.boundary_lines.back().vertices[0]
>> subcelldata.boundary_lines.back().vertices[1];
else if ((cell_type == "quad") && (dim == 3))
// boundary info
{
- subcelldata.boundary_quads.push_back (CellData<2>());
+ subcelldata.boundary_quads.emplace_back ();
in >> subcelldata.boundary_quads.back().vertices[0]
>> subcelldata.boundary_quads.back().vertices[1]
>> subcelldata.boundary_quads.back().vertices[2]
{
// read in vertex numbers. they
// are 1-based, so subtract one
- cells.push_back (CellData<dim>());
+ cells.emplace_back ();
for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
{
in >> cells.back().vertices[i];
"number required for this object"));
// allocate and read indices
- cells.push_back (CellData<dim>());
+ cells.emplace_back ();
for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
in >> cells.back().vertices[i];
else if ((cell_type == 1) && ((dim == 2) || (dim == 3)))
// boundary info
{
- subcelldata.boundary_lines.push_back (CellData<1>());
+ subcelldata.boundary_lines.emplace_back ();
in >> subcelldata.boundary_lines.back().vertices[0]
>> subcelldata.boundary_lines.back().vertices[1];
else if ((cell_type == 3) && (dim == 3))
// boundary info
{
- subcelldata.boundary_quads.push_back (CellData<2>());
+ subcelldata.boundary_quads.emplace_back ();
in >> subcelldata.boundary_quads.back().vertices[0]
>> subcelldata.boundary_quads.back().vertices[1]
>> subcelldata.boundary_quads.back().vertices[2]
std::vector<DataOutBase::Patch<dim,spacedim> > patches;
const unsigned int n_datasets=4;
std::vector<std::string> data_names;
- data_names.push_back("level");
- data_names.push_back("subdomain");
- data_names.push_back("level_subdomain");
- data_names.push_back("proc_writing");
+ data_names.emplace_back("level");
+ data_names.emplace_back("subdomain");
+ data_names.emplace_back("level_subdomain");
+ data_names.emplace_back("proc_writing");
const unsigned int n_q_points = GeometryInfo<dim>::vertices_per_cell;
// the compiler will
// optimize away this
// little kludge
- line_list.push_back (LineEntry(Point<2>(line->vertex(0)(0),
- line->vertex(0)(1)),
- Point<2>(line->vertex(1)(0),
- line->vertex(1)(1)),
- line->user_flag_set(),
- cell->level()));
+ line_list.emplace_back(Point<2>(line->vertex(0)(0),
+ line->vertex(0)(1)),
+ Point<2>(line->vertex(1)(0),
+ line->vertex(1)(1)),
+ line->user_flag_set(),
+ cell->level());
}
// next if we are to treat
(cell, q_projector.point(offset+i)));
const Point<2> p1 (p1_dim(0), p1_dim(1));
- line_list.push_back (LineEntry(p0, p1,
- face->user_flag_set(),
- cell->level() ));
+ line_list.emplace_back (p0,
+ p1,
+ face->user_flag_set(),
+ cell->level() );
p0=p1;
}
// generate last piece
const Point<dim> p1_dim (face->vertex(1));
const Point<2> p1 (p1_dim(0), p1_dim(1));
- line_list.push_back (LineEntry(p0, p1,
- face->user_flag_set(),
- cell->level()));
+ line_list.emplace_back (p0,
+ p1,
+ face->user_flag_set(),
+ cell->level());
}
}
}
{
typename dealii::Triangulation<dim, spacedim>::line_iterator
line=cell->line(line_no);
- line_list.push_back (LineEntry(Point<2>(line->vertex(0) * unit_vector2,
- line->vertex(0) * unit_vector1),
- Point<2>(line->vertex(1) * unit_vector2,
- line->vertex(1) * unit_vector1),
- line->user_flag_set(),
- cell->level()));
+ line_list.emplace_back (Point<2>(line->vertex(0) * unit_vector2,
+ line->vertex(0) * unit_vector1),
+ Point<2>(line->vertex(1) * unit_vector2,
+ line->vertex(1) * unit_vector1),
+ line->user_flag_set(),
+ cell->level());
}
break;
edge_list.reserve(cells.size()*GeometryInfo<dim>::lines_per_cell);
for (unsigned int i=0; i<cells.size(); ++i)
for (unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l)
- edge_list.push_back (Edge<dim>(cells[i], l));
+ edge_list.emplace_back (cells[i], l);
// next sort the edge list and then remove duplicates
std::sort (edge_list.begin(), edge_list.end());
{
// create our own data structure for the cells and let it
// connect to the edges array
- cell_list.push_back (Cell<dim>(cells[i], edges));
+ cell_list.emplace_back (cells[i], edges);
// then also inform the edges that they are adjacent
// to the current cell, and where within this cell
template class GridReordering<3,3>;
DEAL_II_NAMESPACE_CLOSE
-
tmp((*adjacent_cell)->subdomain_id(), cell->vertex_index(i));
if (vertices_added.find(tmp)==vertices_added.end())
{
- vertices_to_send[(*adjacent_cell)->subdomain_id()].push_back(
- std::tuple<types::global_vertex_index,types::global_vertex_index,
- std::string> (i,cell->vertex_index(i),
- cell->id().to_string()));
+ vertices_to_send[(*adjacent_cell)->subdomain_id()].emplace_back
+ (i, cell->vertex_index(i), cell->id().to_string());
if (cell->id().to_string().size() > max_cellid_size)
max_cellid_size = cell->id().to_string().size();
vertices_added.insert(tmp);
cell_1 = mesh_1.begin(0),
cell_2 = mesh_2.begin(0);
for (; cell_1 != mesh_1.end(0); ++cell_1, ++cell_2)
- cell_list.push_back (std::make_pair (cell_1, cell_2));
+ cell_list.emplace_back (cell_1, cell_2);
// then traverse list as described
// above
Assert(cell_pair->first->refinement_case()==
cell_pair->second->refinement_case(), ExcNotImplemented());
for (unsigned int c=0; c<cell_pair->first->n_children(); ++c)
- cell_list.push_back (std::make_pair (cell_pair->first->child(c),
- cell_pair->second->child(c)));
+ cell_list.emplace_back (cell_pair->first->child(c),
+ cell_pair->second->child(c));
// erasing an iterator
// keeps other iterators
PersistentTriangulation<dim,spacedim>::execute_coarsening_and_refinement ()
{
// first save flags
- refine_flags.push_back (std::vector<bool>());
- coarsen_flags.push_back (std::vector<bool>());
+ refine_flags.emplace_back ();
+ coarsen_flags.emplace_back ();
this->save_refine_flags (refine_flags.back());
this->save_coarsen_flags (coarsen_flags.back());
in >> n_flag_levels;
for (unsigned int i=0; i<n_flag_levels; ++i)
{
- refine_flags.push_back (std::vector<bool>());
- coarsen_flags.push_back (std::vector<bool>());
+ refine_flags.emplace_back ();
+ coarsen_flags.emplace_back ();
this->read_bool_vector (mn_tria_refine_flags_begin, refine_flags.back(),
mn_tria_refine_flags_end, in);
this->read_bool_vector (mn_tria_coarsen_flags_begin, coarsen_flags.back(),
template class PersistentTriangulation<2,3>;
DEAL_II_NAMESPACE_CLOSE
-
weight);
for (size_type i=1; i<constrained_line->entries.size(); ++i)
- line->entries
- .push_back (std::make_pair (constrained_line->entries[i].first,
- constrained_line->entries[i].second *
- weight));
+ line->entries.emplace_back (constrained_line->entries[i].first,
+ constrained_line->entries[i].second
+ * weight);
#ifdef DEBUG
// keep track of how many entries we replace in this
for (ConstraintLine::Entries::const_iterator j=other_line->begin();
j!=other_line->end(); ++j)
- tmp.push_back (std::pair<size_type,double>(j->first,
- j->second*weight));
+ tmp.emplace_back(j->first, j->second*weight);
line->inhomogeneity
+= other_constraints.get_inhomogeneity(line->entries[i].first) *
// Add the pivot and all direct neighbors of the pivot node not
// yet touched to the list of new entries.
- groups.push_back(std::vector<types::global_dof_index>());
+ groups.emplace_back();
std::vector<types::global_dof_index> &next_group = groups.back();
next_group.push_back(min_neighbors.first);
{
std::vector<Epetra_Map> parallel_partitioning;
for (size_type i=0; i<block_sparsity_pattern.n_block_rows(); ++i)
- parallel_partitioning.push_back
- (Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(block_sparsity_pattern.block(i,0).n_rows()),
- 0,
- Utilities::Trilinos::comm_self()));
+ parallel_partitioning.emplace_back
+ (static_cast<TrilinosWrappers::types::int_type>(block_sparsity_pattern.block(i,0).n_rows()),
+ 0,
+ Utilities::Trilinos::comm_self());
reinit (parallel_partitioning, block_sparsity_pattern);
}
std::vector<Epetra_Map> parallel_partitioning;
for (size_type i=0; i<dealii_block_sparse_matrix.n_block_rows(); ++i)
- parallel_partitioning.push_back (Epetra_Map(static_cast<TrilinosWrappers::types::int_type>(dealii_block_sparse_matrix.block(i,0).m()),
- 0,
- trilinos_communicator));
+ parallel_partitioning.emplace_back
+ (static_cast<TrilinosWrappers::types::int_type>(dealii_block_sparse_matrix.block(i,0).m()),
+ 0,
+ trilinos_communicator);
reinit (parallel_partitioning, dealii_block_sparse_matrix, drop_tolerance);
}
// by itself
prolongation_matrices.resize (0);
prolongation_sparsities.resize (0);
+ prolongation_matrices.reserve (n_levels - 1);
+ prolongation_sparsities.reserve (n_levels - 1);
for (unsigned int i=0; i<n_levels-1; ++i)
{
- prolongation_sparsities
- .push_back (std::shared_ptr<BlockSparsityPattern> (new BlockSparsityPattern));
- prolongation_matrices
- .push_back (std::shared_ptr<BlockSparseMatrix<double> > (new BlockSparseMatrix<double>));
+ prolongation_sparsities.emplace_back (new BlockSparsityPattern);
+ prolongation_matrices.emplace_back (new BlockSparseMatrix<double>);
}
// two fields which will store the
// by itself
prolongation_matrices.resize (0);
prolongation_sparsities.resize (0);
+ prolongation_matrices.reserve (n_levels - 1);
+ prolongation_sparsities.reserve (n_levels - 1);
for (unsigned int i=0; i<n_levels-1; ++i)
{
- prolongation_sparsities
- .push_back (std::shared_ptr<BlockSparsityPattern> (new BlockSparsityPattern));
- prolongation_matrices
- .push_back (std::shared_ptr<BlockSparseMatrix<double> > (new BlockSparseMatrix<double>));
+ prolongation_sparsities.emplace_back (new BlockSparsityPattern);
+ prolongation_matrices.emplace_back (new BlockSparseMatrix<double>);
}
// two fields which will store the
if (global_mine && level_mine)
{
- copy_indices[level].push_back(
- std::make_pair (global_dof_indices[i], level_dof_indices[i]));
+ copy_indices[level].emplace_back(global_dof_indices[i],
+ level_dof_indices[i]);
}
else if (global_mine)
{
- copy_indices_global_mine[level].push_back(
- std::make_pair (global_dof_indices[i], level_dof_indices[i]));
+ copy_indices_global_mine[level].emplace_back(global_dof_indices[i],
+ level_dof_indices[i]);
//send this to the owner of the level_dof:
- send_data_temp.push_back(DoFPair(level, global_dof_indices[i], level_dof_indices[i]));
+ send_data_temp.emplace_back(level,
+ global_dof_indices[i],
+ level_dof_indices[i]);
}
else
{
local_dof_indices,
&global_level_dof_indices_l0[start_index]);
- dirichlet_indices[0].push_back(std::vector<unsigned short>());
+ dirichlet_indices[0].emplace_back();
if (mg_constrained_dofs != nullptr)
for (unsigned int i=0; i<mg_dof.get_fe().dofs_per_cell; ++i)
if (mg_constrained_dofs->is_boundary_index(0, local_dof_indices[elem_info.lexicographic_numbering[i]]))
// by itself
prolongation_matrices.resize (0);
prolongation_sparsities.resize (0);
+ prolongation_matrices.reserve (n_levels - 1);
+ prolongation_sparsities.reserve (n_levels - 1);
for (unsigned int i=0; i<n_levels-1; ++i)
{
- prolongation_sparsities.push_back
- (std::shared_ptr<typename internal::MatrixSelector<VectorType>::Sparsity> (new typename internal::MatrixSelector<VectorType>::Sparsity));
- prolongation_matrices.push_back
- (std::shared_ptr<typename internal::MatrixSelector<VectorType>::Matrix> (new typename internal::MatrixSelector<VectorType>::Matrix));
+ prolongation_sparsities.emplace_back
+ (new typename internal::MatrixSelector<VectorType>::Sparsity);
+ prolongation_matrices.emplace_back
+ (new typename internal::MatrixSelector<VectorType>::Matrix);
}
// two fields which will store the
ExcInternalError());
cell_to_patch_index_map[cell->level()][cell->index()] = all_cells.size();
- all_cells.push_back (std::make_pair(cell, active_index));
+ all_cells.emplace_back (cell, active_index);
}
}
switch (vector_type)
{
case dof_vector:
- dof_data.push_back (DataVector());
+ dof_data.emplace_back ();
dof_data.back().names = names;
break;
case cell_vector:
- cell_data.push_back (DataVector());
+ cell_data.emplace_back ();
cell_data.back().names = names;
break;
};
// then produce all the other lists
// for the other data vectors by
// copying
- intervals.push_back (std::vector<Interval>());
+ intervals.emplace_back ();
switch (interval_spacing)
{
const float delta = (max_value-min_value)/n_intervals;
for (unsigned int n=0; n<n_intervals; ++n)
- intervals[0].push_back (Interval(min_value+n*delta,
- min_value+(n+1)*delta));
+ intervals[0].emplace_back (min_value+n*delta, min_value+(n+1)*delta);
break;
};
const float delta = (std::log(max_value)-std::log(min_value))/n_intervals;
for (unsigned int n=0; n<n_intervals; ++n)
- intervals[0].push_back (Interval(std::exp(std::log(min_value)+n*delta),
- std::exp(std::log(min_value)+(n+1)*delta)));
+ intervals[0].emplace_back (std::exp(std::log(min_value)+n*delta),
+ std::exp(std::log(min_value)+(n+1)*delta));
break;
};
{
// for any of the non-initial grids
// store the refinement flags
- refine_flags.push_back (std::vector<bool>());
- coarsen_flags.push_back (std::vector<bool>());
+ refine_flags.emplace_back ();
+ coarsen_flags.emplace_back ();
tria->save_refine_flags (refine_flags.back());
tria->save_coarsen_flags (coarsen_flags.back());
}