]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Move some details into namespace internal.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 20 Feb 2003 00:00:48 +0000 (00:00 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 20 Feb 2003 00:00:48 +0000 (00:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@7188 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/grid_reordering.h
deal.II/deal.II/source/grid/grid_reordering.cc
deal.II/doc/news/2002/c-3-4.html

index 395a185551e226c598ae6510bcfcd6729364c845..ea563e4b9c0c3c367f395467def5651afa1bd78d 100644 (file)
 #include <grid/tria.h>
 
 
+namespace internal
+{
 /**
  * Class declaring some dimension dependent numbers which are needed
  * for the grid reordering class.
  *
  * @author Wolfgang Bangerth, 2000
  */
-template <int dim>
-class GridReorderingInfo
-{
-};
+  template <int dim>
+  class GridReorderingInfo
+  {
+  };
 
 
 /**
@@ -39,29 +41,29 @@ class GridReorderingInfo
  *
  * @author Wolfgang Bangerth, 2000
  */
-template <>
-class GridReorderingInfo<2>
-{
-  public:
-                                    /**
-                                     * Number of possible valid
-                                     * orientations of a cell. They
-                                     * are the state in which it was
-                                     * delivered and three possible
-                                     * rotations in counter-clockwise
-                                     * sense, thus a total of four.
-                                     */
-    static const unsigned int rotational_states_of_cells = 4;
-
-                                    /**
-                                     * Number of possible
-                                     * orientations of a face in
-                                     * 2d. It is the face and the
-                                     * face with vertices exchanged,
-                                     * thus two.
-                                     */
-    static const unsigned int rotational_states_of_faces = 2;
-};
+  template <>
+  class GridReorderingInfo<2>
+  {
+    public:
+                                      /**
+                                       * Number of possible valid
+                                       * orientations of a cell. They
+                                       * are the state in which it was
+                                       * delivered and three possible
+                                       * rotations in counter-clockwise
+                                       * sense, thus a total of four.
+                                       */
+      static const unsigned int rotational_states_of_cells = 4;
+
+                                      /**
+                                       * Number of possible
+                                       * orientations of a face in
+                                       * 2d. It is the face and the
+                                       * face with vertices exchanged,
+                                       * thus two.
+                                       */
+      static const unsigned int rotational_states_of_faces = 2;
+  };
 
 
 
@@ -72,39 +74,40 @@ class GridReorderingInfo<2>
  *
  * @author Wolfgang Bangerth, 2000
  */
-template <>
-class GridReorderingInfo<3>
-{
-  public:
-                                    /**
-                                     * Number of possible
-                                     * orientations of a cell in 3d,
-                                     * i.e. in how many ways can we
-                                     * arrange the eight vertices of
-                                     * a cube such that the numbering
-                                     * conventions of deal.II are
-                                     * satisfied. Since we can put
-                                     * the cube on each of its six
-                                     * faces and rotate it into four
-                                     * ways on each of these faces,
-                                     * the total number is 24.
-                                     */
-    static const unsigned int rotational_states_of_cells = 24;
-
-                                    /**
-                                     * Number of possible
-                                     * orientations of a face in
-                                     * 2d. It is the quadrilateral
-                                     * rotated in all four
-                                     * orientations, and also viewed
-                                     * from the back, i.e. vertices
-                                     * not numbered in
-                                     * counter-clockwise sense but in
-                                     * the other direction.
-                                     */
-    static const unsigned int rotational_states_of_faces = 8;
-};
-
+  template <>
+  class GridReorderingInfo<3>
+  {
+    public:
+                                      /**
+                                       * Number of possible
+                                       * orientations of a cell in 3d,
+                                       * i.e. in how many ways can we
+                                       * arrange the eight vertices of
+                                       * a cube such that the numbering
+                                       * conventions of deal.II are
+                                       * satisfied. Since we can put
+                                       * the cube on each of its six
+                                       * faces and rotate it into four
+                                       * ways on each of these faces,
+                                       * the total number is 24.
+                                       */
+      static const unsigned int rotational_states_of_cells = 24;
+
+                                      /**
+                                       * Number of possible
+                                       * orientations of a face in
+                                       * 2d. It is the quadrilateral
+                                       * rotated in all four
+                                       * orientations, and also viewed
+                                       * from the back, i.e. vertices
+                                       * not numbered in
+                                       * counter-clockwise sense but in
+                                       * the other direction.
+                                       */
+      static const unsigned int rotational_states_of_faces = 8;
+  };
+}
 
   
 
@@ -517,7 +520,7 @@ class GridReorderingInfo<3>
  * @author Wolfgang Bangerth, 2000
  */
 template <int dim>
-class GridReordering : private GridReorderingInfo<dim>
+class GridReordering
 {
   public:
                                     /**
@@ -615,7 +618,7 @@ class GridReordering : private GridReorderingInfo<dim>
                                          * cell.
                                          */
        typename std::map<Face,FaceData>::iterator
-       faces[GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
+       faces[internal::GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
 
                                         /**
                                          * Cell indices of the
@@ -827,7 +830,7 @@ class GridReordering : private GridReorderingInfo<dim>
                                          * algorithm.
                                          */
        typename std::map<Face,FaceData >::const_iterator
-       reverse_faces[GridReorderingInfo<dim>::rotational_states_of_faces-1];
+       reverse_faces[internal::GridReorderingInfo<dim>::rotational_states_of_faces-1];
 
                                         /**
                                          * Indices of the one or two
index 7451ea62262820325fbe90a79a343b79c2652f35..150ce0ab1823af35e01c492ec4d53eab375b28b9 100644 (file)
 
 
 
+namespace internal
+{
 // static variables
 #if deal_II_dimension == 2
-const unsigned int GridReorderingInfo<2>::rotational_states_of_cells;
-const unsigned int GridReorderingInfo<2>::rotational_states_of_faces;
+  const unsigned int GridReorderingInfo<2>::rotational_states_of_cells;
+  const unsigned int GridReorderingInfo<2>::rotational_states_of_faces;
 #endif
 
 #if deal_II_dimension == 3
-const unsigned int GridReorderingInfo<3>::rotational_states_of_cells;
-const unsigned int GridReorderingInfo<3>::rotational_states_of_faces;
+  const unsigned int GridReorderingInfo<3>::rotational_states_of_cells;
+  const unsigned int GridReorderingInfo<3>::rotational_states_of_faces;
 #endif
 
-template <int dim>
-const unsigned int GridReordering<dim>::Cell::invalid_neighbor;
-
-template <int dim>
-const unsigned int GridReordering<dim>::FaceData::invalid_adjacent_cell;
+  template <int dim>
+  const unsigned int GridReordering<dim>::Cell::invalid_neighbor;
 
+  template <int dim>
+  const unsigned int GridReordering<dim>::FaceData::invalid_adjacent_cell;
+}
 
 
 
@@ -65,7 +67,7 @@ GridReordering<dim>::Cell::Cell (const Cell &c) :
                 cell_no(c.cell_no),
                 track_back_to_cell(c.track_back_to_cell)
 {
-  for (unsigned int i=0; i<GridReorderingInfo<dim>::rotational_states_of_cells; ++i)
+  for (unsigned int i=0; i<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++i)
     for (unsigned int j=0; j<GeometryInfo<dim>::faces_per_cell; ++j)
       faces[i][j]=c.faces[i][j];
 
@@ -245,7 +247,7 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
             this->vertices[6], this->vertices[7] } },
        { { this->vertices[0], this->vertices[4],
             this->vertices[7], this->vertices[3] } } };
-  Face new_faces[GeometryInfo<dim>::faces_per_cell][GridReorderingInfo<dim>::rotational_states_of_faces]
+  Face new_faces[GeometryInfo<dim>::faces_per_cell][internal::GridReorderingInfo<dim>::rotational_states_of_faces]
     = { { new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0],
           new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0] },
         { new_faces_tmp[1], new_faces_tmp[0], new_faces_tmp[0], new_faces_tmp[0],
@@ -262,7 +264,7 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
                                   // first do the faces in their
                                   // usual direction
   for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
-    for (unsigned int rot=1; rot<GridReorderingInfo<dim>::rotational_states_of_faces/2; ++rot)
+    for (unsigned int rot=1; rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces/2; ++rot)
       for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
        new_faces[face][rot].vertices[v]
          = new_faces[face][0].vertices[(v+rot) % GeometryInfo<dim>::vertices_per_face];
@@ -271,14 +273,14 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
                                   // as we only have to revert
                                   // indices 1 and 3
   for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
-    for (unsigned int rot=GridReorderingInfo<dim>::rotational_states_of_faces/2;
-        rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+    for (unsigned int rot=internal::GridReorderingInfo<dim>::rotational_states_of_faces/2;
+        rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
         ++rot)
       {
        for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_face; ++v)
          new_faces[face][rot].vertices[v]
            = new_faces[face]
-           [rot-GridReorderingInfo<dim>::rotational_states_of_faces/2].vertices[v];
+           [rot-internal::GridReorderingInfo<dim>::rotational_states_of_faces/2].vertices[v];
        std::swap (new_faces[face][rot].vertices[1],
                   new_faces[face][rot].vertices[3]);
       };
@@ -296,11 +298,11 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
                                   // it or not. we don't care about
                                   // that here, though
   std::map<Face,FaceData>::iterator
-    new_faces_ptr[GridReorderingInfo<dim>::rotational_states_of_faces]
+    new_faces_ptr[internal::GridReorderingInfo<dim>::rotational_states_of_faces]
     [GeometryInfo<dim>::faces_per_cell];
   for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
     for (unsigned int rot=0;
-        rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+        rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
         ++rot)
       new_faces_ptr[rot][face]
        = global_faces.insert (std::make_pair(new_faces[face][rot], FaceData())).first;
@@ -308,10 +310,10 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
                                   // and crosslink them to each other
   for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
     for (unsigned int rot=0;
-        rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+        rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
         ++rot)
       for (unsigned int other_rot=0;
-          other_rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+          other_rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
           ++other_rot)
        {
          if (other_rot < rot)
@@ -346,7 +348,7 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
                                           // used before, so we are the
                                           // first adjacent cell
          for (unsigned int rot=0;
-              rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+              rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
               ++rot)
            {
              Assert (new_faces_ptr[rot][face]->second.adjacent_cells[0]
@@ -364,7 +366,7 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
            previous_neighbor = new_faces_ptr[0][face]->second.adjacent_cells[0];
 //     cout << " as neighbor 1 (previous: " << previous_neighbor << ")" << endl;
          for (unsigned int rot=0;
-              rot<GridReorderingInfo<dim>::rotational_states_of_faces;
+              rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
               ++rot)
            {
              Assert (new_faces_ptr[rot][face]->second.adjacent_cells[0] ==
@@ -434,11 +436,11 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
                                   // cell (store which face and which
                                   // orientation):
   static std::pair<unsigned int, unsigned int>
-    cell_orientation_faces[GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
+    cell_orientation_faces[internal::GridReorderingInfo<dim>::rotational_states_of_cells][GeometryInfo<dim>::faces_per_cell];
 
   if (already_initialized == false)
     {
-      for (unsigned int rot=0; rot<GridReorderingInfo<dim>::rotational_states_of_cells; ++rot)
+      for (unsigned int rot=0; rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++rot)
        {
                                           // initialize a standard
                                           // cell with the vertex
@@ -478,7 +480,7 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
              for (unsigned int f=0;
                   (!face_found) && (f<GeometryInfo<dim>::faces_per_cell); ++f)
                for (unsigned int r=0;
-                    r<GridReorderingInfo<dim>::rotational_states_of_faces;
+                    r<internal::GridReorderingInfo<dim>::rotational_states_of_faces;
                     ++r)
                  if (standard_faces[face] == new_faces[f][r])
                    {
@@ -543,7 +545,7 @@ GridReordering<3>::Cell::insert_faces (std::map<Face,FaceData> &global_faces)
                                   // directions to the cell in each
                                   // of its orientations
   for (unsigned int rot=0;
-       rot<GridReorderingInfo<dim>::rotational_states_of_cells;
+       rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells;
        ++rot)
     for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
       faces[rot][face] = new_faces_ptr
@@ -638,7 +640,7 @@ bool GridReordering<dim>::Cell::check_consistency (const unsigned int rot) const
       const FaceData &face = faces[rot][face_no]->second;
 
       for (unsigned int face_rot=0;
-          face_rot<GridReorderingInfo<dim>::rotational_states_of_faces-1;
+          face_rot<internal::GridReorderingInfo<dim>::rotational_states_of_faces-1;
           ++face_rot)
        {
          const FaceData &reverse_face = face.reverse_faces[face_rot]->second;
@@ -756,14 +758,14 @@ void GridReordering<dim>::track_back (std::vector<Cell> &cells,
                                       // stack
       rotation_states.pop_back();
     };
-  Assert (last_rotation_state < GridReorderingInfo<dim>::rotational_states_of_cells, ExcInternalError());
+  Assert (last_rotation_state < internal::GridReorderingInfo<dim>::rotational_states_of_cells, ExcInternalError());
   
                                   // now we will have to find out
                                   // whether we can try the last cell
                                   // we have popped from the stack in
                                   // another rotation state, or will
                                   // have to backtrack further:
-  if (last_rotation_state < GridReorderingInfo<dim>::rotational_states_of_cells-1)
+  if (last_rotation_state < internal::GridReorderingInfo<dim>::rotational_states_of_cells-1)
     {
                                       // possible. push that state to
                                       // the stack and leave
@@ -840,7 +842,7 @@ bool GridReordering<dim>::try_rotate_single_neighbors (std::vector<Cell> &cells,
                                           // that have already been
                                           // tried:
          for (unsigned int neighbor_rot=old_rotation_state+1;
-              neighbor_rot<GridReorderingInfo<dim>::rotational_states_of_cells; ++neighbor_rot)
+              neighbor_rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++neighbor_rot)
            {
                                               // first, if the
                                               // neighbor itself does
@@ -860,7 +862,7 @@ bool GridReordering<dim>::try_rotate_single_neighbors (std::vector<Cell> &cells,
                                               // orientation
              cells[neighbor_no].mark_faces_used (neighbor_rot);
 
-             for (unsigned int cell_rot=0; cell_rot<GridReorderingInfo<dim>::rotational_states_of_cells; ++cell_rot)
+             for (unsigned int cell_rot=0; cell_rot<internal::GridReorderingInfo<dim>::rotational_states_of_cells; ++cell_rot)
                if (cells[cell_no].check_consistency (cell_rot) == true)
                  {
                                                     // ah, see,
@@ -989,7 +991,7 @@ void GridReordering<dim>::find_reordering (std::vector<Cell>           &cells,
                                           // we can rotate the top
                                           // cell so that it works
          if (rotation_states.back()+1
-             < GridReorderingInfo<dim>::rotational_states_of_cells)
+             < internal::GridReorderingInfo<dim>::rotational_states_of_cells)
            {
                                               // yes, can be
                                               // done. then do so and
index d08852434ef4ca0bdad6779304d3eb6b87c1b9d4..c2ba3e5b04b3f933911bd863bf3d3e5dc29391c7 100644 (file)
@@ -739,6 +739,14 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p> 
+       Changed: Some implementation details of the <code
+       class="class">GridReordering</code> class have been moved to a
+       namespace <code class="class">internal</code>.
+       <br>
+       (WB 2003/02/19)
+       </p>
+
   <li> <p>
        New: There is now a function <code
        class="member">FiniteElement::constraints_are_implemented</code> that

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.