From: Peter Munch Date: Sun, 20 Dec 2020 07:34:57 +0000 (+0100) Subject: FE_Nothing: pass reference-cell type to constructor X-Git-Tag: v9.3.0-rc1~729^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff97d96eca9fbc0c2fe28ba16e4d279817c7f0ce;p=dealii.git FE_Nothing: pass reference-cell type to constructor --- 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; }