From: Ralf Hartmann Date: Thu, 15 Mar 2001 19:02:04 +0000 (+0000) Subject: Remove InternalDataBase argument and simplify implementation of transform_unit_to_rea... X-Git-Tag: v8.0.0~19549 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71664ccd58f28fd133d1b2718851ff99fd090c2c;p=dealii.git Remove InternalDataBase argument and simplify implementation of transform_unit_to_real_cell function. git-svn-id: https://svn.dealii.org/trunk@4223 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/mapping_cartesian.cc b/deal.II/deal.II/source/fe/mapping_cartesian.cc index 549ec5761e..8c2ab4ba12 100644 --- a/deal.II/deal.II/source/fe/mapping_cartesian.cc +++ b/deal.II/deal.II/source/fe/mapping_cartesian.cc @@ -457,49 +457,32 @@ MappingCartesian::transform_contravariant (std::vector > & template Point MappingCartesian::transform_unit_to_real_cell ( const typename Triangulation::cell_iterator cell, - const Point &p, - const typename Mapping::InternalDataBase *const m_data) const + const Point &p) const { -//TODO: wouldn't it be simpler in this function to compute local lengths ourselved, rather than relying on an InternalDataBase object? - - // If m_data!=0 use this - // InternalData. - // - // Otherwise use the get_data - // function to create an - // InternalData with data vectors - // already of the right size; And - // compute shape values and mapping - // support points. - // - // Let, at the end, mdata be a - // pointer to the given or the new - // created InternalData - const InternalData *mdata; - if (m_data==0) + Tensor<1,dim> length; + const Point start = cell->vertex(0); + switch (dim) { - static Point dummy_p; - static Quadrature dummy_quadrature(dummy_p); - mdata=dynamic_cast (get_data(update_default, - dummy_quadrature)); + case 1: + length[0] = cell->vertex(1)(0) - start(0); + break; + case 2: + length[0] = cell->vertex(1)(0) - start(0); + length[1] = cell->vertex(3)(1) - start(1); + break; + case 3: + length[0] = cell->vertex(1)(0) - start(0); + length[1] = cell->vertex(4)(1) - start(1); + length[2] = cell->vertex(3)(2) - start(2); + break; + default: + Assert(false, ExcNotImplemented()); } - else - mdata = dynamic_cast (m_data); - Assert(mdata!=0, ExcInternalError()); -//TODO: don't we need to reinit() mdata on the present cell or initialize the mdata->length array in some other way? - - // use now the InternalData, that - // mdata is pointing to, to compute - // the point in real space. it is - // simply a scaled version of the - // unit cell point shifted by the - // (lower) left corner of the cell Point p_real = cell->vertex(0); for (unsigned int d=0; dlength[d]*p(d); + p_real(d) +=length[d]*p(d); -//TODO: memory leak: if initially mdata==0, then an object is created but never deleted. see mapping_q1 for a better implementation return p_real; }