From: wolf Date: Tue, 30 Sep 2003 14:45:33 +0000 (+0000) Subject: Add quadrature in reverse orientation when projecting to faces and subfaces in 3d. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfe86ca4c379a9721105b070bbc6e30fffe8b0c4;p=dealii-svn.git Add quadrature in reverse orientation when projecting to faces and subfaces in 3d. git-svn-id: https://svn.dealii.org/trunk@8068 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/source/quadrature.cc b/deal.II/base/source/quadrature.cc index 8f303403dd..74317798af 100644 --- a/deal.II/base/source/quadrature.cc +++ b/deal.II/base/source/quadrature.cc @@ -15,7 +15,9 @@ #include #include #include + #include +#include template <> @@ -235,6 +237,23 @@ Quadrature::memory_consumption () const //----------------------------------------------------------------------// + +Quadrature<2> revert (const Quadrature<2> &q) +{ + std::vector > q_points (q.n_quadrature_points); + std::vector weights (q.n_quadrature_points); + for (unsigned int i=0; i (q_points, weights); +} + + template <> void QProjector<1>::project_to_face (const Quadrature<0> &, @@ -591,31 +610,97 @@ QProjector<1>::project_to_all_faces (const Quadrature<0> &) -template -Quadrature -QProjector::project_to_all_faces (const SubQuadrature &quadrature) +template <> +Quadrature<2> +QProjector<2>::project_to_all_faces (const SubQuadrature &quadrature) { + const unsigned int dim = 2; + const unsigned int n_points = quadrature.n_quadrature_points, n_faces = GeometryInfo::faces_per_cell; // first fix quadrature points - std::vector > q_points (n_points * n_faces); + std::vector > q_points; + q_points.reserve(n_points * n_faces); std::vector > help(n_points); - // project to each face and copy + // project to each face and append + // results + for (unsigned int face=0; face weights; + weights.reserve (n_points * n_faces); + for (unsigned int face=0; face(q_points, weights); +} + + + +template <> +Quadrature<3> +QProjector<3>::project_to_all_faces (const SubQuadrature &quadrature) +{ + const unsigned int dim = 3; + + const SubQuadrature q_reverted = revert (quadrature); + + const unsigned int n_points = quadrature.n_quadrature_points, + n_faces = GeometryInfo::faces_per_cell; + + // first fix quadrature points + std::vector > q_points; + q_points.reserve(n_points * n_faces * 2); + std::vector > help(n_points); + + // project to each face and append // results for (unsigned int face=0; face weights (n_points * n_faces); + std::vector weights; + weights.reserve (n_points * n_faces * 2); for (unsigned int face=0; face(q_points, weights); } @@ -632,16 +717,19 @@ QProjector<1>::project_to_all_subfaces (const Quadrature<0> &) -template -Quadrature -QProjector::project_to_all_subfaces (const SubQuadrature &quadrature) +template <> +Quadrature<2> +QProjector<2>::project_to_all_subfaces (const SubQuadrature &quadrature) { + const unsigned int dim = 2; + const unsigned int n_points = quadrature.n_quadrature_points, n_faces = GeometryInfo::faces_per_cell, subfaces_per_face = GeometryInfo::subfaces_per_face; // first fix quadrature points - std::vector > q_points (n_points * n_faces * subfaces_per_face); + std::vector > q_points; + q_points.reserve (n_points * n_faces * subfaces_per_face); std::vector > help(n_points); // project to each face and copy @@ -651,16 +739,83 @@ QProjector::project_to_all_subfaces (const SubQuadrature &quadrature) { project_to_subface(quadrature, face, subface, help); std::copy (help.begin(), help.end(), - q_points.begin()+n_points*(face*subfaces_per_face+subface)); + std::back_inserter (q_points)); }; // next copy over weights - std::vector weights (n_points * n_faces * subfaces_per_face); + std::vector weights; + weights.reserve (n_points * n_faces * subfaces_per_face); + for (unsigned int face=0; face(q_points, weights); +} + + + +template <> +Quadrature<3> +QProjector<3>::project_to_all_subfaces (const SubQuadrature &quadrature) +{ + const unsigned int dim = 3; + + const SubQuadrature q_reverted = revert (quadrature); + + const unsigned int n_points = quadrature.n_quadrature_points, + n_faces = GeometryInfo::faces_per_cell, + subfaces_per_face = GeometryInfo::subfaces_per_face; + + // first fix quadrature points + std::vector > q_points; + q_points.reserve (n_points * n_faces * subfaces_per_face * 2); + std::vector > help(n_points); + + // project to each face and copy + // results + for (unsigned int face=0; face weights; + weights.reserve (n_points * n_faces * subfaces_per_face * 2); for (unsigned int face=0; face(q_points, weights); }