From: Wolfgang Bangerth Date: Fri, 5 Oct 2018 04:42:23 +0000 (-0600) Subject: Add a variadic constructor to hp::QCollection. X-Git-Tag: v9.1.0-rc1~657^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9249e3f07b6fdb361c865d40b6f55b1283eed3fd;p=dealii.git Add a variadic constructor to hp::QCollection. --- diff --git a/include/deal.II/hp/q_collection.h b/include/deal.II/hp/q_collection.h index 8f37004529..7d0b05ebbd 100644 --- a/include/deal.II/hp/q_collection.h +++ b/include/deal.II/hp/q_collection.h @@ -62,6 +62,15 @@ namespace hp */ explicit QCollection(const Quadrature &quadrature); + /** + * Constructor. This constructor creates a QCollection from one or + * more quadrature objects passed to the constructor. For this + * call to be valid, all arguments need to be of types derived + * from class Quadrature. + */ + template + explicit QCollection(const QTypes &... quadrature_objects); + /** * Adds a new quadrature rule to the QCollection. In most cases, you will * want to add quadrature rules in the same order as the elements were @@ -136,6 +145,24 @@ namespace hp /* --------------- inline functions ------------------- */ + template + template + QCollection::QCollection(const QTypes &... quadrature_objects) + { + static_assert(is_base_of_all, QTypes...>::value, + "Not all of the input arguments of this function " + "are derived from Quadrature!"); + + // loop over all of the given arguments and add the quadrature objects to + // this collection. Inlining the definition of q_pointers causes internal + // compiler errors on GCC 7.1.1 so we define it separately: + const auto q_pointers = {&quadrature_objects...}; + for (auto p : q_pointers) + push_back(*p); + } + + + template inline unsigned int QCollection::size() const