Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
partons
core
numa
Commits
055454af
Commit
055454af
authored
Jun 09, 2017
by
Nabil Chouika
Browse files
Functors documentation partons/core/partons#4
parent
f341ee72
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/NumA/functor/one_dimension/FunctionType1D.h
View file @
055454af
...
...
@@ -42,6 +42,8 @@ namespace NumA {
*
* See also FunctorUtils documentation.
*
* See also Integrator1D documentation for the specific case of integration routines.
*
* For multi-dimensional functions, see FunctionTypeMD.
*/
...
...
include/NumA/integration/one_dimension/Integrator1D.h
View file @
055454af
...
...
@@ -30,7 +30,7 @@ namespace NumA {
* Example:
* ```cpp
* NumA::Integrator1D* integrator = NumA::Integrator1D::newIntegrator(NumA::IntegratorType1D::GaussLegendre); // Using Gauss-Legendre quadrature.
* NumA::FunctionType1D* functor = NumA::FunctorUtils::newFunctor1D(
thi
s, &MyClass::myFunction); // See FunctionType1D documentation.
* NumA::FunctionType1D* functor = NumA::FunctorUtils::newFunctor1D(
pointerMyClas
s, &MyClass::myFunction); // See FunctionType1D documentation.
* double integral = integrator.integrate(functor, -1., 1.); // We integrate a function on [-1,1].
* ```
*/
...
...
include/NumA/utils/FunctorUtils.h
View file @
055454af
...
...
@@ -16,16 +16,38 @@ namespace NumA {
/**
* @class FunctorUtils
*
* @brief
* @brief
Utilities for Functors.
*/
class
FunctorUtils
{
public:
/**
* Defines a new functor with the given one-dimensional function.
*
* See FunctionType1D documentation for an example.
* @param object Pointer to the object instantiating a class where the function is defined as a method.
* @param function Reference to the function defining the functor. Should have the following signature:
* ```cpp
* double MyClass::myFunction(double variable, std::vector<double>& parameters);
* ```
* @return Functor pointer.
*/
template
<
typename
PointerToObj
,
typename
PointerToMemFn
>
static
Functor1D
<
PointerToObj
,
PointerToMemFn
>*
newFunctor1D
(
PointerToObj
*
object
,
PointerToMemFn
function
)
{
return
new
Functor1D
<
PointerToObj
,
PointerToMemFn
>
(
object
,
function
);
}
/**
* Defines a new functor with the given multi-dimensional function.
*
* See FunctionTypeMD documentation for an example.
* @param object Pointer to the object instantiating a class where the function is defined as a method.
* @param function Reference to the function defining the functor. Should have the signature:
* ```cpp
* double MyClass::myFunction(NumA::VectorD& variables, std::vector<double>& parameters);
* ```
* @return Functor pointer.
*/
template
<
typename
PointerToObj
,
typename
PointerToMemFn
>
static
FunctorMD
<
PointerToObj
,
PointerToMemFn
>*
newFunctorMD
(
PointerToObj
*
object
,
PointerToMemFn
function
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment