From 57b7ecc68aaa8ca978031fd221ff51e01e114a0d Mon Sep 17 00:00:00 2001 From: leicht Date: Mon, 15 May 2006 12:36:25 +0000 Subject: [PATCH] 1/ Bug fix: count hexes instead of quads for used_cells in 3d. Triggered no error before as always n_quads > n_hexes. 2/ Two doc fixes. 3/ Use of GeometryInfo::child_cell_on_face instead of searching through all children and faces. git-svn-id: https://svn.dealii.org/trunk@13113 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/grid/tria.cc | 78 +++++++++-------------------- 1 file changed, 25 insertions(+), 53 deletions(-) diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 7f390da2bc..567a6f71e9 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -5598,8 +5598,8 @@ Triangulation<3>::execute_refinement () // count number of used cells on // the next higher level const unsigned int used_cells - = std::count_if (levels[level+1]->quads.used.begin(), - levels[level+1]->quads.used.end(), + = std::count_if (levels[level+1]->hexes.used.begin(), + levels[level+1]->hexes.used.end(), std::bind2nd (std::equal_to(), true)); @@ -6101,7 +6101,7 @@ Triangulation<3>::execute_refinement () 7./192.; // finally add centers of // faces. note that - // vertex 2 is an + // vertex 3 is an // invariant with respect // to the face // orientation @@ -6822,27 +6822,18 @@ Triangulation<3>::execute_refinement () // face is // swapped // - // (?? I - // actually - // don't - // understand - // why we - // need to - // ask the - // present - // face as - // well, but - // it fixes - // the - // mesh_3d_7 - // and - // mesh_3d_11 - // testcases, - // so it - // can't be - // all - // wrong...) - const bool orient + // We have to ask both cells for + // the face orientation, as the + // relevant check is, wether they + // disagree or not. However, we + // should never run into a face + // which has non-standard + // orientation in both adjacent + // cells, therefore it is enough to + // ask, whether the + // face-orientation is non-standard + // in one of the cases. + const bool orient = (neighbor->face_orientation(nb_nb) && hex->face_orientation(face)); @@ -7019,35 +7010,16 @@ Triangulation<3>::execute_refinement () Assert (face::faces_per_cell, ExcInternalError()); - // then figure - // out which of - // the new cells - // points to this - // neighbor. this - // could - // presumably be - // made faster - // with only one - // loop, but is - // notoriously - // tricky to get - // right in view - // of - // mis-oriented - // faces :-( - for (unsigned int c=0; - c::children_per_cell; ++c) - for (unsigned int f=0; - f::faces_per_cell; ++f) - if (new_hexes[c]->neighbor(f) == neighbor) - { - neighbor->set_neighbor(face, new_hexes[c]); - goto found; - } - Assert (false, ExcInternalError()); - - found: - ; + // then figure out which of the new + // cells points to this neighbor. + // + // As we have considered + // face-orientation issues already in + // the construction of the + // neighbor_cells array, this can easily + // be achieved here. + int c = GeometryInfo::child_cell_on_face(nb,subface,true); + neighbor->set_neighbor(face,new_hexes[c]); } -- 2.39.5