]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add vector_value_list and inherit documentation from base class
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 12 Jul 2006 08:22:12 +0000 (08:22 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 12 Jul 2006 08:22:12 +0000 (08:22 +0000)
git-svn-id: https://svn.dealii.org/trunk@13358 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 94f5aba243b870378d731e6052f50e90c176a650..7cf503e98d325407ca525c3305f107426da9a5f6 100644 (file)
@@ -341,41 +341,26 @@ namespace Functions
   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;
index cbecc2968da056e0ad7150ef083f00d1b65a7201..a628f3d61d1610a7def7f17cea792f4193ad903d 100644 (file)
@@ -15,6 +15,7 @@
 #include <base/tensor.h>
 #include <base/point.h>
 #include <base/function_lib.h>
+#include <lac/vector.h>
 
 #include <cmath>
 
@@ -831,6 +832,34 @@ namespace Functions
   }
   
   
+  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

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.