Skip to content

Commit

Permalink
Adding the CRTP interface for a two dimensional function
Browse files Browse the repository at this point in the history
  • Loading branch information
whaeck committed Jul 24, 2024
1 parent 077a52b commit 2848739
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/scion/math/TwoDimensionalFunctionBase.hpp
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2848739

Please sign in to comment.