dune-grid  2.2.1
coordfunctioncaller.hh
Go to the documentation of this file.
1 #ifndef DUNE_GEOGRID_COORDFUNCTIONCALLER_HH
2 #define DUNE_GEOGRID_COORDFUNCTIONCALLER_HH
3 
6 
7 namespace Dune
8 {
9 
10  namespace GeoGrid
11  {
12 
13  // CoordFunctionCaller
14  // -------------------
15 
16  template< class HostEntity, class CoordFunctionInterface >
18 
19  template< class HostEntity, class ct, unsigned int dimD, unsigned int dimR, class Impl >
20  class CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >
21  {
24 
25  static const int codimension = HostEntity::codimension;
26 
27  public:
29 
30  CoordFunctionCaller ( const HostEntity &hostEntity,
31  const CoordFunctionInterface &coordFunction )
32  : hostCorners_( hostEntity ),
33  coordFunction_( coordFunction )
34  {}
35 
36  void evaluate ( unsigned int i, RangeVector &y ) const
37  {
38  coordFunction_.evaluate( hostCorners_.corner( i ), y );
39  }
40 
41  GeometryType type () const
42  {
43  return hostCorners_.type();
44  }
45 
46  unsigned int numCorners () const
47  {
48  return hostCorners_.numCorners();
49  }
50 
51  private:
52  const HostCorners< HostEntity > hostCorners_;
53  const CoordFunctionInterface &coordFunction_;
54  };
55 
56  template< class HostEntity, class ct, unsigned int dimR, class Impl >
57  class CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > >
58  {
61 
62  typedef typename CoordFunctionInterface::RangeVector RangeVector;
63 
64  public:
65  CoordFunctionCaller ( const HostEntity &hostEntity,
66  const CoordFunctionInterface &coordFunction )
67  : hostEntity_( hostEntity ),
68  coordFunction_( coordFunction )
69  {}
70 
71  void evaluate ( unsigned int i, RangeVector &y ) const
72  {
73  coordFunction_.evaluate( hostEntity_, i, y );
74  }
75 
76  GeometryType type () const
77  {
78  return hostEntity_.type();
79  }
80 
81  unsigned int numCorners () const
82  {
83  return hostEntity_.geometry().corners();
84  }
85 
86  private:
87  const HostEntity &hostEntity_;
88  const CoordFunctionInterface &coordFunction_;
89  };
90 
91  } // namespace GeoGrid
92 
93 } // namespace Dune
94 
95 #endif // #ifndef DUNE_GEOGRID_COORDFUNCTIONCALLER_HH