From 29126f0084d1ae4eaadb5ab1dd3710a9c681a69f Mon Sep 17 00:00:00 2001 From: angelrca Date: Fri, 15 Jan 2016 10:04:32 +0100 Subject: [PATCH] hp::FECollection new constructors added --- include/deal.II/hp/fe_collection.h | 44 ++++++++++++++++++++ source/hp/fe_collection.cc | 65 ++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) diff --git a/include/deal.II/hp/fe_collection.h b/include/deal.II/hp/fe_collection.h index 0684aead53..86a9b400a0 100644 --- a/include/deal.II/hp/fe_collection.h +++ b/include/deal.II/hp/fe_collection.h @@ -67,6 +67,50 @@ namespace hp */ explicit FECollection (const FiniteElement &fe); + /** + * Constructor. This constructor creates a FECollection from two + * finite elements. + */ + 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); + + /** + * Constructor. Same as above but for any number of elements. Pointers + * to the elements are passed in a vector to this constructor. + * As above, the finite element objects pointed to by the argument are + * not actually used other than to create copies internally. Consequently, + * you can delete these pointers immediately again after calling this + * constructor. + */ + FECollection (const std::vector*> &fes); + /** * Copy constructor. */ diff --git a/source/hp/fe_collection.cc b/source/hp/fe_collection.cc index 0e52842212..54a3cc3be8 100644 --- a/source/hp/fe_collection.cc +++ b/source/hp/fe_collection.cc @@ -100,6 +100,71 @@ 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) + { + Assert (fes.size() > 0, + ExcMessage ("Need to pass at least one finite element.")); + + for (unsigned int i = 0; i < fes.size(); ++i) + push_back(*fes[i]); + } + + + template FECollection:: FECollection (const FECollection &fe_collection) -- 2.39.5