]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer emplace_back over push_back in a few places. 6386/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 29 Apr 2018 11:06:22 +0000 (13:06 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 29 Apr 2018 11:34:19 +0000 (13:34 +0200)
include/deal.II/matrix_free/face_setup_internal.h

index 368364ca4a053f22dcc6d24015433554b5c12c1c..47d16365296cbc5ef8d79911abbba5baba194b7f 100644 (file)
@@ -244,12 +244,12 @@ namespace internal
                           // involved, so both processors will generate the same
                           // list that we will later order
                           const CellId id_neigh = neighbor->id();
-                          inner_faces_at_proc_boundary[neigh_domain].shared_faces.
-                          push_back(my_domain < neigh_domain
-                                    ?
-                                    std::make_pair(id_mine, id_neigh)
-                                    :
-                                    std::make_pair(id_neigh, id_mine));
+                          if (my_domain < neigh_domain)
+                            inner_faces_at_proc_boundary[neigh_domain].shared_faces.
+                            emplace_back(id_mine, id_neigh);
+                          else
+                            inner_faces_at_proc_boundary[neigh_domain].shared_faces.
+                            emplace_back(id_neigh, id_mine);
                         }
                     }
                 }
@@ -801,10 +801,10 @@ namespace internal
         }
 
       info.face_orientation = 0;
-      unsigned int  left_face_orientation =
+      const unsigned int  left_face_orientation =
         !cell->face_orientation(face_no) + 2 * cell->face_flip(face_no) +
         4 * cell->face_rotation(face_no);
-      unsigned int right_face_orientation =
+      const unsigned int right_face_orientation =
         !neighbor->face_orientation(info.exterior_face_no) +
         2 * neighbor->face_flip(info.exterior_face_no) +
         4 * neighbor->face_rotation(info.exterior_face_no);
@@ -927,7 +927,7 @@ namespace internal
                       goto face_found;
                     }
                 }
-              faces_type.push_back(std::vector<unsigned int>(1, face));
+              faces_type.emplace_back(1, face);
 face_found :
               {}
             }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.