From 0637c14970b17f98303dcde1dd7fe429e2f7864c Mon Sep 17 00:00:00 2001 From: heltai Date: Fri, 24 Jan 2014 17:27:47 +0000 Subject: [PATCH] Removed references in tria.cc to boundary[] map. Now I only use one map for both boundaries and manifolds, to simplify the internal logic. Next commit will change header files too. git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@32301 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/fe/mapping_q.cc | 9 ++++- deal.II/source/grid/tria.cc | 49 +++++++----------------- deal.II/source/grid/tria_boundary_lib.cc | 4 +- 3 files changed, 23 insertions(+), 39 deletions(-) diff --git a/deal.II/source/fe/mapping_q.cc b/deal.II/source/fe/mapping_q.cc index 3fd609b8c4..4f357b7029 100644 --- a/deal.II/source/fe/mapping_q.cc +++ b/deal.II/source/fe/mapping_q.cc @@ -776,7 +776,9 @@ MappingQ::add_line_support_points (const typename Triangulation::line_iterator line = cell->line(line_no); ps[0] = line->vertex(0); ps[1] = line->vertex(1); - a.push_back(line->get_manifold().get_new_point(ps,ws)); + const Manifold &manifold = + ( dim != spacedim ? cell->get_boundary() : line->get_manifold()); + a.push_back(manifold.get_new_point(ps,ws)); }; } else @@ -798,7 +800,10 @@ MappingQ::add_line_support_points (const typename Triangulationvertex(0); ps[1] = line->vertex(1); - get_intermediate_points (line->get_manifold(), ps, line_points); + const Manifold &manifold = + ( dim != spacedim ? cell->get_boundary() : line->get_manifold()); + + get_intermediate_points (manifold, ps, line_points); if (dim==3) { diff --git a/deal.II/source/grid/tria.cc b/deal.II/source/grid/tria.cc index f8c619bdee..82ebaa7dc6 100644 --- a/deal.II/source/grid/tria.cc +++ b/deal.II/source/grid/tria.cc @@ -4921,13 +4921,17 @@ namespace internal ExcTooFewVerticesAllocated()); triangulation.vertices_used[next_unused_vertex] = true; - // Ask the manifold - // where to put the - // new line + // Ask the manifold where to put the new point. To + // maintain backward compatibility, if the line does + // not have a manifold id, query the cell boundary + // instead get_default_points_and_weights(sp, wp, line); - triangulation.vertices[next_unused_vertex] = - line->get_manifold().get_new_point(sp, wp); - + if(dim < spacedim && line->manifold_id() == numbers::invalid_manifold_id) + triangulation.vertices[next_unused_vertex] = + triangulation.get_manifold(line->user_index()).get_new_point(sp, wp); + else + triangulation.vertices[next_unused_vertex] = + line->get_manifold().get_new_point(sp, wp); // if (spacedim == dim) // { @@ -9163,7 +9167,7 @@ namespace internal // this one. get_default_points_and_weights(sp,wp,face); const Point new_bound - = face->get_boundary().get_new_point(sp,wp); + = face->get_manifold().get_new_point(sp,wp); // triangulation.get_boundary(face->boundary_indicator()) // .get_new_point_on_face (face); // to check it, @@ -9642,11 +9646,7 @@ void Triangulation::set_boundary (const types::manifold_id m_number, const Manifold &boundary_object) { - types::boundary_id number = static_cast(m_number); - Assert(number < numbers::internal_face_boundary_id, - ExcIndexRange(number,0,numbers::internal_face_boundary_id)); - - boundary[m_number] = &boundary_object; + set_manifold(m_number, boundary_object); } @@ -9667,11 +9667,7 @@ template void Triangulation::set_boundary (const types::manifold_id m_number) { - types::boundary_id number = static_cast(m_number); - Assert(number < numbers::internal_face_boundary_id, ExcIndexRange(number,0,numbers::internal_face_boundary_id)); - - //delete the entry located at number. - boundary.erase(m_number); + set_manifold(m_number); } @@ -9692,24 +9688,7 @@ template const Manifold & Triangulation::get_boundary (const types::manifold_id m_number) const { - //look, if there is a boundary stored at - //boundary_id number. - typename std::map, Triangulation > >::const_iterator it - = boundary.find(m_number); - - if (it != boundary.end()) - { - //if we have found an entry, return it - return *(it->second); - } - else - { - //if we have not found an entry - //connected with number, we return - //straight_boundary - return straight_boundary; - } + return get_manifold(m_number); } diff --git a/deal.II/source/grid/tria_boundary_lib.cc b/deal.II/source/grid/tria_boundary_lib.cc index 39fb037a50..a2b42bcbb3 100644 --- a/deal.II/source/grid/tria_boundary_lib.cc +++ b/deal.II/source/grid/tria_boundary_lib.cc @@ -248,8 +248,8 @@ HyperBallBoundary::get_intermediate_point(const Point &p r=radius; const double r2=r*r; - Assert(std::fabs(v0.square()-r2) pm=0.5*(v0+v1); -- 2.39.5