3 #ifndef DUNE_GRID_ALUGRID_BACKUPRESTORE_HH
4 #define DUNE_GRID_ALUGRID_BACKUPRESTORE_HH
10 #include <dune/common/exceptions.hh>
18 template<
int dim,
int dimworld, ALUGr
idElementType elType, ALUGr
idRefinementType refineType,
class Comm >
22 typedef ALUGrid< dim, dimworld, elType, refineType, Comm >
Grid;
24 static std::string createFilename(
const std::string &path,
const std::string &fileprefix )
26 std::string filename( path );
27 if( fileprefix.size() > 0 )
29 filename +=
"/" + fileprefix ;
31 else if( filename[ filename.size() - 1 ] == char(
'/') )
33 filename +=
"/alugrid";
39 static void backup (
const Grid &grid,
const std::string &filename )
41 std::ofstream file( filename.c_str() );
49 std::cerr <<
"ERROR: BackupRestoreFacility::backup: couldn't open file `" << filename <<
"'" << std::endl;
54 static void backup (
const Grid &grid, std::ostream &stream )
57 grid.backup( stream );
64 std::ifstream file( filename.c_str() );
71 std::cerr <<
"ERROR: BackupRestoreFacility::restore: couldn't open file `" << filename <<
"'" << std::endl;
81 grid->restore( stream );
88 #endif // #ifndef DUNE_GRID_ALUGRID_BACKUPRESTORE_HH