From: Daniel Arndt Date: Mon, 30 Apr 2018 23:38:17 +0000 (+0200) Subject: Simplify CommunicateLocallyMovedVertices::unpack_data X-Git-Tag: v9.0.0-rc1~38^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87adcfc1ad06465b3f661acd3b44fbb4824b4c66;p=dealii.git Simplify CommunicateLocallyMovedVertices::unpack_data --- diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 21a554bb65..fd8a52123c 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -1413,12 +1413,12 @@ namespace parallel unsigned int bytes_for_buffer () const { - return (sizeof(unsigned int) + - tree_index.size() * sizeof(unsigned int) + - quadrants.size() * sizeof(typename dealii::internal::p4est - ::types::quadrant) + - vertices.size() * sizeof(dealii::Point)) + - vertex_indices.size() * sizeof(unsigned int); + return sizeof(unsigned int) + + tree_index.size() * sizeof(unsigned int) + + quadrants.size() * sizeof(typename dealii::internal::p4est + ::types::quadrant) + + vertex_indices.size() * sizeof(unsigned int) + + vertices.size() * sizeof(dealii::Point); } void pack_data (std::vector &buffer) const @@ -1447,7 +1447,6 @@ namespace parallel vertex_indices.data(), vertex_indices.size() * sizeof(unsigned int)); ptr += vertex_indices.size() * sizeof(unsigned int); - std::memcpy(ptr, vertices.data(), vertices.size() * sizeof(dealii::Point)); @@ -1502,16 +1501,11 @@ namespace parallel first_vertices.resize(cells); for (unsigned int c=0; c *const vertex - = reinterpret_cast *>(ptr); first_indices[c] = vertices.size(); - vertices.push_back(*vertex); - ptr += sizeof(dealii::Point); - vertices.resize(vertices.size() + n_vertices_on_cell[c]-1); - memcpy(&vertices[vertices.size() - (n_vertices_on_cell[c]-1)], - ptr, (n_vertices_on_cell[c]-1)*sizeof(dealii::Point)); - ptr += (n_vertices_on_cell[c]-1)*sizeof(dealii::Point); + vertices.resize(vertices.size() + n_vertices_on_cell[c]); + memcpy(&vertices[vertices.size() - n_vertices_on_cell[c]], + ptr, n_vertices_on_cell[c]*sizeof(dealii::Point)); + ptr += n_vertices_on_cell[c]*sizeof(dealii::Point); } for (unsigned int c=0; c