New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test serialization for serial and shared triangulations #15649
Conversation
/rebuild |
995e99e
to
dbea6d7
Compare
@pcafrica After you rebase, I'll take a look at this PR. |
dbea6d7
to
e66fbf7
Compare
Thank you @peterrum! I have just rebased, this MR is ready for review. |
#include "./tests.h" | ||
#include "../grid/tests.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests.h
file has just been moved from fullydistributed_grids
to grids
, without modify its content.
Is it fine to reference it also from other folders than grids
?
{ | ||
boost::archive::text_oarchive oa(stream); | ||
oa << triangulation; | ||
oa << vector; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to test here the vector. There should be other tests whether the serialization/deserialization of vectors work.
{ | ||
const std::string filename = "save_load_" + std::to_string(dim) + "d_out"; | ||
|
||
triangulation.save(filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But here we should test vectors sometime in the future ;) What is missing for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing is missing, indeed :)
This is actually tested in grids/serialization_01.cc
.
std::stringstream stream; | ||
{ | ||
boost::archive::text_oarchive oa(stream); | ||
oa << triangulation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering what happens for p:s:T
for load/save? I guess it should work but users need to provide unique file names on each process!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the current implementation of T::{save,load}()
, the following two are equivalent:
boost::archive::text_oarchive oa(std::ofstream(filename));
oa << triangulation;
and
triangulation.save(filename);
I decided to stick with the first one, as it is more versatile (we can easily serialize more information, such as vectors, onto the same file). Also, @blaisb and I are planning to use it for step-83.
The p::s::T::{save,load}()
methods were already tested (see sharedtria/tria_load_01.cc
), and #15576 did not break it.
So if run in parallel then yes, unique file names must be provided on each process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding step-83: I think triangulation.save(filename);
is the right approach.
@pcafrica One thing I am wondering of is whether |
e66fbf7
to
d68d963
Compare
Personally, I haven't tested it. From what I see here, there are a couple of I'll try out, and possibly open a new PR. |
|
Fixed, thank you! |
8b1b0ab
to
65a5df8
Compare
65a5df8
to
7e9d3d4
Compare
@peterrum Do you approve now? |
std::stringstream stream; | ||
{ | ||
boost::archive::text_oarchive oa(stream); | ||
oa << triangulation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding step-83: I think triangulation.save(filename);
is the right approach.
Depends on #15576.
Tests for serializing/deserializing were already implemented for
p::d::T
andp::f::T
.The new design introduced in #15576 unlocks the same interface also for
T
andp::s::T
.This PR adds 3 new tests for serializing/deserializing:
@peterrum @blaisb @bangerth