diff --git a/src/scion/math/TwoDimensionalFunctionBase.hpp b/src/scion/math/TwoDimensionalFunctionBase.hpp new file mode 100644 index 0000000..3479173 --- /dev/null +++ b/src/scion/math/TwoDimensionalFunctionBase.hpp @@ -0,0 +1,41 @@ +#ifndef NJOY_SCION_MATH_TWODIMENSIONALFUNCTIONBASE +#define NJOY_SCION_MATH_TWODIMENSIONALFUNCTIONBASE + +// system includes + +// other includes + +namespace njoy { +namespace scion { +namespace math { + + /** + * @class + * @brief Base class for two dimensional function objects modelling y = f(x,y) + * + * This base class provides the common interface for all two dimensional + * function objects. This includes function evaluation. + */ + template < typename Derived, typename X, typename Y, typename Z > + class TwoDimensionalFunctionBase { + + public: + + /* methods */ + + /** + * @brief Evaluate the function for a value of x and y + * + * @param x the value to be evaluated + */ + Z operator()( const X& x, const Y& y ) const { + + return static_cast< const Derived* >( this )->evaluate( x, y ); + } + }; + +} // math namespace +} // scion namespace +} // njoy namespace + +#endif