From: Wolfgang Bangerth Date: Thu, 3 May 2018 21:07:12 +0000 (-0600) Subject: Implement FE_Nothing::operator==(). X-Git-Tag: v9.0.0-rc1~22^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d356ab85a2cef1836cb11b076b6c2172a5787ea9;p=dealii.git Implement FE_Nothing::operator==(). --- diff --git a/include/deal.II/fe/fe_nothing.h b/include/deal.II/fe/fe_nothing.h index 0f42477868..c58aa5793a 100644 --- a/include/deal.II/fe/fe_nothing.h +++ b/include/deal.II/fe/fe_nothing.h @@ -254,6 +254,16 @@ public: */ bool is_dominating() const; + /** + * Comparison operator. In addition to the fields already checked by + * FiniteElement::operator==(), this operator also checks for equality + * of the arguments passed to the constructors of the current object + * as well as the object against which the comparison is done (which + * for this purpose obviously also needs to be of type FE_Nothing). + */ + virtual + bool operator == (const FiniteElement &fe) const override; + private: /** diff --git a/source/fe/fe_nothing.cc b/source/fe/fe_nothing.cc index db131e195c..40f9991413 100644 --- a/source/fe/fe_nothing.cc +++ b/source/fe/fe_nothing.cc @@ -179,6 +179,29 @@ FE_Nothing::is_dominating() const } + +template +bool +FE_Nothing::operator == (const FiniteElement &f) const +{ + // Compare fields stored in the base class + if (! (this->FiniteElement::operator== (f))) + return false; + + // 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 + = dynamic_cast *>(&f)) + return ((dominate == f_nothing->dominate) + && + (this->components == f_nothing->components)); + else + return false; +} + + + template FiniteElementDomination::Domination FE_Nothing ::