]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Invent function neighbor_child_on_subface. Add respective test.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 Oct 2003 19:46:59 +0000 (19:46 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 Oct 2003 19:46:59 +0000 (19:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@8102 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/dofs/dof_accessor.h
deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/include/grid/tria_accessor.templates.h
deal.II/deal.II/source/dofs/dof_accessor.cc
deal.II/deal.II/source/grid/tria_accessor.cc
tests/bits/Makefile
tests/bits/mesh_3d_15.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc2.95/bits/mesh_3d_15.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/mesh_3d_15.output [new file with mode: 0644]
tests/results/sparc-sun-solaris2.7+gcc2.95/bits/mesh_3d_15.output [new file with mode: 0644]

index ba7f4edcc8a122b05fa0582457e394dd7bb47e24..c008cdb9637b38baaaceebd460991bd2d60f604e 100644 (file)
@@ -1090,9 +1090,10 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
 {
   public:
                                     /**
-                                     * Declare the data type that this accessor
-                                     * class expects to get passed from the
-                                     * iterator classes.
+                                     * Declare the data type that
+                                     * this accessor class expects to
+                                     * get passed from the iterator
+                                     * classes.
                                      */
     typedef typename DoFObjectAccessor<dim, dim>::AccessorData AccessorData;
     
@@ -1105,21 +1106,25 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
                     const AccessorData       *local_data);
 
                                     /**
-                                     * Return the @p{i}th neighbor as a DoF cell
-                                     * iterator. This function is needed since
-                                     * the neighbor function of the base
-                                     * class returns a cell accessor without
-                                     * access to the DoF data.
+                                     * Return the @p{i}th neighbor as
+                                     * a DoF cell iterator. This
+                                     * function is needed since the
+                                     * neighbor function of the base
+                                     * class returns a cell accessor
+                                     * without access to the DoF
+                                     * data.
                                      */
     TriaIterator<dim,DoFCellAccessor<dim> >
     neighbor (const unsigned int) const;
 
                                     /**
-                                     * Return the @p{i}th child as a DoF cell
-                                     * iterator. This function is needed since
-                                     * the child function of the base
-                                     * class returns a cell accessor without
-                                     * access to the DoF data.
+                                     * Return the @p{i}th child as a
+                                     * DoF cell iterator. This
+                                     * function is needed since the
+                                     * child function of the base
+                                     * class returns a cell accessor
+                                     * without access to the DoF
+                                     * data.
                                      */
     TriaIterator<dim,DoFCellAccessor<dim> >
     child (const unsigned int) const;
@@ -1135,43 +1140,70 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
     face (const unsigned int i) const;
 
                                     /**
-                                     * Return the interpolation of the given
-                                     * finite element function to the present
-                                     * cell. In the simplest case, the cell
-                                     * is a terminal one, i.e. has no children;
-                                     * then, the returned value is the vector
-                                     * of nodal values on that cell. You could
-                                     * then as well get the desired values
-                                     * through the @p{get_dof_values} function
-                                     * In the other case, when the cell has
-                                     * children, we use the restriction
-                                     * matrices provided by the finite element
-                                     * class to compute the interpolation
-                                     * from the children to the present cell.
+                                     * Return the result of the
+                                     * @p{neighbor_child_on_subface}
+                                     * function of the base class,
+                                     * but convert it so that one can
+                                     * also access the DoF data (the
+                                     * function in the base class
+                                     * only returns an iterator with
+                                     * access to the triangulation
+                                     * data).
+                                     */
+    TriaIterator<dim,DoFCellAccessor<dim> >
+    neighbor_child_on_subface (const unsigned int face_no,
+                               const unsigned int subface_no) const;
+
+                                     /**
+                                     * Return the interpolation of
+                                     * the given finite element
+                                     * function to the present
+                                     * cell. In the simplest case,
+                                     * the cell is a terminal one,
+                                     * i.e. has no children; then,
+                                     * the returned value is the
+                                     * vector of nodal values on that
+                                     * cell. You could then as well
+                                     * get the desired values through
+                                     * the @p{get_dof_values}
+                                     * function In the other case,
+                                     * when the cell has children, we
+                                     * use the restriction matrices
+                                     * provided by the finite element
+                                     * class to compute the
+                                     * interpolation from the
+                                     * children to the present cell.
                                      *
-                                     * It is assumed that both vectors already
-                                     * have the right size beforehand. This
-                                     * function assumes the existence of an
-                                     * interpolation from child cells to the
-                                     * mother cell, denoted by the restriction
-                                     * matrices of the finite element class.
-                                     * Futhermore, this interpolation should
-                                     * be possible for each child alone, i.e.
-                                     * it should be possible to compute the
-                                     * restriction by writing values obtained
-                                     * from each child directly into the output
-                                     * vector, without, for example, computing
-                                     * an average over all children.
-                                     * These properties, however, do not exist
-                                     * for all elements; an example is the
-                                     * DG(0) element, which represents
-                                     * piecewise constant elements: for these
-                                     * the restriction to mother cell could
-                                     * be the average of the values of the
-                                     * children, maybe weighted by the measure
-                                     * of each child. It is not yet decided
-                                     * what the this function does in these
-                                     * cases.
+                                     * It is assumed that both
+                                     * vectors already have the right
+                                     * size beforehand. This function
+                                     * assumes the existence of an
+                                     * interpolation from child cells
+                                     * to the mother cell, denoted by
+                                     * the restriction matrices of
+                                     * the finite element class.
+                                     * Futhermore, this interpolation
+                                     * should be possible for each
+                                     * child alone, i.e.  it should
+                                     * be possible to compute the
+                                     * restriction by writing values
+                                     * obtained from each child
+                                     * directly into the output
+                                     * vector, without, for example,
+                                     * computing an average over all
+                                     * children.  These properties,
+                                     * however, do not exist for all
+                                     * elements; an example is the
+                                     * DG(0) element, which
+                                     * represents piecewise constant
+                                     * elements: for these the
+                                     * restriction to mother cell
+                                     * could be the average of the
+                                     * values of the children, maybe
+                                     * weighted by the measure of
+                                     * each child. It is not yet
+                                     * decided what the this function
+                                     * does in these cases.
                                      *
                                      * Unlike the @p{get_dof_values}
                                      * function, this function is
@@ -1187,57 +1219,73 @@ class DoFCellAccessor :  public DoFObjectAccessor<dim, dim>
                                      Vector<number>    &interpolated_values) const;
 
                                     /**
-                                     * This, again, is the counterpart to
-                                     * @p{get_interpolated_dof_values}: you
-                                     * specify the dof values on a cell and
-                                     * these are interpolated to the children
-                                     * of the present cell and set on the
-                                     * terminal cells.
+                                     * This, again, is the
+                                     * counterpart to
+                                     * @p{get_interpolated_dof_values}:
+                                     * you specify the dof values on
+                                     * a cell and these are
+                                     * interpolated to the children
+                                     * of the present cell and set on
+                                     * the terminal cells.
                                      *
-                                     * In principle, it works as follows: if
-                                     * the cell pointed to by this object is
-                                     * terminal, then the dof values are set
-                                     * in the global data vector by calling
-                                     * the @p{set_dof_values} function;
-                                     * otherwise, the values are prolonged
-                                     * to each of the children and this
-                                     * function is called for each of them.
+                                     * In principle, it works as
+                                     * follows: if the cell pointed
+                                     * to by this object is terminal,
+                                     * then the dof values are set in
+                                     * the global data vector by
+                                     * calling the @p{set_dof_values}
+                                     * function; otherwise, the
+                                     * values are prolonged to each
+                                     * of the children and this
+                                     * function is called for each of
+                                     * them.
                                      *
-                                     * Using the @p{get_interpolated_dof_values}
-                                     * and this function, you can compute the
-                                     * interpolation of a finite element
-                                     * function to a coarser grid by first
-                                     * getting the interpolated solution on a
-                                     * cell of the coarse grid and afterwards
-                                     * redistributing it using this function.
+                                     * Using the
+                                     * @p{get_interpolated_dof_values}
+                                     * and this function, you can
+                                     * compute the interpolation of a
+                                     * finite element function to a
+                                     * coarser grid by first getting
+                                     * the interpolated solution on a
+                                     * cell of the coarse grid and
+                                     * afterwards redistributing it
+                                     * using this function.
                                      *
-                                     * Note that for continuous finite
-                                     * elements, calling this function affects
-                                     * the dof values on neighboring cells as
-                                     * well. It may also violate continuity
-                                     * requirements for hanging nodes, if
-                                     * neighboring cells are less refined than
-                                     * the present one, or if their children are
-                                     * less refined than the children of this
-                                     * cell. These requirements
-                                     * are not taken care of and must be
-                                     * enforced by the user afterwards.
+                                     * Note that for continuous
+                                     * finite elements, calling this
+                                     * function affects the dof
+                                     * values on neighboring cells as
+                                     * well. It may also violate
+                                     * continuity requirements for
+                                     * hanging nodes, if neighboring
+                                     * cells are less refined than
+                                     * the present one, or if their
+                                     * children are less refined than
+                                     * the children of this
+                                     * cell. These requirements are
+                                     * not taken care of and must be
+                                     * enforced by the user
+                                     * afterwards.
                                      *
-                                     * It is assumed that both vectors already
-                                     * have the right size beforehand. This
-                                     * function relies on the existence of a
-                                     * natural interpolation property of
-                                     * finite element spaces of a cell to
-                                     * its children, denoted by the
-                                     * prolongation matrices of finite element
-                                     * classes. For some elements, the spaces
-                                     * on coarse and fine grids are not nested,
-                                     * in which case the interpolation to a
-                                     * child is not the identity; refer to the
-                                     * documentation of the respective finite
-                                     * element class for a description of what
-                                     * the prolongation matrices represent in
-                                     * this case.
+                                     * It is assumed that both
+                                     * vectors already have the right
+                                     * size beforehand. This function
+                                     * relies on the existence of a
+                                     * natural interpolation property
+                                     * of finite element spaces of a
+                                     * cell to its children, denoted
+                                     * by the prolongation matrices
+                                     * of finite element classes. For
+                                     * some elements, the spaces on
+                                     * coarse and fine grids are not
+                                     * nested, in which case the
+                                     * interpolation to a child is
+                                     * not the identity; refer to the
+                                     * documentation of the
+                                     * respective finite element
+                                     * class for a description of
+                                     * what the prolongation matrices
+                                     * represent in this case.
                                      *
                                      * Unlike the @p{set_dof_values}
                                      * function, this function is
index 90e15c57893bd76d64bac6780ba7b86c529bf547..664687eab90bc8dedf4056683e527207dc4142af 100644 (file)
@@ -84,11 +84,7 @@ class TriaAccessor
     TriaAccessor (const Triangulation<dim> *parent =  0,
                  const int                 level  = -1,
                  const int                 index  = -1,
-                 const AccessorData       *       =  0)
-                    :
-                   present_level (level),
-                   present_index (index),
-                   tria (parent) {};
+                 const AccessorData       *       =  0);
 
                                     /**
                                      *  Copy operator. Since this is
@@ -297,10 +293,7 @@ class TriaObjectAccessor :  public TriaAccessor<dim>
     TriaObjectAccessor (const Triangulation<dim> *parent     =  0,
                        const int                 level      = -1,
                        const int                 index      = -1,
-                       const AccessorData       *local_data =  0)
-                    :
-                   TriaAccessor<dim> (parent, level, index, local_data)
-      {};
+                       const AccessorData       *local_data =  0);
 
                                     /**
                                      * Copy the data of a line. Only
@@ -815,10 +808,7 @@ class TriaObjectAccessor<1, dim> :  public TriaAccessor<dim>
     TriaObjectAccessor (const Triangulation<dim> *parent     =  0,
                        const int                 level      = -1,
                        const int                 index      = -1,
-                       const AccessorData       *local_data =  0)
-                    :
-                   TriaAccessor<dim> (parent, level, index, local_data)
-      {};
+                       const AccessorData       *local_data =  0);
 
                                     /**
                                      *  Copy the data of the given
@@ -1252,10 +1242,7 @@ class TriaObjectAccessor<2, dim> :  public TriaAccessor<dim>
     TriaObjectAccessor (const Triangulation<dim> *parent     =  0,
                        const int                 level      = -1,
                        const int                 index      = -1,
-                       const AccessorData       *local_data =  0)
-                    :
-                   TriaAccessor<dim> (parent, level, index, local_data)
-      {};
+                       const AccessorData       *local_data =  0);
 
                                     /**
                                      *  Copy the data of the given quad.
@@ -1742,10 +1729,7 @@ class TriaObjectAccessor<3, dim> :  public TriaAccessor<dim>
     TriaObjectAccessor (const Triangulation<dim> *parent     =  0,
                        const int                 level      = -1,
                        const int                 index      = -1,
-                       const AccessorData       *local_data =  0)
-                    :
-                   TriaAccessor<dim> (parent, level, index, local_data)
-      {};
+                       const AccessorData       *local_data =  0);
 
                                     /**
                                      *  Copy the data of the given
@@ -2258,10 +2242,7 @@ class CellAccessor :  public TriaObjectAccessor<dim,dim>
     CellAccessor (const Triangulation<dim> *parent     =  0,
                  const int                 level      = -1,
                  const int                 index      = -1,
-                 const AccessorData       *local_data =  0)
-                    :
-                   TriaObjectAccessor<dim,dim> (parent, level, index, local_data)
-      {};
+                 const AccessorData       *local_data =  0);
 
                                     /**
                                      *  Return a pointer to the
@@ -2440,6 +2421,48 @@ class CellAccessor :  public TriaObjectAccessor<dim,dim>
                                      */
     TriaIterator<dim,TriaObjectAccessor<dim-1, dim> >
     face (const unsigned int i) const;
+
+                                     /**
+                                      * Return an iterator to that
+                                      * cell that neighbors the
+                                      * present cell on the given face
+                                      * and subface number.
+                                      *
+                                      * To succeed, the present cell
+                                      * must not be further refined,
+                                      * and the neighbor on the given
+                                      * face must be further refined
+                                      * exactly once; the returned
+                                      * cell is then a child of that
+                                      * neighbor.
+                                      *
+                                      * The function may not be called
+                                      * in 1d, since there we have no
+                                      * subfaces.  The implementation
+                                      * of this function is rather
+                                      * straightforward in 2d, by
+                                      * first determining which face
+                                      * of the neighbor cell the
+                                      * present cell is bordering on
+                                      * (this is what the
+                                      * @p{neighbor_of_neighbor}
+                                      * function does), and then
+                                      * asking
+                                      * @p{GeometryInfo::child_cell_on_subface}
+                                      * for the index of the
+                                      * child. However, the function
+                                      * is more complicated in 3d,
+                                      * since there faces may have
+                                      * more than one orientation, and
+                                      * we have to use
+                                      * @p{face_orientation} for both
+                                      * this and the neighbor cell to
+                                      * figure out which cell we want
+                                      * to have.
+                                      */
+    TriaIterator<dim,CellAccessor<dim> >
+    neighbor_child_on_subface (const unsigned int face_no,
+                               const unsigned int subface_no) const;
     
                                     /**
                                      * Return the material id of this
@@ -2563,6 +2586,19 @@ template <> bool CellAccessor<3>::point_inside (const Point<3> &) const;
 
 template <> bool CellAccessor<1>::has_boundary_lines () const;
 
+template <>
+TriaIterator<1,CellAccessor<1> >
+CellAccessor<1>::neighbor_child_on_subface (const unsigned int,
+                                            const unsigned int) const;
+template <>
+TriaIterator<2,CellAccessor<2> >
+CellAccessor<2>::neighbor_child_on_subface (const unsigned int,
+                                            const unsigned int) const;
+template <>
+TriaIterator<3,CellAccessor<3> >
+CellAccessor<3>::neighbor_child_on_subface (const unsigned int,
+                                            const unsigned int) const;
+
 template <> double TriaObjectAccessor<2, 2>::measure () const;
 template <> double TriaObjectAccessor<2, 3>::measure () const;
 template <> double TriaObjectAccessor<3, 3>::measure () const;
index 7eb16fed5cb639e9559e3b263d9ac2bf8f1fa34b..d70059e6b985efa326b88d688844c09e010c0d22 100644 (file)
 
 /*------------------------ Functions: TriaAccessor ---------------------------*/
 
+template <int dim>
+inline
+TriaAccessor<dim>::TriaAccessor (const Triangulation<dim> *parent,
+                                 const int                 level,
+                                 const int                 index,
+                                 const AccessorData       *)
+                :
+                present_level (level),
+                present_index (index),
+                tria (parent)
+{}
+
+
 
 template <int dim>
 inline
@@ -114,6 +127,19 @@ TriaAccessor<dim>::get_triangulation () const
 /*------------------------ Functions: LineAccessor ---------------------------*/
 
 
+template <int dim>
+inline
+TriaObjectAccessor<1,dim>::
+TriaObjectAccessor (const Triangulation<dim> *parent,
+                    const int                 level,
+                    const int                 index,
+                    const AccessorData       *local_data)
+                :
+                TriaAccessor<dim> (parent, level, index, local_data)
+{}
+
+
+
 template <int dim>
 inline
 bool
@@ -281,6 +307,19 @@ TriaObjectAccessor<1,dim>::operator -- ()
 /*------------------------ Functions: QuadAccessor ---------------------------*/
 
 
+template <int dim>
+inline
+TriaObjectAccessor<2,dim>::
+TriaObjectAccessor (const Triangulation<dim> *parent,
+                    const int                 level,
+                    const int                 index,
+                    const AccessorData       *local_data)
+                :
+                TriaAccessor<dim> (parent, level, index, local_data)
+{}
+
+
+
 template <int dim>
 inline
 bool
@@ -477,6 +516,19 @@ TriaObjectAccessor<2,dim>::operator -- ()
 /*------------------------ Functions: HexAccessor ---------------------------*/
 
 
+template <int dim>
+inline
+TriaObjectAccessor<3,dim>::
+TriaObjectAccessor (const Triangulation<dim> *parent,
+                    const int                 level,
+                    const int                 index,
+                    const AccessorData       *local_data)
+                :
+                TriaAccessor<dim> (parent, level, index, local_data)
+{}
+
+
+
 template <int dim>
 inline
 bool
@@ -1054,6 +1106,19 @@ TriaObjectAccessor<celldim,dim>::operator -- ()
 /*------------------------ Functions: CellAccessor<dim> -----------------------*/
 
 
+template <int dim>
+inline
+CellAccessor<dim>::
+CellAccessor (const Triangulation<dim> *parent,
+              const int                 level,
+              const int                 index,
+              const AccessorData       *local_data)
+                :
+                TriaObjectAccessor<dim,dim> (parent, level, index, local_data)
+{}
+
+
+
 template <>
 inline
 TriaIterator<1,TriaObjectAccessor<0, 1> >
index b79f0fc1969656a516adedc96e2628851c50de77..952988c7d08a49b58001e515c97148ed3941ab42 100644 (file)
@@ -637,6 +637,24 @@ DoFCellAccessor<3>::face (const unsigned int i) const
 #endif
 
 
+
+template <int dim>
+inline
+TriaIterator<dim,DoFCellAccessor<dim> >
+DoFCellAccessor<dim>::
+neighbor_child_on_subface (const unsigned int face,
+                           const unsigned int subface) const
+{
+  const TriaIterator<dim,CellAccessor<dim> > q
+    = CellAccessor<dim>::neighbor_child_on_subface (face, subface);
+  return TriaIterator<dim,DoFCellAccessor<dim> > (this->tria,
+                                                  q->level (),
+                                                  q->index (),
+                                                  this->dof_handler);
+}
+
+
+
 template <int dim>
 template <class InputVector, typename number>
 void
index 0b69a294e8a0ef9a977b8cad93aa9dd5187f0c5d..dfc23cb812f67544c6ea9316467bd4acf94ca602 100644 (file)
@@ -2122,6 +2122,93 @@ bool CellAccessor<dim>::has_boundary_lines () const
 
 #endif
 
+#if deal_II_dimension == 1
+
+template <>
+inline
+TriaIterator<1,CellAccessor<1> >
+CellAccessor<1>::
+neighbor_child_on_subface (const unsigned int,
+                           const unsigned int) const
+{
+  Assert (false, ExcNotImplemented());
+}
+
+#endif
+
+#if deal_II_dimension == 2
+
+template <>
+inline
+TriaIterator<2,CellAccessor<2> >
+CellAccessor<2>::
+neighbor_child_on_subface (const unsigned int face,
+                           const unsigned int subface) const
+{
+  Assert (!this->has_children(),
+          ExcMessage ("The present cell must not have children!"));
+  Assert (!this->at_boundary(face),
+          ExcMessage ("The present cell must have a valid neighbor!"));
+  Assert (this->neighbor(face)->level() == this->level(),
+          ExcMessage ("The neighbor must be on the same level as this cell!"));
+  Assert (this->neighbor(face)->has_children() == true,
+          ExcMessage ("The neighbor must have children!"));
+
+  const unsigned int neighbor_neighbor
+    = this->neighbor_of_neighbor (face);
+  const unsigned int neighbor_child_index
+    = GeometryInfo<2>::child_cell_on_face(neighbor_neighbor,subface);
+
+  return this->neighbor(face)->child(neighbor_child_index);
+}
+
+#endif
+
+#if deal_II_dimension == 3
+
+template <>
+inline
+TriaIterator<3,CellAccessor<3> >
+CellAccessor<3>::
+neighbor_child_on_subface (const unsigned int face,
+                           const unsigned int subface) const
+{
+  Assert (!this->has_children(),
+          ExcMessage ("The present cell must not have children!"));
+  Assert (!this->at_boundary(face),
+          ExcMessage ("The present cell must have a valid neighbor!"));
+  Assert (this->neighbor(face)->level() == this->level(),
+          ExcMessage ("The neighbor must be on the same level as this cell!"));
+  Assert (this->neighbor(face)->has_children() == true,
+          ExcMessage ("The neighbor must have children!"));
+  
+  static const unsigned int subface_translation[4]
+    = { 0, 3, 2, 1 };
+                                   // see whether face and
+                                   // the neighbor's
+                                   // counterface share the
+                                   // same indexing of
+                                   // children. if not so,
+                                   // translate child
+                                   // indices
+  const unsigned int neighbor_neighbor
+    = this->neighbor_of_neighbor (face);
+  const bool face_orientations_match
+    = (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])));
+
+  return this->neighbor(face)->child(neighbor_child_index);
+}
+
+#endif
+
+
 
 // explicit instantiations
 template class TriaAccessor<deal_II_dimension>;
