dune-grid  2.2.0
Static Public Member Functions
Dune::BackupRestoreFacility< Grid > Class Template Reference

facility for writing and reading grids More...

#include <dune/grid/common/backuprestore.hh>

List of all members.

Static Public Member Functions

static void backup (const Grid &grid, const std::string &path, const std::string &fileprefix)
 write a hierarchic grid to disk
static void backup (const Grid &grid, const std::ostream &stream)
 write a hierarchic grid into a stream
static Gridrestore (const std::string &path, const std::string &fileprefix)
 read a hierarchic grid from disk
static Gridrestore (const std::istream &stream)
 read a hierarchic grid from a stream

Detailed Description

template<class Grid>
class Dune::BackupRestoreFacility< Grid >

facility for writing and reading grids

The BackupRestoreFacility allows writing hierarchic grids to disk and reading them back into another program.

It is guaranteed that all index sets and id sets are preserved by the backup / restore process. The result of restore is undefined, if the number of processes in a parallel program differs from the number of processes used on backup.

There are two pairs of backup / restore methods:

These techniques may not be mixed, i.e., you cannot write the grid into files and read it back from a stream or vice versa. While operating on a std::stream might be convenient, a grid written in another language than C++ might need to emulate this method by writing through a temporary file.

Note:
The backup and restore methods might not be implemented for each grid. In this case one can catch the Dune::NotImplemented exception and do something else.
Template Parameters:
Gridtype of grid

Member Function Documentation

template<class Grid >
static void Dune::BackupRestoreFacility< Grid >::backup ( const Grid grid,
const std::string &  path,
const std::string &  fileprefix 
)
inlinestatic

write a hierarchic grid to disk

Parameters:
[in]gridgrid to write
[in]pathpath to write the file to
[in]fileprefixprefix of the file name
Note:
This method might create multiple files based on the file prefix.

Referenced by Dune::BackupRestoreFacility< GeometryGrid< HostGrid, CoordFunction, Allocator > >::backup().

template<class Grid >
static void Dune::BackupRestoreFacility< Grid >::backup ( const Grid grid,
const std::ostream &  stream 
)
inlinestatic

write a hierarchic grid into a stream

Parameters:
[in]gridgrid to write
[in]streamstd::stream to write the grid to
Note:
While operating on a std::stream might be convenient, a grid written in another language than C++ might need to emulate this method by writing through a temporary file.
template<class Grid >
static Grid* Dune::BackupRestoreFacility< Grid >::restore ( const std::string &  path,
const std::string &  fileprefix 
)
inlinestatic

read a hierarchic grid from disk

Parameters:
[in]pathpath to write the file to
[in]fileprefixprefix of the file name
Returns:
a pointer to the grid (allocated by new)
Note:
This method might require multiple files based on the file prefix.

Referenced by Dune::BackupRestoreFacility< GeometryGrid< HostGrid, CoordFunction, Allocator > >::restore().

template<class Grid >
static Grid* Dune::BackupRestoreFacility< Grid >::restore ( const std::istream &  stream)
inlinestatic

read a hierarchic grid from a stream

Parameters:
[in]streamstd::stream to read the grid from
Note:
While operating on a std::stream might be convenient, a grid written in another language than C++ might need to emulate this method by writing through a temporary file.

The documentation for this class was generated from the following file: