]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Rename do_renumbering to renumber_dofs and make it public; add another assertion...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 4 Jan 1999 11:54:22 +0000 (11:54 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 4 Jan 1999 11:54:22 +0000 (11:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@723 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_handler.h
deal.II/deal.II/source/dofs/dof_handler.cc

index 66d10cbcdca963c7bf055242d701d84146a29ac5..9c60d84c8589592e86bda6624d9586feda3604ea 100644 (file)
@@ -298,6 +298,24 @@ enum RenumberingMethod {
  * may be difficult, however, and in many cases will not justify the effort.
  *
  *
+ * \subsection{User defined renumbering schemes}
+ *
+ * The #renumber_dofs# function offers a fixed number of renumbering
+ * schemes like the Cuthill-McKey scheme. Basically, the function sets
+ * up an array in which for each degree of freedom the index is stored
+ * which is to be assigned by the renumbering. Using this array, the
+ * #renumber_dofs(vector<int>)# function is called, which actually
+ * does the change from old DoF indices to the ones given in the
+ * array. In some cases, however, a user may want to compute her own
+ * renumbering order; in this case, allocate an array with one element
+ * per degree of freedom and fill it with the number that the
+ * respective degree of freedom shall be assigned. This number may,
+ * for example, be obtained by sorting the support points of the
+ * degrees of freedom in downwind direction.  Then call the
+ * #renumber_dofs(vector<int>)# with the array, which converts old
+ * into new degree of freedom indices.
+ *
+ *
  * \subsection{Setting up sparsity patterns}
  *
  * When assembling system matrices, the entries are usually of the form
@@ -386,6 +404,10 @@ enum RenumberingMethod {
  *
  * \subsection{Data transfer between grids}
  *
+ * {\bf Note: The functionality described in this section has never been tested
+ * and is expected to be broken or at least incomplete. Contact the author if
+ * you need these functions for more information.}
+ *
  * The #DoFHandler# class offers two functions #make_transfer_matrix# which create
  * a matrix to transform the data of one grid to another. The functions assumes the
  * coarsest mesh of the two grids to be the same. However there are few ways to
@@ -436,8 +458,7 @@ enum RenumberingMethod {
  *
  *
  *
- * @author Wolfgang Bangerth, 1998
- */
+ * @author Wolfgang Bangerth, 1998 */
 template <int dim>
 class DoFHandler : public DoFDimensionInfo<dim> {
   public:
@@ -531,6 +552,27 @@ class DoFHandler : public DoFDimensionInfo<dim> {
                        const bool use_constraints         = false,
                        const vector<int> &starting_points = vector<int>());
     
+                                    /**
+                                     * Actually do the renumbering based on
+                                     * a list of new dof numbers for all the
+                                     * dofs.
+                                     *
+                                     * #new_numbers# is an array of integers
+                                     * with size equal to the number of dofs
+                                     * on the present grid. It stores the new
+                                     * indices after renumbering in the
+                                     * order of the old indices.
+                                     *
+                                     * This function is called by the
+                                     * #renumber_dofs# function after computing
+                                     * the ordering of the degrees of freedom.
+                                     * However, you can call this function
+                                     * yourself, which is necessary if a user
+                                     * wants to implement an ordering scheme
+                                     * herself, for example downwind numbering.
+                                     */
+    void renumber_dofs (const vector<int> &new_numbers);
+
                                     /**
                                      * Make up the constraint matrix which
                                      * is used to condensate the global
@@ -1321,6 +1363,13 @@ class DoFHandler : public DoFDimensionInfo<dim> {
                    int, int,
                    << "The dimension " << arg1 << " of the vector is wrong. "
                    << "It should be " << arg2);
+                                    /**
+                                     * Exception
+                                     */
+    DeclException1 (ExcNewNumbersNotConsecutive,
+                   int,
+                   << "The given list of new dof indices is not consecutive: "
+                   << "the index " << arg1 << " does not exist.");
 
   protected:
     
@@ -1375,20 +1424,6 @@ class DoFHandler : public DoFDimensionInfo<dim> {
     unsigned int distribute_dofs_on_cell (active_cell_iterator &cell,
                                          unsigned int next_free_dof);
 
-                                    /**
-                                     * Actually do the renumbering prepared
-                                     * by the #renumber_dofs# function. Since
-                                     * this is dimension specific, we
-                                     * need to have another function.
-                                     *
-                                     * #new_numbers# is an array of integers
-                                     * with size equal to the number of dofs
-                                     * on the present grid. It stores the new
-                                     * indices after renumbering in the
-                                     * order of the old indices.
-                                     */
-    void do_renumbering (const vector<int> &new_numbers);
-
                                     /**
                                      * Make up part of the sparsity pattern of
                                      * the transfer matrix by looking at the
index 8ca18175490f32f3dec8f0e9e220a1e6444c7284..b8eab582f3bb0d9d79e5bf4e2303597b074f4b14 100644 (file)
@@ -1200,15 +1200,29 @@ void DoFHandler<dim>::renumber_dofs (const RenumberingMethod method,
                                   // actually perform renumbering;
                                   // this is dimension specific and
                                   // thus needs an own function
-  do_renumbering (new_number);
+  renumber_dofs (new_number);
 };
 
 
+
 #if deal_II_dimension == 1
 
 template <>
-void DoFHandler<1>::do_renumbering (const vector<int> &new_numbers) {
+void DoFHandler<1>::renumber_dofs (const vector<int> &new_numbers) {
   Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
+#ifdef DEBUG
+                                  // assert that the new indices are
+                                  // consecutively numbered
+  if (true)
+    {
+      vector<int> tmp(new_numbers);
+      sort (tmp.begin(), tmp.end());
+      vector<int>::const_iterator p = tmp.begin();
+      int                         i = 0;
+      for (; p!=tmp.end(); ++p, ++i)
+       Assert (*p == i, ExcNewNumbersNotConsecutive(i));
+    };
+#endif
 
                                   // note that we can not use cell iterators
                                   // in this function since then we would
@@ -1241,8 +1255,21 @@ void DoFHandler<1>::do_renumbering (const vector<int> &new_numbers) {
 #if deal_II_dimension == 2
 
 template <>
-void DoFHandler<2>::do_renumbering (const vector<int> &new_numbers) {
+void DoFHandler<2>::renumber_dofs (const vector<int> &new_numbers) {
   Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
+#ifdef DEBUG
+                                  // assert that the new indices are
+                                  // consecutively numbered
+  if (true)
+    {
+      vector<int> tmp(new_numbers);
+      sort (tmp.begin(), tmp.end());
+      vector<int>::const_iterator p = tmp.begin();
+      int                         i = 0;
+      for (; p!=tmp.end(); ++p, ++i)
+       Assert (*p == i, ExcNewNumbersNotConsecutive(i));
+    };
+#endif
 
                                   // note that we can not use cell iterators
                                   // in this function since then we would

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.