1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
// vi: set et ts=4 sw=2 sts=2:
1
3
#ifndef DUNE_ALU_BNDPROJECTION_HH
2
4
#define DUNE_ALU_BNDPROJECTION_HH
6
//! \brief ALUGrid boundary projection implementation
7
//! DuneBndProjection has to fulfil the DuneBoundaryProjection interface
8
template <class GridImp, class ctype = double >
9
class ALUGridBoundaryProjection
8
//! \brief ALUGrid boundary projection implementation
9
//! DuneBndProjection has to fulfil the DuneBoundaryProjection interface
10
template <class GridImp, class ctype = double >
11
class ALUGridBoundaryProjection
10
12
#ifdef ALUGRID_VERTEX_PROJECTION
11
13
: public GridImp :: ALUGridVertexProjectionType
14
16
typedef GridImp GridType;
15
// type of double coordinate vector
17
// type of double coordinate vector
16
18
typedef ctype coord_t[ GridType :: dimensionworld ];
19
//! reference to boundary projection implementation
21
//! reference to boundary projection implementation
20
22
const GridType& grid_;
22
//! type of boundary projection
24
//! type of boundary projection
23
25
typedef typename GridType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
25
//! type of coordinate vector
27
//! type of coordinate vector
26
28
typedef typename DuneBoundaryProjectionType :: CoordinateType CoordinateType;
28
//! constructor storing reference to boundary projection implementation
29
ALUGridBoundaryProjection(const GridType& grid)
30
//! constructor storing reference to boundary projection implementation
31
ALUGridBoundaryProjection(const GridType& grid)
34
35
//! (old) method projection vertices defaults to segment 0
35
int operator () (const coord_t &orig,
36
int operator () (const coord_t &orig,
38
39
return this->operator()( orig, 0, prj);
41
//! projection operator
42
int operator () (const coord_t &orig,
42
//! projection operator
43
int operator () (const coord_t &orig,
43
44
const int segmentIndex,
46
47
#ifdef ALUGRID_VERTEX_PROJECTION
47
// get boundary projection
48
const DuneBoundaryProjectionType* bndPrj =
48
// get boundary projection
49
const DuneBoundaryProjectionType* bndPrj =
49
50
grid_.boundaryProjection( segmentIndex );
51
52
// if pointer is zero we do nothing, i.e. identity mapping
54
// call projection operator
55
reinterpret_cast<CoordinateType &> (* (&prj[0])) =
55
// call projection operator
56
reinterpret_cast<CoordinateType &> (* (&prj[0])) =
56
57
(*bndPrj)( reinterpret_cast<const CoordinateType &> (* (&orig[0])) );
60
// return 1 for success
61
// return 1 for success
65
} // end namespace Dune
66
} // end namespace Dune