]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add pseudo-functionality to 0-dim TriaAccessor and remove specialization for GridGene...
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 9 Nov 2010 20:22:29 +0000 (20:22 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 9 Nov 2010 20:22:29 +0000 (20:22 +0000)
git-svn-id: https://svn.dealii.org/trunk@22657 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/grid/grid_generator.h
deal.II/include/deal.II/grid/tria_accessor.h
deal.II/source/grid/grid_generator.cc

index ac9443ed479f950b8d2ed12885463099ec17e220..c5a347b1ccc632d9203e0bf045756f8d64cc8b25 100644 (file)
@@ -794,17 +794,7 @@ class GridGenerator
     static
     void
     colorize_hyper_rectangle (Triangulation<dim,spacedim> &tria);
-
-                                    /**
-                                     * Same function as above for
-                                     * 1d. This function is not
-                                     * implemented.
-                                     */
-    template <int spacedim>
-    static
-    void
-    colorize_hyper_rectangle (Triangulation<1,spacedim> &tria);
-
+    
                                     /**
                                      * Perform the action specified
                                      * by the @p colorize flag of
index 9a60c48f80ccef76e955c43c53938d1a7a5cbecf..90f43c5bf192e2fbf5358e892e7db339405f63e0 100644 (file)
@@ -1602,7 +1602,7 @@ class TriaAccessor<0, dim, spacedim> : public TriaAccessorBase<0,dim, spacedim>
                     :
                    TriaAccessorBase<0,dim, spacedim> (parent, level, index, local_data)
       {
-       Assert (false, ExcInternalError());
+       Assert(false, ExcImpossibleInDim(0));
       }
 
                                     /**
@@ -1613,7 +1613,7 @@ class TriaAccessor<0, dim, spacedim> : public TriaAccessorBase<0,dim, spacedim>
     template <int structdim2, int dim2, int spacedim2>
     TriaAccessor (const TriaAccessor<structdim2,dim2,spacedim2> &)
       {
-       Assert (false, ExcInternalError());
+       Assert(false, ExcImpossibleInDim(0));
       }
 
                                     /**
@@ -1624,37 +1624,284 @@ class TriaAccessor<0, dim, spacedim> : public TriaAccessorBase<0,dim, spacedim>
     template <int structdim2, int dim2, int spacedim2>
     TriaAccessor (const InvalidAccessor<structdim2,dim2,spacedim2> &)
       {
-       Assert (false, ExcInternalError());
+       Assert(false, ExcImpossibleInDim(0));
       }
 
                                     /**
-                                     * Boundary indicator of this
-                                     * object.
+                                     *  Index of the parent. Always -1
                                      */
-    unsigned char boundary_indicator () const
+    int parent_index () const
       {
-       Assert (false, ExcInternalError());
-       return 0;
+       return -1;
       }
+    
+
 
                                     /**
-                                     * Whether this object is used.
+                                     *  @name Accessing sub-objects
                                      */
-    bool used () const
+                                    /**
+                                     * @{
+                                     */
+
+                                    /**
+                                     *  Return the global index of i-th
+                                     *  vertex of the current object. The
+                                     *  convention regarding the numbering of
+                                     *  vertices is laid down in the
+                                     *  documentation of the GeometryInfo
+                                     *  class.
+                                     *
+                                     *  Note that the returned value is only
+                                     *  the index of the geometrical
+                                     *  vertex. It has nothing to do with
+                                     *  possible degrees of freedom
+                                     *  associated with it. For this, see the
+                                     *  @p DoFAccessor::vertex_dof_index
+                                     *  functions.
+                                     */
+    unsigned int vertex_index (const unsigned int i) const
+      {
+       Assert(false, ExcNotImplemented());
+       return numbers::invalid_unsigned_int;
+      }
+
+                                    /**
+                                     *  Return a reference to the
+                                     *  @p ith vertex.
+                                     */
+    Point<spacedim> & vertex (const unsigned int i) const
+      {
+       Assert(false, ExcNotImplemented());
+       static Point<spacedim> p;
+       return p;
+      }
+    
+
+                                    /**
+                                     * Pointer to the @p ith line
+                                     * bounding this object. Will
+                                     * point to an invalid object.
+                                     */
+//     typename internal::Triangulation::Iterators<dim,spacedim>::line_iterator
+//     line (const unsigned int i) const
+//       {
+//     return TriaIterator<InvalidAccessor<0,dim,spacedim> >();
+//       }
+    
+
+                                    /**
+                                     * Line index of the @p ith
+                                     * line bounding this object.
+                                     *
+                                     * Implemented only for
+                                     * <tt>structdim>1</tt>,
+                                     * otherwise an exception
+                                     * generated.
+                                     */
+    unsigned int line_index (const unsigned int i) const
+      {
+       Assert(false, ExcImpossibleInDim(0));
+       return numbers::invalid_unsigned_int;
+      }
+    
+
+                                    /**
+                                     * Pointer to the @p ith quad
+                                     * bounding this object.
+                                     */
+//     typename internal::Triangulation::Iterators<dim,spacedim>::quad_iterator
+//     quad (const unsigned int i) const;
+
+                                    /**
+                                     * Quad index of the @p ith
+                                     * quad bounding this object.
+                                     *
+                                     * Implemented only for
+                                     * <tt>structdim>2</tt>,
+                                     * otherwise an exception
+                                     * generated.
+                                     */
+    unsigned int quad_index (const unsigned int i) const
+      {
+       Assert(false, ExcImpossibleInDim(0));
+       return numbers::invalid_unsigned_int;
+      }
+                                    /**
+                                     * @}
+                                     */
+
+                                    /**
+                                     *  @name Orientation of sub-objects
+                                     */
+                                    /**
+                                     * @{
+                                     */
+
+                                     /**
+                                     * @brief Always return false
+                                      */
+    bool face_orientation (const unsigned int face) const
+      {
+       return false;
+      }
+    
+                                     /**
+                                     * @brief Always return false
+                                      */
+    bool face_flip (const unsigned int face) const
+      {
+       return false;
+      }    
+
+                                     /**
+                                     * @brief Always return false
+                                      */
+    bool face_rotation (const unsigned int face) const
       {
-       Assert (false, ExcInternalError());
        return false;
       }
+    
+
+                                     /**
+                                     * @brief Always return false
+                                      */
+    bool line_orientation (const unsigned int line) const
+      {
+       return false;
+      }
+    
+                                    /**
+                                     * @}
+                                     */
+
+                                    /**
+                                     *  @name Accessing children
+                                     */
+                                    /**
+                                     * @{
+                                     */
+
+                                    /**
+                                     *  Test whether the object has
+                                     *  children. Always false.
+                                     */
+    bool has_children () const
+      {
+       return false;
+      }
+    
+
+                                    /**
+                                     * Return the number of immediate
+                                     * children of this object.This
+                                     * is always zero in dimension 0.
+                                     */
+    unsigned int n_children() const
+      {
+       return 0;
+      }
+    
+                                    /**
+                                     * Compute and return the number
+                                     * of active descendants of this
+                                     * objects. Always zero.
+                                     */
+    unsigned int number_of_children () const
+      {
+       return 0;
+      }
+
+                                    /**
+                                     * Return the number of times
+                                     * that this object is
+                                     * refined. Always 0.
+                                     */
+    unsigned int max_refinement_depth () const
+      {
+       return 0;
+      }
 
                                     /**
-                                     * Produce a dummy child object.
+                                     * @brief Return an invalid object
                                      */
     TriaIterator<InvalidAccessor<0,dim,spacedim> >
     child (const unsigned int) const
       {
-       Assert (false, ExcInternalError());
        return TriaIterator<InvalidAccessor<0,dim,spacedim> >();
       }
+
+                                    /**
+                                     * @brief Return an invalid object
+                                     */
+    TriaIterator<InvalidAccessor<0,dim,spacedim> >
+    isotropic_child (const unsigned int) const
+      {
+       return TriaIterator<InvalidAccessor<0,dim,spacedim> >();
+      }
+
+                                    /**
+                                     * Always return no refinement.
+                                     */
+    RefinementCase<0> refinement_case () const
+      {
+       return RefinementCase<0>(RefinementPossibilities<0>::no_refinement);
+      }
+    
+
+                                    /**
+                                     * @brief Returns -1
+                                     */
+    int child_index (const unsigned int i) const
+      {
+       return -1;
+      }
+    
+
+                                    /**
+                                     * @brief Returns -1
+                                     */
+    int isotropic_child_index (const unsigned int i) const
+      {
+       return -1;
+      }
+                                    /**
+                                     * @brief Do nothing and throw and error
+                                     */
+    inline
+    unsigned char boundary_indicator () const
+      {
+       Assert(false, ExcImpossibleInDim(0));
+       return 0;
+      }
+
+                                    /**
+                                     * @brief Do nothing and throw and error
+                                     */
+    inline
+    void
+    set_boundary_indicator (const unsigned char) const
+      {
+       Assert(false, ExcImpossibleInDim(0));
+      }
+    
+                                    /**
+                                     * @brief Do nothing and throw and error
+                                     */
+    void set_all_boundary_indicators (const unsigned char) const
+      {
+       Assert(false, ExcImpossibleInDim(0));
+      }
+
+                                    /**
+                                     * @brief Do nothing and throw and error
+                                     */
+    bool used () const
+      {
+       Assert(false, ExcImpossibleInDim(0));
+       return false;
+      }
+
 };
 
 
