From: Tobias Leicht Date: Thu, 11 Oct 2007 13:18:37 +0000 (+0000) Subject: On meshes with non-standard face_orientation, face_flip or face_rotation we could... X-Git-Tag: v8.0.0~9785 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54bac9dbe70e3457bfbfac6becd27d7bc26dee63;p=dealii.git On meshes with non-standard face_orientation, face_flip or face_rotation we could not find our way back from coarse cells with fine neighbors or vice versa using the neighbor_child_on_subface and neighbor_of_coarser_neighbor functions. Change the way that neighbor_of_coarser_neighbor works, so that we now find our way back in any case. (see tests/bits/mesh_3d_21) git-svn-id: https://svn.dealii.org/trunk@15288 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 b2bd31b35f..d82eb7e96d 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -3261,7 +3261,7 @@ class CellAccessor : public TriaObjectAccessor * pair of numbers, face_no and * subface_no, with the following * property: - * cell->neighbor(neighbor)->face(face_no)->child(subface_no)==cell->face(neighbor). + * cell->neighbor(neighbor)->neighbor_child_on_subface(face_no,subface_no)==cell. * * This function is impossible * for dim==1. diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 64b10d2307..f4d7521022 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -2266,7 +2266,15 @@ CellAccessor::neighbor_of_coarser_neighbor (const unsigned int neighbor) co if (face_guess->has_children()) for (unsigned int subface_no=0; subface_non_children(); ++subface_no) if (face_guess->child_index(subface_no)==this_face_index) - return std::make_pair (face_no_guess, subface_no); + // return the result, but don't forget + // to take care of possible rotation, + // flip and wrong orientation of the + // neighbor's face... + return std::make_pair (face_no_guess, + GeometryInfo::real_to_standard_face_vertex(subface_no, + neighbor_cell->face_orientation(face_no_guess), + neighbor_cell->face_flip(face_no_guess), + neighbor_cell->face_rotation(face_no_guess))); // if the guess was false, then // we need to loop over all faces @@ -2281,7 +2289,15 @@ CellAccessor::neighbor_of_coarser_neighbor (const unsigned int neighbor) co if (face->has_children()) for (unsigned int subface_no=0; subface_non_children(); ++subface_no) if (face->child_index(subface_no)==this_face_index) - return std::make_pair (face_no, subface_no); + // return the result, but don't forget + // to take care of possible rotation, + // flip and wrong orientation of the + // neighbor's face... + return std::make_pair (face_no, + GeometryInfo::real_to_standard_face_vertex(subface_no, + neighbor_cell->face_orientation(face_no), + neighbor_cell->face_flip(face_no), + neighbor_cell->face_rotation(face_no))); } }