From 150ee7178d51fa4f6d255dd2e7f1e90cd49e6715 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 17 Oct 2006 04:08:39 +0000 Subject: [PATCH] Take over a few useful changes anyway. git-svn-id: https://svn.dealii.org/trunk@14009 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-26/step-26.cc | 40 +++++++++++++++++++---------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/deal.II/examples/step-26/step-26.cc b/deal.II/examples/step-26/step-26.cc index 0cffe5165b..aa363f6256 100644 --- a/deal.II/examples/step-26/step-26.cc +++ b/deal.II/examples/step-26/step-26.cc @@ -55,12 +55,13 @@ #include -class PointDefinedSurface : public StraightBoundary<3> +class PointCloudSurface : public StraightBoundary<3> { public: - PointDefinedSurface (const std::string &filename); - - Point<3> closest_point (const Point<3> &p) const; + /** + * Constructor. + */ + PointCloudSurface (const std::string &filename); /** * Let the new point be the @@ -125,12 +126,23 @@ class PointDefinedSurface : public StraightBoundary<3> virtual void get_intermediate_points_on_quad (const Triangulation<3>::quad_iterator &quad, std::vector > &points) const; + + /** + * A function that, given a point @p p, + * returns the closest point on the + * surface defined by the input file. For + * the time being, we simply return the + * closest point in the point cloud, + * rather than doing any sort of + * interpolation. + */ + Point<3> closest_point (const Point<3> &p) const; private: std::vector > point_list; }; -PointDefinedSurface::PointDefinedSurface (const std::string &filename) +PointCloudSurface::PointCloudSurface (const std::string &filename) { // first read in all the points { @@ -237,7 +249,7 @@ PointDefinedSurface::PointDefinedSurface (const std::string &filename) Point<3> -PointDefinedSurface::closest_point (const Point<3> &p) const +PointCloudSurface::closest_point (const Point<3> &p) const { double distance = p.distance (point_list[0]); Point<3> point = point_list[0]; @@ -258,7 +270,7 @@ PointDefinedSurface::closest_point (const Point<3> &p) const Point<3> -PointDefinedSurface:: +PointCloudSurface:: get_new_point_on_line (const Triangulation<3>::line_iterator &line) const { return closest_point (StraightBoundary<3>::get_new_point_on_line (line)); @@ -267,7 +279,7 @@ get_new_point_on_line (const Triangulation<3>::line_iterator &line) const Point<3> -PointDefinedSurface:: +PointCloudSurface:: get_new_point_on_quad (const Triangulation<3>::quad_iterator &quad) const { return closest_point (StraightBoundary<3>::get_new_point_on_quad (quad)); @@ -276,7 +288,7 @@ get_new_point_on_quad (const Triangulation<3>::quad_iterator &quad) const void -PointDefinedSurface:: +PointCloudSurface:: get_intermediate_points_on_line (const Triangulation<3>::line_iterator &line, std::vector > &points) const { @@ -289,7 +301,7 @@ get_intermediate_points_on_line (const Triangulation<3>::line_iterator &line, void -PointDefinedSurface:: +PointCloudSurface:: get_intermediate_points_on_quad (const Triangulation<3>::quad_iterator &quad, std::vector > &points) const { @@ -301,7 +313,7 @@ get_intermediate_points_on_quad (const Triangulation<3>::quad_iterator &quad, -PointDefinedSurface pds("surface-points"); +PointCloudSurface pds("surface-points"); @@ -492,7 +504,7 @@ void LaplaceProblem::make_grid_and_dofs () triangulation.begin()->vertex(v)[1], 0)); - for (unsigned int i=0; i<7; ++i) + for (unsigned int i=0; i<4; ++i) { for (typename Triangulation::active_cell_iterator cell = triangulation.begin_active(); @@ -597,7 +609,9 @@ void LaplaceProblem::assemble_system () template void LaplaceProblem::solve () { - SolverControl solver_control (1000, 1e-12); + // NEW + SolverControl solver_control (dof_handler.n_dofs(), + 1e-12*system_rhs.l2_norm()); SolverCG<> cg (solver_control); PreconditionSSOR<> preconditioner; -- 2.39.5