index ec69c44d8c11557a38876c7992c59a3d2e19d615..e423ca1505d2e182ffe5be3962483a69ec789034 100644 (file)
@@ -117,6 +117,7 @@ mesh_3d_11.exe          : mesh_3d_11.g.$(OBJEXT)           $(libraries)
 mesh_3d_12.exe          : mesh_3d_12.g.$(OBJEXT)           $(libraries)
 mesh_3d_13.exe          : mesh_3d_13.g.$(OBJEXT)           $(libraries)
 mesh_3d_14.exe          : mesh_3d_14.g.$(OBJEXT)           $(libraries)
+mesh_3d_15.exe          : mesh_3d_15.g.$(OBJEXT)           $(libraries)
 q_points.exe            : q_points.g.$(OBJEXT)             $(libraries)
 
 
@@ -149,7 +150,7 @@ tests = anna_1 anna_2 anna_3 anna_4 anna_5 anna_6 \
        hyper_ball_3d cylinder coarsening_3d \
        mesh_3d_1 mesh_3d_2 mesh_3d_3 mesh_3d_4 mesh_3d_5 \
        mesh_3d_6 mesh_3d_7 mesh_3d_8 mesh_3d_9 mesh_3d_10 \
-       mesh_3d_11 mesh_3d_12 mesh_3d_13 mesh_3d_14 \
+       mesh_3d_11 mesh_3d_12 mesh_3d_13 mesh_3d_14 mesh_3d_15 \
        q_points
 
 ############################################################
