dune-grid 2.11
Loading...
Searching...
No Matches
Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > > Struct Template Reference

facility for writing and reading grids More...

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

Inheritance diagram for Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >:
Inheritance graph

Public Types

typedef Dune::YaspGrid< dim, Coordinates > Grid
typedef Grid::ctype ctype
typedef Grid::Traits::Communication Comm

Static Public Member Functions

static void backup (const Grid &grid, const std::string &filename)
 write a hierarchic grid to disk
static void backup (const Grid &grid, std::ostream &stream)
 write a hierarchic grid to disk
static Gridrestore (const std::string &filename, Comm comm=Comm())
 read a hierarchic grid from disk
static Gridrestore (std::istream &stream, Comm comm=Comm())
 read a hierarchic grid from a stream

Detailed Description

template<int dim, class Coordinates>
struct Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >

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:

  • methods writing into one or more dedicated files,
  • methods operating on a std::stream.

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 Typedef Documentation

◆ Comm

template<int dim, class Coordinates>
typedef Grid::Traits::Communication Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >::Comm

◆ ctype

template<int dim, class Coordinates>
typedef Grid::ctype Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >::ctype

◆ Grid

template<int dim, class Coordinates>
typedef Dune::YaspGrid<dim, Coordinates> Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >::Grid

Member Function Documentation

◆ backup() [1/2]

template<int dim, class Coordinates>
void Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >::backup ( const Grid & grid,
const std::string & filename )
inlinestatic

write a hierarchic grid to disk

Parameters
[in]gridgrid to write
[in]filenamefilename of the file to create
Note
This method might create multiple files based on the filename plus internal extension.

◆ backup() [2/2]

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

write a hierarchic grid to disk

Parameters
[in]gridgrid to write
[in]filenamefilename of the file to create
Note
This method might create multiple files based on the filename plus internal extension.

◆ restore() [1/2]

template<int dim, class Coordinates>
Grid * Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >::restore ( const std::string & filename,
Comm comm = Comm() )
inlinestatic

read a hierarchic grid from disk

Parameters
[in]filenamefilename of the file to read
Returns
a pointer to the grid (allocated by new)
Note
This method might require multiple files based on the filename plus some extension.
Parameters
commCommunication object.

◆ restore() [2/2]

template<int dim, class Coordinates>
Grid * Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >::restore ( std::istream & stream,
Comm comm = Comm() )
inlinestatic

read a hierarchic grid from a stream

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

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