From: wolf Date: Wed, 21 Nov 2001 15:40:01 +0000 (+0000) Subject: Fix neighbor_of_coarser_neighbor for 1d. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd909bcf6cf7d5619dd27f7b1a40695341351e50;p=dealii-svn.git Fix neighbor_of_coarser_neighbor for 1d. git-svn-id: https://svn.dealii.org/branches/Branch-3-2@5237 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index dbfc55ccd3..718f38c1a4 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -1882,9 +1882,13 @@ class CellAccessor : public TriaObjectAccessor * pair of numbers, face_no and * subface_no, with the following * property: - * @p{cell->neighbor(neighbor)->face(face_no)->child(subface_no)==cell}. + * @p{cell->neighbor(neighbor)->face(face_no)->child(subface_no)==cell->face(neighbor)}. + * + * This function is impossible + * for @p{dim==1}. */ - std::pair neighbor_of_coarser_neighbor (const unsigned int neighbor) const; + std::pair + neighbor_of_coarser_neighbor (const unsigned int neighbor) const; /** * Return whether the @p{i}th diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 5019e76d69..f7b2722b63 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -1572,6 +1572,17 @@ bool CellAccessor<1>::point_inside (const Point<1> &p) const return (vertex(0)[0] <= p[0]) && (p[0] <= vertex(1)[0]); } + +template <> +std::pair +CellAccessor<1>::neighbor_of_coarser_neighbor (const unsigned int) const +{ + Assert(false, ExcImpossibleInDim(1)); + return std::make_pair (static_cast(-1), + static_cast(-1)); +} + + #endif @@ -1787,7 +1798,7 @@ unsigned int CellAccessor::neighbor_of_neighbor (const unsigned int neighbo template -pair +std::pair CellAccessor::neighbor_of_coarser_neighbor (const unsigned int neighbor) const { // make sure that the neighbor is @@ -1822,7 +1833,7 @@ CellAccessor::neighbor_of_coarser_neighbor (const unsigned int neighbor) co if (face_guess->has_children()) for (unsigned int subface_no=0; subface_no::subfaces_per_face; ++subface_no) if (face_guess->child(subface_no)==this_face) - return pair (face_no_guess, subface_no); + return std::make_pair (face_no_guess, subface_no); // if the guess was false, then // we need to loop over all faces @@ -1837,7 +1848,7 @@ CellAccessor::neighbor_of_coarser_neighbor (const unsigned int neighbor) co if (face->has_children()) for (unsigned int subface_no=0; subface_no::subfaces_per_face; ++subface_no) if (face->child(subface_no)==this_face) - return pair (face_no, subface_no); + return std::make_pair (face_no, subface_no); } } @@ -1845,8 +1856,8 @@ CellAccessor::neighbor_of_coarser_neighbor (const unsigned int neighbor) co // since then we did not find // our way back... Assert (false, ExcInternalError()); - return pair (static_cast(-1), - static_cast(-1)); + return std::make_pair (static_cast(-1), + static_cast(-1)); };