From: hartmann Date: Mon, 26 Nov 2001 12:19:50 +0000 (+0000) Subject: Fix of MappingQ::transform_real_to_unit_cell. Take MappingQ1::transform_real_to_... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88a9a71cb2c9cbcb7620f458e7adb8d80d8ccdd4;p=dealii-svn.git Fix of MappingQ::transform_real_to_unit_cell. Take MappingQ1::transform_real_to_unit_cell as start value of the MappingQ Newton iteration. git-svn-id: https://svn.dealii.org/trunk@5266 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index 37bfe641b5..cf1db84ddf 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -1232,38 +1232,29 @@ Point MappingQ::transform_real_to_unit_cell ( const typename Triangulation::cell_iterator cell, const Point &p) const { - // Let the start value of the - // newton iteration be the center - // of the unit cell - Point p_unit; - for (unsigned int i=0; i point_quadrature(p_unit); - InternalData *mdata=dynamic_cast ( - get_data(update_transformation_values | update_transformation_gradients, - point_quadrature)); - Assert(mdata!=0, ExcInternalError()); - - mdata->use_mapping_q1_on_current_cell = !(use_mapping_q_on_all_cells - || cell->has_boundary_lines()); - - typename MappingQ1::InternalData *p_data=0; - if (mdata->use_mapping_q1_on_current_cell) - p_data=&mdata->mapping_q1_data; - else - p_data=mdata; + // first a Newton iteration based + // on a Q1 mapping + Point p_unit=MappingQ1::transform_real_to_unit_cell(cell, p); + + if (cell->has_boundary_lines() || use_mapping_q_on_all_cells) + { + // then a Newton iteration + // based on the full MappingQ + const Quadrature point_quadrature(p_unit); + InternalData *mdata=dynamic_cast ( + get_data(update_transformation_values | update_transformation_gradients, + point_quadrature)); + Assert(mdata!=0, ExcInternalError()); + mdata->use_mapping_q1_on_current_cell=false; + + std::vector > &points=mdata->mapping_support_points; + compute_mapping_support_points(cell, points); + + transform_real_to_unit_cell_internal(cell, p, *mdata, p_unit); - // perform the newton iteration. - transform_real_to_unit_cell_internal(cell, p, *p_data, p_unit); + delete mdata; + } - delete mdata; return p_unit; } diff --git a/deal.II/deal.II/source/fe/mapping_q1.cc b/deal.II/deal.II/source/fe/mapping_q1.cc index 05c1eda9b7..e0d0c50b98 100644 --- a/deal.II/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/deal.II/source/fe/mapping_q1.cc @@ -930,10 +930,14 @@ Point MappingQ1::transform_real_to_unit_cell ( // point p_unit. const Quadrature point_quadrature(p_unit); InternalData *mdata=dynamic_cast ( - get_data(update_transformation_values | update_transformation_gradients, - point_quadrature)); + MappingQ1::get_data(update_transformation_values + | update_transformation_gradients, + point_quadrature)); Assert(mdata!=0, ExcInternalError()); + MappingQ1::compute_mapping_support_points(cell, mdata->mapping_support_points); + Assert(mdata->mapping_support_points.size()==4, ExcInternalError()); + // perform the newton iteration. transform_real_to_unit_cell_internal(cell, p, *mdata, p_unit); @@ -955,7 +959,6 @@ void MappingQ1::transform_real_to_unit_cell_internal ( Assert(mdata.shape_derivatives.size()==n_shapes, ExcInternalError()); std::vector > &points=mdata.mapping_support_points; - compute_mapping_support_points(cell, points); Assert(points.size()==n_shapes, ExcInternalError()); // Newton iteration to solve