1#ifndef DUNE_GRID_ALUGRID_BACKUPRESTORE_HH
2#define DUNE_GRID_ALUGRID_BACKUPRESTORE_HH
8#include <dune/alugrid/impl/macrofileheader.hh>
9#include <dune/common/exceptions.hh>
10#include <dune/grid/common/backuprestore.hh>
17 template<
int dim,
int dimworld, ALUGr
idElementType elType, ALUGr
idRefinementType refineType,
class Comm >
18 struct BackupRestoreFacility<
ALUGrid< dim, dimworld, elType, refineType, Comm > >
25 static const ::ALUGrid:: MacroFileHeader::Format defaultFormat = ::ALUGrid::
26 MacroFileHeader::defaultFormat ;
28 static std::string
createFilename(
const std::string &path,
const std::string &fileprefix )
30 std::string filename( path );
31 if( fileprefix.size() > 0 )
33 filename +=
"/" + fileprefix ;
35 else if( filename[ filename.size() - 1 ] ==
char(
'/') )
37 filename +=
"/alugrid";
43 static void backup (
const Grid &grid,
const std::string &filename,
44 const ::ALUGrid:: MacroFileHeader::Format format = defaultFormat )
46 std::ofstream file( filename.c_str() );
50 backup( grid, file, defaultFormat );
54 std::cerr <<
"ERROR: BackupRestoreFacility::backup: couldn't open file `" << filename <<
"'" << std::endl;
59 static void backup (
const Grid &grid, std::ostream &stream,
60 const ::ALUGrid:: MacroFileHeader::Format format = defaultFormat )
63 grid.backup( stream, format );
70 std::ifstream file( filename.c_str() );
73 return restore( file );
77 std::cerr <<
"ERROR: BackupRestoreFacility::restore: couldn't open file `" << filename <<
"'" << std::endl;
87 grid->restore( stream );
Definition alu3dinclude.hh:50
Definition alu3dinclude.hh:80
unstructured parallel implementation of the DUNE grid interface
Definition alugrid.hh:31
ALUGrid< dim, dimworld, elType, refineType, Comm > Grid
Definition backuprestore.hh:21
static Grid * restore(std::istream &stream)
Definition backuprestore.hh:83
static std::string createFilename(const std::string &path, const std::string &fileprefix)
Definition backuprestore.hh:28
static Grid * restore(const std::string &filename)
Definition backuprestore.hh:67
static void backup(const Grid &grid, const std::string &filename, const ::ALUGrid::MacroFileHeader::Format format=defaultFormat)
Definition backuprestore.hh:43
static void backup(const Grid &grid, std::ostream &stream, const ::ALUGrid::MacroFileHeader::Format format=defaultFormat)
Definition backuprestore.hh:59