class LSingularityFunction : public Function<2>
{
public:
- /**
- * The value at a single point.
- */
virtual double value (const Point<2> &p,
const unsigned int component = 0) const;
- /**
- * Values at multiple points.
- */
virtual void value_list (const std::vector<Point<2> > &points,
std::vector<double> &values,
const unsigned int component = 0) const;
+
+ virtual void vector_value_list (const std::vector<Point<2> >& points,
+ std::vector<Vector<double> >& values) const;
- /**
- * Gradient at a single point.
- */
virtual Tensor<1,2> gradient (const Point<2> &p,
const unsigned int component = 0) const;
- /**
- * Gradients at multiple points.
- */
virtual void gradient_list (const std::vector<Point<2> > &points,
std::vector<Tensor<1,2> > &gradients,
const unsigned int component = 0) const;
- /**
- * Laplacian at a single point.
- */
virtual double laplacian (const Point<2> &p,
const unsigned int component = 0) const;
- /**
- * Laplacian at multiple points.
- */
virtual void laplacian_list (const std::vector<Point<2> > &points,
std::vector<double> &values,
const unsigned int component = 0) const;
#include <base/tensor.h>
#include <base/point.h>
#include <base/function_lib.h>
+#include <lac/vector.h>
#include <cmath>
}
+ void
+ LSingularityFunction::vector_value_list (
+ const std::vector<Point<2> >& points,
+ std::vector<Vector<double> >& values) const
+ {
+ Assert (values.size() == points.size(),
+ ExcDimensionMismatch(values.size(), points.size()));
+
+ for (unsigned int i=0;i<points.size();++i)
+ {
+ Assert (values[i].size() == 1,
+ ExcDimensionMismatch(values[i].size(), 1));
+ double x = points[i](0);
+ double y = points[i](1);
+
+ if ((x>=0) && (y>=0))
+ values[i](0) = 0.;
+ else
+ {
+ double phi = std::atan2(y,-x)+M_PI;
+ double r2 = x*x+y*y;
+
+ values[i](0) = std::pow(r2,1./3.) * std::sin(2./3.*phi);
+ }
+ }
+ }
+
+
double
LSingularityFunction::laplacian (const Point<2> &,
const unsigned int) const