From: kanschat Date: Wed, 7 Dec 2011 18:45:56 +0000 (+0000) Subject: throw exception if Mapping iteration fails X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f5859617069f08e79a20dfaf725adfdaabda3ba;p=dealii-svn.git throw exception if Mapping iteration fails git-svn-id: https://svn.dealii.org/trunk@24798 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/fe/mapping_q1.h b/deal.II/include/deal.II/fe/mapping_q1.h index 38bebfed55..065f24849c 100644 --- a/deal.II/include/deal.II/fe/mapping_q1.h +++ b/deal.II/include/deal.II/fe/mapping_q1.h @@ -521,6 +521,18 @@ class MappingQ1 : public Mapping virtual bool preserves_vertex_locations () const; + /** + * The Newton iteration computing + * the mapping between a + * real space point and a point + * in reference space did not + * converge, thus resulting in a + * wrong mapping. + * + * @ingroup Exceptions + */ + DeclException0(ExcTransformationFailed); + private: /** * Implementation of the interface in diff --git a/deal.II/source/fe/mapping_q1.cc b/deal.II/source/fe/mapping_q1.cc index d68e56654a..07917df35f 100644 --- a/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/source/fe/mapping_q1.cc @@ -1519,8 +1519,10 @@ transform_real_to_unit_cell_internal Point f = p_real-p; const double eps=1e-15*cell->diameter(); + const unsigned int loop_limit = 10; + unsigned int loop=0; - while (f.square()>eps*eps && loop++<10) + while (f.square()>eps*eps && loop++ df; @@ -1552,7 +1554,7 @@ transform_real_to_unit_cell_internal df = transpose(df); } } - + // Solve [f'(x)]d=f(x) Tensor<1,spacedim> d; Tensor<2,spacedim> df_1; @@ -1587,6 +1589,15 @@ transform_real_to_unit_cell_internal if(dim