]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
laplacian added to interface
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 18 Feb 2000 22:10:26 +0000 (22:10 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 18 Feb 2000 22:10:26 +0000 (22:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@2442 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/function.h
deal.II/base/source/function.cc

index 277c0d1fdea378413c105c47fa577a3fd24f4f87..f7e6829548640d1a2eb5eecd85ef43a3b6b5e2ed 100644 (file)
@@ -217,6 +217,32 @@ class Function : public FunctionTime,
     virtual void vector_gradient_list (const vector<Point<dim> >       &points,
                                       vector<vector<Tensor<1,dim> > > &gradients) const;
 
+                                    /**
+                                     * Compute the Laplacian of a given component at point #p#.
+                                     */
+    virtual double laplacian (const Point<dim>   &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<dim>   &p,
+                                    Vector<double>     &values) const;
+    
+                                    /**
+                                     * Compute the Laplacian of one component at a set of points.
+                                     */
+    virtual void laplacian_list (const vector<Point<dim> > &points,
+                                vector<double>            &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<Point<dim> > &points,
+                                       vector<Vector<double> >   &values) const;
+
                                     /**
                                      * Exception
                                      */
index 9d0da2c5c2dbfc8dfabb178882f43797886776f5..c689a7248c95210d72163b24526b1409dfaf75a5 100644 (file)
@@ -306,6 +306,55 @@ void ConstantFunction<dim>::vector_value_list (const vector<Point<dim> > &points
 };
 
 
+template <int dim>
+double Function<dim>::laplacian (const Point<dim> &,
+                            const unsigned int) const
+{
+  Assert (false, ExcPureFunctionCalled());
+  return 0;
+}
+
+
+
+template <int dim>
+void Function<dim>::vector_laplacian (const Point<dim> &,
+                                 Vector<double>   &) const
+{
+  Assert (false, ExcPureFunctionCalled());
+}
+
+
+
+template <int dim>
+void Function<dim>::laplacian_list (const vector<Point<dim> > &points,
+                               vector<double>            &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; i<points.size(); ++i)
+    laplacians[i]  = this->laplacian (points[i], component);
+}
+
+
+
+template <int dim>
+void Function<dim>::vector_laplacian_list (const vector<Point<dim> > &points,
+                                      vector<Vector<double> >   &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; i<points.size(); ++i)
+    this->vector_laplacian (points[i], laplacians[i]);
+}
 
 
 // explicit instantiations

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.