index 4584fa8d6116cd6a357022fe67375176cd42c9f2..902094e5895680d3641adee49821db682d3dec34 100644 (file)
@@ -135,17 +135,6 @@ GridGenerator::hyper_rectangle (Triangulation<dim,spacedim> &tria,
 
 
 
-template <int spacedim>
-void
-GridGenerator::colorize_hyper_rectangle (Triangulation<1,spacedim> &)
-{
-                                  // Nothing to do in 1D
-}
-
-
-
-
-// Implementation for dimensions except 1
 template <int dim, int spacedim>
 void
 GridGenerator::colorize_hyper_rectangle (Triangulation<dim,spacedim> &tria)
@@ -535,12 +524,12 @@ GridGenerator::subdivided_hyper_rectangle (
 
 template <int dim>
 void
-GridGenerator::
-subdivided_hyper_rectangle(Triangulation<dim>              &tria,
-                           const std::vector<std::vector<double> > &step_sz,
-                           const Point<dim>                &p_1,
-                           const Point<dim>                &p_2,
-                           const bool                       colorize)
+GridGenerator::subdivided_hyper_rectangle(
+  Triangulation<dim>              &tria,
+  const std::vector<std::vector<double> > &step_sz,
+  const Point<dim>                &p_1,
+  const Point<dim>                &p_2,
+  const bool                       colorize)
 {
                                   // contributed by Joerg R. Weimar
                                   // (j.weimar@jweimar.de) 2003
@@ -757,12 +746,12 @@ subdivided_hyper_rectangle(Triangulation<dim>              &tria,
 
 template <>
 void
-GridGenerator::
-subdivided_hyper_rectangle (Triangulation<1>&                             tria,
-                            const std::vector< std::vector<double> >&     spacing,
-                            const Point<1>&                               p,
-                           const Table<1,unsigned char>&                 material_id,
-                            const bool                                    colorize)
+GridGenerator::subdivided_hyper_rectangle (
+  Triangulation<1>&                             tria,
+  const std::vector< std::vector<double> >&     spacing,
+  const Point<1>&                               p,
+  const Table<1,unsigned char>&                 material_id,
+  const bool                                    colorize)
 {
                                   // contributed by Yaqi Wang 2006
   Assert(spacing.size() == 1,
@@ -816,12 +805,12 @@ subdivided_hyper_rectangle (Triangulation<1>&                             tria,
 
 template <>
 void
-GridGenerator::
-subdivided_hyper_rectangle (Triangulation<2>&                         tria,
-                            const std::vector< std::vector<double> >&     spacing,
-                            const Point<2>&                               p,
-                           const Table<2,unsigned char>&                 material_id,
-                            const bool                                    colorize)
+GridGenerator::subdivided_hyper_rectangle (
+  Triangulation<2>&                         tria,
+  const std::vector< std::vector<double> >&     spacing,
+  const Point<2>&                               p,
+  const Table<2,unsigned char>&                 material_id,
+  const bool                                    colorize)
 {
                                   // contributed by Yaqi Wang 2006
   Assert(spacing.size() == 2,
@@ -914,12 +903,12 @@ subdivided_hyper_rectangle (Triangulation<2>&                         tria,
 
 template <>
 void
-GridGenerator::
-subdivided_hyper_rectangle (Triangulation<3>&                           tria,
-                            const std::vector< std::vector<double> >&     spacing,
-                            const Point<3>&                             p,
-                           const Table<3,unsigned char>&               material_id,
-                            const bool                                    colorize)
+GridGenerator::subdivided_hyper_rectangle (
+  Triangulation<3>&                           tria,
+  const std::vector< std::vector<double> >&     spacing,
+  const Point<3>&                             p,
+  const Table<3,unsigned char>&               material_id,
+  const bool                                    colorize)
 {
                                   // contributed by Yaqi Wang 2006
   const unsigned int dim = 3;

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.