~ubuntu-branches/ubuntu/utopic/dune-grid/utopic-proposed

« back to all changes in this revision

Viewing changes to dune/grid/alugrid/common/bndprojection.hh

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2014-02-14 10:49:16 UTC
  • mfrom: (1.3.1) (5.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20140214104916-2clchnny3eu7ks4w
Tags: 2.3.0-2
InstallĀ /usr/share/dune-grid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
3
5
 
4
6
namespace Dune {
5
7
 
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
12
14
#endif
13
15
  {
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 ];
17
19
  protected:
18
20
 
19
 
    //! reference to boundary projection implementation 
 
21
    //! reference to boundary projection implementation
20
22
    const GridType& grid_;
21
 
  public: 
22
 
    //! type of boundary projection 
 
23
  public:
 
24
    //! type of boundary projection
23
25
    typedef typename GridType :: DuneBoundaryProjectionType DuneBoundaryProjectionType;
24
26
 
25
 
    //! type of coordinate vector 
 
27
    //! type of coordinate vector
26
28
    typedef typename DuneBoundaryProjectionType :: CoordinateType CoordinateType;
27
29
 
28
 
    //! constructor storing reference to boundary projection implementation 
29
 
    ALUGridBoundaryProjection(const GridType& grid) 
30
 
      : grid_( grid ) 
31
 
    {
32
 
    }
 
30
    //! constructor storing reference to boundary projection implementation
 
31
    ALUGridBoundaryProjection(const GridType& grid)
 
32
      : grid_( grid )
 
33
    {}
33
34
 
34
35
    //! (old) method projection vertices defaults to segment 0
35
 
    int operator () (const coord_t &orig, 
36
 
                     coord_t &prj) const 
 
36
    int operator () (const coord_t &orig,
 
37
                     coord_t &prj) const
37
38
    {
38
39
      return this->operator()( orig, 0, prj);
39
40
    }
40
41
 
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,
44
 
                     coord_t &prj) const 
 
45
                     coord_t &prj) const
45
46
    {
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 );
50
51
 
51
52
      // if pointer is zero we do nothing, i.e. identity mapping
52
 
      if( bndPrj ) 
 
53
      if( bndPrj )
53
54
      {
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])) );
57
58
      }
58
59
#endif
59
60
 
60
 
      // return 1 for success 
 
61
      // return 1 for success
61
62
      return 1;
62
63
    }
63
 
  }; 
 
64
  };
64
65
 
65
 
} // end namespace Dune 
 
66
} // end namespace Dune
66
67
#endif