]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add support class for the projection of quadrature formula onto faces and subfaces.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 4 May 1998 16:45:21 +0000 (16:45 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 4 May 1998 16:45:21 +0000 (16:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@244 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/quadrature.cc

index 3fae03bd06a40f1eaab3db618a77c8cf03bb5145..c84fba356a557dc29f3f6d6f7722a952e3e1a11e 100644 (file)
@@ -39,6 +39,115 @@ double Quadrature<dim>::weight (const unsigned int i) const {
 
 
 
+template <int dim>
+const vector<double> & Quadrature<dim>::get_weights () const {
+  return weights;
+};
+
+
+
+
+template <>
+void QProjector<2>::project_to_face (const Quadrature<1> &quadrature,
+                                    const unsigned int   face_no,
+                                    vector<Point<2> >   &q_points) {
+  const unsigned int dim=2;
+  Assert (face_no<2*dim, ExcInvalidIndex (face_no, 2*dim));
+  
+  for (unsigned int p=0; p<quadrature.n_quadrature_points; ++p)
+    switch (face_no)
+      {
+       case 0:
+             q_points[p] = Point<dim>(quadrature.quad_point(p)(0),0);
+             break;       
+       case 1:
+             q_points[p] = Point<dim>(1,quadrature.quad_point(p)(0));
+             break;       
+       case 2:
+             q_points[p] = Point<dim>(quadrature.quad_point(p)(0),1);
+             break;       
+       case 3:
+             q_points[p] = Point<dim>(0,quadrature.quad_point(p)(0));
+             break;
+       default:
+             Assert (false, ExcInternalError());
+      };
+};
+
+
+
+template <>
+void QProjector<2>::project_to_subface (const Quadrature<1> &quadrature,
+                                       const unsigned int   face_no,
+                                       const unsigned int   subface_no,
+                                       vector<Point<2> >   &q_points) {
+  const unsigned int dim=2;
+  Assert (face_no<2*dim, ExcInvalidIndex (face_no, 2*dim));
+  Assert (subface_no<(1<<(dim-1)), ExcInvalidIndex (face_no, 1<<(dim-1)));
+  
+  for (unsigned int p=0; p<quadrature.n_quadrature_points; ++p)
+    switch (face_no)
+      {
+       case 0:
+             switch (subface_no) 
+               {
+                 case 0:
+                       q_points[p]
+                         = Point<dim>(quadrature.quad_point(p)(0)/2,0);
+                       break;
+                 case 1:
+                       q_points[p]
+                         = Point<dim>(quadrature.quad_point(p)(0)/2+0.5,0);
+                       break;
+                 default:
+                       Assert (false, ExcInternalError());
+               };
+             break;       
+       case 1:
+             switch (subface_no) 
+               {
+                 case 0:
+                       q_points[p] = Point<dim>(1,quadrature.quad_point(p)(0)/2);
+                       break;
+                 case 1:
+                       q_points[p] = Point<dim>(1,quadrature.quad_point(p)(0)/2+0.5);
+                       break;
+                 default:
+                       Assert (false, ExcInternalError());
+               };
+             break;       
+       case 2:
+             switch (subface_no) 
+               {
+                 case 0:
+                       q_points[p] = Point<dim>(quadrature.quad_point(p)(0)/2,1);
+                       break;
+                 case 1:
+                       q_points[p] = Point<dim>(quadrature.quad_point(p)(0)/2+0.5,1);
+                       break;
+                 default:
+                       Assert (false, ExcInternalError());
+               };
+             break;       
+       case 3:
+             switch (subface_no) 
+               {
+                 case 0:
+                       q_points[p] = Point<dim>(0,quadrature.quad_point(p)(0)/2);
+                       break;
+                 case 1:
+                       q_points[p] = Point<dim>(0,quadrature.quad_point(p)(0)/2+0.5);
+                       break;
+                 default:
+                       Assert (false, ExcInternalError());
+               };
+             break;
+       default:
+             Assert (false, ExcInternalError());
+      };
+};
+
+
 
 
 // explicite instantiations

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.