From: Marc Fehling Date: Thu, 16 Jan 2020 11:56:45 +0000 (+0100) Subject: hp::QCollection: Added equality operator. X-Git-Tag: v9.2.0-rc1~624^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b0de44f1884e9b0c9e3b3bcbec227ec841ef3e9;p=dealii.git hp::QCollection: Added equality operator. --- diff --git a/doc/news/changes/minor/20200116Fehling-1 b/doc/news/changes/minor/20200116Fehling-1 new file mode 100644 index 0000000000..c59d0a3f16 --- /dev/null +++ b/doc/news/changes/minor/20200116Fehling-1 @@ -0,0 +1,3 @@ +New: Equality operator (==) for hp::QCollection. +
+(Marc Fehling, 2020/01/16) diff --git a/include/deal.II/hp/q_collection.h b/include/deal.II/hp/q_collection.h index 255c830ab5..0a391abda8 100644 --- a/include/deal.II/hp/q_collection.h +++ b/include/deal.II/hp/q_collection.h @@ -106,6 +106,13 @@ namespace hp */ const Quadrature &operator[](const unsigned int index) const; + /** + * Equality comparison operator. All stored Quadrature objects are compared + * in order. + */ + bool + operator==(const QCollection &q_collection) const; + /** * Return the number of quadrature pointers stored in this object. */ @@ -200,6 +207,23 @@ namespace hp + template + inline bool + QCollection::operator==(const QCollection &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 inline QCollection::QCollection(const Quadrature &quadrature) {