From: bangerth Date: Fri, 19 Nov 2010 20:21:29 +0000 (+0000) Subject: The data type of the unit_tangentials should be a Tensor<1,dim>, not Tensor<1,spacedi... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94e011cac60eb3d0f7ce060fa97f7d35e90bec86;p=dealii-svn.git The data type of the unit_tangentials should be a Tensor<1,dim>, not Tensor<1,spacedim>. With this change, rewrite code in such a way that we can now build FEFaceValues also for the case <2,3>, though we still get missing symbols elsewhere. git-svn-id: https://svn.dealii.org/trunk@22824 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 33ff0e7e7e..9372ea6dbd 100644 --- a/deal.II/include/deal.II/fe/mapping_q1.h +++ b/deal.II/include/deal.II/fe/mapping_q1.h @@ -230,7 +230,7 @@ class MappingQ1 : public Mapping * * Filled once. */ - std::vector > > unit_tangentials; + std::vector > > unit_tangentials; /** * Auxiliary vectors for internal use. diff --git a/deal.II/source/fe/mapping_q1.cc b/deal.II/source/fe/mapping_q1.cc index 7ce1b98fcd..eb5b0d558b 100644 --- a/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/source/fe/mapping_q1.cc @@ -517,7 +517,7 @@ MappingQ1::compute_face_data (const UpdateFlags update_flags, // unit cell. const unsigned int nfaces = GeometryInfo::faces_per_cell; data.unit_tangentials.resize (nfaces*(dim-1), - std::vector > (n_original_q_points)); + std::vector > (n_original_q_points)); if (dim==2) { // ensure a counterclock wise @@ -525,7 +525,7 @@ MappingQ1::compute_face_data (const UpdateFlags update_flags, static const int tangential_orientation[4]={-1,1,1,-1}; for (unsigned int i=0; i tang; + Tensor<1,dim> tang; tang[1-i/2]=tangential_orientation[i]; std::fill (data.unit_tangentials[i].begin(), data.unit_tangentials[i].end(), tang); @@ -535,7 +535,7 @@ MappingQ1::compute_face_data (const UpdateFlags update_flags, { for (unsigned int i=0; i tang1, tang2; + Tensor<1,dim> tang1, tang2; const unsigned int nd= GeometryInfo::unit_normal_direction[i]; @@ -866,65 +866,6 @@ MappingQ1::fill_fe_values ( -template<> -void -MappingQ1<2,3>::compute_fill_face (const Triangulation<2,3>::cell_iterator &, - const unsigned int, - const unsigned int, - const unsigned int, - const DataSetDescriptor, - const std::vector&, - InternalData &, - std::vector >&, - std::vector&, - std::vector > &, - std::vector > &) const -{ - Assert(false, ExcNotImplemented()); -} - - - -template <> -void -MappingQ1<1,1>::compute_fill_face ( - const Triangulation<1,1>::cell_iterator &, - const unsigned int, - const unsigned int, - const unsigned int, - const DataSetDescriptor, - const std::vector &, - InternalData &, - std::vector > &, - std::vector &, - std::vector > &, - std::vector > &) const -{ - Assert(false, ExcNotImplemented()); -} - - - -template <> -void -MappingQ1<1,2>::compute_fill_face ( - const Triangulation<1,2>::cell_iterator &, - const unsigned int, - const unsigned int, - const unsigned int, - const DataSetDescriptor, - const std::vector &, - InternalData &, - std::vector > &, - std::vector &, - std::vector > &, - std::vector > &) const -{ - Assert(false, ExcNotImplemented()); -} - - - template <> void MappingQ1<1,1>::fill_fe_face_values ( @@ -995,6 +936,137 @@ MappingQ1<1,2>::fill_fe_subface_values ( +namespace internal +{ + namespace + { + void + compute_fill_face (const dealii::MappingQ1<1,1> &, + const dealii::Triangulation<1,1>::cell_iterator &, + const unsigned int, + const unsigned int, + const unsigned int, + const std::vector &, + dealii::MappingQ1<1,1>::InternalData &, + std::vector &, + std::vector > &, + std::vector > &) + { + Assert(false, ExcNotImplemented()); + } + + + + void + compute_fill_face (const dealii::MappingQ1<1,2> &, + const dealii::Triangulation<1,2>::cell_iterator &, + const unsigned int, + const unsigned int, + const unsigned int, + const std::vector &, + dealii::MappingQ1<1,2>::InternalData &, + std::vector &, + std::vector > &, + std::vector > &) + { + Assert(false, ExcNotImplemented()); + } + + + + template + void + compute_fill_face (const dealii::MappingQ1 &mapping, + const typename dealii::Triangulation::cell_iterator &cell, + const unsigned int face_no, + const unsigned int subface_no, + const unsigned int n_q_points, + const std::vector &weights, + typename dealii::MappingQ1::InternalData &data, + std::vector &JxW_values, + std::vector > &boundary_forms, + std::vector > &normal_vectors) + { + const UpdateFlags update_flags(data.current_update_flags()); + + if (update_flags & update_boundary_forms) + { + Assert (boundary_forms.size()==n_q_points, + ExcDimensionMismatch(boundary_forms.size(), n_q_points)); + if (update_flags & update_normal_vectors) + Assert (normal_vectors.size()==n_q_points, + ExcDimensionMismatch(normal_vectors.size(), n_q_points)); + if (update_flags & update_JxW_values) + Assert (JxW_values.size() == n_q_points, + ExcDimensionMismatch(JxW_values.size(), n_q_points)); + + mapping.transform (data.unit_tangentials[face_no], + data.aux[0], + data, + mapping_contravariant); + + typename std::vector >::iterator + result = boundary_forms.begin(); + const typename std::vector >::iterator + end = boundary_forms.end(); + + switch (dim) + { + case 2: + { + for (unsigned int i=0; result != end; ++result, ++i) + cross_product (*result, data.aux[0][i]); + break; + } + + case 3: + { + Assert (face_no+GeometryInfo::faces_per_cell < + data.unit_tangentials.size(), + ExcInternalError()); + Assert (data.aux[1].size() <= + data.unit_tangentials[face_no+GeometryInfo::faces_per_cell].size(), + ExcInternalError()); + mapping.transform (data.unit_tangentials[face_no+GeometryInfo::faces_per_cell], + data.aux[1], + data, + mapping_contravariant); + for (unsigned int i=0; result != end; ++result, ++i) + cross_product (*result, data.aux[0][i], data.aux[1][i]); + + break; + } + + default: + Assert(false, ExcNotImplemented()); + } + + if (update_flags & (update_normal_vectors + | update_JxW_values)) + for (unsigned int i=0;i::subface_ratio( + cell->subface_case(face_no), subface_no); + JxW_values[i] *= area_ratio; + } + } + + if (update_flags & update_normal_vectors) + normal_vectors[i] = boundary_forms[i] / f; + } + } + } + } +} + + template void MappingQ1::compute_fill_face ( @@ -1012,77 +1084,10 @@ MappingQ1::compute_fill_face ( { compute_fill (cell, n_q_points, data_set, CellSimilarity::none, data, quadrature_points); - - const UpdateFlags update_flags(data.current_update_flags()); - - if (update_flags & update_boundary_forms) - { - Assert (boundary_forms.size()==n_q_points, - ExcDimensionMismatch(boundary_forms.size(), n_q_points)); - if (update_flags & update_normal_vectors) - Assert (normal_vectors.size()==n_q_points, - ExcDimensionMismatch(normal_vectors.size(), n_q_points)); - if (update_flags & update_JxW_values) - Assert (JxW_values.size() == n_q_points, - ExcDimensionMismatch(JxW_values.size(), n_q_points)); - - transform(data.unit_tangentials[face_no], data.aux[0], - data, mapping_contravariant); - - typename std::vector >::iterator - result = boundary_forms.begin(); - const typename std::vector >::iterator - end = boundary_forms.end(); - - switch (dim) - { - case 2: - { - for (unsigned int i=0; result != end; ++result, ++i) - cross_product (*result, data.aux[0][i]); - break; - }; - - case 3: - { - Assert (face_no+GeometryInfo::faces_per_cell < - data.unit_tangentials.size(), - ExcInternalError()); - Assert (data.aux[1].size() <= - data.unit_tangentials[face_no+GeometryInfo::faces_per_cell].size(), - ExcInternalError()); - transform(data.unit_tangentials[face_no+GeometryInfo::faces_per_cell], - data.aux[1], data, mapping_contravariant); - for (unsigned int i=0; result != end; ++result, ++i) - cross_product (*result, data.aux[0][i], data.aux[1][i]); - - break; - }; - - default: - Assert(false, ExcNotImplemented()); - } - - if (update_flags & (update_normal_vectors - | update_JxW_values)) - for (unsigned int i=0;i::subface_ratio( - cell->subface_case(face_no), subface_no); - JxW_values[i] *= area_ratio; - } - } - if (update_flags & update_normal_vectors) - normal_vectors[i] = boundary_forms[i] / f; - } - } + internal::compute_fill_face (*this, + cell, face_no, subface_no, n_q_points, + weights, data, + JxW_values, boundary_forms, normal_vectors); }