5#ifndef DUNE_GEOGRID_BACKUPRESTORE_HH
6#define DUNE_GEOGRID_BACKUPRESTORE_HH
11#include <dune/grid/common/backuprestore.hh>
13#include <dune/grid/geometrygrid/declaration.hh>
14#include <dune/grid/geometrygrid/capabilities.hh>
25 template<
class Gr
id,
bool hasBackupRestoreFacilities = Capabilities::hasBackupRestoreFacilities< Gr
id > ::v >
26 class BackupRestoreFacilities
29 template<
class Gr
id >
30 class BackupRestoreFacilities<
Grid, true >
32 typedef BackupRestoreFacilities< Grid, true > This;
35 BackupRestoreFacilities ()
39 BackupRestoreFacilities (
const This & );
40 This &operator= (
const This & );
43 const Grid &asImp ()
const
45 return static_cast< const Grid &
>( *this );
50 return static_cast< Grid &
>( *this );
61 template<
class HostGr
id,
class CoordFunction,
class Allocator >
68 template <
class Output>
69 static void backup (
const Grid &grid,
const Output &filename_or_stream )
72 HostBackupRestoreFacility::backup( grid.hostGrid(), filename_or_stream );
76 template <
class Input>
77 static Grid *
restore (
const Input &filename_or_stream )
80 return restore_impl(filename_or_stream, std::is_default_constructible<CoordFunction>{});
84 template <
class Input>
85 static Grid *restore_impl (
const Input &filename_or_stream, std::true_type )
88 HostGrid *hostGrid = HostBackupRestoreFacility::restore( filename_or_stream );
89 CoordFunction *coordFunction =
new CoordFunction();
90 return new Grid( hostGrid, coordFunction );
93 template <
class Input>
94 static Grid *restore_impl (
const Input &filename_stream, std::false_type )
97 "Restoring a GeometryGrid with a CoordFunction that is not default-constructible is not implemented.");
grid wrapper replacing the geometries
Definition: grid.hh:86
Grid abstract base class.
Definition: grid.hh:375
A few common exception classes.
#define DUNE_THROW(E,...)
Definition: exceptions.hh:312
Dune namespace.
Definition: alignedallocator.hh:13
facility for writing and reading grids
Definition: backuprestore.hh:43
static Grid * restore(const std::string &filename)
read a hierarchic grid from disk
Definition: backuprestore.hh:78
static void backup(const Grid &grid, const std::string &filename)
write a hierarchic grid to disk
Definition: backuprestore.hh:51