]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New function TriaObjectAccessor::set_all_boundary_indicators. Use it in step-31.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Feb 2008 16:22:36 +0000 (16:22 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Feb 2008 16:22:36 +0000 (16:22 +0000)
git-svn-id: https://svn.dealii.org/trunk@15791 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/source/grid/tria_accessor.cc
deal.II/doc/news/changes.h
deal.II/examples/step-31/step-31.cc

index d82eb7e96d6124856f2068bba399400e4229c1cd..62082fdefbc592707f9aa502745b3b6baf797c41 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -858,13 +858,6 @@ class TriaObjectAccessor :  public TriaAccessor<celldim,dim>
                                      * object.  If the return value
                                      * is 255, then this line is in
                                      * the interior of the domain.
-                                     *
-                                     * Since boundary data is only
-                                     * useful for structures with a
-                                     * dimension less than the
-                                     * dimension of a cell, this
-                                     * function issues an error if
-                                     * <tt>dim<4</tt>.
                                      */
     unsigned char boundary_indicator () const;
 
@@ -874,6 +867,22 @@ class TriaObjectAccessor :  public TriaAccessor<celldim,dim>
                                      * <tt>boundary_indicator()</tt>
                                      * function.
                                      *
+                                     * Note that it only sets the
+                                     * boundary object of the current
+                                     * object itself, not the
+                                     * indicators of the ones that
+                                     * bound it. For example, in 3d,
+                                     * if this function is called on
+                                     * a face, then the boundary
+                                     * indicator of the 4 edges that
+                                     * bound the face remain
+                                     * unchanged. If you want to set
+                                     * the boundary indicators of
+                                     * face and edges at the same
+                                     * time, use the
+                                     * set_all_boundary_indicators()
+                                     * function.
+                                     *
                                      * Caution: Never set the
                                      * boundary indicator to 255,
                                      * unless you exactly know what
@@ -887,6 +896,24 @@ class TriaObjectAccessor :  public TriaAccessor<celldim,dim>
                                      */
     void set_boundary_indicator (const unsigned char) const;
 
+                                    /**
+                                     * Do as set_boundary_indicator()
+                                     * but also set the boundary
+                                     * indicators of the objects that
+                                     * bound the current object. For
+                                     * example, in 3d, if
+                                     * set_boundary_indicator() is
+                                     * called on a face, then the
+                                     * boundary indicator of the 4
+                                     * edges that bound the face
+                                     * remain unchanged. On the other
+                                     * hand, the boundary indicators
+                                     * of face and edges are all set
+                                     * at the same time using the
+                                     * current function.
+                                     */
+    void set_all_boundary_indicators (const unsigned char) const;
+    
                                     /**
                                      * Return whether this object is
                                      * at the boundary. This is
@@ -1565,6 +1592,24 @@ class TriaObjectAccessor<1, dim> :  public TriaAccessor<1,dim>
                                      */
     void set_boundary_indicator (const unsigned char) const;
 
+                                    /**
+                                     * Do as set_boundary_indicator()
+                                     * but also set the boundary
+                                     * indicators of the objects that
+                                     * bound the current object. For
+                                     * example, in 3d, if
+                                     * set_boundary_indicator() is
+                                     * called on a face, then the
+                                     * boundary indicator of the 4
+                                     * edges that bound the face
+                                     * remain unchanged. On the other
+                                     * hand, the boundary indicators
+                                     * of face and edges are all set
+                                     * at the same time using the
+                                     * current function.
+                                     */
+    void set_all_boundary_indicators (const unsigned char) const;
+
                                     /**
                                      * Return whether this line is at
                                      * the boundary. This is checked
@@ -2184,6 +2229,22 @@ class TriaObjectAccessor<2, dim> :  public TriaAccessor<2,dim>
                                      * <tt>boundary_indicator()</tt>
                                      * function.
                                      *
+                                     * Note that it only sets the
+                                     * boundary object of the current
+                                     * object itself, not the
+                                     * indicators of the ones that
+                                     * bound it. For example, in 3d,
+                                     * if this function is called on
+                                     * a face, then the boundary
+                                     * indicator of the 4 edges that
+                                     * bound the face remain
+                                     * unchanged. If you want to set
+                                     * the boundary indicators of
+                                     * face and edges at the same
+                                     * time, use the
+                                     * set_all_boundary_indicators()
+                                     * function.
+                                     *
                                      * You should be careful with
                                      * this function and especially
                                      * never try to set the boundary
@@ -2199,6 +2260,24 @@ class TriaObjectAccessor<2, dim> :  public TriaAccessor<2,dim>
                                      */
     void set_boundary_indicator (const unsigned char) const;
 
+                                    /**
+                                     * Do as set_boundary_indicator()
+                                     * but also set the boundary
+                                     * indicators of the objects that
+                                     * bound the current object. For
+                                     * example, in 3d, if
+                                     * set_boundary_indicator() is
+                                     * called on a face, then the
+                                     * boundary indicator of the 4
+                                     * edges that bound the face
+                                     * remain unchanged. On the other
+                                     * hand, the boundary indicators
+                                     * of face and edges are all set
+                                     * at the same time using the
+                                     * current function.
+                                     */
+    void set_all_boundary_indicators (const unsigned char) const;
+
                                     /**
                                      * Return whether this quad is at
                                      * the boundary. This is checked
@@ -2857,6 +2936,22 @@ class TriaObjectAccessor<3, dim> :  public TriaAccessor<3,dim>
                                      * <tt>boundary_indicator()</tt>
                                      * function.
                                      *
+                                     * Note that it only sets the
+                                     * boundary object of the current
+                                     * object itself, not the
+                                     * indicators of the ones that
+                                     * bound it. For example, in 3d,
+                                     * if this function is called on
+                                     * a face, then the boundary
+                                     * indicator of the 4 edges that
+                                     * bound the face remain
+                                     * unchanged. If you want to set
+                                     * the boundary indicators of
+                                     * face and edges at the same
+                                     * time, use the
+                                     * set_all_boundary_indicators()
+                                     * function.
+                                     *
                                      * You should be careful with
                                      * this function and especially
                                      * never try to set the boundary
@@ -2872,6 +2967,24 @@ class TriaObjectAccessor<3, dim> :  public TriaAccessor<3,dim>
                                      */
     void set_boundary_indicator (const unsigned char) const;
 
+                                    /**
+                                     * Do as set_boundary_indicator()
+                                     * but also set the boundary
+                                     * indicators of the objects that
+                                     * bound the current object. For
+                                     * example, in 3d, if
+                                     * set_boundary_indicator() is
+                                     * called on a face, then the
+                                     * boundary indicator of the 4
+                                     * edges that bound the face
+                                     * remain unchanged. On the other
+                                     * hand, the boundary indicators
+                                     * of face and edges are all set
+                                     * at the same time using the
+                                     * current function.
+                                     */
+    void set_all_boundary_indicators (const unsigned char) const;
+
                                     /**
                                      * Return whether this hex is at
                                      * the boundary. This is checked
index d3f628854b898b30719f79a6c35a739d16dfea73..03084618967f4813a66605df391ebdd6ff9a0755 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -266,6 +266,14 @@ void TriaObjectAccessor<1, dim>::set_boundary_indicator (const unsigned char bou
 
 
 
+template <int dim>
+void TriaObjectAccessor<1, dim>::set_all_boundary_indicators (const unsigned char boundary_ind) const
+{
+  set_boundary_indicator (boundary_ind);
+}
+
+
+
 template <int dim>
 bool TriaObjectAccessor<1, dim>::at_boundary () const
 {
@@ -573,6 +581,17 @@ void TriaObjectAccessor<2, dim>::set_boundary_indicator (const unsigned char bou
 
 
 
+template <int dim>
+void TriaObjectAccessor<2, dim>::set_all_boundary_indicators (const unsigned char boundary_ind) const
+{
+  set_boundary_indicator (boundary_ind);
+
+  for (unsigned int i=0; i<4; ++i)
+    this->line(i)->set_boundary_indicator (boundary_ind);
+}
+
+
+
 template <int dim>
 bool TriaObjectAccessor<2, dim>::at_boundary () const
 {
@@ -1098,6 +1117,14 @@ void TriaObjectAccessor<3, dim>::set_boundary_indicator (const unsigned char) co
 
 
 
+template <int dim>
+void TriaObjectAccessor<3, dim>::set_all_boundary_indicators (const unsigned char) const
+{
+  Assert (false, ExcImpossibleInDim(dim));
+}
+
+
+
 template <int dim>
 bool TriaObjectAccessor<3, dim>::at_boundary () const
 {
index 6e06d82d2495432703c644c4dbcca5bf633d8db5..59fa1e3806d499c449fe0f781a2928e27db1edd7 100644 (file)
@@ -260,6 +260,16 @@ constraints individually.
 <h3>deal.II</h3>
 
 <ol> 
+  <li> <p>New: The new TriaObjectAccessor::set_all_boundary_indicators function
+  does not only set the boundary indicator of the current object but of all that
+  bound it as well. For example, in 3d, if TriaObjectAccessor::set_boundary_indicator
+  is called on a face, then the boundary indicator of the 4 edges that bound the face
+  remain unchanged. On the other hand, the boundary indicators of face and edges are
+  all set at the same time using the new function.
+  <br>
+  (WB 2008/02/26)
+  </p></li>
+
 
   <li> <p>Improved: The tria pointer and the debug_output_grid function in GridIn
   are changed from private to protected to be accessible in derived classes.
index 0310047b703ca1996c457cbfbda84e4d8aa70a61..5ee22832416f3af7fa2632e15a375405e7dc6033 100644 (file)
@@ -1163,13 +1163,7 @@ void StokesProblem<dim>::run ()
        cell != triangulation.end(); ++cell)
     for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
       if (cell->face(f)->center()[dim-1] == 0)
-       {
-         cell->face(f)->set_boundary_indicator(1);
-                                          /*
-                                            for (unsigned int e=0; e<GeometryInfo<dim>::lines_per_face; ++e)
-                                            cell->face(f)->line(e)->set_boundary_indicator (1);
-                                          */
-       }
+       cell->face(f)->set_all_boundary_indicators(1);
   
   
                                   // We then apply an initial

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.