Skip to content
Snippets Groups Projects
Commit d3b946ff authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

add a linear function of space

parent a81b346b
No related branches found
No related tags found
No related merge requests found
/**
* \author Norihiro Watanabe
* \date 2013-08-13
*
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef SPATIALFUNCTIONLINEAR_H_
#define SPATIALFUNCTIONLINEAR_H_
#include "MathLib/LinearFunction.h"
#include "TemplateSpatialFunction.h"
namespace NumLib
{
/// Linear function of space
typedef TemplateSpatialFunction<MathLib::LinearFunction<double, 3> > SpatialFunctionLinear;
}
#endif /* SPATIALFUNCTIONLINEAR_H_ */
/**
* \author Norihiro Watanabe
* \date 2013-08-13
*
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef TEMPLATESPATIALFUNCTION_H_
#define TEMPLATESPATIALFUNCTION_H_
#include "ISpatialFunction.h"
namespace NumLib
{
/**
* Template class to relate pure mathematical functions with ISpatialFunction
*
* @tparam T_FUNCTION Function object which takes "double const* const" as an argument.
*/
template <class T_FUNCTION>
class TemplateSpatialFunction : public ISpatialFunction
{
public:
/**
* Constructor
* @param f a function object
*/
TemplateSpatialFunction(const T_FUNCTION &f)
: _f(f) {}
/**
* evaluate a function
* @param pnt a point object
* @return evaluated value
*/
virtual double operator()(const GeoLib::Point& pnt) const
{
return _f(pnt.getCoords());
}
private:
/// a function object
const T_FUNCTION _f;
};
}
#endif /* TEMPLATESPATIALFUNCTION_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment