]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
child_cell_on_face, face_to_cell_vertices and face_to_cell_lines now include a new...
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Jun 2005 10:58:38 +0000 (10:58 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 16 Jun 2005 10:58:38 +0000 (10:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@10871 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/geometry_info.h
deal.II/deal.II/source/fe/mapping_q.cc
deal.II/deal.II/source/grid/geometry_info.cc
deal.II/deal.II/source/grid/tria.cc
deal.II/deal.II/source/grid/tria_accessor.cc

index 8fe33f278a4a2403256016f0f7cd10c9c2c66eea..3137454388bd12931a5a580b7873f23dbce45590 100644 (file)
@@ -353,34 +353,20 @@ struct GeometryInfo
                                      * the exact order of the
                                      * children is laid down in the
                                      * documentation of the
-                                     * Triangulation class.
-                                     * However, it must be noted that
-                                     * this class and function only
-                                     * deals with faces in standard
-                                     * orientation. In 3d, faces can
-                                     * exist in two orientations,
-                                     * though, and if a face is in
-                                     * the wrong orientation, then
-                                     * this function may not give you
-                                     * what you want. You can inquire
-                                     * about the face orientation
-                                     * using the
-                                     * <tt>cell->face_orientation</tt>
-                                     * function, and the function to
-                                     * ask for a neighbor's cell
-                                     * behind a given face and
-                                     * subface is
-                                     * <tt>cell->neighbor_child_on_subface</tt>.
-                                     * The latter function, in
-                                     * contrast to the present one,
-                                     * also takes into account the
-                                     * actual orientation of the
-                                     * faces of a cell and will
-                                     * return the correct result in
-                                     * all cases.
+                                     * Triangulation class. Through
+                                     * the <tt>face_orientation</tt>
+                                     * argument this function handles
+                                     * faces oriented in both, the
+                                     * standard and non-standard
+                                     * orientation.
+                                     * <tt>face_orientation</tt>
+                                     * defaults to <tt>true</tt>
+                                     * (standard orientation) and has
+                                     * no effect in 2d.
                                      */
     static unsigned int child_cell_on_face (const unsigned int face,
-                                           const unsigned int subface);
+                                           const unsigned int subface,
+                                           const bool face_orientation = true);
     
                                     /**
                                      * Map line vertex number to cell
@@ -416,6 +402,17 @@ struct GeometryInfo
                                      * face <tt>face</tt>, e.g.
                                      * <tt>GeometryInfo<2>::face_to_cell_vertices(2,0)=3</tt>.
                                      *
+                                     * Through the
+                                     * <tt>face_orientation</tt>
+                                     * argument this function handles
+                                     * faces oriented in both, the
+                                     * standard or non-standard
+                                     * orientation.
+                                     * <tt>face_orientation</tt>
+                                     * defaults to <tt>true</tt>
+                                     * (standard orientation) and has
+                                     * no effect in 2d.
+                                     *
                                      * As the children of a cell are
                                      * ordered according to the
                                      * vertices of the cell, this
@@ -427,7 +424,8 @@ struct GeometryInfo
                                      * a suggestive name.
                                      */
     static unsigned int face_to_cell_vertices (const unsigned int face,
-                                              const unsigned int vertex);
+                                              const unsigned int vertex,
+                                              const bool face_orientation = true);
 
                                     /**
                                      * Map face line number to cell
@@ -437,12 +435,23 @@ struct GeometryInfo
                                      * <tt>face</tt>, e.g.
                                      * <tt>GeometryInfo<3>::face_to_cell_lines(3,1)=5</tt>.
                                      *
+                                     * Through the
+                                     * <tt>face_orientation</tt>
+                                     * argument this function handles
+                                     * faces oriented in both, the
+                                     * standard and non-standard
+                                     * orientation.
+                                     * <tt>face_orientation</tt>
+                                     * defaults to <tt>true</tt>
+                                     * (standard orientation).
+                                     *
                                      * This function is useful and
                                      * implemented for
                                      * <tt>dim=3</tt>, only.
                                      */
     static unsigned int face_to_cell_lines (const unsigned int face,
-                                           const unsigned int line);
+                                           const unsigned int line,
+                                           const bool face_orientation = true);
     
                                     /**
                                      * Return the position of the
index 569f9a4b21d3d59ea23d5e19dd5c3c5023260e90..b8b8205a339a9aa507e97a3e62bc571c2261866f 100644 (file)
@@ -954,21 +954,6 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell,
                     lines_per_face    = GeometryInfo<3>::lines_per_face,
                     vertices_per_cell = GeometryInfo<3>::vertices_per_cell;
 
-                                   // mapping of faces to vertex
-                                   // indices for properly oriented
-                                   // faces is given by
-                                   // GeometryInfo<3>::face_to_cell_vertices
-                                  //
-                                   // same if the face is in opposite
-                                   // orientation
-  static const unsigned int face_to_cell_vertices2
-    [faces_per_cell][vertices_per_face]={{0,3,2,1},
-                                        {4,7,6,5},
-                                        {0,4,5,1},
-                                        {1,2,6,5},
-                                        {3,7,6,2},
-                                        {0,3,7,4}};
-
   static const StraightBoundary<3> straight_boundary;
                                   // used if face quad at boundary or
                                   // entirely in the interior of the
@@ -991,29 +976,17 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell,
 
                                        // some sanity checks up front
       for (unsigned int i=0; i<vertices_per_face; ++i)
-        Assert(face->vertex_index(i)==
-               cell->vertex_index(face_orientation ?
-                                 GeometryInfo<3>::face_to_cell_vertices(face_no, i) :
-                                 face_to_cell_vertices2[face_no][i]),
-               ExcInternalError());
-      
+        Assert(face->vertex_index(i)==cell->vertex_index(
+         GeometryInfo<3>::face_to_cell_vertices(face_no, i, face_orientation)),
+         ExcInternalError());
 
                                       // indices of the lines that
-                                      // bound a properly oriented
-                                      // face are given by
-                                      // GeometryInfo<3>::
-                                      // face_to_cell_lines(face_no, line_no)
-                                      //
-                                      // same for faces in wrong
-                                      // orientation is given by
+                                      // bound a face are given by
                                       // GeometryInfo<3>::
-                                      // face_to_cell_lines(face_no, 3-line_no)
+                                      // face_to_cell_lines
       for (unsigned int i=0; i<lines_per_face; ++i)
-        Assert(face->line(i)==
-               cell->line(face_orientation ?
-                         GeometryInfo<3>::face_to_cell_lines(face_no, i) :
-                         GeometryInfo<3>::face_to_cell_lines(face_no, 3-i)),
-               ExcInternalError());
+        Assert(face->line(i)==cell->line(GeometryInfo<3>::face_to_cell_lines(
+         face_no, i, face_orientation)), ExcInternalError());
       
                                       // if face at boundary, then
                                       // ask boundary object to
@@ -1064,17 +1037,13 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell,
              
                                               // sort the points into b
               for (unsigned int i=0; i<vertices_per_face; ++i)
-                b[i]=a[face_orientation ?
-                     GeometryInfo<3>::face_to_cell_vertices(face_no, i) :
-                     face_to_cell_vertices2[face_no][i]];
+                b[i]=a[GeometryInfo<3>::face_to_cell_vertices(face_no, i, face_orientation)];
                      
               for (unsigned int i=0; i<lines_per_face; ++i)
                 for (unsigned int j=0; j<degree-1; ++j)
                   b[vertices_per_face+i*(degree-1)+j]=
-                    a[vertices_per_cell+
-                    (face_orientation ?
-                     GeometryInfo<3>::face_to_cell_lines(face_no, i) :
-                     GeometryInfo<3>::face_to_cell_lines(face_no, 3-i))*(degree-1)+j];
+                    a[vertices_per_cell + GeometryInfo<3>::face_to_cell_lines(
+                     face_no, i, face_orientation)*(degree-1)+j];
 
                                               // Now b includes the
                                               // right order of
index cd6681556e1eb9ae9700a7baf66a9a35d80c828d..dc0bb0f12ba4e1151e32cd873ec829163c55cb99 100644 (file)
@@ -109,7 +109,8 @@ GeometryInfo<3>::unit_normal_orientation[GeometryInfo<3>::faces_per_cell]
 template <>
 unsigned int
 GeometryInfo<1>::child_cell_on_face (const unsigned int face,
-                                     const unsigned int subface)
+                                     const unsigned int subface,
+                                    const bool)
 {
   Assert (face<faces_per_cell, ExcIndexRange(face, 0, faces_per_cell));
   Assert (subface==subfaces_per_face, ExcIndexRange(subface, 0, 1));
@@ -122,7 +123,8 @@ GeometryInfo<1>::child_cell_on_face (const unsigned int face,
 template <>
 unsigned int
 GeometryInfo<2>::child_cell_on_face (const unsigned int face,
-                                     const unsigned int subface)
+                                     const unsigned int subface,
+                                    const bool)
 {
   Assert (face<faces_per_cell, ExcIndexRange(face, 0, faces_per_cell));
   Assert (subface<subfaces_per_face, ExcIndexRange(subface, 0, subfaces_per_face));
@@ -140,11 +142,13 @@ GeometryInfo<2>::child_cell_on_face (const unsigned int face,
 template <>
 unsigned int
 GeometryInfo<3>::child_cell_on_face (const unsigned int face,
-                                    const unsigned int subface)
+                                    const unsigned int subface,
+                                    const bool face_orientation)
 {
   Assert (face<faces_per_cell, ExcIndexRange(face, 0, faces_per_cell));
   Assert (subface<subfaces_per_face, ExcIndexRange(subface, 0, subfaces_per_face));
-  
+  static const unsigned int
+    flip[GeometryInfo<3>::subfaces_per_face] = { 0, 3, 2, 1 };
   static const unsigned
     subcells[faces_per_cell][subfaces_per_face] = {{0, 1, 2, 3},
                                                    {4, 5, 6, 7},
@@ -152,7 +156,7 @@ GeometryInfo<3>::child_cell_on_face (const unsigned int face,
                                                    {1, 5, 6, 2},
                                                    {3, 2, 6, 7},
                                                    {0, 4, 7, 3}};
-  return subcells[face][subface];
+  return face_orientation ? subcells[face][subface] : subcells[face][flip[subface]];
 }
 
 
@@ -208,7 +212,8 @@ GeometryInfo<3>::line_to_cell_vertices (const unsigned int line,
 template <>
 unsigned int
 GeometryInfo<3>::face_to_cell_lines (const unsigned int face,
-                                    const unsigned int line)
+                                    const unsigned int line,
+                                    const bool face_orientation)
 {
   Assert (face<faces_per_cell, ExcIndexRange(face, 0, faces_per_cell));
   Assert (line<lines_per_face, ExcIndexRange(line, 0, lines_per_face));
@@ -221,7 +226,7 @@ GeometryInfo<3>::face_to_cell_lines (const unsigned int face,
                                             {2,10, 6,11},
                                             {8, 7,11, 3}};
 
-  return lines[face][line];
+  return face_orientation ? lines[face][line] : lines[face][3-line];
 }
 
 
@@ -230,9 +235,10 @@ template <int dim>
 inline
 unsigned int
 GeometryInfo<dim>::face_to_cell_vertices (const unsigned int face,
-                                         const unsigned int vertex)
+                                         const unsigned int vertex,
+                                         const bool face_orientation)
 {
-  return child_cell_on_face(face, vertex);
+  return child_cell_on_face(face, vertex, face_orientation);
 }
 
 
index 9d44f1e4ac6c925ddc4368a95a951f39e3d1e18c..fa1119760356898fd4ffafeaa63c58b3014ce2f6 100644 (file)
@@ -6280,6 +6280,16 @@ Triangulation<3>::execute_refinement ()
                 new_hexes[GeometryInfo<dim>::child_cell_on_face(f,s)]
                   ->set_face_orientation(f, hex->face_orientation(f));
             
+#ifdef DEBUG
+                                            // check consistency
+                                            // against
+                                            // GeometryInfo<3>::child_cell_on_face
+           for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+             for (unsigned int s=0; s<GeometryInfo<dim>::subfaces_per_face; ++s) 
+               Assert(hex->face(f)->child(s)==hex->child(
+                 GeometryInfo<dim>::child_cell_on_face(
+                   f, s, hex->face_orientation(f)))->face(f), ExcInternalError());
+#endif
 
                                             /////////////////////////////////
                                             // now the only thing still
@@ -6431,19 +6441,12 @@ Triangulation<3>::execute_refinement ()
                              &&
                              hex->face_orientation(face));
                         
-                        static const unsigned int
-                          child_switch_table[GeometryInfo<dim>::subfaces_per_face]
-                          = { 0, 3, 2, 1 };
-                        
                        for (unsigned int c=0;
                             c<GeometryInfo<dim>::subfaces_per_face; ++c)
                          {
                            neighbor_cells[face][c]
                              = neighbor->child(GeometryInfo<dim>::
-                                                child_cell_on_face(nb_nb,
-                                                                   orient ?
-                                                                   c :
-                                                                   child_switch_table[c]));
+                                               child_cell_on_face(nb_nb, c, orient));
                            
                            Assert (neighbor_cells[face][c].state() ==
                                    IteratorState::valid,
index 99f21db64332b0596ab2e86dc2d82dc80fdab26f..40bf7421e775f605cc691265875c710070bb4c31 100644 (file)
@@ -2195,11 +2195,8 @@ neighbor_child_on_subface (const unsigned int face,
     = (this->neighbor(face)->face_orientation(neighbor_neighbor) ==
        this->face_orientation(face));
   const unsigned int neighbor_child_index
-    = (GeometryInfo<3>::
-       child_cell_on_face(neighbor_neighbor,
-                          (face_orientations_match ?
-                           subface :
-                           subface_translation[subface])));
+    = GeometryInfo<3>::child_cell_on_face(neighbor_neighbor, subface,
+                                         face_orientations_match);
   const TriaIterator<3,CellAccessor<3> > neighbor_child=
     this->neighbor(face)->child(neighbor_child_index);
 

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.