dune-grid  2.4.1-rc2
common/bndprojection.hh
Go to the documentation of this file.
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_ALU_BNDPROJECTION_HH
4 #define DUNE_ALU_BNDPROJECTION_HH
5 
6 namespace Dune {
7 
10  template <class GridImp, class ctype = double >
12 #ifdef ALUGRID_VERTEX_PROJECTION
13  : public GridImp :: ALUGridVertexProjectionType
14 #endif
15  {
16  typedef GridImp GridType;
17  // type of double coordinate vector
18  typedef ctype coord_t[ GridType :: dimensionworld ];
19  protected:
20 
22  const GridType& grid_;
23  public:
25  typedef typename GridType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
26 
28  typedef typename DuneBoundaryProjectionType :: CoordinateType CoordinateType;
29 
31  ALUGridBoundaryProjection(const GridType& grid)
32  : grid_( grid )
33  {}
34 
36  int operator () (const coord_t &orig,
37  coord_t &prj) const
38  {
39  return this->operator()( orig, 0, prj);
40  }
41 
43  int operator () (const coord_t &orig,
44  const int segmentIndex,
45  coord_t &prj) const
46  {
47 #ifdef ALUGRID_VERTEX_PROJECTION
48  // get boundary projection
49  const DuneBoundaryProjectionType* bndPrj =
50  grid_.boundaryProjection( segmentIndex );
51 
52  // if pointer is zero we do nothing, i.e. identity mapping
53  if( bndPrj )
54  {
55  // call projection operator
56  reinterpret_cast<CoordinateType &> (* (&prj[0])) =
57  (*bndPrj)( reinterpret_cast<const CoordinateType &> (* (&orig[0])) );
58  }
59 #endif
60 
61  // return 1 for success
62  return 1;
63  }
64  };
65 
66 } // end namespace Dune
67 #endif
const GridType & grid_
reference to boundary projection implementation
Definition: common/bndprojection.hh:22
int operator()(const coord_t &orig, coord_t &prj) const
(old) method projection vertices defaults to segment 0
Definition: common/bndprojection.hh:36
ALUGrid boundary projection implementation DuneBndProjection has to fulfil the DuneBoundaryProjection...
Definition: common/bndprojection.hh:11
Include standard header files.
Definition: agrid.hh:59
GridType::DuneBoundaryProjectionType DuneBoundaryProjectionType
type of boundary projection
Definition: common/bndprojection.hh:25
DuneBoundaryProjectionType::CoordinateType CoordinateType
type of coordinate vector
Definition: common/bndprojection.hh:28
ALUGridBoundaryProjection(const GridType &grid)
constructor storing reference to boundary projection implementation
Definition: common/bndprojection.hh:31