Dune Core Modules (unstable)

backuprestore.hh
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_GRID_ALBERTAGRID_BACKUPRESTORE_HH
6#define DUNE_GRID_ALBERTAGRID_BACKUPRESTORE_HH
7
8#include <dune/grid/common/backuprestore.hh>
9
10namespace Dune
11{
12
13 // External Forward Declarations
14 // -----------------------------
15
16 template< int, int >
17 class AlbertaGrid;
18
19
20
21 // BackupRestoreFacility for AlbertaGrid
22 // -------------------------------------
23
24 template< int dim, int dimworld >
25 struct BackupRestoreFacility< AlbertaGrid< dim, dimworld > >
26 {
28
30 static void backup ( const Grid &grid, const std::string &filename )
31 {
32 grid.writeGrid( filename, 0.0 );
33 }
34
39 static void backup ( const Grid &grid, std::ostream &stream )
40 {
41 DUNE_THROW( NotImplemented, "backup / restore using streams not implemented." );
42 }
43
45 static Grid *restore ( const std::string &filename )
46 {
47 Grid *grid = new Grid;
48 double time; // ignore time
49 grid->readGrid( filename, time );
50 return grid;
51 }
52
57 static Grid *restore ( std::istream &stream )
58 {
59 DUNE_THROW( NotImplemented, "backup / restore using streams not implemented." );
60 }
61 };
62
63} // namespace Dune
64
65#endif // #ifndef DUNE_GRID_ALBERTAGRID_BACKUPRESTORE_HH
#define DUNE_THROW(E,...)
Definition: exceptions.hh:312
Dune namespace.
Definition: alignedallocator.hh:13
static Grid * restore(const std::string &filename)
read a hierarchic grid from disk
Definition: backuprestore.hh:78
static void backup(const Grid &grid, const std::string &filename)
write a hierarchic grid to disk
Definition: backuprestore.hh:51
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)