Dune Core Modules (2.3.1)

bndprojection.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_ALU2D_BNDPROJECTION_HH
4#define DUNE_ALU2D_BNDPROJECTION_HH
5
6#include <dune/grid/alugrid/common/bndprojection.hh>
7
8#include <dune/grid/alugrid/2d/alu2dinclude.hh>
9
10namespace Dune
11{
12
13 template< class Grid >
14 class ALU2dGridBoundaryProjection
15 : public ALU2DSPACE VtxProjection ALU2DDIMWORLD(Grid::dimensionworld,Grid::elementType)
16 {
17 typedef ALU2DSPACE VtxProjection ALU2DDIMWORLD (Grid::dimensionworld,Grid::elementType) Base;
18
19 public:
20 enum { ncoord = Base::ncoord };
21
22 typedef typename Base::hbndel_t hbndel_t;
23 typedef typename Base::helement_t helement_t;
24
25 typedef typename Grid::DuneBoundaryProjectionType DuneBoundaryProjectionType;
26
27 typedef typename DuneBoundaryProjectionType::CoordinateType CoordinateType;
28
29 explicit ALU2dGridBoundaryProjection ( const Grid &grid )
30 : grid_( grid )
31 {}
32
33 int operator() ( const hbndel_t *hbndel, const double local, double (&global)[ ncoord ] ) const
34 {
35 return callProjection( grid_.boundaryProjection( hbndel->segmentIndex() ), global );
36 }
37
38 int operator() ( const helement_t *helement, const double (&local)[ 2 ], double (&global)[ ncoord ] ) const
39 {
40 return callProjection( grid_.globalProjection(), global );
41 }
42
43 private:
44 static int callProjection ( const DuneBoundaryProjectionType *prj, double (&global)[ ncoord ] )
45 {
46 if( prj )
47 {
48 CoordinateType x, y;
49 for( int i = 0; i < ncoord; ++i )
50 x[ i ] = global[ i ];
51 y = (*prj)( x );
52 for( int i = 0; i < ncoord; ++i )
53 global[ i ] = y[ i ];
54 }
55 return 1;
56 }
57
58 const Grid &grid_;
59 };
60
61} // end namespace Dune
62
63#endif // #ifndef DUNE_ALU2D_BNDPROJECTION_HH
@ dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:406
Dune namespace.
Definition: alignment.hh:14
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)