From 062a2af0ccf534ad12d0bd2802bf5304fc286f59 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 28 Dec 2008 03:48:24 +0000 Subject: [PATCH] Unify (a bit tediously) two more sets of functions into common templates. git-svn-id: https://svn.dealii.org/trunk@18034 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria_accessor.h | 22 ++++ .../include/grid/tria_accessor.templates.h | 114 ++++++------------ 2 files changed, 57 insertions(+), 79 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index d749a309de..df4bd31579 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -1564,6 +1564,28 @@ class TriaAccessor<0, dim, spacedim> : public TriaAccessorBase<0,dim, spacedim> Assert (false, ExcInternalError()); } + /** + * Constructor. Should never be + * called and thus produces an + * error. + */ + template + TriaAccessor (const TriaAccessor &) + { + Assert (false, ExcInternalError()); + } + + /** + * Constructor. Should never be + * called and thus produces an + * error. + */ + template + TriaAccessor (const InvalidAccessor &) + { + Assert (false, ExcInternalError()); + } + /** * Boundary indicator of this * object. diff --git a/deal.II/deal.II/include/grid/tria_accessor.templates.h b/deal.II/deal.II/include/grid/tria_accessor.templates.h index 83b1dd6fc9..e74cc05a76 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.templates.h +++ b/deal.II/deal.II/include/grid/tria_accessor.templates.h @@ -1922,98 +1922,54 @@ CellAccessor (const CellAccessor &cell_accessor) -template <> -inline -TriaIterator > -CellAccessor<1,1>::face (const unsigned int) const -{ - Assert (false, ExcImpossibleInDim(1)); - return TriaIterator >(); -} - - - -template <> -inline -TriaIterator > -CellAccessor<1,2>::face (const unsigned int) const -{ - Assert (false, ExcImpossibleInDim(1)); - return TriaIterator >(); -} - - -template <> -inline -Triangulation<2,2>::face_iterator -CellAccessor<2,2>::face (const unsigned int i) const -{ - return this->line(i); -} - -template <> -inline -Triangulation<2,3>::face_iterator -CellAccessor<2,3>::face (const unsigned int i) const -{ - return this->line(i); -} - - - -template <> +template inline -Triangulation<3>::face_iterator -CellAccessor<3,3>::face (const unsigned int i) const +TriaIterator > +CellAccessor::face (const unsigned int i) const { - return this->quad(i); -} - + switch (dim) + { + case 1: + { + Assert (false, ExcImpossibleInDim(1)); + return TriaIterator >(); + } + case 2: + return this->line(i); -template <> -inline -unsigned int -CellAccessor<1,1>::face_index (const unsigned int) const -{ - Assert (false, ExcImpossibleInDim(1)); - return numbers::invalid_unsigned_int; -} + case 3: + return this->quad(i); -template <> -inline -unsigned int -CellAccessor<1,2>::face_index (const unsigned int) const -{ - Assert (false, ExcImpossibleInDim(1)); - return numbers::invalid_unsigned_int; + default: + return TriaIterator >(); + } } -template <> -inline -unsigned int -CellAccessor<2,2>::face_index (const unsigned int i) const -{ - return this->line_index(i); -} -template <> +template inline unsigned int -CellAccessor<2,3>::face_index (const unsigned int i) const +CellAccessor::face_index (const unsigned int i) const { - return this->line_index(i); -} - - + switch (dim) + { + case 1: + { + Assert (false, ExcImpossibleInDim(1)); + return numbers::invalid_unsigned_int; + } -template <> -inline -unsigned int -CellAccessor<3,3>::face_index (const unsigned int i) const -{ - return this->quad_index(i); + case 2: + return this->line_index(i); + + case 3: + return this->quad_index(i); + + default: + return numbers::invalid_unsigned_int; + } } -- 2.39.5