From 9ca03c96f683ff9f4e6ed48a7b070efabb549285 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 7 Dec 2000 17:39:45 +0000 Subject: [PATCH] new function Q1Wedge git-svn-id: https://svn.dealii.org/trunk@3529 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/function_lib.h | 52 ++++++++++++++ deal.II/base/source/function_lib.cc | 87 ++++++++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/deal.II/base/include/base/function_lib.h b/deal.II/base/include/base/function_lib.h index 19f43e7ab0..cf57ccac3c 100644 --- a/deal.II/base/include/base/function_lib.h +++ b/deal.II/base/include/base/function_lib.h @@ -73,6 +73,58 @@ class SquareFunction : public Function +/** + * The function @p{xy}. This function serves as an example for + * a vanishing Laplacian. + * + * @author: Guido Kanschat, 2000 + */ +template +class Q1WedgeFunction : public Function +{ + public: + /** + * Function value at one point. + */ + virtual double value (const Point &p, + const unsigned int component = 0) const; + + /** + * Function values at multiple points. + */ + virtual void value_list (const vector > &points, + vector &values, + const unsigned int component = 0) const; + + /** + * Gradient at one point. + */ + virtual Tensor<1,dim> gradient (const Point &p, + const unsigned int component = 0) const; + + /** + Gradients at multiple points. + */ + virtual void gradient_list (const vector > &points, + vector > &gradients, + const unsigned int component = 0) const; + + /** + * Laplacian of the function at one point. + */ + virtual double laplacian (const Point &p, + const unsigned int component = 0) const; + + /** + * Laplacian of the function at multiple points. + */ + virtual void laplacian_list (const vector > &points, + vector &values, + const unsigned int component = 0) const; +}; + + + /** * d-quadratic pillow on the unit hypercube. * diff --git a/deal.II/base/source/function_lib.cc b/deal.II/base/source/function_lib.cc index 66df13b319..2a7a63ca76 100644 --- a/deal.II/base/source/function_lib.cc +++ b/deal.II/base/source/function_lib.cc @@ -108,6 +108,90 @@ SquareFunction::gradient_list (const vector > &points, ////////////////////////////////////////////////////////////////////// +template +double +Q1WedgeFunction::value (const Point &p, + const unsigned int) const +{ + return p(0)*p(1); +} + + + +template +void +Q1WedgeFunction::value_list (const vector > &points, + vector &values, + const unsigned int) const +{ + Assert (values.size() == points.size(), + ExcDimensionMismatch(values.size(), points.size())); + + for (unsigned int i=0;i& p = points[i]; + values[i] = p(0)*p(1); + } +} + + +template +double +Q1WedgeFunction::laplacian (const Point &, + const unsigned int) const +{ + return 0.; +} + + +template +void +Q1WedgeFunction::laplacian_list (const vector > &points, + vector &values, + const unsigned int) const +{ + Assert (values.size() == points.size(), + ExcDimensionMismatch(values.size(), points.size())); + + for (unsigned int i=0;i +Tensor<1,dim> +Q1WedgeFunction::gradient (const Point &p, + const unsigned int) const +{ + Tensor<1,dim> erg; + erg[0] = p(1); + erg[1] = p(0); + return erg; +} + + + +template +void +Q1WedgeFunction::gradient_list (const vector > &points, + vector > &gradients, + const unsigned int) const +{ + Assert (gradients.size() == points.size(), + ExcDimensionMismatch(gradients.size(), points.size())); + + for (unsigned int i=0; i PillowFunction::PillowFunction (const double offset) : @@ -902,6 +986,9 @@ JumpFunction::memory_consumption () const template SquareFunction<1>; template SquareFunction<2>; template SquareFunction<3>; +template Q1WedgeFunction<1>; +template Q1WedgeFunction<2>; +template Q1WedgeFunction<3>; template PillowFunction<1>; template PillowFunction<2>; template PillowFunction<3>; -- 2.39.5