dune-grid
2.2.0
|
00001 #ifndef DUNE_GEOGRID_COORDFUNCTIONCALLER_HH 00002 #define DUNE_GEOGRID_COORDFUNCTIONCALLER_HH 00003 00004 #include <dune/grid/geometrygrid/hostcorners.hh> 00005 #include <dune/grid/geometrygrid/coordfunction.hh> 00006 00007 namespace Dune 00008 { 00009 00010 namespace GeoGrid 00011 { 00012 00013 // CoordFunctionCaller 00014 // ------------------- 00015 00016 template< class HostEntity, class CoordFunctionInterface > 00017 class CoordFunctionCaller; 00018 00019 template< class HostEntity, class ct, unsigned int dimD, unsigned int dimR, class Impl > 00020 class CoordFunctionCaller< HostEntity, AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > > 00021 { 00022 typedef AnalyticalCoordFunctionInterface< ct, dimD, dimR, Impl > CoordFunctionInterface; 00023 typedef CoordFunctionCaller< HostEntity, CoordFunctionInterface > This; 00024 00025 static const int codimension = HostEntity::codimension; 00026 00027 public: 00028 typedef typename CoordFunctionInterface::RangeVector RangeVector; 00029 00030 CoordFunctionCaller ( const HostEntity &hostEntity, 00031 const CoordFunctionInterface &coordFunction ) 00032 : hostCorners_( hostEntity ), 00033 coordFunction_( coordFunction ) 00034 {} 00035 00036 void evaluate ( unsigned int i, RangeVector &y ) const 00037 { 00038 coordFunction_.evaluate( hostCorners_.corner( i ), y ); 00039 } 00040 00041 GeometryType type () const 00042 { 00043 return hostCorners_.type(); 00044 } 00045 00046 unsigned int numCorners () const 00047 { 00048 return hostCorners_.numCorners(); 00049 } 00050 00051 private: 00052 const HostCorners< HostEntity > hostCorners_; 00053 const CoordFunctionInterface &coordFunction_; 00054 }; 00055 00056 template< class HostEntity, class ct, unsigned int dimR, class Impl > 00057 class CoordFunctionCaller< HostEntity, DiscreteCoordFunctionInterface< ct, dimR, Impl > > 00058 { 00059 typedef DiscreteCoordFunctionInterface< ct, dimR, Impl > CoordFunctionInterface; 00060 typedef CoordFunctionCaller< HostEntity, CoordFunctionInterface > This; 00061 00062 typedef typename CoordFunctionInterface::RangeVector RangeVector; 00063 00064 public: 00065 CoordFunctionCaller ( const HostEntity &hostEntity, 00066 const CoordFunctionInterface &coordFunction ) 00067 : hostEntity_( hostEntity ), 00068 coordFunction_( coordFunction ) 00069 {} 00070 00071 void evaluate ( unsigned int i, RangeVector &y ) const 00072 { 00073 coordFunction_.evaluate( hostEntity_, i, y ); 00074 } 00075 00076 GeometryType type () const 00077 { 00078 return hostEntity_.type(); 00079 } 00080 00081 unsigned int numCorners () const 00082 { 00083 return hostEntity_.geometry().corners(); 00084 } 00085 00086 private: 00087 const HostEntity &hostEntity_; 00088 const CoordFunctionInterface &coordFunction_; 00089 }; 00090 00091 } // namespace GeoGrid 00092 00093 } // namespace Dune 00094 00095 #endif // #ifndef DUNE_GEOGRID_COORDFUNCTIONCALLER_HH