]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allocate the right amount of memory when serializing particles. 16813/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 29 Mar 2024 16:17:56 +0000 (10:17 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 29 Mar 2024 16:17:56 +0000 (10:17 -0600)
source/particles/particle.cc

index a1b055ae99cd082c3b56b877442bd567fd45df87..d6b837e86b4ff0266d22f0db532e61fcf4333ac3 100644 (file)
@@ -285,8 +285,9 @@ namespace Particles
   std::size_t
   Particle<dim, spacedim>::serialized_size_in_bytes() const
   {
-    std::size_t size = sizeof(get_id()) + sizeof(get_location()) +
-                       sizeof(get_reference_location());
+    std::size_t size = sizeof(get_id()) +
+                       sizeof(double) * spacedim + // get_location()
+                       sizeof(double) * dim;       // get_reference_location()
 
     if (has_properties())
       {

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.