From: Ralf Hartmann Date: Wed, 21 Nov 2001 13:28:35 +0000 (+0000) Subject: Implementation of CellAccessor<1>::neighbor_of_coarser_neighbor. Add some std's X-Git-Tag: v8.0.0~18596 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7098d7b1d2c3930b1080d0b7c343dcdd013d8eb4;p=dealii.git Implementation of CellAccessor<1>::neighbor_of_coarser_neighbor. Add some std's git-svn-id: https://svn.dealii.org/trunk@5236 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 e040cd209e..970f69cf7c 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -1883,9 +1883,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 11d45037db..cb8c7676da 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 @@ -1807,7 +1818,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 @@ -1842,7 +1853,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 @@ -1857,7 +1868,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); } } @@ -1865,8 +1876,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)); };