From: Martin Kronbichler Date: Fri, 21 Nov 2014 22:55:05 +0000 (+0100) Subject: Allow comparison == and != of TriaAccessorBase with different tria X-Git-Tag: v8.2.0-rc1~50^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5590c8e8643b801e63a6bae866391462b8dee9e9;p=dealii.git Allow comparison == and != of TriaAccessorBase with different tria It is well-defined to check for equality and inequality of TriaAccessorBase (cell_iterator types) that belong to different triangulations. Those are simply unequal. This is necessary e.g. for comparing with a default constructed cell_iterator variable. Of course, operator < is still undefined. --- diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 020d51f390..97232e4268 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -121,8 +121,8 @@ inline bool TriaAccessorBase::operator == (const TriaAccessorBase &a) const { - Assert (tria == a.tria, TriaAccessorExceptions::ExcCantCompareIterators()); - return ((present_level == a.present_level) && + return ((tria == a.tria) && + (present_level == a.present_level) && (present_index == a.present_index)); } @@ -133,8 +133,8 @@ inline bool TriaAccessorBase::operator != (const TriaAccessorBase &a) const { - Assert (tria == a.tria, TriaAccessorExceptions::ExcCantCompareIterators()); - return ((present_level != a.present_level) || + return ((tria != a.tria) || + (present_level != a.present_level) || (present_index != a.present_index)); }