MSA: Add fuller range of functionality to 2D's handles
authorPhil Miller <mille121@illinois.edu>
Thu, 10 Sep 2009 19:14:22 +0000 (14:14 -0500)
committerPhil Miller <mille121@illinois.edu>
Thu, 10 Dec 2009 22:23:01 +0000 (16:23 -0600)
The handles for the 2D code were missing some operations and forms,
particularly the two-index forms that don't require the caller to do
the index translation. Fix that.

src/libs/ck-libs/multiphaseSharedArrays/msa-distArray.h

index 3c47638453054e30d4871e3e53b0a5f90183cc83..191dc65a4dad1dbaf6a1de105377d3847d1249e4 100644 (file)
@@ -550,6 +550,9 @@ public:
             Handle::checkValid();
             return Writable<ENTRY>(Handle::msa.set(row, col));
         }
+
+        inline Writable<ENTRY> operator()(unsigned int row, unsigned int col)
+            { return set(row, col); }
     };
 
     class Accum : public Handle
@@ -565,6 +568,11 @@ public:
             Handle::checkValid();
             return Accumulable<ENTRY, ENTRY_OPS_CLASS>(Handle::msa.accumulate(idx));
         }
+        inline Accumulable<ENTRY, ENTRY_OPS_CLASS> accumulate(unsigned int x, unsigned int y)
+        {
+            Handle::checkValid();
+            return Accumulable<ENTRY, ENTRY_OPS_CLASS>(Handle::msa.accumulate(Handle::msa.getIndex(x, y)));
+        }
         inline void accumulate(unsigned int idx, const ENTRY& ent)
         {
             Handle::checkValid();
@@ -582,6 +590,8 @@ public:
 
         inline Accumulable<ENTRY, ENTRY_OPS_CLASS> operator() (unsigned int idx)
             { return accumulate(idx); }
+        inline Accumulable<ENTRY, ENTRY_OPS_CLASS> operator() (unsigned int x, unsigned int y)
+            { return accumulate(x, y); }
     };
 
     inline MSA2D(unsigned int rows_, unsigned int cols_, unsigned int numwrkrs,