]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
recursively_set_material_id
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Sep 2003 19:39:53 +0000 (19:39 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Sep 2003 19:39:53 +0000 (19:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@7956 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/c-4-0.html

index 028897130a01800b2da530625e06a402d6444afd..908f9632d4bd2a849b938ce34a627c59ee5be44e 100644 (file)
@@ -2336,6 +2336,14 @@ class CellAccessor :  public TriaObjectAccessor<dim,dim>
                                      */
     void set_material_id (const unsigned char new_material_id) const;
 
+                                    /**
+                                     * Set the material id of this
+                                     * cell and all its children (and
+                                     * grand-children, and so on) to
+                                     * the given value.
+                                     */
+    void recursively_set_material_id (const unsigned char new_material_id) const;
+
                                     /**
                                      * Return the subdomain id of
                                      * this cell.
@@ -2423,14 +2431,17 @@ template <> Point<3> TriaObjectAccessor<3, 3>::barycenter () const;
 template <> bool CellAccessor<1>::at_boundary () const;
 template <> unsigned char CellAccessor<1>::material_id () const;
 template <> void CellAccessor<1>::set_material_id (const unsigned char mat_id) const;
+template <> void CellAccessor<1>::recursively_set_material_id (const unsigned char mat_id) const;
 template <> bool CellAccessor<1>::point_inside (const Point<1> &p) const;
 template <> bool CellAccessor<2>::at_boundary () const;
 template <> unsigned char CellAccessor<2>::material_id () const;
 template <> void CellAccessor<2>::set_material_id (const unsigned char mat_id) const;
+template <> void CellAccessor<2>::recursively_set_material_id (const unsigned char mat_id) const;
 template <> bool CellAccessor<2>::point_inside (const Point<2> &p) const;
 template <> bool CellAccessor<3>::at_boundary () const;
 template <> unsigned char CellAccessor<3>::material_id () const;
 template <> void CellAccessor<3>::set_material_id (const unsigned char mat_id) const;
+template <> void CellAccessor<3>::recursively_set_material_id (const unsigned char mat_id) const;
 template <> bool CellAccessor<3>::point_inside (const Point<3> &) const;
 
 template <> bool CellAccessor<1>::has_boundary_lines () const;
index c8762ebdc7b28b2d3e3dc271512651e74332a4e0..84b110f2ab3a607cd9e17731cbfe8d0cdbec20cf 100644 (file)
@@ -1657,6 +1657,19 @@ void CellAccessor<1>::set_material_id (const unsigned char mat_id) const
 }
 
 
+
+template <>
+void CellAccessor<1>::recursively_set_material_id (const unsigned char mat_id) const
+{
+  set_material_id (mat_id);
+
+  if (has_children())
+    for (unsigned int c=0; c<2; ++c)
+      child(c)->recursively_set_material_id (mat_id);
+}
+
+
+
 template <>
 bool CellAccessor<1>::point_inside (const Point<1> &p) const
 {
@@ -1664,6 +1677,7 @@ bool CellAccessor<1>::point_inside (const Point<1> &p) const
 }
 
 
+
 template <>
 std::pair<unsigned int, unsigned int>
 CellAccessor<1>::neighbor_of_coarser_neighbor (const unsigned int) const
@@ -1709,6 +1723,18 @@ void CellAccessor<2>::set_material_id (const unsigned char mat_id) const
 
 
 
+template <>
+void CellAccessor<2>::recursively_set_material_id (const unsigned char mat_id) const
+{
+  set_material_id (mat_id);
+
+  if (has_children())
+    for (unsigned int c=0; c<4; ++c)
+      child(c)->recursively_set_material_id (mat_id);
+}
+
+
+
 template <>
 bool CellAccessor<2>::point_inside (const Point<2> &p) const
 {
@@ -1782,8 +1808,6 @@ unsigned char CellAccessor<3>::material_id () const
   return this->tria->levels[this->present_level]->hexes.material_id[this->present_index];
 }
 
-
-
 template <>
 void CellAccessor<3>::set_material_id (const unsigned char mat_id) const
 {
@@ -1794,7 +1818,19 @@ void CellAccessor<3>::set_material_id (const unsigned char mat_id) const
 
 
 template <>
-bool CellAccessor<3>::point_inside (const Point<3> &) const
+void CellAccessor<3>::recursively_set_material_id (const unsigned char mat_id) const
+{
+  set_material_id (mat_id);
+
+  if (has_children())
+    for (unsigned int c=0; c<8; ++c)
+      child(c)->recursively_set_material_id (mat_id);
+}
+
+
+
+template <>
+bool CellAccessor<3>::point_inside (const Point<3> &p) const
 {
   Assert (false, ExcNotImplemented() );
   return false;
index 3cdb402966decd29859e5c6df0ade3b1d21fbcda..7037cf8cff77a8788b73a8047dae969632542bc8 100644 (file)
@@ -150,6 +150,14 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p> New: The <code class="class">TriaAccessor</code>::<code
+       class="member">recursively_set_material_id</code> function sets
+       the material id of the present cell and of all its children,
+       grandchildren, etc to the given value.
+       <br>
+       (WB 2002/09/04)
+       </p>
+
   <li> <p> New: The new <code class="class">FETools</code>::<code
        class="member">get_fe_from_name</code> function can do the
        reverse of the <code class="class">FiniteElement</code>::<code

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.