From ff97d96eca9fbc0c2fe28ba16e4d279817c7f0ce Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sun, 20 Dec 2020 08:34:57 +0100 Subject: [PATCH] FE_Nothing: pass reference-cell type to constructor --- include/deal.II/fe/fe_nothing.h | 15 +++++++++++++-- source/fe/fe_nothing.cc | 24 +++++++++++++++++++----- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/include/deal.II/fe/fe_nothing.h b/include/deal.II/fe/fe_nothing.h index 3b219b0f0a..b9185e3726 100644 --- a/include/deal.II/fe/fe_nothing.h +++ b/include/deal.II/fe/fe_nothing.h @@ -79,16 +79,27 @@ class FE_Nothing : public FiniteElement { public: /** - * Constructor. First argument denotes the number of components to give this + * Constructor. + * + * The first argument specifies the reference-cell type. + * + * The second argument denotes the number of components to give this * finite element (default = 1). * - * Second argument decides whether FE_Nothing will dominate any other FE in + * The third argument decides whether FE_Nothing will dominate any other FE in * compare_for_domination() (default = false). Therefore at interfaces where, * for example, a Q1 meets an FE_Nothing, we will force the traces of the two * functions to be the same. Because the FE_Nothing encodes a space that is * zero everywhere, this means that the Q1 field will be forced to become zero * at this interface. */ + FE_Nothing(const ReferenceCell::Type &type, + const unsigned int n_components = 1, + const bool dominate = false); + + /** + * Same as above but for a hypercube reference-cell type. + */ FE_Nothing(const unsigned int n_components = 1, const bool dominate = false); virtual std::unique_ptr> diff --git a/source/fe/fe_nothing.cc b/source/fe/fe_nothing.cc index ce77a56f79..35a1436786 100644 --- a/source/fe/fe_nothing.cc +++ b/source/fe/fe_nothing.cc @@ -22,10 +22,12 @@ DEAL_II_NAMESPACE_OPEN template -FE_Nothing::FE_Nothing(const unsigned int n_components, - const bool dominate) +FE_Nothing::FE_Nothing(const ReferenceCell::Type &type, + const unsigned int n_components, + const bool dominate) : FiniteElement( FiniteElementData(std::vector(dim + 1, 0), + type, n_components, 0, FiniteElementData::unknown), @@ -41,6 +43,17 @@ FE_Nothing::FE_Nothing(const unsigned int n_components, } + +template +FE_Nothing::FE_Nothing(const unsigned int n_components, + const bool dominate) + : FE_Nothing(ReferenceCell::get_hypercube(dim), + n_components, + dominate) +{} + + + template std::unique_ptr> FE_Nothing::clone() const @@ -194,10 +207,11 @@ operator==(const FiniteElement &f) const // Then make sure the other object is really of type FE_Nothing, // and compare the data that has been passed to both objects' // constructors. - if (const FE_Nothing *f_nothing = + if (const FE_Nothing *fe_nothing = dynamic_cast *>(&f)) - return ((dominate == f_nothing->dominate) && - (this->components == f_nothing->components)); + return ((dominate == fe_nothing->dominate) && + (this->components == fe_nothing->components) && + (this->reference_cell_type() == fe_nothing->reference_cell_type())); else return false; } -- 2.39.5