Hi,
yes there is.

You may find more references by searching for the "archive" keyword instead 
of serialization.
*demo_CH_archive 
<https://github.com/projectchrono/chrono/blob/main/src/demos/core/demo_CH_archive.cpp>*is
 
a starting point, but it's probably showing many more features that just 
simply a Chrono system serialization.
*utest_CH_archive 
<https://github.com/projectchrono/chrono/blob/main/src/tests/unit_tests/core/utest_CH_archive.cpp>*is
 
another source of information, while it's meant for testing.

In general you can import|export to JSON, XML and binary format.

In general, for a whole ChSystem, you can simply do something like.

{
    ChSystemNSC system;
    ADD THINGS TO YOUR SYSTEM
    std::ofstream mfileo("ChArchiveJSON_Pendulum.json");
    ChArchiveOutJSON archive_out(mfileo);
    archive_out << CHNVP(system);
}

std::ifstream mfilei("ChArchiveJSON_Pendulum.json");
ChArchiveInJSON archive_in(mfilei);

ChSystemNSC system;
archive_in >> CHNVP(system);

Please mind that not all the classes are enabled to serialization (e.g. 
ChVisualShapeFEA are not).
You may be able to check which are enabled by checking the relative 
ArchiveIn|ArchiveOut methods for each class.

Il giorno giovedì 20 giugno 2024 alle 20:00:49 UTC+2 [email protected] ha 
scritto:

> Is there any way to serialize Chrono::Systems so that the system state is 
> recoverable from disk? I'd like to be able to save the state of the system 
> for debugging at a later date.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/de08160b-701b-4d04-ab3f-683335ae265an%40googlegroups.com.

Reply via email to