distributed::triangulation and persistentTriangulation

83 views
Skip to first unread message

Minh Do-Quang

unread,
Aug 22, 2013, 7:11:07 AM8/22/13
to dea...@googlegroups.com
Hi,

I am wondering, can I store/restore my simulation that running with distributed::triangulation (step-40)
Before I can use persistentTriangulation to do that. Is there any better way for doing this ?

Thank you very much,
/ Minh Do

Timo Heister

unread,
Aug 23, 2013, 6:13:47 PM8/23/13
to dea...@googlegroups.com
Yes you can store/restore, but not using persistentTriangulation. It
is actually quite easy. Here is what we do in aspect (should be
possible to adapt to your problem):

/// saving:

// save Triangulation and Solution vectors:
{
std::vector<const LinearAlgebra::BlockVector *> x_system (3);
x_system[0] = &solution;
x_system[1] = &old_solution;
x_system[2] = &old_old_solution;

parallel::distributed::SolutionTransfer<dim, LinearAlgebra::BlockVector>
system_trans (dof_handler);

system_trans.prepare_serialization (x_system);

triangulation.save ((parameters.output_directory +
"restart.mesh").c_str());
}

/// resuming:

void Simulator<dim>::resume_from_snapshot()
{
triangulation.load ((parameters.output_directory +
"restart.mesh").c_str());
setup_dofs();

LinearAlgebra::BlockVector
distributed_system (system_rhs);
LinearAlgebra::BlockVector
old_distributed_system (system_rhs);
LinearAlgebra::BlockVector
old_old_distributed_system (system_rhs);
std::vector<LinearAlgebra::BlockVector *> x_system (3);
x_system[0] = & (distributed_system);
x_system[1] = & (old_distributed_system);
x_system[2] = & (old_old_distributed_system);

parallel::distributed::SolutionTransfer<dim, LinearAlgebra::BlockVector>
system_trans (dof_handler);

system_trans.deserialize (x_system);

solution = distributed_system;
old_solution = old_distributed_system;
old_old_solution = old_old_distributed_system;
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Timo Heister
http://www.math.clemson.edu/~heister/
Reply all
Reply to author
Forward
0 new messages