*/
QCollection() = default;
+ /**
+ * Copy constructor.
+ */
+ template <int dim_in>
+ QCollection(const QCollection<dim_in> &other);
+
/**
* Conversion constructor. This constructor creates a QCollection from a
* single quadrature rule. More quadrature formulas can be added with
* push_back(), if desired, though it would probably be clearer to add all
* mappings the same way.
*/
- explicit QCollection(const Quadrature<dim> &quadrature);
+ template <int dim_in>
+ explicit QCollection(const Quadrature<dim_in> &quadrature);
/**
* Constructor. This constructor creates a QCollection from one or
* is later destroyed by this object upon destruction of the entire
* collection.
*/
+ template <int dim_in>
void
- push_back(const Quadrature<dim> &new_quadrature);
+ push_back(const Quadrature<dim_in> &new_quadrature);
/**
* Return a reference to the quadrature rule specified by the argument.
/* --------------- inline functions ------------------- */
+ template <int dim>
+ template <int dim_in>
+ QCollection<dim>::QCollection(const QCollection<dim_in> &other)
+ {
+ for (unsigned int i = 0; i < other.size(); ++i)
+ push_back(other[i]);
+ }
+
+
+
template <int dim>
template <class... QTypes>
QCollection<dim>::QCollection(const QTypes &... quadrature_objects)
{
- static_assert(is_base_of_all<Quadrature<dim>, QTypes...>::value,
- "Not all of the input arguments of this function "
- "are derived from Quadrature<dim>!");
-
// 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 = {
- (static_cast<const Quadrature<dim> *>(&quadrature_objects))...};
- for (const auto p : q_pointers)
- push_back(*p);
+ if (is_base_of_all<Quadrature<dim>, QTypes...>::value)
+ {
+ const auto q_pointers = {
+ (reinterpret_cast<const Quadrature<dim> *>(&quadrature_objects))...};
+ for (const auto p : q_pointers)
+ push_back(*p);
+ }
+ else if (is_base_of_all<Quadrature<1>, QTypes...>::value)
+ {
+ const auto q_pointers = {
+ (reinterpret_cast<const Quadrature<1> *>(&quadrature_objects))...};
+ for (const auto p : q_pointers)
+ push_back(*p);
+ }
+ else
+ {
+ Assert(false, ExcNotImplemented());
+ }
}
template <int dim>
- inline QCollection<dim>::QCollection(const Quadrature<dim> &quadrature)
+ template <int dim_in>
+ inline QCollection<dim>::QCollection(const Quadrature<dim_in> &quadrature)
{
quadratures.push_back(std::make_shared<const Quadrature<dim>>(quadrature));
}
template <int dim>
+ template <int dim_in>
inline void
- QCollection<dim>::push_back(const Quadrature<dim> &new_quadrature)
+ QCollection<dim>::push_back(const Quadrature<dim_in> &new_quadrature)
{
quadratures.push_back(
std::make_shared<const Quadrature<dim>>(new_quadrature));