version 3.8
adapt.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_ADAPTIVE_ADAPT_HH
13#define DUMUX_ADAPTIVE_ADAPT_HH
14
15#include "griddatatransfer.hh"
16
17namespace Dumux {
18
27template<class Grid>
28bool adapt(Grid& grid, GridDataTransfer<Grid>& dataTransfer)
29{
30 // Do pre-adaption step of the grid
31 const bool mightCoarsen = grid.preAdapt();
32
33 // Let the helper do storage of variables
34 dataTransfer.store(grid);
35
36 // adapt the grid
37 const bool refine = grid.adapt();
38
39 // (Re-)construct variables to new grid
40 dataTransfer.reconstruct(grid);
41
42 // delete markers in grid
43 grid.postAdapt();
44
45 // return boolean if grid has been changed
46 return mightCoarsen || refine;
47}
48
49} // end namespace Dumux
50
51#endif
Interface to be used by classes transferring grid data on adaptive grids.
Definition: adaptive/griddatatransfer.hh:23
virtual void store(const Grid &)=0
store user data before grid adaption
virtual void reconstruct(const Grid &)=0
store user data after grid adaption
bool adapt(Grid &grid, GridDataTransfer< Grid > &dataTransfer)
Adapt the grid and reconstruct the user data.
Definition: adapt.hh:28
Definition: adapt.hh:17
Performs the transfer of data on a grid from before to after adaptation.