]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
introduce Hermite interpolation polynomials
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 12 Sep 2012 12:35:57 +0000 (12:35 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 12 Sep 2012 12:35:57 +0000 (12:35 +0000)
git-svn-id: https://svn.dealii.org/trunk@26310 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 611b7a7884dbcf876079c561801fc29c2dca8555..3d92dc98c434547e4450f5fee94a74d2b17e931d 100644 (file)
@@ -672,9 +672,64 @@ namespace Polynomials
                                         */
     static std::vector<std_cxx1x::shared_ptr<const std::vector<double> > > recursive_coefficients;
    };
-}
 
 
+/**
+ * Polynomials for Hermite interpolation condition.
+ *
+ * This is the set of polynomials of degree at least three, such that
+ * the following interpolation conditions are met: the polynomials and
+ * their first derivatives vanish at the values <i>x</i>=0 and
+ * <i>x</i>=1, with the exceptions <i>p</i><sub>0</sub>(0)=1,
+ * <i>p</i><sub><i>1</i></sub>(1)=1, <i>p</i>'<sub>2</sub>(0)=1, 
+ * <i>p'</i><sub>3</sub>(1)=1.
+ *
+ * For degree three, we obtain the standard four Hermitian
+ * interpolation polynomials, see for instance <a
+ * href="http://en.wikipedia.org/wiki/Cubic_Hermite_spline">Wikipedia</a>.
+ * For higher degrees, these are augmented
+ * first, by the polynomial of degree four with vanishing values and
+ * derivatives at <i>x</i>=0 and <i>x</i>=1, then by the product of
+ * this fourth order polynomial with Legendre polynomials of
+ * increasing order. The implementation is
+ * @f{align*}{
+ * p_0(x) &= 2x^3-3x^2+1 \\
+ * p_1(x) &= -2x^2+3x^2 \\
+ * p_2(x) &= x^3-2x^2+x  \\
+ * p_3(x) &= x^3-x^2 \\
+ * p_4(x) &= 16x^2(x-1)^2 \\
+ * \ldots & \ldots \\
+ * p_k(x) &= x^2(x-1)^2 L_{k-4}(x)
+ * @f}
+ *
+ * @author Guido Kanschat
+ * @date 2012
+ */
+  class HermiteInterpolation : public Polynomial<double>
+  {
+    public:
+                                    /**
+                                        * Constructor for polynomial
+                                        * with index <tt>p</tt>. See
+                                        * the class documentation on
+                                        * the definition of the
+                                        * sequence of polynomials.
+                                        */
+    HermiteInterpolation (const unsigned int p);
+
+                                       /**
+                                        * Return the polynomials with index
+                                        * <tt>0</tt> up to
+                                        * <tt>p+1</tt> in a space of
+                                        * degree up to
+                                        * <tt>p</tt>. Here, <tt>p</tt>
+                                        * has to be at least 3.
+                                        */
+      static std::vector<Polynomial<double> >
+      generate_complete_basis (const unsigned int p);
+  };
+}
+
 
 /** @} */
 
index 652c8023c36d98e0499173c77512c9206c4329a7..652d9d972c28ca181c05b40aa958a9dedfbd703f 100644 (file)
@@ -1323,9 +1323,61 @@ std::vector<Polynomial<double> > Lobatto::generate_complete_basis (const unsigne
         return v;
       }
   }
-}
+
+// ------------------ HermiteInterpolation --------------- //
+  
+  HermiteInterpolation::HermiteInterpolation (const unsigned int p)
+                 :
+                 Polynomial<double>((p<4) ? 3 : p+1)
+  {
+    if (p==0)
+      {
+       this->coefficients[0] = 1.;
+       this->coefficients[2] = -3.;
+       this->coefficients[3] = 2.;
+      }
+    else if (p==1)
+      {
+       this->coefficients[2] = 3.;
+       this->coefficients[3] = -2.;
+      }
+    else if (p==2)
+      {
+       this->coefficients[1] = 1.;
+       this->coefficients[2] = -2.;
+       this->coefficients[3] = 1.;
+      }
+    else if (p==3)
+      {
+       this->coefficients[2] = -1.;
+       this->coefficients[3] = 1.;
+      }
+    else
+      {
+       this->coefficients[4] = 16.;
+       this->coefficients[3] = -32.;
+       this->coefficients[2] = 16.;
+       
+       if (p>4)
+         {
+           Legendre legendre(p-4);
+           (*this) *= legendre;
+         }
+      } 
+  }
 
 
+  std::vector<Polynomial<double> >
+  HermiteInterpolation::generate_complete_basis (const unsigned int n)
+  {
+    std::vector<Polynomial<double> > basis (n + 1);
+    
+    for (unsigned int i = 0; i <= n; ++i)
+      basis[i] = HermiteInterpolation (i);
+    
+    return basis;
+  }
+}
 
 // ------------------ 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.