3#ifndef DUNE_GEOGRID_BACKUPRESTORE_HH
4#define DUNE_GEOGRID_BACKUPRESTORE_HH
6#include <dune/grid/common/backuprestore.hh>
7#include <dune/grid/utility/grapedataioformattypes.hh>
9#include <dune/grid/geometrygrid/declaration.hh>
10#include <dune/grid/geometrygrid/capabilities.hh>
21 template<
class Gr
id,
bool hasBackupRestoreFacilities = Capabilities::hasBackupRestoreFacilities< Gr
id > ::v >
22 class BackupRestoreFacilities
25 template<
class Gr
id >
26 class BackupRestoreFacilities<
Grid, true >
28 typedef BackupRestoreFacilities< Grid, true > This;
31 BackupRestoreFacilities ()
35 BackupRestoreFacilities (
const This & );
36 This &operator= (
const This & );
39 template< GrapeIOFileFormatType type >
40 bool writeGrid (
const std::string &filename,
double time )
const
42 return asImp().hostGrid().template writeGrid< type >( filename, time );
45 template< GrapeIOFileFormatType type >
46 bool readGrid (
const std::string &filename,
double &time )
49 = asImp().hostGrid().template readGrid< type >( filename, time );
55 const Grid &asImp ()
const
57 return static_cast< const Grid &
>( *this );
62 return static_cast< Grid &
>( *this );
73 template<
class HostGr
id,
class CoordFunction,
class Allocator >
79 static void backup (
const Grid &grid,
const std::string &path,
const std::string &fileprefix )
82 HostBackupRestoreFacility::backup( grid.hostGrid(), path, fileprefix );
85 static void backup (
const Grid &grid,
const std::ostream &stream )
88 HostBackupRestoreFacility::backup( grid.hostGrid(), stream );
91 static Grid *
restore (
const std::string &path,
const std::string &fileprefix )
94 HostGrid *hostGrid = HostBackupRestoreFacility::restore( path, fileprefix );
95 CoordFunction *coordFunction =
new CoordFunction();
96 return new Grid( hostGrid, coordFunction );
99 static Grid *
restore (
const std::istream &stream )
102 HostGrid *hostGrid = HostBackupRestoreFacility::restore( stream );
103 CoordFunction *coordFunction =
new CoordFunction();
104 return new Grid( hostGrid, coordFunction );
grid wrapper replacing the geometries
Definition: grid.hh:83
Grid abstract base class.
Definition: grid.hh:388
Dune namespace.
Definition: alignment.hh:10
facility for writing and reading grids
Definition: backuprestore.hh:41
static Grid * restore(const std::string &filename)
read a hierarchic grid from disk
Definition: backuprestore.hh:76
static void backup(const Grid &grid, const std::string &filename)
write a hierarchic grid to disk
Definition: backuprestore.hh:49