-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the CRTP interface for a two dimensional function
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |