From: Wolfgang Bangerth Date: Thu, 30 Jul 2009 13:21:24 +0000 (+0000) Subject: Add functions project_to_surface to the Boundary description. X-Git-Tag: v8.0.0~7426 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=039502447aab7897a568ba2129dddee73790bc1c;p=dealii.git Add functions project_to_surface to the Boundary description. git-svn-id: https://svn.dealii.org/trunk@19139 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/tria_boundary.h b/deal.II/deal.II/include/grid/tria_boundary.h index 7fedc661a9..d0b5f65eca 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, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -73,7 +73,7 @@ template class Triangulation; * around a given center point. * * @ingroup boundary - * @author Wolfgang Bangerth, 1999, 2001, Ralf Hartmann, 2001, 2008 + * @author Wolfgang Bangerth, 1999, 2001, 2009, Ralf Hartmann, 2001, 2008 */ template class Boundary : public Subscriptor @@ -280,6 +280,46 @@ class Boundary : public Subscriptor virtual void get_normals_at_vertices (const typename Triangulation::face_iterator &face, FaceVertexNormals &face_vertex_normals) const; + + /** + * Given a candidate point and a + * line segment characterized by + * the iterator, return a point + * that lies on the surface + * described by this object. This + * function is used in some mesh + * smoothing algorithms that try + * to move around points in order + * to improve the mesh quality + * but need to ensure that points + * that were on the boundary + * remain on the boundary. + * + * Derived classes do not need to + * implement this function unless + * mesh smoothing algorithms are + * used with a particular + * boundary object. The default + * implementation of this + * function throws an exception + * of type ExcPureFunctionCalled. + */ + virtual + Point + project_to_surface (const typename Triangulation::line_iterator &line, + const Point &candidate) const; + + /** + * Same function as above but for + * a point that is to be + * projected onto the area + * characterized by the given + * quad. + */ + virtual + Point + project_to_surface (const typename Triangulation::quad_iterator &quad, + const Point &candidate) const; }; @@ -387,6 +427,50 @@ class StraightBoundary : public Boundary virtual void get_normals_at_vertices (const typename Triangulation::face_iterator &face, typename Boundary::FaceVertexNormals &face_vertex_normals) const; + + /** + * Given a candidate point and a + * line segment characterized by + * the iterator, return a point + * that lies on the surface + * described by this object. This + * function is used in some mesh + * smoothing algorithms that try + * to move around points in order + * to improve the mesh quality + * but need to ensure that points + * that were on the boundary + * remain on the boundary. + * + * The point returned is the + * projection of the candidate + * point onto the line through + * the two vertices of the given + * line iterator. + */ + virtual + Point + project_to_surface (const typename Triangulation::line_iterator &line, + const Point &candidate) const; + + /** + * Same function as above but for + * a point that is to be + * projected onto the area + * characterized by the given + * quad. + * + * The point returned is the + * projection of the candidate + * point onto the bilinear + * surface spanned by the four + * vertices of the given quad + * iterator. + */ + virtual + Point + project_to_surface (const typename Triangulation::quad_iterator &quad, + const Point &candidate) const; }; diff --git a/deal.II/deal.II/source/grid/tria_boundary.cc b/deal.II/deal.II/source/grid/tria_boundary.cc index 0254258eff..c89556a76e 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, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -163,6 +163,30 @@ get_normals_at_vertices (const typename Triangulation::face_itera +template +Point +Boundary:: +project_to_surface (const typename Triangulation::line_iterator &, + const Point &) const +{ + Assert (false, ExcPureFunctionCalled()); + return Point(); +} + + + +template +Point +Boundary:: +project_to_surface (const typename Triangulation::quad_iterator &, + const Point &) const +{ + Assert (false, ExcPureFunctionCalled()); + return Point(); +} + + + /* -------------------------- StraightBoundary --------------------- */ @@ -461,6 +485,30 @@ get_normals_at_vertices (const Triangulation<3>::face_iterator &face, #endif +template +Point +StraightBoundary:: +project_to_surface (const typename Triangulation::line_iterator &, + const Point &) const +{ + Assert (false, ExcPureFunctionCalled()); + return Point(); +} + + + +template +Point +StraightBoundary:: +project_to_surface (const typename Triangulation::quad_iterator &, + const Point &) const +{ + Assert (false, ExcPureFunctionCalled()); + return Point(); +} + + + // explicit instantiations template class Boundary; template class StraightBoundary;