From 554d708025e0d719abee92d8b59f9a573537876d Mon Sep 17 00:00:00 2001 From: Ralf Hartmann Date: Tue, 9 Jan 2001 14:44:31 +0000 Subject: [PATCH] New get_intermediate_points_on_line function. Needed for MappingQ class. git-svn-id: https://svn.dealii.org/trunk@3623 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria_boundary.h | 46 ++++++++++++++++++- .../deal.II/include/grid/tria_boundary_lib.h | 15 +++++- deal.II/deal.II/source/grid/tria_boundary.cc | 27 ++++++++++- .../deal.II/source/grid/tria_boundary_lib.cc | 40 +++++++++++++++- 4 files changed, 122 insertions(+), 6 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria_boundary.h b/deal.II/deal.II/include/grid/tria_boundary.h index b7d4f137bb..c7115e2eb3 100644 --- a/deal.II/deal.II/include/grid/tria_boundary.h +++ b/deal.II/deal.II/include/grid/tria_boundary.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -65,7 +65,7 @@ * @ref{HyperBallBoundary} creating a hyperball with given radius * around a given center point. * - * @author Wolfgang Bangerth, 1999 + * @author Wolfgang Bangerth, 1999, Ralf Hartmann, 2001 */ template class Boundary : public Subscriptor @@ -115,6 +115,30 @@ class Boundary : public Subscriptor virtual Point get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; + /** + * Return intermediate points + * on the boundary line. + * + * The number of points requested + * is given by the size of the + * vector @p{points}. It is the + * task of the derived classes to + * arrange the points in + * approximately equal distances. + * + * This function is needed by the + * @p{MappingQ} class. As this + * function is not needed for Q1 + * mappings, it is not made pure + * virtual, to avoid the need to + * overload it. The default + * implementation throws an error + * in any case, however. + */ + virtual void + get_intermediate_points_on_line (const typename Triangulation::line_iterator &line, + vector > &points) const; + /** * Exception. */ @@ -132,6 +156,8 @@ class Boundary : public Subscriptor * placing new points in the middle of old ones, it rather assumes that the * boundary of the domain is given by the polygon/polyhedron defined by the * boundary of the initial coarse triangulation. + * + * @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2001 */ template class StraightBoundary : public Boundary { @@ -160,6 +186,22 @@ class StraightBoundary : public Boundary { */ virtual Point get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; + + /** + * Gives @p{n=points.size()} + * points that splits the + * p{StraightBoundary} line into + * p{n+1} partitions of equal + * lengths. + * + * Refer to the general documentation of + * this class and the documentation of the + * base class. + */ + virtual void + get_intermediate_points_on_line (const typename Triangulation::line_iterator &line, + vector > &points) const; + }; diff --git a/deal.II/deal.II/include/grid/tria_boundary_lib.h b/deal.II/deal.II/include/grid/tria_boundary_lib.h index b647a406e3..fc95dca43f 100644 --- a/deal.II/deal.II/include/grid/tria_boundary_lib.h +++ b/deal.II/deal.II/include/grid/tria_boundary_lib.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -30,7 +30,7 @@ * @ref{Boundary}, which would seem natural, since this way we can use the * @ref{StraightBoundary}@p{::in_between(neighbors)} function. * - * @author Wolfgang Bangerth, 1998 + * @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2001 */ template class HyperBallBoundary : public StraightBoundary @@ -58,6 +58,17 @@ class HyperBallBoundary : public StraightBoundary virtual Point get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; + /** + * Refer to the general documentation of + * this class and the documentation of the + * base class. + * + * Only implemented for @p{dim=2}. + */ + virtual void + get_intermediate_points_on_line (const typename Triangulation::line_iterator &line, + vector > &points) const; + /** * Return the center of the ball. */ diff --git a/deal.II/deal.II/source/grid/tria_boundary.cc b/deal.II/deal.II/source/grid/tria_boundary.cc index 8fa2eff1cf..d2b6b96df5 100644 --- a/deal.II/deal.II/source/grid/tria_boundary.cc +++ b/deal.II/deal.II/source/grid/tria_boundary.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -33,6 +33,16 @@ Boundary::get_new_point_on_quad (const typename Triangulation::quad_it }; +template +void +Boundary::get_intermediate_points_on_line ( + const typename Triangulation::line_iterator &, + vector > &) const +{ + Assert (false, ExcPureVirtualFunctionCalled()); +}; + + template Point StraightBoundary::get_new_point_on_line (const typename Triangulation::line_iterator &line) const @@ -70,6 +80,21 @@ StraightBoundary::get_new_point_on_quad (const typename Triangulation: #endif +template +void +StraightBoundary::get_intermediate_points_on_line ( + const typename Triangulation::line_iterator &line, + vector > &points) const +{ + const unsigned int n=points.size(); + Assert(n>0, ExcInternalError()); + const double part=1./(n+1); + double position=part; + for (unsigned int i=0; ivertex(0) + position*line->vertex(1); +}; + + // explicit instantiations template class Boundary; template class StraightBoundary; diff --git a/deal.II/deal.II/source/grid/tria_boundary_lib.cc b/deal.II/deal.II/source/grid/tria_boundary_lib.cc index 67eff897c5..10cb013b41 100644 --- a/deal.II/deal.II/source/grid/tria_boundary_lib.cc +++ b/deal.II/deal.II/source/grid/tria_boundary_lib.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -74,6 +74,44 @@ get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) c }; +template <> +void +HyperBallBoundary<2>::get_intermediate_points_on_line ( + const Triangulation<2>::line_iterator &line, + vector > &points) const +{ + const unsigned int n=points.size(); + Assert(n>0, ExcInternalError()); + if (n==1) + points[0]=get_new_point_on_line(line); + else + { + Point<2> v0=line->vertex(0)-center, + v1=line->vertex(1)-center; + double alpha0=atan(v0(1)/v0(0)), + alpha1=atan(v1(1)/v1(0)); + double dalpha=(alpha1-alpha0)/(n+1); + double alpha=alpha0+dalpha; + + for (unsigned int i=0; i +void +HyperBallBoundary::get_intermediate_points_on_line ( + const typename Triangulation::line_iterator &, + vector > &) const +{ + Assert(false, ExcNotImplemented()); +} + template Point -- 2.39.5