Ignore:
Timestamp:
04/25/17 10:57:48 (7 years ago)
Author:
mhnguyen
Message:

Adding comparison operator between objects of XIOS.
Two objects of a same type are considered equal if they have same non-empty
attributes which have same values

+) Add operator== to class CArray
+) Add comparison operator to some basic attribute classes
+) Add operator== to date and duration (It seems that they don't serve much)

Test
+) On Curie
+) No Unit tests but test with transformation work (the next commit)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/array_new.hpp

    r1050 r1105  
    300300        Array<T_numtype,N_rank>::reference(array); 
    301301        initialized = true; 
     302      } 
     303 
     304      bool operator== (const CArray<T_numtype,N_rank>& array) 
     305      { 
     306        size_t nbThis = this->numElements(); 
     307        size_t nbArr  = array.numElements(); 
     308        if (nbThis != nbArr) return false; 
     309        for (size_t idx = 0; idx < nbThis; ++idx) 
     310          if ((*this)(idx) != array(idx)) return false; 
     311 
     312        return true; 
     313      } 
     314 
     315      bool operator== (const Array<T_numtype,N_rank>& array) 
     316      { 
     317        return ((*this) == (dynamic_cast<const CArray<T_numtype,N_rank>& >(array))); 
    302318      } 
    303319 
Note: See TracChangeset for help on using the changeset viewer.