]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new constructor for Quadrature
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Nov 1999 20:15:57 +0000 (20:15 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Nov 1999 20:15:57 +0000 (20:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@1825 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/quadrature.h
deal.II/base/include/base/tensorindex.h [deleted file]
deal.II/base/source/quadrature.cc

index bf8baf338d68b8939c5d1b622aaa5a8ecf2d8e35..1435375ca13b972f2e7e1e4b77d1064380c9e463 100644 (file)
@@ -20,7 +20,7 @@
  *
  * There are a number of derived classes, denoting concrete integration
  * formulae. These are named by a prefixed #Q#, the name of the formula
- * (e.g. #Midpoint# or #Gauss#) and finally (only for Gauss integration 
+ * (e.g. #Midpoint# or #Gauss#) and finally (for Gauss integration 
  * formulae) the number of quadrature points.
  *
  * For each quadrature formula
@@ -65,7 +65,8 @@
  * @author Wolfgang Bangerth, 1998, documentation: Ralf Hartmann, 1999
  */
 template <int dim>
-class Quadrature {
+class Quadrature
+{
   public:
                                     /**
                                      * Number of quadrature points.
@@ -87,10 +88,13 @@ class Quadrature {
                const Quadrature<1>     &);
     
                                     /**
-                                     * Virtual destructor needed, since someone
-                                     * may want to use pointers to this class
-                                     * though the object pointed to is a derived
-                                     * class.
+                                     * Constructor from given vectors.
+                                     */
+    Quadrature (const vector<Point<dim> > & points,
+               const vector<double> & weights);
+    
+                                    /**
+                                     * Virtual destructor.
                                      */
     virtual ~Quadrature ();
     
diff --git a/deal.II/base/include/base/tensorindex.h b/deal.II/base/include/base/tensorindex.h
deleted file mode 100644 (file)
index b9d0ddb..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*----------------------------   tensorindex.h     ---------------------------*/
-/*      $Id$ */
-#ifndef __tensorindex_H
-#define __tensorindex_H
-/*----------------------------   tensorindex.h     ---------------------------*/
-
-#include <base/exceptions.h>
-
-
-/**
- * Rank-independent access to elements of #Tensor#.  A little class
- * template remembering #rank# integers.
- *
- * This template is implemented only for ranks between 1 and 4. If you
- * really need higher ranks, please modify the source code accordingly
- * or contact the developer.
- *
- * @author Guido Kanschat, 1999
- */
-template<int rank>
-class TensorIndex
-{
-  private:
-                                    /**
-                                     * Field of indices.
-                                     */
-    unsigned int index[rank];
-  public:
-                                    /**
-                                     * Constructor taking #rank# indices. 
-                                     */
-    TensorIndex(...);
-    
-                                    /**
-                                     * Access operator returning index
-                                     * in #n#th component
-                                     */
-    unsigned int operator () (const unsigned int n) const;
-    
-                                    /**
-                                     * Exception.
-                                     */
-    DeclException1(ExcRank, int,
-                  << "Index " << arg1 << " higher than maximum " << rank-1);  
-};
-
-
-
-template<>
-class TensorIndex<4>
-{
-  private:
-                                    /**
-                                     * Field of indices.
-                                     */
-    unsigned int index[4];
-  public:
-                                    /**
-                                     * Constructor taking #rank# indices.
-                                     */
-    TensorIndex (const unsigned int i0,
-                const unsigned int i1,
-                const unsigned int i2,
-                const unsigned int i3)
-      {
-       index[0] = i0;
-       index[1] = i1;
-       index[2] = i2;
-       index[3] = i3;
-      }
-  
-  
-                                    /**
-                                     * Access operator returning index
-                                     * in #n#th component
-                                     */
-    unsigned int operator () (const unsigned int n) const
-      {
-       Assert(n<4, ExcRank(n));
-       return index[n];
-
-      }
-
-                                    /**
-                                     * Exception
-                                     */
-    DeclException1(ExcRank, unsigned int,
-                  << "Index " << arg1 << " higher than maximum 3");  
-};
-
-
-
-template<>
-class TensorIndex<3>
-{
-  private:
-                                    /**
-                                     * Field of indices.
-                                     */
-    unsigned int index[3];
-  public:
-                                    /**
-                                     * Constructor taking #rank# indices.
-                                     */
-    TensorIndex(const unsigned int i0,
-               const unsigned int i1,
-               const unsigned int i2)
-      {
-       index[0] = i0;
-       index[1] = i1;
-       index[2] = i2;
-      }
-  
-  
-                                    /**
-                                     * Access operator returning index
-                                     * in #n#th component
-                                     *
-                                     */
-    unsigned int operator () (const unsigned int n) const
-      {
-       Assert(n<3, ExcRank(n));
-       return index[n];
-
-      }
-  
-                                    /**
-                                     * Exception
-                                     */
-    DeclException1(ExcRank, unsigned int,
-                  << "Index " << arg1 << " higher than maximum 2");  
-};
-
-
-
-template<>
-class TensorIndex<2>
-{
-  private:
-                                    /**
-                                     * Field of indices.
-                                     */
-    unsigned int index[4];
-  public:
-                                    /**
-                                     * Constructor taking #rank# indices.
-                                     */
-    TensorIndex(const unsigned int i0,
-               const unsigned int i1)
-      {
-       index[0] = i0;
-       index[1] = i1;
-      }
-  
-  
-                                    /**
-                                     * Access operator returning index
-                                     * in #n#th component
-                                     */
-    unsigned int operator () (const unsigned int n) const
-      {
-       Assert(n<2, ExcRank(n));
-       return index[n];
-
-      }
-
-                                    /**
-                                     * Exception
-                                     */
-    DeclException1(ExcRank, unsigned int,
-                  << "Index " << arg1 << " higher than maximum 1");  
-};
-
-
-
-template<>
-class TensorIndex<1>
-{
-  private:
-                                    /**
-                                     * Field of indices.
-                                     */
-    unsigned int index[1];
-  public:
-                                    /**
-                                     * Constructor taking #rank# indices.
-                                     */
-    TensorIndex(const unsigned int i0)
-      {
-       index[0] = i0;
-      }
-  
-  
-                                    /**
-                                     * Access operator returning index
-                                     * in #n#th component
-                                     */
-    unsigned int operator () (const unsigned int n) const
-      {
-       Assert(n<1, ExcRank(n));
-       return index[n];
-
-      }
-
-                                    /**
-                                     * Exception
-                                     */
-    DeclException1(ExcRank, unsigned int,
-                  << "Index " << arg1 << " higher than maximum 0");  
-};
-
-
-
-template<int rank>
-inline unsigned int
-TensorIndex<rank>::
-operator() (unsigned int n) const
-{
-  Assert(n<rank, ExcRank(n));
-  return index[n];
-}
-
-
-
-/*----------------------------   tensorindex.h     ---------------------------*/
-/* end of #ifndef __tensorindex_H */
-#endif
-/*----------------------------   tensorindex.h     ---------------------------*/
index 3340f3de1051de8646235ae874cdcd37a6f24476..0c7b0671cb9feed5a1ba912fa1057fd58f48d88e 100644 (file)
@@ -17,12 +17,24 @@ template <int dim>
 Quadrature<dim>::Quadrature (const unsigned int n_q) :
                n_quadrature_points(n_q),
                quadrature_points (n_q, Point<dim>()),
-               weights (n_q, 0) {};
+               weights (n_q, 0)
+{}
 
+template <int dim>
+Quadrature<dim>::Quadrature (const vector<Point<dim> > & points,
+                            const vector<double> & weights)
+               : n_quadrature_points(points.size()),
+                 quadrature_points(points),
+                 weights(weights)
+{
+  Assert(weights.size() == points.size(),
+        ExcDimensionMismatch(weights.size(), points.size()));
+}
 
 template <>
 Quadrature<0>::Quadrature (const Quadrature<-1> &,
-                          const Quadrature<1> &) {
+                          const Quadrature<1> &)
+{
   Assert (false, ExcInternalError());
 };
 

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.