]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
MultiGrid's growing
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 22 Jan 1999 17:14:17 +0000 (17:14 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 22 Jan 1999 17:14:17 +0000 (17:14 +0000)
git-svn-id: https://svn.dealii.org/trunk@742 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 6a6524451730299c07f90538b363a0625e44a236..58e968a92de75559b76127f2311cb1990982227e 100644 (file)
@@ -83,7 +83,8 @@ class MultiGrid
                                    * Copies data from active portions
                                    * of an MGVector into the
                                    * respective positions of a
-                                   * dVector.
+                                   * dVector. All other entries of
+                                   * #src# are zero.
                                    */
   void copy_from_mg(dVector& dst, const MGVector& src) const;
 
@@ -102,35 +103,77 @@ protected:
                                   /**
                                    * Number of pre-smoothing steps.
                                    */
-  unsigned n_presmooth;
+  unsigned n_pre_smooth;
   
                                   /**
                                    * Number of post-smoothing steps
                                    */
-  unsigned n_postsmooth;
+  unsigned n_post_smooth;
                                   /**
                                    * The (pre-)smoothing algorithm.
+                                   * This function is required to
+                                   * perform #steps# iterations to
+                                   * smoothen the residual $Ax-b$.
                                    */
   virtual void smooth(unsigned level,
-                     dVector& dst,
-                     const dVector& src) const;
+                     dVector& x,
+                     const dVector& b,
+                     unsigned steps) const;
 
                                   /**
                                    * The post-smoothing algorithm.
                                    * Defaults to #smooth#.
                                    */
   virtual void post_smooth(unsigned level,
-                     dVector& dst,
-                     const dVector& src) const;
+                          dVector& dst,
+                          const dVector& src,
+                          unsigned steps) const;
 
+                                  /**
+                                   * Apply operator on all
+                                   * cells of a level.
+                                   *
+                                   */
+  virtual void level_vmult(unsigned level,
+                          dVector& dst,
+                          const dVector& src) const;
                                   /**
                                    * Apply operator on non-refined
                                    * cells.
+                                   *
+                                   * The sum over all levels
+                                   * of the results of this function
+                                   * is the multiplication with the
+                                   * normal fine-grid matrix.
                                    */
   virtual void level_active_vmult(unsigned level,
                                  dVector& dst,
                                  const dVector& src) const;
 
+                                  /**
+                                   * Restriction from #level#.
+                                   *
+                                   * This function <B>adds</B> the
+                                   * restriction of #src# to #dst#,
+                                   * where #src# is a vector on #level#
+                                   * and #dst# is on #level#-1.
+                                   */
+  virtual void restriction(unsigned level,
+                          dVector& dst,
+                          const dVector& src) const;
+                          
+
+                                  /**
+                                   * Prolongation to #level#.
+                                   *
+                                   * <B>Adds</B> the prolongation of
+                                   * #src# to #dst#. Here, #dst# is on
+                                   * #level# and #src# on #level#-1.
+                                   */
+  virtual void prolongation(unsigned level,
+                           dVector& dst,
+                           const dVector& src) const;
+
                                   /**
                                    * Solve exactly on coarsest grid.
                                    */
index 6a6524451730299c07f90538b363a0625e44a236..58e968a92de75559b76127f2311cb1990982227e 100644 (file)
@@ -83,7 +83,8 @@ class MultiGrid
                                    * Copies data from active portions
                                    * of an MGVector into the
                                    * respective positions of a
-                                   * dVector.
+                                   * dVector. All other entries of
+                                   * #src# are zero.
                                    */
   void copy_from_mg(dVector& dst, const MGVector& src) const;
 
@@ -102,35 +103,77 @@ protected:
                                   /**
                                    * Number of pre-smoothing steps.
                                    */
-  unsigned n_presmooth;
+  unsigned n_pre_smooth;
   
                                   /**
                                    * Number of post-smoothing steps
                                    */
