Commit a58ef37b authored by Bryan Berthou's avatar Bryan Berthou
Browse files

refs#16

In NumA++ (trunk) :
- Add multidimentional functor.
parent 5b94e3e5
#ifndef FUNCTION_TYPE_MD
#define FUNCTION_TYPE_MD
/**
* @file FunctionType1D.h
* @author Bryan BERTHOU (SPhN / CEA Saclay)
* @date October 07, 2016
* @version 1.0
*/
#include <vector>
#include "../../linear_algebra/vector/VectorD.h"
namespace NumA {
/**
* @class FunctionTypeMD
*
* @brief
*/
class FunctionTypeMD {
public:
FunctionTypeMD() {
}
virtual ~FunctionTypeMD() {
}
virtual double operator()(VectorD &variables,
std::vector<double> &parameters) = 0;
};
} // namespace NumA
#endif /* FUNCTION_TYPE_MD */
#ifndef FUNCTOR_MD
#define FUNCTOR_MD
/**
* @file FunctorMD.h
* @author Bryan BERTHOU (SPhN / CEA Saclay)
* @date October 07, 2016
* @version 1.0
*/
#include <vector>
#include "../../linear_algebra/vector/VectorD.h"
#include "FunctionTypeMD.h"
namespace NumA {
/**
* @class FunctorMD
*
* @brief
*/
template<typename PointerToObj, typename PointerToFunc>
class FunctorMD: public FunctionTypeMD {
public:
FunctorMD(PointerToObj* object, PointerToFunc function) :
m_pObject(object), m_pFunction(function) {
}
virtual ~FunctorMD() {
}
inline double operator()(VectorD &variables,
std::vector<double> &parameters) {
return ((*m_pObject).*m_pFunction)(variables, parameters);
}
private:
PointerToObj* m_pObject;
PointerToFunc m_pFunction;
////////////////////////////////////////////////////////////
/// Disallow copy & comparisons
////////////////////////////////////////////////////////////
FunctorMD(const FunctorMD&); // Not implemented
FunctorMD& operator=(const FunctorMD&); // Not implemented
};
} // namespace NumA
#endif /* FUNCTOR_MD */
/*
* MathUtils.h
*
* Created on: Feb 17, 2016
* Author: debian
*/
#ifndef MATH_UTILS_H
#define MATH_UTILS_H
/**
* @file MathUtils.h
* @author Bryan BERTHOU (SPhN / CEA Saclay)
* @date February 17, 2016
* @version 1.0
*/
namespace NumA {
/**
* @class MathUtils
*
* @brief
*/
class MathUtils {
public:
static double convertDegreeToRadian(double degree);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment