From 5a02a37d4761e18c0e4e3ec7e174e7f1a75c4cc8 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 18 Feb 1999 16:41:02 +0000 Subject: [PATCH] Adapt the program to the new way of describing boundaries and fix the curved line boundary in 3d. git-svn-id: https://svn.dealii.org/trunk@842 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/Attic/examples/dof/dof_test.cc | 151 ++++++++++++++---- tests/big-tests/dof/dof_test.cc | 151 ++++++++++++++---- 2 files changed, 244 insertions(+), 58 deletions(-) diff --git a/deal.II/deal.II/Attic/examples/dof/dof_test.cc b/deal.II/deal.II/Attic/examples/dof/dof_test.cc index 33ab383305..a176758e01 100644 --- a/deal.II/deal.II/Attic/examples/dof/dof_test.cc +++ b/deal.II/deal.II/Attic/examples/dof/dof_test.cc @@ -34,17 +34,32 @@ template class Ball : public StraightBoundary { public: - virtual Point in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); - - for (int i=0; i + get_new_point_on_line (const typename Triangulation::line_iterator &line) const { + Point middle = StraightBoundary::get_new_point_on_line(line); + + for (int i=0; i + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const { + Point middle = StraightBoundary::get_new_point_on_quad(quad); + + for (int i=0; i class CurvedLine : public StraightBoundary { public: - virtual Point in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); - double x=middle(0), - y=middle(1); - - if (y + get_new_point_on_line (const typename Triangulation::line_iterator &line) const; - return middle; - }; + virtual Point + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; }; +template +Point +CurvedLine::get_new_point_on_line (const typename Triangulation::line_iterator &line) const +{ + Point middle = StraightBoundary::get_new_point_on_line (line); + + // if the line is at the top of bottom + // face: do a special treatment on + // this line. Note that if the + // z-value of the midpoint is either + // 0 or 1, then the z-values of all + // vertices of the line is like that + if (dim>=3) + if (((middle(2) == 0) || (middle(2) == 1)) + // find out, if the line is in the + // interior of the top or bottom face + // of the domain, or at the edge. + // lines at the edge need to undergo + // the usual treatment, while for + // interior lines taking the midpoint + // is sufficient + // + // note: the trick with the boundary + // id was invented after the above was + // written, so we are not very strict + // here with using these flags + && (line->boundary_indicator() == 1)) + return middle; + + + double x=middle(0), + y=middle(1); + + if (y +Point +CurvedLine::get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const +{ + Point middle = StraightBoundary::get_new_point_on_quad (quad); + + // if the face is at the top of bottom + // face: do not move the midpoint in + // x/y direction. Note that if the + // z-value of the midpoint is either + // 0 or 1, then the z-values of all + // vertices of the quad is like that + if ((middle(2) == 0) || (middle(2) == 1)) + return middle; + + double x=middle(0), + y=middle(1); + + if (y class TestCases : public MultipleParameterLoop::UserClass{ public: @@ -186,6 +273,12 @@ void TestCases::run (ParameterHandler &prm) { case 2: case 3: { + if (dim==3) + { + tria->begin_active()->face(2)->set_boundary_indicator(1); + tria->begin_active()->face(4)->set_boundary_indicator(1); + }; + // set the boundary function boundary = (test_case==2 ? static_cast*>(new Ball()) : diff --git a/tests/big-tests/dof/dof_test.cc b/tests/big-tests/dof/dof_test.cc index 33ab383305..a176758e01 100644 --- a/tests/big-tests/dof/dof_test.cc +++ b/tests/big-tests/dof/dof_test.cc @@ -34,17 +34,32 @@ template class Ball : public StraightBoundary { public: - virtual Point in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); - - for (int i=0; i + get_new_point_on_line (const typename Triangulation::line_iterator &line) const { + Point middle = StraightBoundary::get_new_point_on_line(line); + + for (int i=0; i + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const { + Point middle = StraightBoundary::get_new_point_on_quad(quad); + + for (int i=0; i class CurvedLine : public StraightBoundary { public: - virtual Point in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); - double x=middle(0), - y=middle(1); - - if (y + get_new_point_on_line (const typename Triangulation::line_iterator &line) const; - return middle; - }; + virtual Point + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; }; +template +Point +CurvedLine::get_new_point_on_line (const typename Triangulation::line_iterator &line) const +{ + Point middle = StraightBoundary::get_new_point_on_line (line); + + // if the line is at the top of bottom + // face: do a special treatment on + // this line. Note that if the + // z-value of the midpoint is either + // 0 or 1, then the z-values of all + // vertices of the line is like that + if (dim>=3) + if (((middle(2) == 0) || (middle(2) == 1)) + // find out, if the line is in the + // interior of the top or bottom face + // of the domain, or at the edge. + // lines at the edge need to undergo + // the usual treatment, while for + // interior lines taking the midpoint + // is sufficient + // + // note: the trick with the boundary + // id was invented after the above was + // written, so we are not very strict + // here with using these flags + && (line->boundary_indicator() == 1)) + return middle; + + + double x=middle(0), + y=middle(1); + + if (y +Point +CurvedLine::get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const +{ + Point middle = StraightBoundary::get_new_point_on_quad (quad); + + // if the face is at the top of bottom + // face: do not move the midpoint in + // x/y direction. Note that if the + // z-value of the midpoint is either + // 0 or 1, then the z-values of all + // vertices of the quad is like that + if ((middle(2) == 0) || (middle(2) == 1)) + return middle; + + double x=middle(0), + y=middle(1); + + if (y class TestCases : public MultipleParameterLoop::UserClass{ public: @@ -186,6 +273,12 @@ void TestCases::run (ParameterHandler &prm) { case 2: case 3: { + if (dim==3) + { + tria->begin_active()->face(2)->set_boundary_indicator(1); + tria->begin_active()->face(4)->set_boundary_indicator(1); + }; + // set the boundary function boundary = (test_case==2 ? static_cast*>(new Ball()) : -- 2.39.5