NDMeshStreamer: API streamlining
authorLukasz Wesolowski <wesolwsk@illinois.edu>
Sat, 15 Sep 2012 23:15:56 +0000 (18:15 -0500)
committerLukasz Wesolowski <wesolwsk@illinois.edu>
Sat, 15 Sep 2012 23:15:56 +0000 (18:15 -0500)
src/libs/ck-libs/NDMeshStreamer/NDMeshStreamer.ci
src/libs/ck-libs/NDMeshStreamer/NDMeshStreamer.h

index ca2d5c51ffc7a503b646850c45505d3141926534..991ce535ec7c2e43b25c258ccde1cc546b23e3ee 100644 (file)
@@ -24,10 +24,13 @@ module NDMeshStreamer {
                    CkCallback endCb, int prio, 
                    bool usePeriodicFlushing);
 
-    entry void associateCallback(int numContributors, 
-                                CkCallback startCb, CkCallback endCb, 
-                                CProxy_CompletionDetector detector,
-                                int prio, bool usePeriodicFlushing);
+    entry void init(int numContributors, CkCallback startCb, 
+                   CkCallback endCb, CProxy_CompletionDetector detector,
+                   int prio, bool usePeriodicFlushing);   
+    entry void init(CkArrayID senderArrayID, CkCallback startCb, 
+                   CkCallback endCb, int prio, 
+                   bool usePeriodicFlushing); 
+
     entry void receiveAtDestination(MeshStreamerMessage<dtype> *msg);
   };
 
@@ -58,10 +61,6 @@ module NDMeshStreamer {
          const CProxy_MeshStreamerArrayClient<dtype> &clientProxy,
          int bufferSize, bool yieldFlag = 0, 
          double progressPeriodInMs = -1.0);
-
-    entry void init(CkArrayID senderArrayID, CkCallback startCb, 
-                   CkCallback endCb, int prio, 
-                   bool usePeriodicFlushing); 
   };
 
 };
index 360aca7b81f5411e2106c53a89d4230b22d838fe..7dd98e6587f7bdf28b461caadd45cc12fcd39a5c 100644 (file)
@@ -180,10 +180,12 @@ public:
   // entry
   void init(int numLocalContributors, CkCallback startCb, CkCallback endCb, 
             int prio, bool usePeriodicFlushing);
-  void associateCallback(int numContributors, 
-                         CkCallback startCb, CkCallback endCb, 
-                         CProxy_CompletionDetector detector,
-                         int prio, bool usePeriodicFlushing);
+  void init(int numContributors, CkCallback startCb, CkCallback endCb, 
+            CProxy_CompletionDetector detector,
+            int prio, bool usePeriodicFlushing);
+  void init(CkArrayID senderArrayID, CkCallback startCb, CkCallback endCb, 
+            int prio, bool usePeriodicFlushing);
+
   void receiveAlongRoute(MeshStreamerMessage<dtype> *msg);
   virtual void receiveAtDestination(MeshStreamerMessage<dtype> *msg) = 0;
   void flushIfIdle();
@@ -654,11 +656,10 @@ void MeshStreamer<dtype>::init(int numLocalContributors, CkCallback startCb,
 }
 
 template <class dtype>
-void MeshStreamer<dtype>::associateCallback(
-                         int numContributors,
-                         CkCallback startCb, CkCallback endCb, 
-                         CProxy_CompletionDetector detector, 
-                         int prio, bool usePeriodicFlushing) {
+void MeshStreamer<dtype>::init(int numContributors,      
+                               CkCallback startCb, CkCallback endCb,
+                               CProxy_CompletionDetector detector, 
+                               int prio, bool usePeriodicFlushing) {
 
   useStagedCompletion_ = false; 
   yieldCount_ = 0; 
@@ -689,6 +690,15 @@ void MeshStreamer<dtype>::associateCallback(
 
 }
 
+template <class dtype>
+void MeshStreamer<dtype>::init(CkArrayID senderArrayID, CkCallback startCb, 
+            CkCallback endCb, int prio, bool usePeriodicFlushing) {
+    CkArray *senderArrayMgr = senderArrayID.ckLocalBranch();
+    int numLocalElements = senderArrayMgr->getLocMgr()->numLocalElements();
+    init(numLocalElements, startCb, endCb, prio, usePeriodicFlushing); 
+  }
+
+
 template <class dtype>
 void MeshStreamer<dtype>::finish() {
   isPeriodicFlushEnabled_ = false; 
@@ -1183,15 +1193,6 @@ public:
 #endif
   }
 
-  void init(CkArrayID senderArrayID, CkCallback startCb, 
-            CkCallback endCb, int prio, bool usePeriodicFlushing) {
-    CkArray *senderArrayMgr = senderArrayID.ckLocalBranch();
-    int numLocalElements = senderArrayMgr->getLocMgr()->numLocalElements();
-    MeshStreamer<ArrayDataItem<dtype, itype> >::init(
-                 numLocalElements, startCb, endCb, prio,
-                 usePeriodicFlushing); 
-  }
-
   void receiveAtDestination(
        MeshStreamerMessage<ArrayDataItem<dtype, itype> > *msg) {