]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
DoFRenumbering::random
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Oct 2000 08:38:30 +0000 (08:38 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Oct 2000 08:38:30 +0000 (08:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@3454 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/dof_renumbering.h
deal.II/deal.II/source/dofs/dof_renumbering.cc

index 808c9027b387f116d0a4d8c0c1e83a3749348e75..a3b9907e4859474674eab1963062a84ec597dffa 100644 (file)
  * are numbered cell-wise without taking into account that they may belong to
  * different components.
  *
- * This kind of numbering may be obtained by calling the @p{component_wise} function
- * of this class. Since it does not touch the order of indices within each, it
- * may be worthwhile to first renumber using the Cuthill-McKee or a similar
- * algorithm and afterwards renumbering component-wise. This will bring out the
- * matrix structure and additionally have a good numbering within each block.
+ * This kind of numbering may be obtained by calling the
+ * @p{component_wise} function of this class. Since it does not touch
+ * the order of indices within each, it may be worthwhile to first
+ * renumber using the Cuthill-McKee or a similar algorithm and
+ * afterwards renumbering component-wise. This will bring out the
+ * matrix structure and additionally have a good numbering within each
+ * block.
  *
  *
  * @sect2{Cell-wise numbering for Discontinuous Galerkin FEM}
  * preserved, so it may be useful to apply @component_wise} first.
  *
  *
+ * @sect2{Random renumbering}
+ *
+ * The @p{random} function renumbers degrees of freedom randomly. This
+ * function is probably seldom of use, but to check the dependence of
+ * solvers (iterative or direct ones) on the numbering of the degrees
+ * of freedom. It uses the @p{random_shuffle} function from the C++
+ * standard library to do its work.
+ *
+ *
  * @sect2{Multigrid DoF numbering}
  *
  * Most algorithms also work on multigrid degree of freedom numberings. Refer
@@ -364,6 +375,14 @@ class DoFRenumbering
     sort_selected_dofs_back (DoFHandler<dim>    &dof_handler,
                             const vector<bool> &selected_dofs);
 
+                                    /**
+                                     * Renumber the degrees of
+                                     * freedom in a random way.
+                                     */
+    template <int dim>
+    static void
+    random (DoFHandler<dim> &dof_handler);
+    
                                     /**
                                      * Exception
                                      */
index 1628385fe15de28a3f91a4092cf0a4206365efdf..d056afc75ff020b064ec8b620aed9104c74caeb8 100644 (file)
@@ -716,6 +716,20 @@ DoFRenumbering::downstream_dg (MGDoFHandler<dim>& dof,
 
 
 
+extern "C" long int lrand48 (void);
+
+
+template <int dim>
+void
+DoFRenumbering::random (DoFHandler<dim> &dof_handler)
+{
+  vector<unsigned int> new_indices (dof_handler.n_dofs());
+  random_shuffle (new_indices.begin(), new_indices.end());
+  dof_handler.renumber_dofs(new_indices);  
+};
+
+
+
 // explicit instantiations
 template
 void DoFRenumbering::Cuthill_McKee (DoFHandler<deal_II_dimension>&,
@@ -755,3 +769,6 @@ void DoFRenumbering::downstream_dg (MGDoFHandler<deal_II_dimension>&,
 template
 void DoFRenumbering::sort_selected_dofs_back (DoFHandler<deal_II_dimension> &,
                                              const vector<bool> &);
+
+template
+void DoFRenumbering::random (DoFHandler<deal_II_dimension> &);

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.