]> https://gitweb.dealii.org/ - dealii.git/commitdiff
hp::QCollection: Added equality operator.
authorMarc Fehling <marc.fehling@gmx.net>
Thu, 16 Jan 2020 11:56:45 +0000 (12:56 +0100)
committerMarc Fehling <marc.fehling@gmx.net>
Tue, 21 Jan 2020 23:38:49 +0000 (00:38 +0100)
doc/news/changes/minor/20200116Fehling-1 [new file with mode: 0644]
include/deal.II/hp/q_collection.h

diff --git a/doc/news/changes/minor/20200116Fehling-1 b/doc/news/changes/minor/20200116Fehling-1
new file mode 100644 (file)
index 0000000..c59d0a3
--- /dev/null
@@ -0,0 +1,3 @@
+New: Equality operator (==) for hp::QCollection.
+<br>
+(Marc Fehling, 2020/01/16)
index 255c830ab568e525e81d483c6860418bd978f009..0a391abda8344df96da98146f5a6d9e510f20249 100644 (file)
@@ -106,6 +106,13 @@ namespace hp
      */
     const Quadrature<dim> &operator[](const unsigned int index) const;
 
+    /**
+     * Equality comparison operator. All stored Quadrature objects are compared
+     * in order.
+     */
+    bool
+    operator==(const QCollection<dim> &q_collection) const;
+
     /**
      * Return the number of quadrature pointers stored in this object.
      */
@@ -200,6 +207,23 @@ namespace hp
 
 
 
+  template <int dim>
+  inline bool
+  QCollection<dim>::operator==(const QCollection<dim> &q_collection) const
+  {
+    const unsigned int n_quadratures = size();
+    if (n_quadratures != q_collection.size())
+      return false;
+
+    for (unsigned int i = 0; i < n_quadratures; ++i)
+      if (!(*quadratures[i] == q_collection[i]))
+        return false;
+
+    return true;
+  }
+
+
+
   template <int dim>
   inline QCollection<dim>::QCollection(const Quadrature<dim> &quadrature)
   {

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.