From: Daniel Arndt Date: Sat, 19 Aug 2017 21:41:01 +0000 (+0200) Subject: Improve hp::FECollection X-Git-Tag: v9.0.0-rc1~1205^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47fd5da4aa305506b8616a8097668b9a2e0d9a5f;p=dealii.git Improve hp::FECollection --- diff --git a/include/deal.II/hp/fe_collection.h b/include/deal.II/hp/fe_collection.h index 37562d8e02..f81839f2ab 100644 --- a/include/deal.II/hp/fe_collection.h +++ b/include/deal.II/hp/fe_collection.h @@ -69,38 +69,11 @@ namespace hp explicit FECollection (const FiniteElement &fe); /** - * Constructor. This constructor creates a FECollection from two finite - * elements. + * Constructor. This constructor creates a FECollection from more than + * one finite element. */ - FECollection (const FiniteElement &fe1, - const FiniteElement &fe2); - - /** - * Constructor. This constructor creates a FECollection from three finite - * elements. - */ - FECollection (const FiniteElement &fe1, - const FiniteElement &fe2, - const FiniteElement &fe3); - - /** - * Constructor. This constructor creates a FECollection from four finite - * elements. - */ - FECollection (const FiniteElement &fe1, - const FiniteElement &fe2, - const FiniteElement &fe3, - const FiniteElement &fe4); - - /** - * Constructor. This constructor creates a FECollection from five finite - * elements. - */ - FECollection (const FiniteElement &fe1, - const FiniteElement &fe2, - const FiniteElement &fe3, - const FiniteElement &fe4, - const FiniteElement &fe5); + template + explicit FECollection (const FETypes &... fes); /** * Constructor. Same as above but for any number of elements. Pointers to @@ -114,7 +87,18 @@ namespace hp /** * Copy constructor. */ - FECollection (const FECollection &fe_collection); + FECollection (const FECollection &fe_collection) = default; + + /** + * Move constructor. + */ + FECollection (FECollection &&fe_collection) = default; + + /** + * Move assignement operator. + */ + FECollection & + operator= (FECollection &&fe_collection) = default; /** * Add a finite element. This function generates a copy of the given @@ -466,6 +450,14 @@ namespace hp /* --------------- inline functions ------------------- */ + template + template + FECollection::FECollection (const FETypes &... fes) + { + [](...) {}((push_back(fes),0)...); + } + + template inline unsigned int diff --git a/source/hp/fe_collection.cc b/source/hp/fe_collection.cc index e7a4c3a400..b41bb529c7 100644 --- a/source/hp/fe_collection.cc +++ b/source/hp/fe_collection.cc @@ -100,58 +100,6 @@ namespace hp - template - FECollection::FECollection (const FiniteElement &fe1, - const FiniteElement &fe2) - { - push_back(fe1); - push_back(fe2); - } - - - - template - FECollection::FECollection (const FiniteElement &fe1, - const FiniteElement &fe2, - const FiniteElement &fe3) - { - push_back(fe1); - push_back(fe2); - push_back(fe3); - } - - - - template - FECollection::FECollection (const FiniteElement &fe1, - const FiniteElement &fe2, - const FiniteElement &fe3, - const FiniteElement &fe4) - { - push_back(fe1); - push_back(fe2); - push_back(fe3); - push_back(fe4); - } - - - - template - FECollection::FECollection (const FiniteElement &fe1, - const FiniteElement &fe2, - const FiniteElement &fe3, - const FiniteElement &fe4, - const FiniteElement &fe5) - { - push_back(fe1); - push_back(fe2); - push_back(fe3); - push_back(fe4); - push_back(fe5); - } - - - template FECollection:: FECollection (const std::vector*> &fes) @@ -165,27 +113,6 @@ namespace hp - template - FECollection:: - FECollection (const FECollection &fe_collection) - : - Subscriptor (), - // copy the array - // of shared - // pointers. nothing - // bad should - // happen -- they - // simply all point - // to the same - // objects, and the - // last one to die - // will delete the - // mappings - finite_elements (fe_collection.finite_elements) - {} - - - template void FECollection::push_back (const FiniteElement &new_fe) {