diff --git a/tests/bits/mesh_3d_15.cc b/tests/bits/mesh_3d_15.cc
new file mode 100644 (file)
index 0000000..44b0109
--- /dev/null
@@ -0,0 +1,146 @@
+//----------------------------  mesh_3d_15.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2003 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  mesh_3d_15.cc  ---------------------------
+
+
+// make sure TriaCellAccessor::neighbor_child_on_subface does what it
+// is supposed to do. check it for dof accessors, since they simply
+// call the tria accessors, and this way we catch both cases at the
+// same time
+
+#include "mesh_3d.h"
+
+#include <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <lac/vector.h>
+#include <grid/tria.h>
+#include <grid/tria_accessor.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_reordering.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_accessor.h>
+#include <fe/fe_q.h>
+
+#include <fstream>
+
+
+void check_this (Triangulation<3> &tria)
+{
+  FE_Q<3> fe(1);
+  
+  DoFHandler<3> dof_handler (tria);
+  dof_handler.distribute_dofs (fe);
+  
+  DoFHandler<3>::active_cell_iterator cell = dof_handler.begin_active();
+  for (; cell!=dof_handler.end(); ++cell)
+    for (unsigned int face_no=0; face_no<GeometryInfo<3>::faces_per_cell;
+         ++face_no)
+      if (!cell->at_boundary(face_no)
+          &&
+          cell->neighbor(face_no)->has_children())
+        for (unsigned int subface_no=0;
+             subface_no<GeometryInfo<3>::subfaces_per_face;
+             ++subface_no)
+          {
+                                             // get an iterator
+                                             // pointing to the cell
+                                             // behind the present
+                                             // subface
+            const DoFHandler<3>::cell_iterator
+              neighbor = cell->neighbor(face_no);
+            const unsigned int neighbor_neighbor
+              = cell->neighbor_of_neighbor (face_no);
+
+                                             // see whether face and
+                                             // the neighbor's
+                                             // counterface share the
+                                             // same indexing of
+                                             // children. if not so,
+                                             // translate child
+                                             // indices
+            const bool face_orientations_match
+              = (neighbor->face_orientation(neighbor_neighbor) ==
+                 cell->face_orientation(face_no));
+            static const unsigned int subface_translation[4]
+              = { 0, 3, 2, 1 };
+            const unsigned int neighbor_child_index
+              = (GeometryInfo<3>::
+                 child_cell_on_face(neighbor_neighbor,
+                                    (face_orientations_match ?
+                                     subface_no :
+                                     subface_translation[subface_no])));
+            const DoFHandler<3>::active_cell_iterator neighbor_child
+              = neighbor->child(neighbor_child_index);
+
+            Assert (neighbor_child ==
+                    cell->neighbor_child_on_subface (face_no,
+                                                     subface_no),
+                    ExcInternalError());
+          }
+}
+
+
+
+void check (Triangulation<3> &tria)
+{
+  (++tria.begin_active())->set_refine_flag ();
+  tria.execute_coarsening_and_refinement ();
+  
+  deallog << "Initial check" << std::endl;
+  check_this (tria);
+  
+  for (unsigned int r=0; r<3; ++r)
+    {
+      tria.refine_global (1);
+      deallog << "Check " << r << std::endl;
+      check_this (tria);
+    }
+
+  coarsen_global (tria);
+  deallog << "Check " << 1 << std::endl;
+  check_this (tria);
+  
+  tria.refine_global (1);
+  deallog << "Check " << 2 << std::endl;
+  check_this (tria);
+}
+
+
+int main () 
+{
+  std::ofstream logfile("mesh_3d_15.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  {  
+    Triangulation<3> coarse_grid;
+    create_two_cubes (coarse_grid);
+    check (coarse_grid);
+  }
+  
+  {  
+    Triangulation<3> coarse_grid;
+    create_L_shape (coarse_grid);
+    check (coarse_grid);
+  }
+  
+  {  
+    Triangulation<3> coarse_grid;
+    GridGenerator::hyper_ball (coarse_grid);
+    check (coarse_grid);
+  }
+  
+}
+
+  
+  
diff --git a/tests/results/i686-pc-linux-gnu+gcc2.95/bits/mesh_3d_15.output b/tests/results/i686-pc-linux-gnu+gcc2.95/bits/mesh_3d_15.output
new file mode 100644 (file)
index 0000000..0b20bdf
--- /dev/null
@@ -0,0 +1,19 @@
+
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/mesh_3d_15.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/mesh_3d_15.output
new file mode 100644 (file)
index 0000000..0b20bdf
--- /dev/null
@@ -0,0 +1,19 @@
+
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
diff --git a/tests/results/sparc-sun-solaris2.7+gcc2.95/bits/mesh_3d_15.output b/tests/results/sparc-sun-solaris2.7+gcc2.95/bits/mesh_3d_15.output
new file mode 100644 (file)
index 0000000..0b20bdf
--- /dev/null
@@ -0,0 +1,19 @@
+
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Initial check
+DEAL::Check 0
+DEAL::Check 1
+DEAL::Check 2
+DEAL::Check 1
+DEAL::Check 2

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.