Saving particles for checkpointing

31 views
Skip to first unread message

blais...@gmail.com

unread,
Dec 9, 2020, 5:15:09 PM12/9/20
to deal.II User Group
Dear all, I hope you are well.
I am trying to add checkpointing in our particle code. Particles do not have a save function, but they have a serialize function, which I think would be exactly what I need.
However, the function is not documented. It takes as an argument something of class Archive, which I could not find any information on.
I also grepped all over the tests, but I could not find a usage of this function.

Would anybody have a quick tutorial or example on how this function could be used for checkpoint the particle_handler and the properties of the particles?
Thank you so much :)!
Bruno

peterrum

unread,
Dec 9, 2020, 6:06:17 PM12/9/20
to deal.II User Group

blais...@gmail.com

unread,
Dec 9, 2020, 7:13:08 PM12/9/20
to deal.II User Group
I think they will! I feel kind-off dumb not having realized that :)
Thanks!
Bruno

blais...@gmail.com

unread,
Dec 9, 2020, 7:32:29 PM12/9/20
to deal.II User Group
I have one tiny question actually.
In all tests, the std::ostringstream oss which contains some information about the number of particles and the data being serialized is kept.
Generally, I guess this should be written to an auxiliary file, then re-read before deserialization can occur?

Wolfgang Bangerth

unread,
Dec 9, 2020, 8:10:13 PM12/9/20
to dea...@googlegroups.com
On 12/9/20 5:32 PM, blais...@gmail.com wrote:
> I have one tiny question actually.
> In all tests, the std::ostringstream oss which contains some information about
> the number of particles and the data being serialized is kept.
> Generally, I guess this should be written to an auxiliary file, then re-read
> before deserialization can occur?

Yes, precisely. In fact, instead of a std::ostringstring, when you write to
file you might as well have directly given a std::ofstream.

That that data could be written to a file is not important for the test,
though, and so it doesn't do that.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

blais...@gmail.com

unread,
Dec 10, 2020, 8:57:37 AM12/10/20
to deal.II User Group
Awesome.
It works perfectly
Thank you all :)!

rene.gas...@mailbox.org

unread,
Dec 12, 2020, 2:31:59 PM12/12/20
to deal.II User Group
Hi Bruno,

The particles do indeed have a serialize function, but it is somewhat tricky to use directly and not really necessary (you can see an example here: https://github.com/dealii/dealii/pull/11314/files#diff-fbe7d72b2e0af27fba150e987a3ce0c2cad90b6054decc94810c898fef6d9eaf). The more common case is that you have the particles inside a ParticleHandler that is connected to a triangulation. For this case the ParticleHandler can take care of the serialization by attaching the particle data to the triangulation data that is serialized anyway. An example is inside the test serialization/particle_handler_01 and _02.

Hope that helps, let me know in case you run into problems (e.g. if you want to serialize particles and a FE solution vector the order of serialization/deserialization is critical and a bit confusing due to the triangulation signals),

Best,
Rene
Reply all
Reply to author
Forward
0 new messages