26 #ifndef GRALE_MONOPOLEBASISFUNCTION_H
28 #define GRALE_MONOPOLEBASISFUNCTION_H
30 #include "graleconfig.h"
36 class MonopoleBasisFunction :
public Real2DDerivableFunction
39 MonopoleBasisFunction(
double zeroPoint,
double lengthScale)
41 m_zeroPoint = zeroPoint;
42 m_lengthScale = lengthScale;
44 m_a2 = -1.0/(m_zeroPoint*m_zeroPoint);
47 double m1 = m_zeroPoint-1;
48 double factor = (m_zeroPoint*m_zeroPoint)/4.0*(1.0/(m1*m1*m1));
51 m_b0 = factor*6.0*(1.0+m_zeroPoint);
52 m_b_1 = factor*(-6.0)*m_zeroPoint;
56 ~MonopoleBasisFunction()
60 double operator()(Vector2D<double> point)
const
62 Vector2D<double> p = point/m_lengthScale;
63 double x = p.getLength();
74 val = m_b1*x + m_b0 + m_b_1/x;
80 Vector2D<double> getGradient(Vector2D<double> point)
const
82 Vector2D<double> p = point/m_lengthScale;
83 double x = p.getLength();
98 val /= (x*m_lengthScale);
102 double getLengthScale()
const
104 return m_lengthScale;
107 double getZeroPoint()
const
112 double m_lengthScale;
115 double m_b1, m_b0, m_b_1;
120 #endif // GRALE_MONOPOLEBASISFUNCTION_H