From 9156cf5736f0df41c64acaf9cdba3512ae06c798 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Sun, 13 Jul 2014 22:10:51 +0000 Subject: [PATCH] Fixed get_boundary/manifold_ids. Removed all references to get_boundary in tria.cc git-svn-id: https://svn.dealii.org/branches/branch_manifold_id_intermediate@33155 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/grid/tria.cc | 73 ++++++++++++------------------------- 1 file changed, 23 insertions(+), 50 deletions(-) diff --git a/deal.II/source/grid/tria.cc b/deal.II/source/grid/tria.cc index 5636edcd48..3ed89fc573 100644 --- a/deal.II/source/grid/tria.cc +++ b/deal.II/source/grid/tria.cc @@ -4055,10 +4055,7 @@ namespace internal // to the information // stored in the // boundary class - const Boundary &manifold = - (cell->manifold_id() != numbers::invalid_manifold_id ? - cell->get_manifold() : - triangulation.get_boundary(static_cast(cell->material_id()))); + const Boundary &manifold = cell->get_manifold(); triangulation.vertices[next_unused_vertex] = manifold.get_new_point_on_quad (cell); @@ -4449,16 +4446,16 @@ namespace internal // object // Now we always ask the manifold where to put the - // new point. The get_boundary function will return + // new point. The get_manifold function will return // a flat boundary if invalid_manifold_id is set, // behaving as before in the flat case. Backward // compatibility requires us to use the material id // of the cell in the codimension one case, however // we only do this if the manifold_id is the invalid // one, otherwise use the material id. This is done - // internally in the get_boundary() function. + // internally in the get_manifold() function. triangulation.vertices[next_unused_vertex] = - cell->get_boundary().get_new_point_on_line(cell); + cell->get_manifold().get_new_point_on_line(cell); triangulation.vertices_used[next_unused_vertex] = true; // search for next two @@ -4879,7 +4876,7 @@ namespace internal // the two vertices: // if (line->at_boundary()) triangulation.vertices[next_unused_vertex] - = line->get_boundary().get_new_point_on_line (line); + = line->get_manifold().get_new_point_on_line (line); } else // however, if spacedim>dim, we always have to ask @@ -4889,10 +4886,10 @@ namespace internal // has been set on this very line. if(line->manifold_id() == numbers::invalid_manifold_id) triangulation.vertices[next_unused_vertex] - = triangulation.get_boundary(line->user_index()).get_new_point_on_line (line); + = triangulation.get_manifold(line->user_index()).get_new_point_on_line (line); else triangulation.vertices[next_unused_vertex] - = line->get_boundary().get_new_point_on_line (line); + = line->get_manifold().get_new_point_on_line (line); // now that we created // the right point, make @@ -5425,7 +5422,7 @@ namespace internal triangulation.vertices_used[next_unused_vertex] = true; triangulation.vertices[next_unused_vertex] - = line->get_boundary().get_new_point_on_line (line); + = line->get_manifold().get_new_point_on_line (line); // now that we created // the right point, make @@ -6028,7 +6025,7 @@ namespace internal // care about boundary quads // here triangulation.vertices[next_unused_vertex] - = middle_line->get_boundary().get_new_point_on_line(middle_line); + = middle_line->get_manifold().get_new_point_on_line(middle_line); triangulation.vertices_used[next_unused_vertex] = true; // now search a slot for the two @@ -6097,7 +6094,7 @@ namespace internal if (quad->at_boundary() || (quad->manifold_id() != numbers::invalid_manifold_id) ) triangulation.vertices[next_unused_vertex] - = quad->get_boundary().get_new_point_on_quad (quad); + = quad->get_manifold().get_new_point_on_quad (quad); else // it might be that the // quad itself is not @@ -9118,7 +9115,7 @@ namespace internal // boundary would be // this one. const Point new_bound - = face->get_boundary().get_new_point_on_face (face); + = face->get_manifold().get_new_point_on_face (face); // to check it, // transform to the // unit cell with @@ -9677,24 +9674,13 @@ Triangulation::get_boundary_indicators () const } else { -//TODO: if boundary_id_t is a real integer type, this might become -//a humongously large array... - std::vector bi_exists(numbers::internal_face_boundary_id, false); + std::set b_ids; active_cell_iterator cell=begin_active(); for (; cell!=end(); ++cell) for (unsigned int face=0; face::faces_per_cell; ++face) if (cell->at_boundary(face)) - bi_exists[cell->face(face)->boundary_indicator()]=true; - - const unsigned int n_bi= - std::count(bi_exists.begin(), bi_exists.end(), true); - - std::vector boundary_indicators(n_bi); - unsigned int bi_counter=0; - for (unsigned int i=0; iface(face)->boundary_indicator()); + std::vector boundary_indicators(b_ids.begin(), b_ids.end()); return boundary_indicators; } } @@ -9703,32 +9689,19 @@ template std::vector Triangulation::get_manifold_ids () const { -//TODO: if manifold_id_t is a real integer type, this might become -//a humongously large array... - // Just store all possible values - std::vector mi_exists(numbers::invalid_manifold_id+1, false); + std::set m_ids; active_cell_iterator cell=begin_active(); - for (; cell!=end(); ++cell) - { - mi_exists[cell->manifold_id()] = true; - if(dim>1) - for (unsigned int face=0; face::faces_per_cell; ++face) - mi_exists[cell->face(face)->manifold_id()] = true; - } - - const unsigned int n_mi= - std::count(mi_exists.begin(), mi_exists.end(), true)-1; - - std::vector manifold_indicators(n_mi); - unsigned int mi_counter=0; - for (unsigned int i=0; imanifold_id()); + if(dim>1) + for (unsigned int face=0; face::faces_per_cell; ++face) + if (cell->at_boundary(face)) + m_ids.insert(cell->face(face)->manifold_id()); + } + std::vector manifold_indicators(m_ids.begin(), m_ids.end()); return manifold_indicators; } - /*-----------------------------------------------------------------*/ -- 2.39.5