dune-grid  2.4.1-rc2
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 
8 namespace 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
bool readGridXdr(const std::string &filename, ctype &time)
reads ALBERTA mesh file
Definition: albertagrid.cc:629
static Grid * restore(std::istream &stream)
Definition: albertagrid/backuprestore.hh:55
[ provides Dune::Grid ]
Definition: agrid.hh:137
static Grid * restore(const std::string &filename)
Definition: albertagrid/backuprestore.hh:43
bool writeGridXdr(const std::string &filename, ctype time) const
Definition: albertagrid.cc:619
AlbertaGrid< dim, dimworld > Grid
Definition: albertagrid/backuprestore.hh:25
Include standard header files.
Definition: agrid.hh:59
facility for writing and reading grids
Definition: common/backuprestore.hh:40
static void backup(const Grid &grid, const std::string &filename)
Definition: albertagrid/backuprestore.hh:28
static void backup(const Grid &grid, std::ostream &stream)
Definition: albertagrid/backuprestore.hh:37