5#ifndef DUNE_GEOGRID_BACKUPRESTORE_HH
6#define DUNE_GEOGRID_BACKUPRESTORE_HH
10#include <dune/common/exceptions.hh>
25 template<
class Gr
id,
bool hasBackupRestoreFacilities = Capabilities::hasBackupRestoreFacilities< Gr
id > ::v >
29 template<
class Gr
id >
40 This &operator= (
const This & );
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>
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 )
96 DUNE_THROW(NotImplemented,
97 "Restoring a GeometryGrid with a CoordFunction that is not default-constructible is not implemented.");
Include standard header files.
Definition: agrid.hh:60
facility for writing and reading grids
Definition: common/backuprestore.hh:43
Grid abstract base class.
Definition: common/grid.hh:375
Definition: geometrygrid/backuprestore.hh:27
Definition: geometrygrid/backuprestore.hh:31
const Grid & asImp() const
Definition: geometrygrid/backuprestore.hh:43
BackupRestoreFacilities()
Definition: geometrygrid/backuprestore.hh:35
Grid & asImp()
Definition: geometrygrid/backuprestore.hh:48
BackupRestoreFacility< HostGrid > HostBackupRestoreFacility
Definition: geometrygrid/backuprestore.hh:65
static void backup(const Grid &grid, const Output &filename_or_stream)
Backup the grid to file or stream.
Definition: geometrygrid/backuprestore.hh:69
static Grid * restore(const Input &filename_or_stream)
Restore the grid from file or stream.
Definition: geometrygrid/backuprestore.hh:77
GeometryGrid< HostGrid, CoordFunction, Allocator > Grid
Definition: geometrygrid/backuprestore.hh:64
grid wrapper replacing the geometries
Definition: geometrygrid/grid.hh:86
const HostGrid & hostGrid() const
obtain constant reference to the host grid
Definition: geometrygrid/grid.hh:538