dune-grid  3.0-git
coordfunctioncaller.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_GEOGRID_COORDFUNCTIONCALLER_HH
4 #define DUNE_GEOGRID_COORDFUNCTIONCALLER_HH
5 
8 
9 namespace Dune
10 {
11 
12  namespace GeoGrid
13  {
14 
15  // CoordFunctionCaller
16  // -------------------
17 
18  template< class HostEntity, class CoordFunctionInterface >
20 
21  template< class HostEntity, class ct, unsigned int dimD, unsigned int dimR, class Impl >
22  class CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >
23  {
26 
27  static const int codimension = HostEntity::codimension;
28 
29  public:
31 
32  CoordFunctionCaller ( const HostEntity &hostEntity,
33  const CoordFunctionInterface &coordFunction )
34  : hostCorners_( hostEntity ),
35  coordFunction_( coordFunction )
36  {}
37 
38  void evaluate ( unsigned int i, RangeVector &y ) const
39  {
40  coordFunction_.evaluate( hostCorners_[ i ], y );
41  }
42 
43  GeometryType type () const
44  {
45  return hostCorners_.type();
46  }
47 
48  std::size_t size () const
49  {
50  return hostCorners_.size();
51  }
52 
53  private:
54  const HostCorners< HostEntity > hostCorners_;
55  const CoordFunctionInterface &coordFunction_;
56  };
57 
58  template< class HostEntity, class ct, unsigned int dimR, class Impl >
59  class CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > >
60  {
63 
64  typedef typename CoordFunctionInterface::RangeVector RangeVector;
65 
66  public:
67  CoordFunctionCaller ( const HostEntity &hostEntity,
68  const CoordFunctionInterface &coordFunction )
69  : hostEntity_( hostEntity ),
70  coordFunction_( coordFunction )
71  {}
72 
73  void evaluate ( unsigned int i, RangeVector &y ) const
74  {
75  coordFunction_.evaluate( hostEntity_, i, y );
76  }
77 
78  GeometryType type () const
79  {
80  return hostEntity_.type();
81  }
82 
83  std::size_t size () const
84  {
85  const Dune::ReferenceElement< ct, HostEntity::mydimension > &refElement
86  = Dune::ReferenceElements< ct, HostEntity::mydimension >::general( type() );
87  return refElement.size( HostEntity::mydimension );
88  }
89 
90  private:
91  const HostEntity &hostEntity_;
92  const CoordFunctionInterface &coordFunction_;
93  };
94 
95  } // namespace GeoGrid
96 
97 } // namespace Dune
98 
99 #endif // #ifndef DUNE_GEOGRID_COORDFUNCTIONCALLER_HH
Dune::GeoGrid::CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > >::evaluate
void evaluate(unsigned int i, RangeVector &y) const
Definition: coordfunctioncaller.hh:73
Dune
Include standard header files.
Definition: agrid.hh:59
Dune::GeoGrid::CoordFunctionCaller
Definition: coordfunctioncaller.hh:19
Dune::GeoGrid::CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > >::CoordFunctionCaller
CoordFunctionCaller(const HostEntity &hostEntity, const CoordFunctionInterface &coordFunction)
Definition: coordfunctioncaller.hh:67
Dune::VTK::GeometryType
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
coordfunction.hh
Dune::GeoGrid::CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >::CoordFunctionCaller
CoordFunctionCaller(const HostEntity &hostEntity, const CoordFunctionInterface &coordFunction)
Definition: coordfunctioncaller.hh:32
Dune::GeoGrid::CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >::RangeVector
CoordFunctionInterface::RangeVector RangeVector
Definition: coordfunctioncaller.hh:30
Dune::GeoGrid::CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >::type
GeometryType type() const
Definition: coordfunctioncaller.hh:43
hostcorners.hh
Dune::GeoGrid::CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > >::type
GeometryType type() const
Definition: coordfunctioncaller.hh:78
Dune::DiscreteCoordFunctionInterface::RangeVector
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:155
Dune::GeoGrid::CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >::evaluate
void evaluate(unsigned int i, RangeVector &y) const
Definition: coordfunctioncaller.hh:38
Dune::AnalyticalCoordFunctionInterface::RangeVector
FieldVector< ctype, dimRange > RangeVector
range vector for the evaluate method
Definition: coordfunction.hh:59
Dune::DiscreteCoordFunctionInterface
Interface class for using a discrete function to define the geometry of a Dune::GeometryGrid....
Definition: coordfunction.hh:138
Dune::GeoGrid::CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > >::size
std::size_t size() const
Definition: coordfunctioncaller.hh:83
Dune::GeoGrid::CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > >::size
std::size_t size() const
Definition: coordfunctioncaller.hh:48
Dune::GeoGrid::HostCorners
Definition: hostcorners.hh:19
Dune::AnalyticalCoordFunctionInterface
Interface class for using an analytical function to define the geometry of a Dune::GeometryGrid....
Definition: coordfunction.hh:38