dune-grid  2.11
albertagrid/datahandle.hh
Go to the documentation of this file.
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_ALBERTAGRIDDATAHANDLE_HH
6 #define DUNE_ALBERTAGRIDDATAHANDLE_HH
7 
8 #include <iostream>
9 
10 #include <dune/grid/common/grid.hh>
11 
16 
17 #if HAVE_ALBERTA
18 
19 namespace Dune
20 {
21 
22  namespace Alberta
23  {
24 
25  template< class Grid, class RestrictProlongOperator >
27  {
28  static const int dimension = Grid::dimension;
29 
30  typedef typename Grid::template Codim< 0 >::Entity Entity;
32  typedef typename EntityObject::ImplementationType EntityImp;
33 
36 
37  Grid &grid_;
38  RestrictProlongOperator &rpOp_;
39  EntityObject father_;
40 
41  public:
42  AdaptRestrictProlongHandler ( Grid &grid, RestrictProlongOperator &rpOp )
43  : grid_( grid ),
44  rpOp_( rpOp ),
45  father_( EntityImp( grid_ ) )
46  {}
47 
48  void restrictLocal ( const Patch &patch, int i )
49  {
50  ElementInfo fatherInfo = patch.elementInfo( i, grid_.levelProvider() );
51  father_.impl().setElement( fatherInfo, 0 );
52  rpOp_.preCoarsening( (const Entity &)father_ );
53  }
54 
55  void prolongLocal ( const Patch &patch, int i )
56  {
57  ElementInfo fatherInfo = patch.elementInfo( i, grid_.levelProvider() );
58  father_.impl().setElement( fatherInfo, 0 );
59  rpOp_.postRefinement( (const Entity &)father_ );
60  }
61  };
62 
63  }
64 
65 }
66 
67 #endif // #if HAVE_ALBERTA
68 
69 #endif
ElementInfo elementInfo(int i, const LevelProvider &levelProvider) const
Definition: refinement.hh:105
concept Entity
Model of a grid entity.
Definition: concepts/entity.hh:119
void prolongLocal(const Patch &patch, int i)
Definition: albertagrid/datahandle.hh:55
void restrictLocal(const Patch &patch, int i)
Definition: albertagrid/datahandle.hh:48
Implementation & impl()
access to the underlying implementation
Definition: common/entity.hh:80
provides a wrapper for ALBERTA&#39;s el_info structure
Grid abstract base classThis class is the base class for all grid implementations. Although no virtual functions are used we call it abstract since its methods do not contain an implementation but forward to the methods of the derived class via the Barton-Nackman trick.
Definition: common/grid.hh:375
Different resources needed by all grid implementations.
Include standard header files.
Definition: agrid.hh:59
Definition: refinement.hh:39
AdaptRestrictProlongHandler(Grid &grid, RestrictProlongOperator &rpOp)
Definition: albertagrid/datahandle.hh:42
static constexpr int dimension
The dimension of the grid.
Definition: common/grid.hh:387
Entity ::Implementation ImplementationType
Definition: common/grid.hh:1122
Definition: albertagrid/datahandle.hh:26
provides a wrapper for ALBERTA&#39;s refinement patches and the corners for geometryInFather ...