From: wolf Date: Thu, 18 Feb 1999 16:08:21 +0000 (+0000) Subject: Adapt the program to the new way of describing boundaries and fix the X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b918783cdb4b6cfcf3bfb92d0ba6b4ac846925c8;p=dealii-svn.git 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@839 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/Attic/examples/grid/grid_test.cc b/deal.II/deal.II/Attic/examples/grid/grid_test.cc index f2afefd0c3..e1b15c9c8e 100644 --- a/deal.II/deal.II/Attic/examples/grid/grid_test.cc +++ b/deal.II/deal.II/Attic/examples/grid/grid_test.cc @@ -26,17 +26,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; + virtual Point + get_new_point_on_line (const typename Triangulation::line_iterator &line) const; + + virtual Point + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; }; template -Point CurvedLine::in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); +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 (((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); @@ -126,6 +206,9 @@ void test (const int test_case) { case 2: case 3: { + tria.begin_active()->face(2)->set_boundary_indicator(1); + tria.begin_active()->face(4)->set_boundary_indicator(1); + // set the boundary function Ball ball; CurvedLine curved_line; diff --git a/tests/big-tests/grid/grid_test.cc b/tests/big-tests/grid/grid_test.cc index f2afefd0c3..e1b15c9c8e 100644 --- a/tests/big-tests/grid/grid_test.cc +++ b/tests/big-tests/grid/grid_test.cc @@ -26,17 +26,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; + virtual Point + get_new_point_on_line (const typename Triangulation::line_iterator &line) const; + + virtual Point + get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; }; template -Point CurvedLine::in_between (const PointArray &neighbors) const { - Point middle = StraightBoundary::in_between(neighbors); +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 (((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); @@ -126,6 +206,9 @@ void test (const int test_case) { case 2: case 3: { + tria.begin_active()->face(2)->set_boundary_indicator(1); + tria.begin_active()->face(4)->set_boundary_indicator(1); + // set the boundary function Ball ball; CurvedLine curved_line;