-
Notifications
You must be signed in to change notification settings - Fork 14
[wip] checkpoint restart #180
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,21 @@ | |
| #include "lac/lac_type.h" | ||
| #include "lac/lac_initializer.h" | ||
|
|
||
|
|
||
| #include <deal2lkit/utilities.h> | ||
|
|
||
| #include <deal.II/base/mpi.h> | ||
| #include <deal.II/grid/grid_tools.h> | ||
| #include <deal.II/distributed/solution_transfer.h> | ||
|
|
||
| #ifdef DEAL_II_WITH_ZLIB | ||
| # include <zlib.h> | ||
| #endif | ||
|
|
||
| #include <boost/archive/binary_oarchive.hpp> | ||
| #include <boost/archive/binary_iarchive.hpp> | ||
|
|
||
|
|
||
| using namespace dealii; | ||
| using namespace deal2lkit; | ||
| using namespace pidomus; | ||
|
|
@@ -290,6 +305,10 @@ class piDoMUS : public ParameterAcceptor, public SundialsInterface<typename LAC: | |
| */ | ||
| double current_dt; | ||
|
|
||
| /** | ||
| * step_number (it is used in output solution) | ||
| */ | ||
| unsigned int step_number; | ||
|
|
||
|
|
||
| //// previous time step | ||
|
|
@@ -358,11 +377,11 @@ class piDoMUS : public ParameterAcceptor, public SundialsInterface<typename LAC: | |
| */ | ||
| double second_to_last_dt; | ||
|
|
||
|
|
||
| /** | ||
| * Show timer statistics | ||
| */ | ||
| bool output_timer; | ||
|
|
||
| /** | ||
| * Teucos timer file | ||
| */ | ||
|
|
@@ -453,6 +472,16 @@ class piDoMUS : public ParameterAcceptor, public SundialsInterface<typename LAC: | |
| */ | ||
| bool enable_finer_preconditioner; | ||
|
|
||
| /** | ||
| * resume computation from a previously created snapshot | ||
| */ | ||
| bool resume_computation; | ||
|
|
||
| /** | ||
| * folder used for read and store snapshots | ||
| */ | ||
| std::string snapshot_folder; | ||
|
|
||
|
|
||
| /** | ||
| * Syncronize to time t. This function update functions and | ||
|
|
@@ -464,6 +493,69 @@ class piDoMUS : public ParameterAcceptor, public SundialsInterface<typename LAC: | |
| const typename LAC::VectorType &solution, | ||
| const typename LAC::VectorType &solution_dot); | ||
|
|
||
| /** | ||
| * Save the state of this program to a set of files in the output | ||
| * directory. In reality, however, only some variables are stored (in | ||
| * particular the mesh, the solution vectors, etc) whereas others can | ||
| * either be re-generated (matrices, DoFHandler objects, etc) or are | ||
| * read from the input parameter file. | ||
| * | ||
| * This function is implemented in | ||
| * <code>source/checkpoint_restart.cc</code>. | ||
| */ | ||
| void create_snapshot() const; | ||
|
|
||
| void save_solutions_and_triangulation(const LADealII::VectorType &y, | ||
| const LADealII::VectorType &y_dot, | ||
| const LADealII::VectorType &y_expl, | ||
| const LADealII::VectorType &, | ||
| const LADealII::VectorType &, | ||
| const LADealII::VectorType &) const; | ||
|
|
||
| void save_solutions_and_triangulation(const LATrilinos::VectorType &, | ||
| const LATrilinos::VectorType &, | ||
| const LATrilinos::VectorType &, | ||
| const LATrilinos::VectorType &locally_relevant_y, | ||
| const LATrilinos::VectorType &locally_relevant_y_dot, | ||
| const LATrilinos::VectorType &locally_relevant_y_expl) const; | ||
|
|
||
|
|
||
| /** | ||
| * Restore the state of this program from a set of files in the output | ||
| * directory. | ||
| * | ||
| * This function is implemented in | ||
| * <code>source/checkpoint_restart.cc</code>. | ||
| */ | ||
| void resume_from_snapshot(); | ||
|
|
||
| void load_solutions(LADealII::VectorType &y, | ||
| LADealII::VectorType &y_expl, | ||
| LADealII::VectorType &y_dot); | ||
|
|
||
| void load_solutions(LATrilinos::VectorType &y, | ||
| LATrilinos::VectorType &y_expl, | ||
| LATrilinos::VectorType &y_dot); | ||
|
|
||
| public: | ||
| /** | ||
| * Save a number of variables using BOOST serialization mechanism. | ||
| * | ||
| * This function is implemented in | ||
| * <code>source/checkpoint_restart.cc</code>. | ||
| */ | ||
| template <class Archive> | ||
| void serialize (Archive &ar, const unsigned int /*version*/) | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move the implementation in the cc file. |
||
| ar ¤t_time; | ||
| ar ¤t_alpha; | ||
| ar ¤t_dt; | ||
| ar &step_number; | ||
| ar ¤t_cycle; | ||
| std::cout << "bannnnnnnnnnnnnnnnnnnaaa"<<std::endl; | ||
| } | ||
|
|
||
| private: | ||
|
|
||
| /** | ||
| * Struct containing the signals | ||
|
|
@@ -476,6 +568,8 @@ class piDoMUS : public ParameterAcceptor, public SundialsInterface<typename LAC: | |
| */ | ||
| friend class SimulatorAccess<dim,spacedim,LAC>; | ||
|
|
||
|
|
||
|
|
||
| }; | ||
|
|
||
| #endif | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
for -> to
folder -> Folder