dune-grid 3.0-git
albertagrid/backuprestore.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_GRID_ALBERTAGRID_BACKUPRESTORE_HH
4#define DUNE_GRID_ALBERTAGRID_BACKUPRESTORE_HH
5
7
8namespace Dune
9{
10
11 // External Forward Declarations
12 // -----------------------------
13
14 template< int, int >
15 class AlbertaGrid;
16
17
18
19 // BackupRestoreFacility for AlbertaGrid
20 // -------------------------------------
21
22 template< int dim, int dimworld >
23 struct BackupRestoreFacility< AlbertaGrid< dim, dimworld > >
24 {
26
28 static void backup ( const Grid &grid, const std::string &filename )
29 {
30 grid.writeGridXdr( filename, 0.0 );
31 }
32
37 static void backup ( const Grid &grid, std::ostream &stream )
38 {
39 DUNE_THROW( NotImplemented, "backup / restore using streams not implemented." );
40 }
41
43 static Grid *restore ( const std::string &filename )
44 {
45 Grid *grid = new Grid;
46 double time; // ignore time
47 grid->readGridXdr( filename, time );
48 return grid;
49 }
50
55 static Grid *restore ( std::istream &stream )
56 {
57 DUNE_THROW( NotImplemented, "backup / restore using streams not implemented." );
58 }
59 };
60
61} // namespace Dune
62
63#endif // #ifndef DUNE_GRID_ALBERTAGRID_BACKUPRESTORE_HH
Include standard header files.
Definition agrid.hh:60
[ provides Dune::Grid ]
Definition agrid.hh:140
bool writeGridXdr(const std::string &filename, ctype time) const
Definition albertagrid.cc:573
bool readGridXdr(const std::string &filename, ctype &time)
reads ALBERTA mesh file
Definition albertagrid.cc:581
static Grid * restore(const std::string &filename)
Definition albertagrid/backuprestore.hh:43
AlbertaGrid< dim, dimworld > Grid
Definition albertagrid/backuprestore.hh:25
static void backup(const Grid &grid, std::ostream &stream)
Definition albertagrid/backuprestore.hh:37
static void backup(const Grid &grid, const std::string &filename)
Definition albertagrid/backuprestore.hh:28
static Grid * restore(std::istream &stream)
Definition albertagrid/backuprestore.hh:55
facility for writing and reading grids
Definition common/backuprestore.hh:41