Skip to content
Snippets Groups Projects

Backup and restore facilities

Merged Praetorius, Simon requested to merge feature/backup_restore into master
All threads resolved!
1 file
+ 11
7
Compare changes
  • Side-by-side
  • Inline
@@ -6,6 +6,7 @@
#include <dune/common/hybridutilities.hh>
#include <dune/common/timer.hh>
#include <dune/grid/common/capabilities.hh>
#include <dune/typetree/childextraction.hh>
#include <amdis/AdaptInfo.hpp>
@@ -489,23 +490,26 @@ template <class Traits>
void ProblemStat<Traits>::
backup(std::string const& filename) const
{
try {
if (Dune::Capabilities::hasBackupRestoreFacilities<Grid>::v)
Dune::BackupRestoreFacility<Grid>::backup(*grid_, filename);
} catch (Dune::NotImplemented const&) {
else {
warning("Falling back to backup of gridview.");
BackupRestoreByGridFactory<Grid>::backup(gridView(), filename);
}
}
template <class Traits>
void ProblemStat<Traits>::
backup(AdaptInfo& adaptInfo)
{
auto param = Parameters::get<std::string>(name_ + "->backup->grid");
std::string grid_filename = param ? *param : name_ + "_" + std::to_string(adaptInfo.timestepNumber()) + ".grid";
std::string grid_filename = param ? *param :
name_ + "_" + std::to_string(adaptInfo.timestepNumber()) + ".grid";
auto param2 = Parameters::get<std::string>(name_ + "->backup->solution");
std::string solution_filename = param2 ? *param2 : name_ + "_" + std::to_string(adaptInfo.timestepNumber()) + ".solution";
std::string solution_filename = param2 ? *param2 :
name_ + "_" + std::to_string(adaptInfo.timestepNumber()) + ".solution";
backup(grid_filename);
solution_->backup(solution_filename);
@@ -519,14 +523,14 @@ restore(std::string const& filename)
{
// restore grid from file
std::unique_ptr<Grid> grid;
try {
if (Dune::Capabilities::hasBackupRestoreFacilities<Grid>::v)
grid.reset(Dune::BackupRestoreFacility<Grid>::restore(filename));
} catch (Dune::NotImplemented const&) {
else
grid.reset(BackupRestoreByGridFactory<Grid>::restore(filename));
}
return std::move(grid);
}
template <class Traits>
void ProblemStat<Traits>::
restore(Flag initFlag)
Loading