]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Made the default Manifold objects inside Triangulation be Manifold. Now get_boundary...
authorLuca Heltai <luca.heltai@sissa.it>
Mon, 28 Jul 2014 12:54:25 +0000 (14:54 +0200)
committerLuca Heltai <luca.heltai@gmail.com>
Wed, 6 Aug 2014 09:20:10 +0000 (11:20 +0200)
include/deal.II/grid/tria.h
include/deal.II/grid/tria_accessor.h
include/deal.II/grid/tria_accessor.templates.h
source/grid/tria.cc

index bbfac4779437d714f9e98cf92daa7b33033a3455..f2dabfed9e060aa0d2e51d8373be5bc924948f7f 100644 (file)
@@ -42,6 +42,7 @@ DEAL_II_NAMESPACE_OPEN
 
 template <int dim, int spacedim> class Boundary;
 template <int dim, int spacedim> class StraightBoundary;
+template <int dim, int spacedim> class Manifold;
 
 template <int, int, int> class TriaAccessor;
 template <int spacedim> class TriaAccessor<0,1,spacedim>;
@@ -1864,7 +1865,7 @@ public:
    * @see @ref GlossManifoldIndicator "Glossary entry on manifold indicators"
    */
   void set_manifold (const types::manifold_id   number,
-                     const Boundary<dim,spacedim> &manifold_object);
+                     const Manifold<dim,spacedim> &manifold_object);
 
     
   /**
@@ -1897,7 +1898,7 @@ public:
    *
    * @see @ref GlossManifoldIndicator "Glossary entry on manifold indicators"
    */    
-  const Boundary<dim,spacedim> &get_manifold (const types::manifold_id number) const;
+  const Manifold<dim,spacedim> &get_manifold (const types::manifold_id number) const;
 
   /**
    * Returns a vector containing all boundary indicators assigned to
@@ -3331,7 +3332,7 @@ private:
    *  Collection of manifold objects. We store only objects, which are
    *  not of type FlatManifold.
    */
-  std::map<types::manifold_id, SmartPointer<const Boundary<dim,spacedim> , Triangulation<dim, spacedim> > >  manifold;
+  std::map<types::manifold_id, SmartPointer<const Manifold<dim,spacedim> , Triangulation<dim, spacedim> > >  manifold;
 
 
   /**
index 122090bc63ddb8703b6a45083bde6d9ab713cbad..2f8c17fbdc5b898516d48311a32ee4fddfd4a124 100644 (file)
@@ -37,6 +37,7 @@ template <typename Accessor> class TriaIterator;
 template <typename Accessor> class TriaActiveIterator;
 
 template <int dim, int spacedim> class Boundary;
+template <int dim, int spacedim> class Manifold;
 
 
 namespace internal
@@ -1200,7 +1201,7 @@ public:
    * involves querying both the manifold or boundary indicators. See there
    * for more information.
    */
