20 #ifndef _FUNCTION_LIBRARY_H_
21 #define _FUNCTION_LIBRARY_H_
23 #include "mbsim/utils/function.h"
32 double operator()(
const double& x,
const void * =NULL) {
return (*fun)(x)(0); }
43 void setVector(fmatvec::Vec v) {vec=v; vec/=nrm2(v); }
44 fmatvec::Vec
operator()(
const double& x,
const void * =NULL) {
return (*fun)(x)*vec; }
67 fmatvec::Vec
operator()(
const double& x,
const void * =NULL);
75 fmatvec::Vec
operator()(
const double& x,
const void * =NULL);
83 fmatvec::Vec
operator()(
const double& x,
const void * =NULL);
89 fmatvec::Vec a0, a1, a2;
103 SinusFunction1_VS(fmatvec::Vec amplitude_, fmatvec::Vec frequency_, fmatvec::Vec phase_, fmatvec::Vec offset_);
109 fmatvec::Vec
operator()(
const double& x,
const void * =NULL);
117 fmatvec::Vec
operator()(
const double& x,
const void * =NULL);
125 fmatvec::Vec
operator()(
const double& x,
const void * =NULL);
131 fmatvec::Vec amplitude, frequency, phase, offset;
141 fmatvec::Vec operator()(
const double& tVal,
const void * =NULL);
151 StepFunction1_VS(fmatvec::Vec stepTime_, fmatvec::Vec stepSize_) : stepTime(stepTime_), stepSize(stepSize_) {
154 fmatvec::Vec
operator()(
const double& tVal,
const void * =NULL);
157 fmatvec::Vec stepTime, stepSize;
169 fmatvec::Vec
operator()(
const double& xVal,
const void * =NULL);
175 int xIndexOld, xSize;
186 fmatvec::Vec
operator()(
const double& xVal,
const void * =NULL);
192 double xMin, xMax, xDelta;
206 ySize=((*function)(0)).size();
208 assert (((*
function)(0)).size()==ySize);
209 functions.push_back(
function);
210 factors.push_back(factor);
212 fmatvec::Vec
operator()(
const double& tVal,
const void * =NULL) {
213 fmatvec::Vec y=factors[0]*(*(functions[0]))(tVal);
214 for (
unsigned int i=1; i<functions.size(); i++)
215 y+=factors[i]*(*(functions[i]))(tVal);
220 std::vector<Function1<fmatvec::Vec, double> *> functions;
221 std::vector<double> factors;
231 virtual double operator()(
const double& x,
const double& y,
const void * = NULL);
234 void setXValues(fmatvec::Vec x_);
235 void setYValues(fmatvec::Vec y_);
236 void setXYMat(fmatvec::Mat XY_);
249 fmatvec::Vec func_value;
254 void calcIndex(
const double * x, fmatvec::Vec X,
int * xSize,
int * xIndexMinus,
int * xIndexPlus);
266 double operator()(
const double& x,
const void * =NULL);
271 void setCoefficients(fmatvec::Vec a);