3#ifndef DUNE_GEOGRID_BACKUPRESTORE_HH
4#define DUNE_GEOGRID_BACKUPRESTORE_HH
9#include <dune/grid/common/backuprestore.hh>
11#include <dune/grid/geometrygrid/declaration.hh>
12#include <dune/grid/geometrygrid/capabilities.hh>
23 template<
class Gr
id,
bool hasBackupRestoreFacilities = Capabilities::hasBackupRestoreFacilities< Gr
id > ::v >
24 class BackupRestoreFacilities
27 template<
class Gr
id >
28 class BackupRestoreFacilities<
Grid, true >
30 typedef BackupRestoreFacilities< Grid, true > This;
33 BackupRestoreFacilities ()
37 BackupRestoreFacilities (
const This & );
38 This &operator= (
const This & );
41 const Grid &asImp ()
const
43 return static_cast< const Grid &
>( *this );
48 return static_cast< Grid &
>( *this );
59 template<
class HostGr
id,
class CoordFunction,
class Allocator >
66 template <
class Output>
67 static void backup (
const Grid &grid,
const Output &filename_or_stream )
70 HostBackupRestoreFacility::backup( grid.hostGrid(), filename_or_stream );
74 template <
class Input>
75 static Grid *
restore (
const Input &filename_or_stream )
78 return restore_impl(filename_or_stream, std::is_default_constructible<CoordFunction>{});
82 template <
class Input>
83 static Grid *restore_impl (
const Input &filename_or_stream, std::true_type )
86 HostGrid *hostGrid = HostBackupRestoreFacility::restore( filename_or_stream );
87 CoordFunction *coordFunction =
new CoordFunction();
88 return new Grid( hostGrid, coordFunction );
91 template <
class Input>
92 static Grid *restore_impl (
const Input &filename_stream, std::false_type )
95 "Restoring a GeometryGrid with a CoordFunction that is not default-constructible is not implemented.");
grid wrapper replacing the geometries
Definition: grid.hh:84
Grid abstract base class.
Definition: grid.hh:372
A few common exception classes.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
Dune namespace.
Definition: alignedallocator.hh:11
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