]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new class QAnisotropic and new module Quadrature
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 May 2005 22:13:21 +0000 (22:13 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 May 2005 22:13:21 +0000 (22:13 +0000)
git-svn-id: https://svn.dealii.org/trunk@10702 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/quadrature.h
deal.II/base/source/quadrature.cc

index d36acc1f5da91e4af839aea0f15f6be03bb7e0b7..90e67261beb481edef5dfe99c5a9459ffb551280 100644 (file)
@@ -20,6 +20,9 @@
 #include <vector>
 
 
+/*!@addtogroup Quadrature */
+/*@{*/
+
 /**
  * Base class for quadrature formulae in arbitrary dimensions. This class
  * stores quadrature points and weights on the unit line [0,1], unit
@@ -202,6 +205,44 @@ class Quadrature : public Subscriptor
 };
 
 
+/**
+ * Quadrature formula implementing anisotropic distributions of
+ * quadrature points on the reference cell. To this end, the tensor
+ * product of <tt>dim</tt> onedimensional quadrature formulas is
+ * generated.
+ *
+ * @note Each constructor can only be used in the dimension matching
+ * the number of arguments.
+ *
+ * @author Guido Kanschat, 2005
+ */
+template <int dim>
+class QAnisotropic : public Quadrature<dim>
+{
+  public:
+                                    /**
+                                     * Constructor for a
+                                     * onedimensional formula. This
+                                     * one just copies the given
+                                     * quadrature rule.
+                                     */
+    QAnisotropic(const Quadrature<1>& qx);
+    
+                                    /**
+                                     * Constructor for a twodimensional formula.
+                                     */
+    QAnisotropic(const Quadrature<1>& qx,
+                const Quadrature<1>& qy);
+    
+                                    /**
+                                     * Constructor for a threedimensional formula.
+                                     */
+    QAnisotropic(const Quadrature<1>& qx,
+                const Quadrature<1>& qy,
+                const Quadrature<1>& qz);
+    
+};
+
 
 /**
  * Quadrature formula constructed by iteration of another quadrature formula in
@@ -567,6 +608,8 @@ class QProjector
     static Quadrature<2> reflect (const Quadrature<2> &q);
 };
 
+/*@}*/
+
 /// @if NoDoc
 
 /* -------------- declaration of explicit specializations ------------- */
index e54823a257a861da6d2c38497eea393f5727e0dd..4096cabde04c48aa3ca976b34338b729bc8dfb1d 100644 (file)
@@ -234,6 +234,67 @@ Quadrature<dim>::memory_consumption () const
 }
 
 
+//---------------------------------------------------------------------------
+template<int dim>
+QAnisotropic<dim>::QAnisotropic(const Quadrature<1>& qx)
+               : Quadrature<dim>(qx.n_quadrature_points)
+{
+  Assert (dim==1, ExcImpossibleInDim(dim));
+  unsigned int k=0;
+  for (unsigned int k1=0;k1<qx.n_quadrature_points;++k1)
+    {
+      this->quadrature_points[k](0) = qx.point(k1)(0);
+      this->weights[k++] = qx.weight(k1);
+    }
+  Assert (k==this->n_quadrature_points, ExcInternalError());
+}
+
+
+
+template<int dim>
+QAnisotropic<dim>::QAnisotropic(const Quadrature<1>& qx,
+                               const Quadrature<1>& qy)
+               : Quadrature<dim>(qx.n_quadrature_points
+                                 *qy.n_quadrature_points)
+{
+  Assert (dim==2, ExcImpossibleInDim(dim));
+  unsigned int k=0;
+  for (unsigned int k2=0;k2<qy.n_quadrature_points;++k2)
+    for (unsigned int k1=0;k1<qx.n_quadrature_points;++k1)
+    {
+      this->quadrature_points[k](0) = qx.point(k1)(0);
+      this->quadrature_points[k](1) = qy.point(k2)(0);
+      this->weights[k++] = qx.weight(k1) * qy.weight(k2);
+    }
+  Assert (k==this->n_quadrature_points, ExcInternalError());
+}
+
+
+
+template<int dim>
+QAnisotropic<dim>::QAnisotropic(const Quadrature<1>& qx,
+                               const Quadrature<1>& qy,
+                               const Quadrature<1>& qz)
+               : Quadrature<dim>(qx.n_quadrature_points
+                                 *qy.n_quadrature_points
+                                 *qz.n_quadrature_points)
+{
+  Assert (dim==2, ExcImpossibleInDim(dim));
+  unsigned int k=0;
+  for (unsigned int k3=0;k3<qz.n_quadrature_points;++k3)
+    for (unsigned int k2=0;k2<qy.n_quadrature_points;++k2)
+      for (unsigned int k1=0;k1<qx.n_quadrature_points;++k1)
+       {
+         this->quadrature_points[k](0) = qx.point(k1)(0);
+         this->quadrature_points[k](1) = qy.point(k2)(0);
+         this->quadrature_points[k](2) = qz.point(k3)(0);
+         this->weights[k++] = qx.weight(k1) * qy.weight(k2) * qz.weight(k3);
+       }
+  Assert (k==this->n_quadrature_points, ExcInternalError());
+}
+
+
+
 //---------------------------------------------------------------------------
 
 
@@ -1105,6 +1166,9 @@ QIterated<dim>::QIterated (const Quadrature<1> &base_quadrature,
 template class Quadrature<1>;
 template class Quadrature<2>;
 template class Quadrature<3>;
+template class QAnisotropic<1>;
+template class QAnisotropic<2>;
+template class QAnisotropic<3>;
 template class QIterated<1>;
 template class QIterated<2>;
 template class QIterated<3>;

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.