]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow comparison == and != of TriaAccessorBase with different tria 262/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 21 Nov 2014 22:55:05 +0000 (23:55 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 21 Nov 2014 22:55:05 +0000 (23:55 +0100)
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.

include/deal.II/grid/tria_accessor.templates.h

index 020d51f3906d2b91b442ef674b219c5de38b5964..97232e4268ac7f932fe7101a238b67c58f55d163 100644 (file)
@@ -121,8 +121,8 @@ inline
 bool
 TriaAccessorBase<structdim,dim,spacedim>::operator == (const TriaAccessorBase<structdim,dim,spacedim> &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<structdim,dim,spacedim>::operator != (const TriaAccessorBase<structdim,dim,spacedim> &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));
 }
 

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.