From 79157eee6d76a0d5c655470f38006c120eb0c01c Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 5 Sep 2017 01:24:05 +0200 Subject: [PATCH] Implement operator^ for FiniteElement --- include/deal.II/fe/fe.h | 17 ++++++++++++++--- source/fe/fe.cc | 9 ++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/deal.II/fe/fe.h b/include/deal.II/fe/fe.h index 1639b565b3..ce23e2b73c 100644 --- a/include/deal.II/fe/fe.h +++ b/include/deal.II/fe/fe.h @@ -758,7 +758,18 @@ public: * Virtual destructor. Makes sure that pointers to this class are deleted * properly. */ - virtual ~FiniteElement (); + virtual ~FiniteElement () = default; + + /** + * Creates information for creating a FESystem with this class as + * base element and with multiplicity @p multiplicity. In particular, + * the return type of this function can be used in the constructor + * for a FESystem object. + * This function calls clone() and hence creates a copy of the + * current object. + */ + std::pair >, unsigned int> + operator^ (unsigned int multiplicity) const; /** * A sort of virtual copy constructor, this function returns a copy of @@ -772,8 +783,8 @@ public: * type. They do so through this function. */ virtual - std::unique_ptr> - clone() const = 0; + std::unique_ptr > + clone() const = 0; /** * Return a string that uniquely identifies a finite element. The general diff --git a/source/fe/fe.cc b/source/fe/fe.cc index 901cdabf45..5b09abb34e 100644 --- a/source/fe/fe.cc +++ b/source/fe/fe.cc @@ -152,9 +152,12 @@ FiniteElement (const FiniteElementData &fe_data, template -FiniteElement::~FiniteElement () -{} - +std::pair >, unsigned int> +FiniteElement::operator^ (unsigned int multiplicity) const +{ + return std::make_pair>, + unsigned int> (std::move(this->clone()), std::move(multiplicity)); +} -- 2.39.5