]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Move some functions from MGDoFHandler to MGDoFTools.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 1999 15:10:32 +0000 (15:10 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Dec 1999 15:10:32 +0000 (15:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@2074 0785d39b-7218-0410-832d-ea1e28bc413d

12 files changed:
deal.II/deal.II/include/dofs/dof_tools.h
deal.II/deal.II/include/dofs/mg_dof_handler.h
deal.II/deal.II/include/dofs/mg_dof_tools.h [new file with mode: 0644]
deal.II/deal.II/include/multigrid/mg_dof_handler.h
deal.II/deal.II/include/multigrid/mg_dof_tools.h [new file with mode: 0644]
deal.II/deal.II/source/dofs/dof_renumbering.cc
deal.II/deal.II/source/dofs/mg_dof_handler.cc
deal.II/deal.II/source/dofs/mg_dof_tools.cc [new file with mode: 0644]
deal.II/deal.II/source/multigrid/mg_dof_handler.cc
deal.II/deal.II/source/multigrid/mg_dof_tools.cc [new file with mode: 0644]
tests/deal.II/mg.cc
tests/deal.II/mglocal.cc

index 49c05b3676d788c1a0ac11f8e28e925a4a42ff04..5bc970dc179b9a6af40c71c9604bfe95ac04e4ad 100644 (file)
@@ -42,7 +42,7 @@
  * other basis functions on a cell adjacent to the boundary vanish at the
  * boundary itself, except for those which are located on the boundary.
  *
- * @author Wolfgang Bangerth and others, 1999
+ * @author Wolfgang Bangerth and others, 1998, 1999
  */
 class DoFTools
 {
index f27031aa0cdbd6d2ded672f230b9eae951bfaa71..2315512e68ae3f23bf34c9a92150cf47ac3bddff 100644 (file)
@@ -119,11 +119,21 @@ class MGDoFDimensionInfo<3> {
 
 
 
-
+/**
+ * This class manages degrees of freedom for a multilevel hierarchy of
+ * grids. It does mostly the same as does the #DoDHandler# class, but
+ * it uses a separate enumeration of the degrees of freedom on each
+ * level. For example, a vertex has several DoF numbers, one for each
+ * level of the triangulation on which it exists.
+ *
+ * At present, multilevel algorithms are not fully functional, so this
+ * documentation is still very brief.
+//TODO: Extend MGDoFHandler doc 
+ *
+ * @author Wolfgang Bangerth, 1998, 1999
+ */
 template <int dim>
-class MGDoFHandler
-  :
-  public DoFHandler<dim>
+class MGDoFHandler : public DoFHandler<dim>
 {
   public:
     typedef typename MGDoFDimensionInfo<dim>::raw_line_iterator raw_line_iterator;
@@ -190,27 +200,6 @@ class MGDoFHandler
     void renumber_dofs (const unsigned int level,
                        const vector<int> &new_numbers);
 
-                                    /**
-                                     * Write the sparsity structure of the
-                                     * matrix belonging to the specified
-                                     * #level# including constrained
-                                     * degrees of freedom into the
-                                     * matrix structure. The sparsity pattern
-                                     * does not include entries introduced by
-                                     * the elimination of constrained nodes.
-                                     * The sparsity
-                                     * pattern is not compressed, since if
-                                     * you want to call
-                                     * #ConstraintMatrix::condense(1)#
-                                     * afterwards, new entries have to be
-                                     * added. However, if you don't want to call
-                                     * #ConstraintMatrix::condense(1)#, you
-                                     * have to compress the matrix yourself,
-                                     * using #SparseMatrixStruct::compress()#.
-                                     */
-    void make_sparsity_pattern (const unsigned int  level,
-                               SparseMatrixStruct &sparsity) const; 
-
                                     /*--------------------------------------*/
     
                                     /**
diff --git a/deal.II/deal.II/include/dofs/mg_dof_tools.h b/deal.II/deal.II/include/dofs/mg_dof_tools.h
new file mode 100644 (file)
index 0000000..4b7714b
--- /dev/null
@@ -0,0 +1,61 @@
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
+/*      $Id$                 */
+#ifndef __mg_dof_tools_H
+#define __mg_dof_tools_H
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
+
+
+#include <lac/forward_declarations.h>
+#include <grid/forward_declarations.h>
+
+
+/**
+ * This is a collection of functions operating on, and manipulating
+ * the numbers of degrees of freedom in a multilevel triangulation. It
+ * is similar in purpose and function to the #DoFTools# class, but
+ * operates on #MGDoFHandler# objects instead of #DoFHandler#
+ * objects. See there and the documentation of the member functions
+ * for more information.
+ *
+ * All member functions are static, so there is no need to create an
+ * object of class #DoFTools#.
+ *
+ * @author Wolfgang Bangerth and others, 1999
+ */
+class MGDoFTools 
+{
+  public:
+                                    /**
+                                     * Write the sparsity structure
+                                     * of the matrix belonging to the
+                                     * specified #level# including
+                                     * constrained degrees of freedom
+                                     * into the matrix structure. The
+                                     * sparsity pattern does not
+                                     * include entries introduced by
+                                     * the elimination of constrained
+                                     * nodes.  The sparsity pattern
+                                     * is not compressed, since if
+                                     * you want to call
+                                     * #ConstraintMatrix::condense(1)#
+                                     * afterwards, new entries have
+                                     * to be added. However, if you
+                                     * don't want to call
+                                     * #ConstraintMatrix::condense(1)#,
+                                     * you have to compress the
+                                     * matrix yourself, using
+                                     * #SparseMatrixStruct::compress()#.
+                                     */
+    template <int dim>
+    static void
+    make_sparsity_pattern (const MGDoFHandler<dim> &dof_handler,
+                          const unsigned int       level,
+                          SparseMatrixStruct      &sparsity);
+};
+
+
+
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
+/* end of #ifndef __mg_dof_tools_H */
+#endif
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
index f27031aa0cdbd6d2ded672f230b9eae951bfaa71..2315512e68ae3f23bf34c9a92150cf47ac3bddff 100644 (file)
@@ -119,11 +119,21 @@ class MGDoFDimensionInfo<3> {
 
 
 
-
+/**
+ * This class manages degrees of freedom for a multilevel hierarchy of
+ * grids. It does mostly the same as does the #DoDHandler# class, but
+ * it uses a separate enumeration of the degrees of freedom on each
+ * level. For example, a vertex has several DoF numbers, one for each
+ * level of the triangulation on which it exists.
+ *
+ * At present, multilevel algorithms are not fully functional, so this
+ * documentation is still very brief.
+//TODO: Extend MGDoFHandler doc 
+ *
+ * @author Wolfgang Bangerth, 1998, 1999
+ */
 template <int dim>
-class MGDoFHandler
-  :
-  public DoFHandler<dim>
+class MGDoFHandler : public DoFHandler<dim>
 {
   public:
     typedef typename MGDoFDimensionInfo<dim>::raw_line_iterator raw_line_iterator;
@@ -190,27 +200,6 @@ class MGDoFHandler
     void renumber_dofs (const unsigned int level,
                        const vector<int> &new_numbers);
 
-                                    /**
-                                     * Write the sparsity structure of the
-                                     * matrix belonging to the specified
-                                     * #level# including constrained
-                                     * degrees of freedom into the
-                                     * matrix structure. The sparsity pattern
-                                     * does not include entries introduced by
-                                     * the elimination of constrained nodes.
-                                     * The sparsity
-                                     * pattern is not compressed, since if
-                                     * you want to call
-                                     * #ConstraintMatrix::condense(1)#
-                                     * afterwards, new entries have to be
-                                     * added. However, if you don't want to call
-                                     * #ConstraintMatrix::condense(1)#, you
-                                     * have to compress the matrix yourself,
-                                     * using #SparseMatrixStruct::compress()#.
-                                     */
-    void make_sparsity_pattern (const unsigned int  level,
-                               SparseMatrixStruct &sparsity) const; 
-
                                     /*--------------------------------------*/
     
                                     /**
diff --git a/deal.II/deal.II/include/multigrid/mg_dof_tools.h b/deal.II/deal.II/include/multigrid/mg_dof_tools.h
new file mode 100644 (file)
index 0000000..4b7714b
--- /dev/null
@@ -0,0 +1,61 @@
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
+/*      $Id$                 */
+#ifndef __mg_dof_tools_H
+#define __mg_dof_tools_H
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
+
+
+#include <lac/forward_declarations.h>
+#include <grid/forward_declarations.h>
+
+
+/**
+ * This is a collection of functions operating on, and manipulating
+ * the numbers of degrees of freedom in a multilevel triangulation. It
+ * is similar in purpose and function to the #DoFTools# class, but
+ * operates on #MGDoFHandler# objects instead of #DoFHandler#
+ * objects. See there and the documentation of the member functions
+ * for more information.
+ *
+ * All member functions are static, so there is no need to create an
+ * object of class #DoFTools#.
+ *
+ * @author Wolfgang Bangerth and others, 1999
+ */
+class MGDoFTools 
+{
+  public:
+                                    /**
+                                     * Write the sparsity structure
+                                     * of the matrix belonging to the
+                                     * specified #level# including
+                                     * constrained degrees of freedom
+                                     * into the matrix structure. The
+                                     * sparsity pattern does not
+                                     * include entries introduced by
+                                     * the elimination of constrained
+                                     * nodes.  The sparsity pattern
+                                     * is not compressed, since if
+                                     * you want to call
+                                     * #ConstraintMatrix::condense(1)#
+                                     * afterwards, new entries have
+                                     * to be added. However, if you
+                                     * don't want to call
+                                     * #ConstraintMatrix::condense(1)#,
+                                     * you have to compress the
+                                     * matrix yourself, using
+                                     * #SparseMatrixStruct::compress()#.
+                                     */
+    template <int dim>
+    static void
+    make_sparsity_pattern (const MGDoFHandler<dim> &dof_handler,
+                          const unsigned int       level,
+                          SparseMatrixStruct      &sparsity);
+};
+
+
+
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
+/* end of #ifndef __mg_dof_tools_H */
+#endif
+/*----------------------------   mg_dof_tools.h     ---------------------------*/
index 4e7ff00d3953b603e5ce068696b2c39488059b81..402788c30bf73893efb5d729fd7db4537cf47dd1 100644 (file)
@@ -1,14 +1,15 @@
 /* $Id$ */
 
+#include <lac/sparse_matrix.h>
 #include <dofs/dof_accessor.h>
 #include <grid/tria_iterator.h>
 #include <dofs/dof_handler.h>
 #include <dofs/mg_dof_handler.h>
 #include <dofs/dof_constraints.h>
+#include <dofs/dof_tools.h>
+#include <dofs/mg_dof_tools.h>
 #include <fe/fe.h>
 #include <numerics/dof_renumbering.h>
-#include <dofs/dof_tools.h>
-#include <lac/sparse_matrix.h>
 
 #include <vector>
 #include <map>
@@ -214,7 +215,7 @@ void DoFRenumbering::Cuthill_McKee (MGDoFHandler<dim>      &dof_handler,
                                   // make the connection graph
   SparseMatrixStruct sparsity (dof_handler.n_dofs(level),
                               dof_handler.max_couplings_between_dofs());
-  dof_handler.make_sparsity_pattern (level, sparsity);
+  MGDoFTools::make_sparsity_pattern (dof_handler, level, sparsity);
     
   const int n_dofs = sparsity.n_rows();
                                   // store the new dof numbers; -1 means
index 87f8192c253916752c2b072554ac285af9fd69c8..d615123b8426aedd60ea6d86d85e6118c7af1d30 100644 (file)
@@ -1539,32 +1539,6 @@ unsigned int MGDoFHandler<dim>::n_dofs (const unsigned int level) const {
 
 
 
-template <int dim>
-void MGDoFHandler<dim>::make_sparsity_pattern (const unsigned int  level,
-                                              SparseMatrixStruct &sparsity) const {
-  Assert (selected_fe != 0, ExcNoFESelected());
-  Assert (sparsity.n_rows() == n_dofs(level),
-         ExcDimensionMismatch (sparsity.n_rows(), n_dofs(level)));
-  Assert (sparsity.n_cols() == n_dofs(level),
-         ExcDimensionMismatch (sparsity.n_cols(), n_dofs(level)));
-
-  const unsigned int dofs_per_cell = selected_fe->dofs_per_cell;
-  vector<int> dofs_on_this_cell(dofs_per_cell);
-  cell_iterator cell = begin(level),
-               endc = end(level);
-  for (; cell!=endc; ++cell) 
-    {
-      cell->get_mg_dof_indices (dofs_on_this_cell);
-                                      // make sparsity pattern for this cell
-      for (unsigned int i=0; i<dofs_per_cell; ++i)
-       for (unsigned int j=0; j<dofs_per_cell; ++j)
-         sparsity.add (dofs_on_this_cell[i],
-                       dofs_on_this_cell[j]);
-    };
-};
-
-
-
 #if deal_II_dimension == 1
 
 template <>
diff --git a/deal.II/deal.II/source/dofs/mg_dof_tools.cc b/deal.II/deal.II/source/dofs/mg_dof_tools.cc
new file mode 100644 (file)
index 0000000..e66eec7
--- /dev/null
@@ -0,0 +1,42 @@
+/* $Id$ */
+
+#include <lac/sparse_matrix.h>
+#include <dofs/mg_dof_handler.h>
+#include <dofs/mg_dof_accessor.h>
+#include <grid/tria_iterator.h>
+#include <dofs/mg_dof_tools.h>
+#include <fe/fe.h>
+
+
+template <int dim>
+void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<dim> &mg_dof_handler,
+                                       const unsigned int       level,
+                                       SparseMatrixStruct      &sparsity)
+{
+  Assert (sparsity.n_rows() == mg_dof_handler.n_dofs(level),
+         ExcDimensionMismatch (sparsity.n_rows(), mg_dof_handler.n_dofs(level)));
+  Assert (sparsity.n_cols() == mg_dof_handler.n_dofs(level),
+         ExcDimensionMismatch (sparsity.n_cols(), mg_dof_handler.n_dofs(level)));
+
+  const unsigned int dofs_per_cell = mg_dof_handler.get_fe().dofs_per_cell;
+  vector<int> dofs_on_this_cell(dofs_per_cell);
+  MGDoFHandler<dim>::cell_iterator cell = mg_dof_handler.begin(level),
+                                  endc = mg_dof_handler.end(level);
+  for (; cell!=endc; ++cell) 
+    {
+      cell->get_mg_dof_indices (dofs_on_this_cell);
+                                      // make sparsity pattern for this cell
+      for (unsigned int i=0; i<dofs_per_cell; ++i)
+       for (unsigned int j=0; j<dofs_per_cell; ++j)
+         sparsity.add (dofs_on_this_cell[i],
+                       dofs_on_this_cell[j]);
+    };
+};
+
+
+
+// explicit instantiations
+template void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<deal_II_dimension> &,
+                                                const unsigned int,
+                                                SparseMatrixStruct &);
+
index 87f8192c253916752c2b072554ac285af9fd69c8..d615123b8426aedd60ea6d86d85e6118c7af1d30 100644 (file)
@@ -1539,32 +1539,6 @@ unsigned int MGDoFHandler<dim>::n_dofs (const unsigned int level) const {
 
 
 
-template <int dim>
-void MGDoFHandler<dim>::make_sparsity_pattern (const unsigned int  level,
-                                              SparseMatrixStruct &sparsity) const {
-  Assert (selected_fe != 0, ExcNoFESelected());
-  Assert (sparsity.n_rows() == n_dofs(level),
-         ExcDimensionMismatch (sparsity.n_rows(), n_dofs(level)));
-  Assert (sparsity.n_cols() == n_dofs(level),
-         ExcDimensionMismatch (sparsity.n_cols(), n_dofs(level)));
-
-  const unsigned int dofs_per_cell = selected_fe->dofs_per_cell;
-  vector<int> dofs_on_this_cell(dofs_per_cell);
-  cell_iterator cell = begin(level),
-               endc = end(level);
-  for (; cell!=endc; ++cell) 
-    {
-      cell->get_mg_dof_indices (dofs_on_this_cell);
-                                      // make sparsity pattern for this cell
-      for (unsigned int i=0; i<dofs_per_cell; ++i)
-       for (unsigned int j=0; j<dofs_per_cell; ++j)
-         sparsity.add (dofs_on_this_cell[i],
-                       dofs_on_this_cell[j]);
-    };
-};
-
-
-
 #if deal_II_dimension == 1
 
 template <>
diff --git a/deal.II/deal.II/source/multigrid/mg_dof_tools.cc b/deal.II/deal.II/source/multigrid/mg_dof_tools.cc
new file mode 100644 (file)
index 0000000..e66eec7
--- /dev/null
@@ -0,0 +1,42 @@
+/* $Id$ */
+
+#include <lac/sparse_matrix.h>
+#include <dofs/mg_dof_handler.h>
+#include <dofs/mg_dof_accessor.h>
+#include <grid/tria_iterator.h>
+#include <dofs/mg_dof_tools.h>
+#include <fe/fe.h>
+
+
+template <int dim>
+void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<dim> &mg_dof_handler,
+                                       const unsigned int       level,
+                                       SparseMatrixStruct      &sparsity)
+{
+  Assert (sparsity.n_rows() == mg_dof_handler.n_dofs(level),
+         ExcDimensionMismatch (sparsity.n_rows(), mg_dof_handler.n_dofs(level)));
+  Assert (sparsity.n_cols() == mg_dof_handler.n_dofs(level),
+         ExcDimensionMismatch (sparsity.n_cols(), mg_dof_handler.n_dofs(level)));
+
+  const unsigned int dofs_per_cell = mg_dof_handler.get_fe().dofs_per_cell;
+  vector<int> dofs_on_this_cell(dofs_per_cell);
+  MGDoFHandler<dim>::cell_iterator cell = mg_dof_handler.begin(level),
+                                  endc = mg_dof_handler.end(level);
+  for (; cell!=endc; ++cell) 
+    {
+      cell->get_mg_dof_indices (dofs_on_this_cell);
+                                      // make sparsity pattern for this cell
+      for (unsigned int i=0; i<dofs_per_cell; ++i)
+       for (unsigned int j=0; j<dofs_per_cell; ++j)
+         sparsity.add (dofs_on_this_cell[i],
+                       dofs_on_this_cell[j]);
+    };
+};
+
+
+
+// explicit instantiations
+template void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<deal_II_dimension> &,
+                                                const unsigned int,
+                                                SparseMatrixStruct &);
+
index dfadf7b5930d76c857afacdb067cc4283d4c3f00..b5993d549f17b6ddbd5061f384f3d48930aee52a 100644 (file)
@@ -26,6 +26,7 @@
 #include <numerics/multigrid.templates.h>
 #include <numerics/mg_smoother.h>
 #include <dofs/dof_tools.h>
+#include <dofs/mg_dof_tools.h>
 
 #include "helmholtz.h"
 
@@ -120,7 +121,7 @@ int main()
            {
              mgstruct[i].reinit(mgdof.n_dofs(i), mgdof.n_dofs(i),
                                 mgdof.max_couplings_between_dofs());
-             mgdof.make_sparsity_pattern(i, mgstruct[i]);
+             MGDoFTools::make_sparsity_pattern(mgdof, i, mgstruct[i]);
              mgstruct[i].compress();
              
              mgA[i].reinit(mgstruct[i]);
index f0174a666b4ce2c8044bcd38432e017c1f65cb90..2ce1219d356f6ee118036176ffc0857b250fc7c8 100644 (file)
@@ -27,6 +27,7 @@
 #include <numerics/mg_smoother.h>
 #include <numerics/multigrid.templates.h>
 #include <dofs/dof_tools.h>
+#include <dofs/mg_dof_tools.h>
 
 #include <fstream>
 
@@ -133,7 +134,7 @@ int main()
            {
              mgstruct[i].reinit(mgdof.n_dofs(i), mgdof.n_dofs(i),
                                 mgdof.max_couplings_between_dofs());
-             mgdof.make_sparsity_pattern(i, mgstruct[i]);
+             MGDoFTools::make_sparsity_pattern(mgdof, i, mgstruct[i]);
              mgstruct[i].compress();
              
              mgA[i].reinit(mgstruct[i]);

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.