From cb35f1113efb2ebb4b3e17a1ba49d845d431b2ae Mon Sep 17 00:00:00 2001 From: heltai Date: Tue, 28 Jan 2014 15:27:53 +0000 Subject: [PATCH] Fixed another two distorted cells bugs. git-svn-id: https://svn.dealii.org/branches/branch_manifold_id@32334 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/distorted_cells_05.cc | 126 ++++++++++++++++--------------- tests/bits/distorted_cells_06.cc | 35 +++++---- 2 files changed, 86 insertions(+), 75 deletions(-) diff --git a/tests/bits/distorted_cells_05.cc b/tests/bits/distorted_cells_05.cc index 7fe258c245..b49450635d 100644 --- a/tests/bits/distorted_cells_05.cc +++ b/tests/bits/distorted_cells_05.cc @@ -39,72 +39,78 @@ template -class MyBoundary : public Boundary +class MyBoundary : public Manifold { virtual Point - get_new_point_on_line (const typename Triangulation::line_iterator &line) const + get_new_point (const std::vector > &p, + const std::vector &w) const { - deallog << "Finding point between " - << line->vertex(0) << " and " - << line->vertex(1) << std::endl; - - // in 2d, find a point that - // lies on the opposite side - // of the quad. in 3d, choose - // the midpoint of the edge - if (dim == 2) - return Point(0,1.25); - else - return (line->vertex(0) + line->vertex(1)) / 2; - } - - virtual Point - get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const - { - deallog << "Finding point between " - << quad->vertex(0) << " and " - << quad->vertex(1) << " and " - << quad->vertex(2) << " and " - << quad->vertex(3) << std::endl; - - return Point(0,0,1.25); - } - - virtual - Point - project_to_surface (const typename Triangulation::line_iterator &, - const Point &p) const - { - deallog << "Projecting line point " << p << std::endl; - - if (dim == 2) - return Point(p[0], 1.25-2.25*std::fabs(p[0])); - else - return p; - } - - virtual - Point - project_to_surface (const typename Triangulation::quad_iterator &, - const Point &p) const - { - deallog << "Projecting quad point " << p << std::endl; - - Assert (dim == 3, ExcInternalError()); - - return Point(p[0], p[1], - 1.25-2.25*std::max(std::fabs(p[0]), - std::fabs(p[1]))); - } - + switch(p.size()) { + case 2: + { + deallog << "Finding point between " + << p[0] << " and " + << p[1] << std::endl; + + // in 2d, find a point that + // lies on the opposite side + // of the quad. in 3d, choose + // the midpoint of the edge + if (dim == 2) + return Point(0,1.25); + else + return (p[0] + p[1]) / 2; + } + break; + default: + { + deallog << "Finding point between " + << p[0] << " and " + << p[1] << " and " + << p[2] << " and " + << p[3] << std::endl; + + return Point(0,0,1.25); + } + break; + } + }; + + virtual Point - project_to_surface (const typename Triangulation::hex_iterator &, - const Point &) const + project_to_manifold (const std::vector > &v, + const Point &p) const { - Assert (false, ExcInternalError()); - return Point(); - } + switch(v.size()) { + case 2: + { + deallog << "Projecting line point " << p << std::endl; + + if (dim == 2) + return Point(p[0], 1.25-2.25*std::fabs(p[0])); + else + return p; + } + break; + case 4: + { + deallog << "Projecting quad point " << p << std::endl; + + Assert (dim == 3, ExcInternalError()); + + return Point(p[0], p[1], + 1.25-2.25*std::max(std::fabs(p[0]), + std::fabs(p[1]))); + } + break; + default: + { + Assert (false, ExcInternalError()); + return Point(); + } + } + }; }; diff --git a/tests/bits/distorted_cells_06.cc b/tests/bits/distorted_cells_06.cc index 7e8bae09bf..fdb4d5d378 100644 --- a/tests/bits/distorted_cells_06.cc +++ b/tests/bits/distorted_cells_06.cc @@ -38,24 +38,29 @@ template -class MyBoundary : public Boundary +class MyBoundary : public Manifold { virtual Point - get_new_point_on_line (const typename Triangulation::line_iterator &line) const + get_new_point (const std::vector > &p, + const std::vector &w) const { - deallog << "Finding point between " - << line->vertex(0) << " and " - << line->vertex(1) << std::endl; - - return Point(0,0.5,0.9); - } - - virtual Point - get_new_point_on_quad (const typename Triangulation::quad_iterator &) const - { - Assert (false, ExcInternalError()); - return Point(0,0,1.25); - } + switch(p.size()) { + case 2: + { + deallog << "Finding point between " + << p[0] << " and " + << p[1] << std::endl; + return Point(0,0.5,0.9); + } + break; + default: + { + Assert (false, ExcInternalError()); + return Point(0,0,1.25); + } + break; + } + }; }; -- 2.39.5