]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Extend all functions of the DerivativeApproximation to use an arbitrary mapping....
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 5 Apr 2001 17:08:03 +0000 (17:08 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 5 Apr 2001 17:08:03 +0000 (17:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@4384 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/derivative_approximation.h
deal.II/deal.II/source/numerics/derivative_approximation.cc

index 734b459ccb475ecd2aca4f89356ea7875a4fb60e..c0c545d95403ebb1a3abe6569ad8cb695d518bb2 100644 (file)
@@ -182,11 +182,24 @@ class DerivativeApproximation
                                      */
     template <int dim>
     static void
-    approximate_gradient (const DoFHandler<dim> &dof,
+    approximate_gradient (const Mapping<dim>    &mapping,
+                         const DoFHandler<dim> &dof,
                          const Vector<double>  &solution,
                          Vector<float>         &derivative_norm,
                          const unsigned int     component = 0);
 
+                                    /**
+                                     * Calls the @p{interpolate}
+                                     * function, see above, with
+                                     * @p{mapping=MappingQ1<dim>()}.
+                                     */
+    template <int dim>
+    static void
+    approximate_gradient (const DoFHandler<dim> &dof,
+                         const Vector<double>  &solution,
+                         Vector<float>         &derivative_norm,
+                         const unsigned int     component = 0);
+    
                                     /**
                                      * This function is the analogue
                                      * to the one above, computing
@@ -211,11 +224,24 @@ class DerivativeApproximation
                                      */
     template <int dim>
     static void
-    approximate_second_derivative (const DoFHandler<dim> &dof,
+    approximate_second_derivative (const Mapping<dim>    &mapping,
+                                  const DoFHandler<dim> &dof,
                                   const Vector<double>  &solution,
                                   Vector<float>         &derivative_norm,
                                   const unsigned int     component);
     
+                                    /**
+                                     * Calls the @p{interpolate}
+                                     * function, see above, with
+                                     * @p{mapping=MappingQ1<dim>()}.
+                                     */
+    template <int dim>
+    static void
+    approximate_second_derivative (const DoFHandler<dim> &dof,
+                                  const Vector<double>  &solution,
+                                  Vector<float>         &derivative_norm,
+                                  const unsigned int     component);
+
                                     /**
                                      * Exception
                                      */
@@ -428,7 +454,8 @@ class DerivativeApproximation
                                      */
     template <class DerivativeDescription, int dim>
     static void
-    approximate_derivative (const DoFHandler<dim> &dof,
+    approximate_derivative (const Mapping<dim>    &mapping,
+                           const DoFHandler<dim> &dof,
                            const Vector<double>  &solution,
                            const unsigned int     component,
                            Vector<float>         &derivative_norm);
@@ -441,7 +468,8 @@ class DerivativeApproximation
                                      */
     template <class DerivativeDescription, int dim>
     static void
-    approximate (const DoFHandler<dim> &dof,
+    approximate (const Mapping<dim>    &mapping,
+                const DoFHandler<dim> &dof,
                 const Vector<double>  &solution,
                 const unsigned int     component,
                 const IndexInterval   &index_interval,
index 63c73f3ce837940c0f537272617d6ffd689986a5..21bbd525dafcfba1d0f48c83b3c73aef3ce6c191 100644 (file)
@@ -27,9 +27,6 @@
 #include <cmath>
 
 
-//TODO:[RH,GK] Replace global by local object; better: have two functions, or by default arg
-static const MappingQ1<deal_II_dimension> mapping;
-
 
 template <typename T>
 static T sqr (const T t)
@@ -190,6 +187,23 @@ DerivativeApproximation::SecondDerivative<dim>::symmetrize (Derivative &d)
 
 
 
+template <int dim>
+void 
+DerivativeApproximation::
+approximate_gradient (const Mapping<dim>    &mapping,
+                     const DoFHandler<dim> &dof_handler,
+                     const Vector<double>  &solution,
+                     Vector<float>         &derivative_norm,
+                     const unsigned int     component)
+{
+  approximate_derivative<Gradient<dim>,dim> (mapping,
+                                            dof_handler,
+                                            solution,
+                                            component,
+                                            derivative_norm);
+};
+
+
 template <int dim>
 void 
 DerivativeApproximation::
@@ -198,13 +212,31 @@ approximate_gradient (const DoFHandler<dim> &dof_handler,
                      Vector<float>         &derivative_norm,
                      const unsigned int     component)
 {
-  approximate_derivative<Gradient<dim>,dim> (dof_handler,
+  static const MappingQ1<dim> mapping;
+  approximate_derivative<Gradient<dim>,dim> (mapping,
+                                            dof_handler,
                                             solution,
                                             component,
                                             derivative_norm);
 };
 
 
+template <int dim>
+void 
+DerivativeApproximation::
+approximate_second_derivative (const Mapping<dim>    &mapping,
+                              const DoFHandler<dim> &dof_handler,
+                              const Vector<double>  &solution,
+                              Vector<float>         &derivative_norm,
+                              const unsigned int     component)
+{
+  approximate_derivative<SecondDerivative<dim>,dim> (mapping,
+                                                    dof_handler,
+                                                    solution,
+                                                    component,
+                                                    derivative_norm);
+};
+
 
 template <int dim>
 void 
@@ -214,18 +246,20 @@ approximate_second_derivative (const DoFHandler<dim> &dof_handler,
                               Vector<float>         &derivative_norm,
                               const unsigned int     component)
 {
-  approximate_derivative<SecondDerivative<dim>,dim> (dof_handler,
+  static const MappingQ1<dim> mapping;
+  approximate_derivative<SecondDerivative<dim>,dim> (mapping,
+                                                    dof_handler,
                                                     solution,
                                                     component,
                                                     derivative_norm);
 };
 
 
-
 template <class DerivativeDescription, int dim>
 void 
 DerivativeApproximation::
-approximate_derivative (const DoFHandler<dim> &dof_handler,
+approximate_derivative (const Mapping<dim>    &mapping,
+                       const DoFHandler<dim> &dof_handler,
                        const Vector<double>  &solution,
                        const unsigned int     component,
                        Vector<float>         &derivative_norm)
@@ -244,7 +278,7 @@ approximate_derivative (const DoFHandler<dim> &dof_handler,
                    Threads::encapsulate
                    (&DerivativeApproximation::
                     template approximate<DerivativeDescription,dim>)
-                   .collect_args (dof_handler, solution, component,
+                   .collect_args (mapping, dof_handler, solution, component,
                                   index_intervals[i],
                                   derivative_norm));
   thread_manager.wait ();
@@ -254,7 +288,8 @@ approximate_derivative (const DoFHandler<dim> &dof_handler,
 
 template <class DerivativeDescription, int dim>
 void 
-DerivativeApproximation::approximate (const DoFHandler<dim> &dof_handler,
+DerivativeApproximation::approximate (const Mapping<dim>    &mapping,
+                                     const DoFHandler<dim> &dof_handler,
                                      const Vector<double>  &solution,
                                      const unsigned int     component,
                                      const IndexInterval   &index_interval,
@@ -475,6 +510,14 @@ DerivativeApproximation::approximate (const DoFHandler<dim> &dof_handler,
 template
 void 
 DerivativeApproximation::
+approximate_gradient (const Mapping<deal_II_dimension> &mapping,
+                     const DoFHandler<deal_II_dimension> &dof_handler,
+                     const Vector<double>  &solution,
+                     Vector<float>         &derivative_norm,
+                     const unsigned int     component);
+template
+void 
+DerivativeApproximation::
 approximate_gradient (const DoFHandler<deal_II_dimension> &dof_handler,
                      const Vector<double>  &solution,
                      Vector<float>         &derivative_norm,
@@ -483,6 +526,14 @@ approximate_gradient (const DoFHandler<deal_II_dimension> &dof_handler,
 template
 void 
 DerivativeApproximation::
+approximate_second_derivative (const Mapping<deal_II_dimension>    &mapping,
+                              const DoFHandler<deal_II_dimension> &dof_handler,
+                              const Vector<double>  &solution,
+                              Vector<float>         &derivative_norm,
+                              const unsigned int     component);
+template
+void 
+DerivativeApproximation::
 approximate_second_derivative (const DoFHandler<deal_II_dimension> &dof_handler,
                               const Vector<double>  &solution,
                               Vector<float>         &derivative_norm,

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.