MappingCollection(
const MappingCollection<dim, spacedim> &mapping_collection);
+ /**
+ * Constructor. This constructor creates a MappingCollection from one or
+ * more mapping objects passed to the constructor. For this
+ * call to be valid, all arguments need to be of types derived
+ * from class Mapping<dim,spacedim>.
+ */
+ template <class... MappingTypes>
+ explicit MappingCollection(const MappingTypes &... mappings);
+
/**
* Add a new mapping to the MappingCollection. Generally, you will
* want to use the same order for mappings as for the elements of
/* --------------- inline functions ------------------- */
+ template <int dim, int spacedim>
+ template <class... MappingTypes>
+ MappingCollection<dim, spacedim>::MappingCollection(
+ const MappingTypes &... mappings)
+ {
+ static_assert(
+ is_base_of_all<Mapping<dim, spacedim>, MappingTypes...>::value,
+ "Not all of the input arguments of this function "
+ "are derived from FiniteElement<dim,spacedim>!");
+
+ // loop over all of the given arguments and add the mappings to
+ // this collection. Inlining the definition of mapping_pointers causes
+ // internal compiler errors on GCC 7.1.1 so we define it separately:
+ const auto mapping_pointers = {
+ (static_cast<const Mapping<dim, spacedim> *>(&mappings))...};
+ for (const auto p : mapping_pointers)
+ push_back(*p);
+ }
+
template <int dim, int spacedim>
inline unsigned int
MappingCollection<dim, spacedim>::size() const
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Test constructor of hp::MappingCollection that accepts multiple mappings.
+
+
+#include <deal.II/fe/mapping_q.h>
+
+#include <deal.II/hp/mapping_collection.h>
+
+#include "../tests.h"
+
+
+
+template <int dim>
+void
+test()
+{
+ hp::MappingCollection<dim> mappings(MappingQ<dim>(1), MappingQ<dim>(2));
+
+ deallog << mappings.size() << std::endl;
+}
+
+
+
+int
+main()
+{
+ initlog();
+ deallog.get_file_stream().precision(2);
+
+ test<1>();
+ test<2>();
+ test<3>();
+
+ deallog << "OK" << std::endl;
+}