G
Gert Van den Eynde
hi,
i'm writing a numerical quadrature class and could use some help on the
design. a numerical quadrature needs two "algorithms": the quadrature
method and (possibly) a variable transform. QuadMethod could be trapezoid,
romberg, etc... VarTrans could be None (no transform), TANH, IMT, ...
the client code should be able to provide an object of a certain class A
(not necessarily fixed which class, any class should do) and indicate what
member function should be used as its "evaluator" (i don't want to be bound
to operator(), but it should have a signature double MF(double) ).
so what happens is that the QuadMethod needs to evaluate the MF in a point,
this point should first be transformed by the VarTrans and then passed to
the object's MF. Side question: is it possible to prepend several VarTrans
objects? suppose i first want to do VarTrans1, followed by VarTrans2... how
would i have to design these nested VarTrans's?
what i have in mind now is two "strategy" patterns (GoF) for QuadMethod and
VarTrans using two abstract base classes...Maybe strategy using
templates...
any better ideas?
how do i construct the Integrator object (being a composition of a VarTrans,
QuadMethod and taking this object's member function MF)? i suppose the
Integrator class should be templated with class A? Or not ?
thanks,
gert
i'm writing a numerical quadrature class and could use some help on the
design. a numerical quadrature needs two "algorithms": the quadrature
method and (possibly) a variable transform. QuadMethod could be trapezoid,
romberg, etc... VarTrans could be None (no transform), TANH, IMT, ...
the client code should be able to provide an object of a certain class A
(not necessarily fixed which class, any class should do) and indicate what
member function should be used as its "evaluator" (i don't want to be bound
to operator(), but it should have a signature double MF(double) ).
so what happens is that the QuadMethod needs to evaluate the MF in a point,
this point should first be transformed by the VarTrans and then passed to
the object's MF. Side question: is it possible to prepend several VarTrans
objects? suppose i first want to do VarTrans1, followed by VarTrans2... how
would i have to design these nested VarTrans's?
what i have in mind now is two "strategy" patterns (GoF) for QuadMethod and
VarTrans using two abstract base classes...Maybe strategy using
templates...
any better ideas?
how do i construct the Integrator object (being a composition of a VarTrans,
QuadMethod and taking this object's member function MF)? i suppose the
Integrator class should be templated with class A? Or not ?
thanks,
gert