From c1bc9d0bc6dc6118433d0970acaf99f6865dd192 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sat, 11 Apr 2009 21:54:24 +0000 Subject: [PATCH] Minor modifications to two functions. git-svn-id: https://svn.dealii.org/trunk@18587 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-34/step-34.cc | 40 ++++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/deal.II/examples/step-34/step-34.cc b/deal.II/examples/step-34/step-34.cc index 8c44870194..1494137770 100644 --- a/deal.II/examples/step-34/step-34.cc +++ b/deal.II/examples/step-34/step-34.cc @@ -464,19 +464,20 @@ double LaplaceKernel::single_layer(const Point &R, template Point LaplaceKernel::double_layer(const Point &R, bool factor_out_2d_singularity) { - Point D(R); - switch(dim) { + switch(dim) { case 2: - factor_out_2d_singularity ? D *= 0 : D /= -2*numbers::PI * R.square(); - break; + if (factor_out_2d_singularity) + return Point(); + else + return R / (-2*numbers::PI * R.square()); case 3: - D /= ( -4*numbers::PI * R.square()*R.norm() ); - break; - default: + return R / ( -4*numbers::PI * R.square()*R.norm() ); + + default: Assert(false, ExcInternalError()); break; } - return D; + return Point(); } template @@ -512,15 +513,24 @@ void BEMProblem::read_domain() { static HyperBallBoundary boundary(Point(),1.); + std::ifstream in; + switch (dim) + { + case 2: + in.open ("coarse_circle.inp"); + break; + + case 3: + in.open ("coarse_sphere.inp"); + break; + + default: + Assert (false, ExcNotImplemented()); + } + GridIn gi; gi.attach_triangulation (tria); - if(dim == 3) { - std::ifstream in ("coarse_sphere.inp"); - gi.read_ucd (in); - } else if(dim == 2) { - std::ifstream in ("coarse_circle.inp"); - gi.read_ucd (in); - } + gi.read_ucd (in); tria.set_boundary(1, boundary); } -- 2.39.5