-  unsigned n_postsmooth;
+  unsigned n_post_smooth;
                                   /**
                                    * The (pre-)smoothing algorithm.
+                                   * This function is required to
+                                   * perform #steps# iterations to
+                                   * smoothen the residual $Ax-b$.
                                    */
   virtual void smooth(unsigned level,
-                     dVector& dst,
-                     const dVector& src) const;
+                     dVector& x,
+                     const dVector& b,
+                     unsigned steps) const;
 
                                   /**
                                    * The post-smoothing algorithm.
                                    * Defaults to #smooth#.
                                    */
   virtual void post_smooth(unsigned level,
-                     dVector& dst,
-                     const dVector& src) const;
+                          dVector& dst,
+                          const dVector& src,
+                          unsigned steps) const;
 
+                                  /**
+                                   * Apply operator on all
+                                   * cells of a level.
+                                   *
+                                   */
+  virtual void level_vmult(unsigned level,
+                          dVector& dst,
+                          const dVector& src) const;
                                   /**
                                    * Apply operator on non-refined
                                    * cells.
+                                   *
+                                   * The sum over all levels
+                                   * of the results of this function
+                                   * is the multiplication with the
+                                   * normal fine-grid matrix.
                                    */
   virtual void level_active_vmult(unsigned level,
                                  dVector& dst,
                                  const dVector& src) const;
 
+                                  /**
+                                   * Restriction from #level#.
+                                   *
+                                   * This function <B>adds</B> the
+                                   * restriction of #src# to #dst#,
+                                   * where #src# is a vector on #level#
+                                   * and #dst# is on #level#-1.
+                                   */
+  virtual void restriction(unsigned level,
+                          dVector& dst,
+                          const dVector& src) const;
+                          
+
+                                  /**
+                                   * Prolongation to #level#.
+                                   *
+                                   * <B>Adds</B> the prolongation of
+                                   * #src# to #dst#. Here, #dst# is on
+                                   * #level# and #src# on #level#-1.
+                                   */
+  virtual void prolongation(unsigned level,
+                           dVector& dst,
+                           const dVector& src) const;
+
                                   /**
                                    * Solve exactly on coarsest grid.
                                    */
index 1a58b75b5c38ba4608397f8092e8a34a085d16a4..e7fdaf0785a0a0c1aded7e257c832351a911d940 100644 (file)
@@ -27,6 +27,7 @@ MultiGrid::precondition(dVector& dst, const dVector& src) const
   level_mgstep(maxlevel);
 }
 
+
 void
 MultiGrid::level_mgstep(unsigned level) const
 {
@@ -36,9 +37,15 @@ MultiGrid::level_mgstep(unsigned level) const
     return;
   }
   
-  for (unsigned i=0; i< n_presmooth; ++i)
-  {
-    smooth(level, d[level], s[level]);
-  }
+  smooth(level, d[level], s[level], n_pre_smooth);
+
+  post_smooth(level, d[level], s[level], n_post_smooth);
 }
 
+
+void MultiGrid::post_smooth(unsigned level,
+                           dVector& dst, const dVector& src,
+                           unsigned steps) const
+{
+  smooth(level, dst, src, steps);
+}
index 1a58b75b5c38ba4608397f8092e8a34a085d16a4..e7fdaf0785a0a0c1aded7e257c832351a911d940 100644 (file)
@@ -27,6 +27,7 @@ MultiGrid::precondition(dVector& dst, const dVector& src) const
   level_mgstep(maxlevel);
 }
 
+
 void
 MultiGrid::level_mgstep(unsigned level) const
 {
@@ -36,9 +37,15 @@ MultiGrid::level_mgstep(unsigned level) const
     return;
   }
   
-  for (unsigned i=0; i< n_presmooth; ++i)
-  {
-    smooth(level, d[level], s[level]);
-  }
+  smooth(level, d[level], s[level], n_pre_smooth);
+
+  post_smooth(level, d[level], s[level], n_post_smooth);
 }
 
+
+void MultiGrid::post_smooth(unsigned level,
+                           dVector& dst, const dVector& src,
+                           unsigned steps) const
+{
+  smooth(level, dst, src, steps);
+}

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.