|
|
|
#ifndef ATTRACTORKERNEL_HPP
|
|
|
|
#define ATTRACTORKERNEL_HPP
|
|
|
|
|
|
|
|
#include "stfu/stf.hpp"
|
|
|
|
|
|
|
|
class AttractorKernel {
|
|
|
|
private:
|
|
|
|
|
|
|
|
void allocate();
|
|
|
|
void dealloc();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// biggest type first, this will reduce sizeof(AttractorKernel)
|
|
|
|
// size is now 40 (when the unsigned int are in front, it was 48)
|
|
|
|
double * parameters;
|
|
|
|
double * vectorNew;
|
|
|
|
double * vectorOld;
|
|
|
|
|
|
|
|
unsigned int numberOfParameters;
|
|
|
|
unsigned int dimension;
|
|
|
|
|
|
|
|
// stuff used by subclasses
|
|
|
|
AttractorKernel(const unsigned int dimension, const unsigned int numberOfParameters);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// parameters are stored in a array of doubles
|
|
|
|
double & operator[](const unsigned int index);
|
|
|
|
double const & operator[](const unsigned int index) const;
|
|
|
|
unsigned int getNumberOfParameters() const;
|
|
|
|
|
|
|
|
// iterate his formula, implemented by subclasses
|
|
|
|
virtual void operator()() = 0;
|
|
|
|
|
|
|
|
// getter functions for teh resulta (can't be used as setters)
|
|
|
|
double const * vector() const;
|
|
|
|
double const * previousVector() const;
|
|
|
|
unsigned int getDimension() const;
|
|
|
|
|
|
|
|
// dtor, should be virtual for subclasses to be deleted
|
|
|
|
virtual ~AttractorKernel();
|
|
|
|
|
|
|
|
// factory function
|
|
|
|
static AttractorKernel * createAttractorKernel(stfu::node& attractorKernel);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ATTRACTORKERNEL_HPP
|
|
|
|
|