From: bangerth Date: Mon, 20 Dec 2010 02:02:03 +0000 (+0000) Subject: Make code somewhat cleaner and dimension independent. Document better what X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986a703a5b95df94d25a3c32ea0b16610f64ac7c;p=dealii-svn.git Make code somewhat cleaner and dimension independent. Document better what exactly we do. git-svn-id: https://svn.dealii.org/trunk@23014 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/fe/mapping_q1.cc b/deal.II/source/fe/mapping_q1.cc index 3dee5dbf4e..200ed752ac 100644 --- a/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/source/fe/mapping_q1.cc @@ -804,59 +804,45 @@ MappingQ1::fill_fe_values ( } else { + data.contravariant[point]=transpose(data.contravariant[point]); + + // compute the normal + // vector to this cell + // and put it into the + // last row of + // data.contravariant if ( (dim==1) && (spacedim==2) ) - { - data.contravariant[point] = transpose(data.contravariant[point]); - JxW_values[point] - = data.contravariant[point][0].norm()*weights[point]; - if (update_flags & update_normal_vectors) - { - normal_vectors[point][0] - = -(data.contravariant[point][0][1] - / - data.contravariant[point][0].norm()); - normal_vectors[point][1] - = (data.contravariant[point][0][0] - / - data.contravariant[point][0].norm()); - - if (cell->direction_flag() == false) - normal_vectors[point] *= -1.; - } - } + cross_product(data.contravariant[point][1], + -data.contravariant[point][0]); + else if ( (dim==2) && (spacedim==3) ) + cross_product(data.contravariant[point][2], + data.contravariant[point][0], + data.contravariant[point][1]); else + Assert (false, ExcNotImplemented()); + + // det(J) is now the norm + // of the cross product + // of all the mapped unit + // tangential vectors + JxW_values[point] + = data.contravariant[point][spacedim-1].norm()*weights[point]; + + // in order to compute + // the normal vector, + // normalize the cross + // product of mapped unit + // vectors + data.contravariant[point][spacedim-1] + /= data.contravariant[point][spacedim-1].norm(); + + if (update_flags & update_normal_vectors) { - if ( (dim==2) && (spacedim==3) ) - { - data.contravariant[point]=transpose(data.contravariant[point]); - cross_product(data.contravariant[point][2], - data.contravariant[point][0], - data.contravariant[point][1]); - JxW_values[point] - = data.contravariant[point][2].norm()*weights[point]; - - // the cell - // normal - // vector - // (normal - // to the - // surface) - // is - // stored - // in the - // 3d - // subtensor - // of the - // contravariant - // tensor - data.contravariant[point][2] /= data.contravariant[point][2].norm(); - if (update_flags & update_normal_vectors) - { - normal_vectors[point]=data.contravariant[point][2]; - if (cell->direction_flag() == false) - normal_vectors[point] *= -1.; - } - } + normal_vectors[point] + = data.contravariant[point][spacedim-1]; + + if (cell->direction_flag() == false) + normal_vectors[point] *= -1.; } } }