From 8ba0156d61b0e76ba47c256f6590d526bb9eb2b2 Mon Sep 17 00:00:00 2001 From: guido Date: Fri, 18 Feb 2000 22:10:26 +0000 Subject: [PATCH] laplacian added to interface git-svn-id: https://svn.dealii.org/trunk@2442 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/function.h | 26 +++++++++++++++ deal.II/base/source/function.cc | 49 ++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/deal.II/base/include/base/function.h b/deal.II/base/include/base/function.h index 277c0d1fde..f7e6829548 100644 --- a/deal.II/base/include/base/function.h +++ b/deal.II/base/include/base/function.h @@ -217,6 +217,32 @@ class Function : public FunctionTime, virtual void vector_gradient_list (const vector > &points, vector > > &gradients) const; + /** + * Compute the Laplacian of a given component at point #p#. + */ + virtual double laplacian (const Point &p, + const unsigned int component = 0) const; + + /** + * Compute the Laplacian of all components at point #p# + * and store them in #values#. + */ + virtual void vector_laplacian (const Point &p, + Vector &values) const; + + /** + * Compute the Laplacian of one component at a set of points. + */ + virtual void laplacian_list (const vector > &points, + vector &values, + const unsigned int component = 0) const; + + /** + * Compute the Laplacians of all components at a set of points. + */ + virtual void vector_laplacian_list (const vector > &points, + vector > &values) const; + /** * Exception */ diff --git a/deal.II/base/source/function.cc b/deal.II/base/source/function.cc index 9d0da2c5c2..c689a7248c 100644 --- a/deal.II/base/source/function.cc +++ b/deal.II/base/source/function.cc @@ -306,6 +306,55 @@ void ConstantFunction::vector_value_list (const vector > &points }; +template +double Function::laplacian (const Point &, + const unsigned int) const +{ + Assert (false, ExcPureFunctionCalled()); + return 0; +} + + + +template +void Function::vector_laplacian (const Point &, + Vector &) const +{ + Assert (false, ExcPureFunctionCalled()); +} + + + +template +void Function::laplacian_list (const vector > &points, + vector &laplacians, + const unsigned int component) const +{ + // check whether component is in + // the valid range is up to the + // derived class + Assert (laplacians.size() == points.size(), + ExcVectorHasWrongSize(laplacians.size(), points.size())); + + for (unsigned int i=0; ilaplacian (points[i], component); +} + + + +template +void Function::vector_laplacian_list (const vector > &points, + vector > &laplacians) const +{ + // check whether component is in + // the valid range is up to the + // derived class + Assert (laplacians.size() == points.size(), + ExcVectorHasWrongSize(laplacians.size(), points.size())); + + for (unsigned int i=0; ivector_laplacian (points[i], laplacians[i]); +} // explicit instantiations -- 2.39.5