From: Wolfgang Bangerth Date: Sun, 3 Apr 2016 15:07:09 +0000 (-0500) Subject: Use a fixed size data structure for MappingQGeneric::InternalData::unit_tangentials. X-Git-Tag: v8.5.0-rc1~1132^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27e99eda98b2f049e0ed1a398994b43a238ee5b8;p=dealii.git Use a fixed size data structure for MappingQGeneric::InternalData::unit_tangentials. --- diff --git a/include/deal.II/fe/mapping_q_generic.h b/include/deal.II/fe/mapping_q_generic.h index 4ba02f3ee4..54010338a6 100644 --- a/include/deal.II/fe/mapping_q_generic.h +++ b/include/deal.II/fe/mapping_q_generic.h @@ -25,6 +25,8 @@ #include #include +#include + #include DEAL_II_NAMESPACE_OPEN @@ -360,7 +362,7 @@ public: * Unit tangential vectors. Used for the computation of boundary forms and * normal vectors. * - * This vector has (dim-1)GeometryInfo::faces_per_cell entries. The first + * This array has (dim-1)*GeometryInfo::faces_per_cell entries. The first * GeometryInfo::faces_per_cell contain the vectors in the first * tangential direction for each face; the second set of * GeometryInfo::faces_per_cell entries contain the vectors in the second @@ -369,7 +371,7 @@ public: * * Filled once. */ - std::vector > > unit_tangentials; + std_cxx11::array >, GeometryInfo::faces_per_cell *(dim-1)> unit_tangentials; /** * The polynomial degree of the mapping. Since the objects here are also diff --git a/source/fe/mapping_q_generic.cc b/source/fe/mapping_q_generic.cc index 080b049ffe..6f82615823 100644 --- a/source/fe/mapping_q_generic.cc +++ b/source/fe/mapping_q_generic.cc @@ -764,24 +764,22 @@ initialize_face (const UpdateFlags update_flags, { aux.resize (dim-1, std::vector > (n_original_q_points)); - // Compute tangentials to the - // unit cell. - const unsigned int nfaces = GeometryInfo::faces_per_cell; - unit_tangentials.resize (nfaces*(dim-1), - std::vector > (n_original_q_points)); + // Compute tangentials to the unit cell. + for (unsigned int i=0; i::faces_per_cell; ++i) { Tensor<1,dim> tang; - tang[1-i/2]=tangential_orientation[i]; + tang[1-i/2] = tangential_orientation[i]; std::fill (unit_tangentials[i].begin(), - unit_tangentials[i].end(), tang); + unit_tangentials[i].end(), + tang); } break; @@ -789,7 +787,7 @@ initialize_face (const UpdateFlags update_flags, case 3: { - for (unsigned int i=0; i::faces_per_cell; ++i) { Tensor<1,dim> tang1, tang2; @@ -811,9 +809,11 @@ initialize_face (const UpdateFlags update_flags, // for all quadrature // points on this face std::fill (unit_tangentials[i].begin(), - unit_tangentials[i].end(), tang1); - std::fill (unit_tangentials[nfaces+i].begin(), - unit_tangentials[nfaces+i].end(), tang2); + unit_tangentials[i].end(), + tang1); + std::fill (unit_tangentials[GeometryInfo::faces_per_cell+i].begin(), + unit_tangentials[GeometryInfo::faces_per_cell+i].end(), + tang2); } break;