From: Wolfgang Bangerth Date: Tue, 26 Feb 2008 16:22:36 +0000 (+0000) Subject: New function TriaObjectAccessor::set_all_boundary_indicators. Use it in step-31. X-Git-Tag: v8.0.0~9367 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20166c53961b1045812c427efe5a496cdd8f012e;p=dealii.git New function TriaObjectAccessor::set_all_boundary_indicators. Use it in step-31. git-svn-id: https://svn.dealii.org/trunk@15791 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index d82eb7e96d..62082fdefb 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -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 * 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 - * dim<4. */ unsigned char boundary_indicator () const; @@ -874,6 +867,22 @@ class TriaObjectAccessor : public TriaAccessor * boundary_indicator() * 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 */ 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> * boundary_indicator() * 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> * boundary_indicator() * 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 diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index d3f628854b..0308461896 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -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 +void TriaObjectAccessor<1, dim>::set_all_boundary_indicators (const unsigned char boundary_ind) const +{ + set_boundary_indicator (boundary_ind); +} + + + template bool TriaObjectAccessor<1, dim>::at_boundary () const { @@ -573,6 +581,17 @@ void TriaObjectAccessor<2, dim>::set_boundary_indicator (const unsigned char bou +template +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 bool TriaObjectAccessor<2, dim>::at_boundary () const { @@ -1098,6 +1117,14 @@ void TriaObjectAccessor<3, dim>::set_boundary_indicator (const unsigned char) co +template +void TriaObjectAccessor<3, dim>::set_all_boundary_indicators (const unsigned char) const +{ + Assert (false, ExcImpossibleInDim(dim)); +} + + + template bool TriaObjectAccessor<3, dim>::at_boundary () const { diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 6e06d82d24..59fa1e3806 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -260,6 +260,16 @@ constraints individually.

deal.II

    +
  1. 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. +
    + (WB 2008/02/26) +

  2. +
  3. Improved: The tria pointer and the debug_output_grid function in GridIn are changed from private to protected to be accessible in derived classes. diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index 0310047b70..5ee2283241 100644 --- a/deal.II/examples/step-31/step-31.cc +++ b/deal.II/examples/step-31/step-31.cc @@ -1163,13 +1163,7 @@ void StokesProblem::run () cell != triangulation.end(); ++cell) for (unsigned int f=0; f::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::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