-  const Boundary<dim,spacedim> &get_manifold () const;
+  const Manifold<dim,spacedim> &get_manifold () const;
 
   /**
    * @}
index b208e361eb8f094bef124bb7470b957e0c5528f7..d6cda3e65f24810d15dfd5ae8335db77cd721832 100644 (file)
@@ -1912,13 +1912,28 @@ TriaAccessor<structdim, dim, spacedim>::at_boundary () const
 template <int structdim, int dim, int spacedim>
 const Boundary<dim,spacedim> &
 TriaAccessor<structdim, dim, spacedim>::get_boundary () const
-{
-  return get_manifold();
+{                                
+  Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed());
+  
+                                  // Get the default (manifold_id)
+  const types::manifold_id mi = this->objects().manifold_id[this->present_index];
+  
+                                  // In case this is not valid, check
+                                  // the boundary id, after having
+                                  // casted it to a manifold id
+  if(mi == numbers::invalid_manifold_id) 
+    return this->tria->get_boundary(structdim < dim ?
+                                   this->objects().boundary_or_material_id[this->present_index].boundary_id:
+                                   dim < spacedim ? 
+                                   this->objects().boundary_or_material_id[this->present_index].material_id:
+                                   numbers::invalid_manifold_id);
+  else
+    return this->tria->get_boundary(mi);
 }
 
 
 template <int structdim, int dim, int spacedim>
-const Boundary<dim,spacedim> &
+const Manifold<dim,spacedim> &
 TriaAccessor<structdim, dim, spacedim>::get_manifold () const
 {                                
   Assert (this->used(), TriaAccessorExceptions::ExcCellNotUsed());
index d7724a20828688dfa52bc232bd33bcf2403c15c6..afe95637c7dce9285097f6a8851c7916e236ea0d 100644 (file)
@@ -23,6 +23,7 @@
 #include <deal.II/grid/tria.h>
 #include <deal.II/grid/tria_levels.h>
 #include <deal.II/grid/tria_faces.h>
+#include <deal.II/grid/manifold.h>
 #include <deal.II/grid/tria_boundary.h>
 #include <deal.II/grid/tria_accessor.h>
 #include <deal.II/grid/tria_iterator.h>
@@ -4039,7 +4040,7 @@ namespace internal
 
                 // new vertex is placed on the surface according to
                 // the information stored in the boundary class
-               const Boundary<dim,spacedim> &manifold = cell->get_manifold();
+               const Manifold<dim,spacedim> &manifold = cell->get_manifold();
                
                 triangulation.vertices[next_unused_vertex] =
                   manifold.get_new_point_on_quad (cell);
@@ -8992,7 +8993,7 @@ Triangulation<dim, spacedim>::set_boundary (const types::manifold_id m_number,
 template <int dim, int spacedim>
 void
 Triangulation<dim, spacedim>::set_manifold (const types::manifold_id m_number,
-                                            const Boundary<dim, spacedim> &manifold_object)
+                                            const Manifold<dim, spacedim> &manifold_object)
 {
   Assert(m_number < numbers::invalid_manifold_id,
         ExcIndexRange(m_number,0,numbers::invalid_manifold_id));
@@ -9026,17 +9027,22 @@ template <int dim, int spacedim>
 const Boundary<dim,spacedim> &
 Triangulation<dim, spacedim>::get_boundary (const types::manifold_id m_number) const
 {
-  return get_manifold(m_number);
+  const Boundary<dim, spacedim> * man = 
+    dynamic_cast<const Boundary<dim, spacedim> *>(&get_manifold(m_number));
+  Assert(man != NULL,
+        ExcMessage("You tried to get a Boundary, but I only have a Manifold."));
+    
+  return *man;
 }
 
 
 template <int dim, int spacedim>
-const Boundary<dim,spacedim> &
+const Manifold<dim,spacedim> &
 Triangulation<dim, spacedim>::get_manifold (const types::manifold_id m_number) const
 {
                                   //look, if there is a manifold stored at
                                   //manifold_id number.
-  typename std::map<types::manifold_id, SmartPointer<const Boundary<dim,spacedim>, Triangulation<dim, spacedim> > >::const_iterator it
+  typename std::map<types::manifold_id, SmartPointer<const Manifold<dim,spacedim>, Triangulation<dim, spacedim> > >::const_iterator it
     = manifold.find(m_number);
 
   if (it != manifold.end())
@@ -9128,7 +9134,7 @@ copy_triangulation (const Triangulation<dim, spacedim> &old_tria)
   faces         = new internal::Triangulation::TriaFaces<dim>(*old_tria.faces);
 
   typename std::map<types::manifold_id,
-    SmartPointer<const Boundary<dim,spacedim> , Triangulation<dim, spacedim> > >::const_iterator
+    SmartPointer<const Manifold<dim,spacedim> , Triangulation<dim, spacedim> > >::const_iterator
   bdry_iterator = old_tria.manifold.begin();
   for (; bdry_iterator != old_tria.manifold.end() ; bdry_iterator++)
     manifold[bdry_iterator->first] = bdry_iterator->second;

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.