]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement FE_Nothing::operator==().
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 May 2018 21:07:12 +0000 (15:07 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 3 May 2018 21:07:12 +0000 (15:07 -0600)
include/deal.II/fe/fe_nothing.h
source/fe/fe_nothing.cc

index 0f424778685397a0ba4e9f9028a0c770fe0c5030..c58aa5793abb42b2ff8395d4b9d97c638bdad409 100644 (file)
@@ -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<dim,spacedim> &fe) const override;
+
 private:
 
   /**
index db131e195cf4c98617acc25870154aed7c900cb7..40f9991413d65b65ced7be04d59d066379d45dd6 100644 (file)
@@ -179,6 +179,29 @@ FE_Nothing<dim,spacedim>::is_dominating() const
 }
 
 
+
+template <int dim, int spacedim>
+bool
+FE_Nothing<dim,spacedim>::operator == (const FiniteElement<dim,spacedim> &f) const
+{
+  // Compare fields stored in the base class
+  if (! (this->FiniteElement<dim,spacedim>::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<dim,spacedim> *f_nothing
+      = dynamic_cast<const FE_Nothing<dim,spacedim> *>(&f))
+    return ((dominate == f_nothing->dominate)
+            &&
+            (this->components == f_nothing->components));
+  else
+    return false;
+}
+
+
+
 template <int dim, int spacedim>
 FiniteElementDomination::Domination
 FE_Nothing<dim,spacedim> ::

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.