From 5863c20a732037c5812da0ec2ab7760bb587db9b Mon Sep 17 00:00:00 2001 From: guido Date: Tue, 31 May 2005 09:09:21 +0000 Subject: [PATCH] QProjector moved to its own header file QProjector::project_to_line added git-svn-id: https://svn.dealii.org/trunk@10786 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/qprojector.h | 405 ++++++++++++++++++ deal.II/base/include/base/quadrature.h | 362 ---------------- deal.II/base/source/quadrature.cc | 24 ++ deal.II/deal.II/include/fe/mapping_q1.h | 2 +- deal.II/deal.II/source/fe/fe.cc | 1 + deal.II/deal.II/source/fe/fe_nedelec.cc | 1 + deal.II/deal.II/source/fe/fe_poly.cc | 1 + deal.II/deal.II/source/fe/fe_poly_tensor.cc | 1 + .../deal.II/source/fe/fe_raviart_thomas.cc | 1 + .../source/fe/fe_raviart_thomas_nodal.cc | 1 + .../deal.II/source/fe/mapping_cartesian.cc | 1 + deal.II/deal.II/source/fe/mapping_q1.cc | 1 + deal.II/deal.II/source/grid/grid_out.cc | 1 + tests/base/Makefile | 2 +- tests/base/qprojector.cc | 80 ++++ tests/base/quadrature_test.cc | 1 + tests/fe/internals.cc | 1 + tests/fe/rtn_1.cc | 1 + .../base/qprojector.output | 64 +++ 19 files changed, 587 insertions(+), 364 deletions(-) create mode 100644 deal.II/base/include/base/qprojector.h create mode 100644 tests/base/qprojector.cc create mode 100644 tests/results/i686-pc-linux-gnu+gcc3.2/base/qprojector.output diff --git a/deal.II/base/include/base/qprojector.h b/deal.II/base/include/base/qprojector.h new file mode 100644 index 0000000000..1d64ec6433 --- /dev/null +++ b/deal.II/base/include/base/qprojector.h @@ -0,0 +1,405 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- +#ifndef __deal2__qprojector_h +#define __deal2__qprojector_h + + +#include + +/*!@addtogroup Quadrature */ +/*@{*/ + + +/** + * This class is a helper class to facilitate the usage of quadrature formulae + * on faces or subfaces of cells. It computes the locations of quadrature + * points on the unit cell from a quadrature object for a manifold of + * one dimension less than that of the cell and the number of the face. + * For example, giving the Simpson rule in one dimension and using the + * project_to_face() function with face number 1, the returned points will + * be (1,0), (1,0.5) and (1,1). Note that faces have an orientation, + * so when projecting to face 3, you will get (0,0), (0,0.5) and (0,1), + * which is in clockwise sense, while for face 1 the points were in + * counterclockwise sense. + * + * For the projection to subfaces (i.e. to the children of a face of the + * unit cell), the same applies as above. Note the order in which the + * children of a face are numbered, which in two dimensions coincides + * with the orientation of the face. + * + * The second set of functions generates a quadrature formula by + * projecting a given quadrature rule on all faces and + * subfaces. This is used in the FEFaceValues and + * FESubfaceValues classes. Since we now have the quadrature + * points of all faces and subfaces in one array, we need to have a + * way to find the starting index of the points and weights + * corresponding to one face or subface within this array. This is + * done through the DataSetDescriptor member class. + * + * The different functions are grouped into a common class to avoid + * putting them into global namespace. However, since they have no + * local data, all functions are declared static and can be + * called without creating an object of this class. + * + * For the 3d case, you should note that the orientation of faces is + * even more intricate than for two dimensions. Quadrature formulae + * are projected upon the faces in their standard orientation, not to + * the inside or outside of the hexahedron. Refer to the + * documentation of the Triangulation class for a description of + * the orientation of the different faces. To make things more + * complicated, in 3d we allow faces in two orientations (which can + * be identified using cell->face_orientation(face)), so we have + * to project quadrature formula onto faces and subfaces in two + * orientations. The DataSetDescriptor member class is used to + * identify where each dataset starts. + * + * @author Wolfgang Bangerth, Guido Kanschat, 1998, 1999, 2003, 2005 + */ +template +class QProjector +{ + public: + /** + * Define a typedef for a + * quadrature that acts on an + * object of one dimension + * less. For cells, this would + * then be a face quadrature. + */ + typedef Quadrature SubQuadrature; + + /** + * Compute the quadrature points + * on the cell if the given + * quadrature formula is used on + * face face_no. For further + * details, see the general doc + * for this class. + */ + static void project_to_face (const SubQuadrature &quadrature, + const unsigned int face_no, + std::vector > &q_points); + + /** + * Compute the quadrature points + * on the cell if the given + * quadrature formula is used on + * face face_no, subface + * number subface_no. For + * further details, see the + * general doc for this class. + */ + static void project_to_subface (const SubQuadrature &quadrature, + const unsigned int face_no, + const unsigned int subface_no, + std::vector > &q_points); + + /** + * Take a face quadrature formula + * and generate a cell quadrature + * formula from it where the + * quadrature points of the given + * argument are projected on all + * faces. + * + * The weights of the new rule + * are replications of the + * original weights. This is not + * a proper handling, in that the + * sum of weights does not equal + * one, but it is consistent with + * the use of this function, + * namely to generate sets of + * face quadrature points on a + * cell, one set of which will + * then be selected at each + * time. This is used in the + * FEFaceValues class, + * where we initialize the + * values, derivatives, etc on + * all faces at once, while + * selecting the data of one + * particular face only happens + * later. + */ + static Quadrature + project_to_all_faces (const SubQuadrature &quadrature); + + /** + * This function is alike the + * previous one, but projects the + * given face quadrature formula + * to the subfaces of a cell, + * i.e. to the children of the + * faces of the unit cell. + */ + static Quadrature + project_to_all_subfaces (const SubQuadrature &quadrature); + + /** + * Project a give quadrature + * formula to a child of a + * cell. You may want to use this + * function in case you want to + * extend an integral only over + * the area which a potential + * child would occupy. The child + * numbering is the same as the + * children would be numbered + * upon refinement of the cell. + * + * As integration using this + * quadrature formula now only + * extends over a fraction of the + * cell, the weights of the + * resulting object are divided by + * GeometryInfo@::children_per_cell. + */ + static + Quadrature + project_to_child (const Quadrature &quadrature, + const unsigned int child_no); + + /** + * Project the onedimensional + * rule quadrature to + * the straight line connecting + * the points p1 and + * p2. + */ + static + Quadrature + project_to_line(const Quadrature<1>& quadrature, + const Point& p1, + const Point& p2); + /** + * Since the + * project_to_all_faces() and + * project_to_all_subfaces() + * functions chain together the + * quadrature points and weights + * of all projections of a face + * quadrature formula to the + * faces or subfaces of a cell, + * we need a way to identify + * where the starting index of + * the points and weights for a + * particular face or subface + * is. This class provides this: + * there are static member + * functions that generate + * objects of this type, given + * face or subface indices, and + * you can then use the generated + * object in place of an integer + * that denotes the offset of a + * given dataset. + * + * @author Wolfgang Bangerth, 2003 + */ + class DataSetDescriptor + { + public: + /** + * Default constructor. This + * doesn't do much except + * generating an invalid + * index, since you didn't + * give a valid descriptor of + * the cell, face, or subface + * you wanted. + */ + DataSetDescriptor (); + + /** + * Static function to + * generate the offset of a + * cell. Since we only have + * one cell per quadrature + * object, this offset is of + * course zero, but we carry + * this function around for + * consistency with the other + * static functions. + */ + static DataSetDescriptor cell (); + + /** + * Static function to + * generate an offset object + * for a given face of a cell + * with the given face + * orientation. This function + * of course is only allowed + * if dim>=2, and the + * face orientation is + * ignored if the space + * dimension equals 2. + * + * The last argument denotes + * the number of quadrature + * points the + * lower-dimensional face + * quadrature formula (the + * one that has been + * projected onto the faces) + * has. + */ + static + DataSetDescriptor + face (const unsigned int face_no, + const bool face_orientation, + const unsigned int n_quadrature_points); + + /** + * Static function to + * generate an offset object + * for a given subface of a + * cell with the given face + * orientation. This function + * of course is only allowed + * if dim>=2, and the + * face orientation is + * ignored if the space + * dimension equals 2. + * + * The last argument denotes + * the number of quadrature + * points the + * lower-dimensional face + * quadrature formula (the + * one that has been + * projected onto the faces) + * has. + */ + static + DataSetDescriptor + sub_face (const unsigned int face_no, + const unsigned int subface_no, + const bool face_orientation, + const unsigned int n_quadrature_points); + + /** + * Conversion operator to an + * integer denoting the + * offset of the first + * element of this dataset in + * the set of quadrature + * formulas all projected + * onto faces and + * subfaces. This conversion + * operator allows us to use + * offset descriptor objects + * in place of integer + * offsets. + */ + operator unsigned int () const; + + private: + /** + * Store the integer offset + * for a given cell, face, or + * subface. + */ + const unsigned int dataset_offset; + + /** + * This is the real + * constructor, but it is + * private and thus only + * available to the static + * member functions above. + */ + DataSetDescriptor (const unsigned int dataset_offset); + }; + + private: + /** + * Given a quadrature object in + * 2d, reflect all quadrature + * points at the main diagonal + * and return them with their + * original weights. + * + * This function is necessary for + * projecting a 2d quadrature + * rule onto the faces of a 3d + * cube, since there we need both + * orientations. + */ + static Quadrature<2> reflect (const Quadrature<2> &q); +}; + +/*@}*/ + +/// @if NoDoc + +/* -------------- declaration of explicit specializations ------------- */ + +template <> +void +QProjector<1>::project_to_face (const Quadrature<0> &, + const unsigned int, + std::vector > &); +template <> +void +QProjector<2>::project_to_face (const Quadrature<1> &quadrature, + const unsigned int face_no, + std::vector > &q_points); +template <> +void +QProjector<3>::project_to_face (const Quadrature<2> &quadrature, + const unsigned int face_no, + std::vector > &q_points); + +template <> +Quadrature<1> +QProjector<1>::project_to_all_faces (const Quadrature<0> &quadrature); + + +template <> +void +QProjector<1>::project_to_subface (const Quadrature<0> &, + const unsigned int, + const unsigned int, + std::vector > &); +template <> +void +QProjector<2>::project_to_subface (const Quadrature<1> &quadrature, + const unsigned int face_no, + const unsigned int subface_no, + std::vector > &q_points); +template <> +void +QProjector<3>::project_to_subface (const Quadrature<2> &quadrature, + const unsigned int face_no, + const unsigned int subface_no, + std::vector > &q_points); + +template <> +Quadrature<1> +QProjector<1>::project_to_all_subfaces (const Quadrature<0> &quadrature); + + +template <> +bool +QIterated<1>::uses_both_endpoints (const Quadrature<1> &base_quadrature); + +template <> +QIterated<1>::QIterated (const Quadrature<1> &base_quadrature, + const unsigned int n_copies); + + +/// @endif + +#endif diff --git a/deal.II/base/include/base/quadrature.h b/deal.II/base/include/base/quadrature.h index 01c1ad4b08..96989be0dc 100644 --- a/deal.II/base/include/base/quadrature.h +++ b/deal.II/base/include/base/quadrature.h @@ -303,314 +303,6 @@ class QIterated : public Quadrature -/** - * This class is a helper class to facilitate the usage of quadrature formulae - * on faces or subfaces of cells. It computes the locations of quadrature - * points on the unit cell from a quadrature object for a manifold of - * one dimension less than that of the cell and the number of the face. - * For example, giving the Simpson rule in one dimension and using the - * project_to_face() function with face number 1, the returned points will - * be (1,0), (1,0.5) and (1,1). Note that faces have an orientation, - * so when projecting to face 3, you will get (0,0), (0,0.5) and (0,1), - * which is in clockwise sense, while for face 1 the points were in - * counterclockwise sense. - * - * For the projection to subfaces (i.e. to the children of a face of the - * unit cell), the same applies as above. Note the order in which the - * children of a face are numbered, which in two dimensions coincides - * with the orientation of the face. - * - * The second set of functions generates a quadrature formula by - * projecting a given quadrature rule on all faces and - * subfaces. This is used in the FEFaceValues and - * FESubfaceValues classes. Since we now have the quadrature - * points of all faces and subfaces in one array, we need to have a - * way to find the starting index of the points and weights - * corresponding to one face or subface within this array. This is - * done through the DataSetDescriptor member class. - * - * The different functions are grouped into a common class to avoid - * putting them into global namespace. However, since they have no - * local data, all functions are declared static and can be - * called without creating an object of this class. - * - * For the 3d case, you should note that the orientation of faces is - * even more intricate than for two dimensions. Quadrature formulae - * are projected upon the faces in their standard orientation, not to - * the inside or outside of the hexahedron. Refer to the - * documentation of the Triangulation class for a description of - * the orientation of the different faces. To make things more - * complicated, in 3d we allow faces in two orientations (which can - * be identified using cell->face_orientation(face)), so we have - * to project quadrature formula onto faces and subfaces in two - * orientations. The DataSetDescriptor member class is used to - * identify where each dataset starts. - * - * @author Wolfgang Bangerth, 1998, 1999, 2003 - */ -template -class QProjector -{ - public: - /** - * Define a typedef for a - * quadrature that acts on an - * object of one dimension - * less. For cells, this would - * then be a face quadrature. - */ - typedef Quadrature SubQuadrature; - - /** - * Compute the quadrature points - * on the cell if the given - * quadrature formula is used on - * face face_no. For further - * details, see the general doc - * for this class. - */ - static void project_to_face (const SubQuadrature &quadrature, - const unsigned int face_no, - std::vector > &q_points); - - /** - * Compute the quadrature points - * on the cell if the given - * quadrature formula is used on - * face face_no, subface - * number subface_no. For - * further details, see the - * general doc for this class. - */ - static void project_to_subface (const SubQuadrature &quadrature, - const unsigned int face_no, - const unsigned int subface_no, - std::vector > &q_points); - - /** - * Take a face quadrature formula - * and generate a cell quadrature - * formula from it where the - * quadrature points of the given - * argument are projected on all - * faces. - * - * The weights of the new rule - * are replications of the - * original weights. This is not - * a proper handling, in that the - * sum of weights does not equal - * one, but it is consistent with - * the use of this function, - * namely to generate sets of - * face quadrature points on a - * cell, one set of which will - * then be selected at each - * time. This is used in the - * FEFaceValues class, - * where we initialize the - * values, derivatives, etc on - * all faces at once, while - * selecting the data of one - * particular face only happens - * later. - */ - static Quadrature - project_to_all_faces (const SubQuadrature &quadrature); - - /** - * This function is alike the - * previous one, but projects the - * given face quadrature formula - * to the subfaces of a cell, - * i.e. to the children of the - * faces of the unit cell. - */ - static Quadrature - project_to_all_subfaces (const SubQuadrature &quadrature); - - /** - * Project a give quadrature - * formula to a child of a - * cell. You may want to use this - * function in case you want to - * extend an integral only over - * the area which a potential - * child would occupy. The child - * numbering is the same as the - * children would be numbered - * upon refinement of the cell. - * - * As integration using this - * quadrature formula now only - * extends over a fraction of the - * cell, the weights of the - * resulting object are divided by - * GeometryInfo@::children_per_cell. - */ - static - Quadrature - project_to_child (const Quadrature &quadrature, - const unsigned int child_no); - - /** - * Since the - * project_to_all_faces() and - * project_to_all_subfaces() - * functions chain together the - * quadrature points and weights - * of all projections of a face - * quadrature formula to the - * faces or subfaces of a cell, - * we need a way to identify - * where the starting index of - * the points and weights for a - * particular face or subface - * is. This class provides this: - * there are static member - * functions that generate - * objects of this type, given - * face or subface indices, and - * you can then use the generated - * object in place of an integer - * that denotes the offset of a - * given dataset. - * - * @author Wolfgang Bangerth, 2003 - */ - class DataSetDescriptor - { - public: - /** - * Default constructor. This - * doesn't do much except - * generating an invalid - * index, since you didn't - * give a valid descriptor of - * the cell, face, or subface - * you wanted. - */ - DataSetDescriptor (); - - /** - * Static function to - * generate the offset of a - * cell. Since we only have - * one cell per quadrature - * object, this offset is of - * course zero, but we carry - * this function around for - * consistency with the other - * static functions. - */ - static DataSetDescriptor cell (); - - /** - * Static function to - * generate an offset object - * for a given face of a cell - * with the given face - * orientation. This function - * of course is only allowed - * if dim>=2, and the - * face orientation is - * ignored if the space - * dimension equals 2. - * - * The last argument denotes - * the number of quadrature - * points the - * lower-dimensional face - * quadrature formula (the - * one that has been - * projected onto the faces) - * has. - */ - static - DataSetDescriptor - face (const unsigned int face_no, - const bool face_orientation, - const unsigned int n_quadrature_points); - - /** - * Static function to - * generate an offset object - * for a given subface of a - * cell with the given face - * orientation. This function - * of course is only allowed - * if dim>=2, and the - * face orientation is - * ignored if the space - * dimension equals 2. - * - * The last argument denotes - * the number of quadrature - * points the - * lower-dimensional face - * quadrature formula (the - * one that has been - * projected onto the faces) - * has. - */ - static - DataSetDescriptor - sub_face (const unsigned int face_no, - const unsigned int subface_no, - const bool face_orientation, - const unsigned int n_quadrature_points); - - /** - * Conversion operator to an - * integer denoting the - * offset of the first - * element of this dataset in - * the set of quadrature - * formulas all projected - * onto faces and - * subfaces. This conversion - * operator allows us to use - * offset descriptor objects - * in place of integer - * offsets. - */ - operator unsigned int () const; - - private: - /** - * Store the integer offset - * for a given cell, face, or - * subface. - */ - const unsigned int dataset_offset; - - /** - * This is the real - * constructor, but it is - * private and thus only - * available to the static - * member functions above. - */ - DataSetDescriptor (const unsigned int dataset_offset); - }; - - private: - /** - * Given a quadrature object in - * 2d, reflect all quadrature - * points at the main diagonal - * and return them with their - * original weights. - * - * This function is necessary for - * projecting a 2d quadrature - * rule onto the faces of a 3d - * cube, since there we need both - * orientations. - */ - static Quadrature<2> reflect (const Quadrature<2> &q); -}; - /*@}*/ /// @if NoDoc @@ -636,60 +328,6 @@ double Quadrature<0>::weight (const unsigned int) const; template <> const std::vector & Quadrature<0>::get_weights () const; -template <> -void -QProjector<1>::project_to_face (const Quadrature<0> &, - const unsigned int, - std::vector > &); -template <> -void -QProjector<2>::project_to_face (const Quadrature<1> &quadrature, - const unsigned int face_no, - std::vector > &q_points); -template <> -void -QProjector<3>::project_to_face (const Quadrature<2> &quadrature, - const unsigned int face_no, - std::vector > &q_points); - -template <> -Quadrature<1> -QProjector<1>::project_to_all_faces (const Quadrature<0> &quadrature); - - -template <> -void -QProjector<1>::project_to_subface (const Quadrature<0> &, - const unsigned int, - const unsigned int, - std::vector > &); -template <> -void -QProjector<2>::project_to_subface (const Quadrature<1> &quadrature, - const unsigned int face_no, - const unsigned int subface_no, - std::vector > &q_points); -template <> -void -QProjector<3>::project_to_subface (const Quadrature<2> &quadrature, - const unsigned int face_no, - const unsigned int subface_no, - std::vector > &q_points); - -template <> -Quadrature<1> -QProjector<1>::project_to_all_subfaces (const Quadrature<0> &quadrature); - - -template <> -bool -QIterated<1>::uses_both_endpoints (const Quadrature<1> &base_quadrature); - -template <> -QIterated<1>::QIterated (const Quadrature<1> &base_quadrature, - const unsigned int n_copies); - - /// @endif #endif diff --git a/deal.II/base/source/quadrature.cc b/deal.II/base/source/quadrature.cc index 8c92928d70..2dc8bab16f 100644 --- a/deal.II/base/source/quadrature.cc +++ b/deal.II/base/source/quadrature.cc @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -912,6 +913,29 @@ QProjector::project_to_child (const Quadrature &quadrature, +template +Quadrature +QProjector::project_to_line( + const Quadrature<1>& quadrature, + const Point& p1, + const Point& p2) +{ + const unsigned int n = quadrature.n_quadrature_points; + std::vector > points(n); + std::vector weights(n); + const double length = p1.distance(p2); + + for (unsigned int k=0;k (points, weights); +} + + template typename QProjector::DataSetDescriptor QProjector::DataSetDescriptor::cell () diff --git a/deal.II/deal.II/include/fe/mapping_q1.h b/deal.II/deal.II/include/fe/mapping_q1.h index 64c590f227..525411f8e3 100644 --- a/deal.II/deal.II/include/fe/mapping_q1.h +++ b/deal.II/deal.II/include/fe/mapping_q1.h @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc index 6dd0c2d3eb..f478635ef1 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/fe_nedelec.cc b/deal.II/deal.II/source/fe/fe_nedelec.cc index 76398bc174..42b4a64299 100644 --- a/deal.II/deal.II/source/fe/fe_nedelec.cc +++ b/deal.II/deal.II/source/fe/fe_nedelec.cc @@ -12,6 +12,7 @@ //--------------------------------------------------------------------------- #include +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/fe_poly.cc b/deal.II/deal.II/source/fe/fe_poly.cc index 88addbb89b..917aaca24a 100644 --- a/deal.II/deal.II/source/fe/fe_poly.cc +++ b/deal.II/deal.II/source/fe/fe_poly.cc @@ -11,6 +11,7 @@ // //--------------------------------------------------------------------------- +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/fe_poly_tensor.cc b/deal.II/deal.II/source/fe/fe_poly_tensor.cc index fa50303cfc..b67fe6d26a 100644 --- a/deal.II/deal.II/source/fe/fe_poly_tensor.cc +++ b/deal.II/deal.II/source/fe/fe_poly_tensor.cc @@ -11,6 +11,7 @@ // //--------------------------------------------------------------------------- +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/fe_raviart_thomas.cc b/deal.II/deal.II/source/fe/fe_raviart_thomas.cc index cf4bb0bdd3..9e26669149 100644 --- a/deal.II/deal.II/source/fe/fe_raviart_thomas.cc +++ b/deal.II/deal.II/source/fe/fe_raviart_thomas.cc @@ -12,6 +12,7 @@ //--------------------------------------------------------------------------- #include +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/fe_raviart_thomas_nodal.cc b/deal.II/deal.II/source/fe/fe_raviart_thomas_nodal.cc index 4dad76b7ab..c62543f266 100644 --- a/deal.II/deal.II/source/fe/fe_raviart_thomas_nodal.cc +++ b/deal.II/deal.II/source/fe/fe_raviart_thomas_nodal.cc @@ -12,6 +12,7 @@ //--------------------------------------------------------------------------- #include +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/mapping_cartesian.cc b/deal.II/deal.II/source/fe/mapping_cartesian.cc index 89b38c52eb..5a5a2150a2 100644 --- a/deal.II/deal.II/source/fe/mapping_cartesian.cc +++ b/deal.II/deal.II/source/fe/mapping_cartesian.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/deal.II/deal.II/source/fe/mapping_q1.cc b/deal.II/deal.II/source/fe/mapping_q1.cc index 59de689edc..554166b344 100644 --- a/deal.II/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/deal.II/source/fe/mapping_q1.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/deal.II/deal.II/source/grid/grid_out.cc b/deal.II/deal.II/source/grid/grid_out.cc index e7afbafb31..c2983f7d4e 100644 --- a/deal.II/deal.II/source/grid/grid_out.cc +++ b/deal.II/deal.II/source/grid/grid_out.cc @@ -14,6 +14,7 @@ #include #include +#include #include #include #include diff --git a/tests/base/Makefile b/tests/base/Makefile index 71c44f4055..7c51f7181a 100644 --- a/tests/base/Makefile +++ b/tests/base/Makefile @@ -24,7 +24,7 @@ threads.cc : threads.pl tests_x = logtest \ reference \ - quadrature_* \ + quadrature_* qprojector \ path_search \ slice_vector \ table \ diff --git a/tests/base/qprojector.cc b/tests/base/qprojector.cc new file mode 100644 index 0000000000..5212ffee7d --- /dev/null +++ b/tests/base/qprojector.cc @@ -0,0 +1,80 @@ +//---------------------------- quadrature_test.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- quadrature_test.cc --------------------------- + +// Test projection onto lines + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include + +template +void check_line(Quadrature<1>& quadrature) +{ + Point p1; + Point p2; + p1(0) = 1.; + p2(0) = 7.; + if (dim>1) + { + p1(1) = 3; + p2(1) = -5.; + } + if (dim>2) + { + p1(2) = 0; + p2(2) = 10.; + } + Quadrature q = QProjector::project_to_line(quadrature, p1, p2); + double s = 0.; + + for (unsigned int k=0;k trapez; + check_line<1> (trapez); + check_line<2> (trapez); + check_line<3> (trapez); + + QSimpson<1> simpson; + check_line<1> (simpson); + check_line<2> (simpson); + check_line<3> (simpson); + + QMilne<1> milne; + check_line<1> (milne); + check_line<2> (milne); + check_line<3> (milne); + + QWeddle<1> weddle; + check_line<1> (weddle); + check_line<2> (weddle); + check_line<3> (weddle); +} diff --git a/tests/base/quadrature_test.cc b/tests/base/quadrature_test.cc index 110f1aed1e..c72b79676f 100644 --- a/tests/base/quadrature_test.cc +++ b/tests/base/quadrature_test.cc @@ -23,6 +23,7 @@ #include #include +#include #include template diff --git a/tests/fe/internals.cc b/tests/fe/internals.cc index 8a15877a46..00211a681f 100644 --- a/tests/fe/internals.cc +++ b/tests/fe/internals.cc @@ -5,6 +5,7 @@ #include "../tests.h" #include +#include #include #include #include diff --git a/tests/fe/rtn_1.cc b/tests/fe/rtn_1.cc index 2fbb1fba7a..96dbeae6d9 100644 --- a/tests/fe/rtn_1.cc +++ b/tests/fe/rtn_1.cc @@ -16,6 +16,7 @@ #include "../tests.h" #include +#include #include #include #include diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/base/qprojector.output b/tests/results/i686-pc-linux-gnu+gcc3.2/base/qprojector.output new file mode 100644 index 0000000000..5861fe5844 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/base/qprojector.output @@ -0,0 +1,64 @@ + +DEAL::0 1.00000 +DEAL::1 7.00000 +DEAL::length: 6.00000 +DEAL::0 1.00000 3.00000 +DEAL::1 7.00000 -5.00000 +DEAL::length: 10.0000 +DEAL::0 1.00000 3.00000 0.00000 +DEAL::1 7.00000 -5.00000 10.0000 +DEAL::length: 14.1421 +DEAL::0 1.00000 +DEAL::1 4.00000 +DEAL::2 7.00000 +DEAL::length: 6.00000 +DEAL::0 1.00000 3.00000 +DEAL::1 4.00000 -1.00000 +DEAL::2 7.00000 -5.00000 +DEAL::length: 10.0000 +DEAL::0 1.00000 3.00000 0.00000 +DEAL::1 4.00000 -1.00000 5.00000 +DEAL::2 7.00000 -5.00000 10.0000 +DEAL::length: 14.1421 +DEAL::0 1.00000 +DEAL::1 2.50000 +DEAL::2 4.00000 +DEAL::3 5.50000 +DEAL::4 7.00000 +DEAL::length: 6.00000 +DEAL::0 1.00000 3.00000 +DEAL::1 2.50000 1.00000 +DEAL::2 4.00000 -1.00000 +DEAL::3 5.50000 -3.00000 +DEAL::4 7.00000 -5.00000 +DEAL::length: 10.0000 +DEAL::0 1.00000 3.00000 0.00000 +DEAL::1 2.50000 1.00000 2.50000 +DEAL::2 4.00000 -1.00000 5.00000 +DEAL::3 5.50000 -3.00000 7.50000 +DEAL::4 7.00000 -5.00000 10.0000 +DEAL::length: 14.1421 +DEAL::0 1.00000 +DEAL::1 2.00000 +DEAL::2 3.00000 +DEAL::3 4.00000 +DEAL::4 5.00000 +DEAL::5 6.00000 +DEAL::6 7.00000 +DEAL::length: 6.00000 +DEAL::0 1.00000 3.00000 +DEAL::1 2.00000 1.66667 +DEAL::2 3.00000 0.333333 +DEAL::3 4.00000 -1.00000 +DEAL::4 5.00000 -2.33333 +DEAL::5 6.00000 -3.66667 +DEAL::6 7.00000 -5.00000 +DEAL::length: 10.0000 +DEAL::0 1.00000 3.00000 0.00000 +DEAL::1 2.00000 1.66667 1.66667 +DEAL::2 3.00000 0.333333 3.33333 +DEAL::3 4.00000 -1.00000 5.00000 +DEAL::4 5.00000 -2.33333 6.66667 +DEAL::5 6.00000 -3.66667 8.33333 +DEAL::6 7.00000 -5.00000 10.0000 +DEAL::length: 14.1421 -- 2.39.5