From: kanschat Date: Tue, 9 Nov 2010 20:22:29 +0000 (+0000) Subject: add pseudo-functionality to 0-dim TriaAccessor and remove specialization for GridGene... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f61d2453df7010486dc585b71893e1e4623af20a;p=dealii-svn.git add pseudo-functionality to 0-dim TriaAccessor and remove specialization for GridGenerator:: git-svn-id: https://svn.dealii.org/trunk@22657 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/grid/grid_generator.h b/deal.II/include/deal.II/grid/grid_generator.h index ac9443ed47..c5a347b1cc 100644 --- a/deal.II/include/deal.II/grid/grid_generator.h +++ b/deal.II/include/deal.II/grid/grid_generator.h @@ -794,17 +794,7 @@ class GridGenerator static void colorize_hyper_rectangle (Triangulation &tria); - - /** - * Same function as above for - * 1d. This function is not - * implemented. - */ - template - static - void - colorize_hyper_rectangle (Triangulation<1,spacedim> &tria); - + /** * Perform the action specified * by the @p colorize flag of diff --git a/deal.II/include/deal.II/grid/tria_accessor.h b/deal.II/include/deal.II/grid/tria_accessor.h index 9a60c48f80..90f43c5bf1 100644 --- a/deal.II/include/deal.II/grid/tria_accessor.h +++ b/deal.II/include/deal.II/grid/tria_accessor.h @@ -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 TriaAccessor (const TriaAccessor &) { - Assert (false, ExcInternalError()); + Assert(false, ExcImpossibleInDim(0)); } /** @@ -1624,37 +1624,284 @@ class TriaAccessor<0, dim, spacedim> : public TriaAccessorBase<0,dim, spacedim> template TriaAccessor (const InvalidAccessor &) { - 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 & vertex (const unsigned int i) const + { + Assert(false, ExcNotImplemented()); + static Point p; + return p; + } + + + /** + * Pointer to the @p ith line + * bounding this object. Will + * point to an invalid object. + */ +// typename internal::Triangulation::Iterators::line_iterator +// line (const unsigned int i) const +// { +// return TriaIterator >(); +// } + + + /** + * Line index of the @p ith + * line bounding this object. + * + * Implemented only for + * structdim>1, + * 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::quad_iterator +// quad (const unsigned int i) const; + + /** + * Quad index of the @p ith + * quad bounding this object. + * + * Implemented only for + * structdim>2, + * 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 > child (const unsigned int) const { - Assert (false, ExcInternalError()); return TriaIterator >(); } + + /** + * @brief Return an invalid object + */ + TriaIterator > + isotropic_child (const unsigned int) const + { + return TriaIterator >(); + } + + /** + * 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; + } + }; diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 4584fa8d61..902094e589 100644 --- a/deal.II/source/grid/grid_generator.cc +++ b/deal.II/source/grid/grid_generator.cc @@ -135,17 +135,6 @@ GridGenerator::hyper_rectangle (Triangulation &tria, -template -void -GridGenerator::colorize_hyper_rectangle (Triangulation<1,spacedim> &) -{ - // Nothing to do in 1D -} - - - - -// Implementation for dimensions except 1 template void GridGenerator::colorize_hyper_rectangle (Triangulation &tria) @@ -535,12 +524,12 @@ GridGenerator::subdivided_hyper_rectangle ( template void -GridGenerator:: -subdivided_hyper_rectangle(Triangulation &tria, - const std::vector > &step_sz, - const Point &p_1, - const Point &p_2, - const bool colorize) +GridGenerator::subdivided_hyper_rectangle( + Triangulation &tria, + const std::vector > &step_sz, + const Point &p_1, + const Point &p_2, + const bool colorize) { // contributed by Joerg R. Weimar // (j.weimar@jweimar.de) 2003 @@ -757,12 +746,12 @@ subdivided_hyper_rectangle(Triangulation &tria, template <> void -GridGenerator:: -subdivided_hyper_rectangle (Triangulation<1>& tria, - const std::vector< std::vector >& 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 >& 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 >& 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 >& 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 >& 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 >& 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;