]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new function Q1Wedge
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Dec 2000 17:39:45 +0000 (17:39 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Dec 2000 17:39:45 +0000 (17:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@3529 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 19f43e7ab0c5784ef338e32a484b5bdd577450df..cf57ccac3cfa9b7c2c3782e56e60dd0752f53401 100644 (file)
@@ -73,6 +73,58 @@ class SquareFunction : public Function<dim>
 
 
 
+/**
+ * The function @p{xy}. This function serves as an example for
+ * a vanishing Laplacian.
+ *
+ * @author: Guido Kanschat, 2000
+ */
+template<int dim>
+class Q1WedgeFunction : public Function<dim>
+{
+  public:
+                                    /**
+                                     * Function value at one point.
+                                     */
+    virtual double value (const Point<dim>   &p,
+                         const unsigned int  component = 0) const;
+
+                                    /**
+                                     * Function values at multiple points.
+                                     */
+    virtual void value_list (const vector<Point<dim> > &points,
+                            vector<double>            &values,
+                            const unsigned int         component = 0) const;
+
+                                    /**
+                                     * Gradient at one point.
+                                     */
+    virtual Tensor<1,dim> gradient (const Point<dim>   &p,
+                                   const unsigned int  component = 0) const;
+
+                                    /**
+                                       Gradients at multiple points.
+                                     */
+    virtual void gradient_list (const vector<Point<dim> > &points,
+                               vector<Tensor<1,dim> >    &gradients,
+                               const unsigned int         component = 0) const;
+
+                                    /**
+                                     * Laplacian of the function at one point.
+                                     */
+    virtual double laplacian (const Point<dim>   &p,
+                             const unsigned int  component = 0) const;
+
+                                    /**
+                                     * Laplacian of the function at multiple points.
+                                     */
+    virtual void laplacian_list (const vector<Point<dim> > &points,
+                                vector<double>            &values,
+                                const unsigned int         component = 0) const;
+};
+
+
+
 /**
  * d-quadratic pillow on the unit hypercube.
  *
index 66df13b3196d18bd60835e7be5050d009de929b1..2a7a63ca7661df4dc28a6988434aaa7496fb2060 100644 (file)
@@ -108,6 +108,90 @@ SquareFunction<dim>::gradient_list (const vector<Point<dim> > &points,
 //////////////////////////////////////////////////////////////////////
 
 
+template<int dim>
+double
+Q1WedgeFunction<dim>::value (const Point<dim>   &p,
+                           const unsigned int) const
+{
+  return p(0)*p(1);
+}
+
+
+
+template<int dim>
+void
+Q1WedgeFunction<dim>::value_list (const vector<Point<dim> > &points,
+                                vector<double>            &values,
+                                const unsigned int) const
+{
+  Assert (values.size() == points.size(),
+         ExcDimensionMismatch(values.size(), points.size()));
+
+  for (unsigned int i=0;i<points.size();++i)
+    {
+      const Point<dim>& p = points[i];
+      values[i] = p(0)*p(1);
+    }
+}
+
+
+template<int dim>
+double
+Q1WedgeFunction<dim>::laplacian (const Point<dim>   &,
+                               const unsigned int) const
+{
+  return 0.;
+}
+
+
+template<int dim>
+void
+Q1WedgeFunction<dim>::laplacian_list (const vector<Point<dim> > &points,
+                                    vector<double>            &values,
+                                    const unsigned int) const
+{
+  Assert (values.size() == points.size(),
+         ExcDimensionMismatch(values.size(), points.size()));
+
+  for (unsigned int i=0;i<points.size();++i)
+    values[i] = 0.;
+}
+
+
+
+template<int dim>
+Tensor<1,dim>
+Q1WedgeFunction<dim>::gradient (const Point<dim>   &p,
+                              const unsigned int) const
+{
+  Tensor<1,dim> erg;
+  erg[0] = p(1);
+  erg[1] = p(0);
+  return erg;
+}
+
+
+
+template<int dim>
+void
+Q1WedgeFunction<dim>::gradient_list (const vector<Point<dim> > &points,
+                                   vector<Tensor<1,dim> >    &gradients,
+                                   const unsigned int) const
+{
+  Assert (gradients.size() == points.size(),
+         ExcDimensionMismatch(gradients.size(), points.size()));
+
+  for (unsigned int i=0; i<points.size(); ++i)
+    {
+      gradients[i][0] = points[i](1);
+      gradients[i][1] = points[i](0);
+    }
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
 template<int dim>
 PillowFunction<dim>::PillowFunction (const double offset)
                :
@@ -902,6 +986,9 @@ JumpFunction<dim>::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>;

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.