[MOAB-dev] r5359 - in MOAB/trunk: src/parallel src/parallel/moab test/parallel

nbertram at wisc.edu nbertram at wisc.edu
Tue Jan 31 15:36:35 CST 2012


Author: bertram
Date: 2012-01-31 15:36:35 -0600 (Tue, 31 Jan 2012)
New Revision: 5359

Modified:
   MOAB/trunk/src/parallel/TupleList.cpp
   MOAB/trunk/src/parallel/moab/ParallelMergeMesh.hpp
   MOAB/trunk/src/parallel/moab/TupleList.hpp
   MOAB/trunk/test/parallel/parmerge.cpp
Log:
Used templates to get rid of duplicated code in TupleList class

Modified: MOAB/trunk/src/parallel/TupleList.cpp
===================================================================
--- MOAB/trunk/src/parallel/TupleList.cpp	2012-01-31 18:31:42 UTC (rev 5358)
+++ MOAB/trunk/src/parallel/TupleList.cpp	2012-01-31 21:36:35 UTC (rev 5359)
@@ -7,9 +7,6 @@
 
 #include "moab/TupleList.hpp"
 
-typedef struct {uint v; uint i;} sort_data;
-typedef struct { ulong v; uint i;} sort_data_long;
-
 namespace moab {
 
   extern void fail(const char *fmt, ...);
@@ -414,6 +411,29 @@
     n = n_in;
   }
 
+  void TupleList::print(std::string name) const
+  {
+    std::cout<<"Printing Tuple " << name << "==================="<<std::endl;
+    unsigned long i=0,l=0,ul=0,r=0;
+    for(uint k=0; k<n; k++){
+      for(uint j=0; j<mi; j++){
+	std::cout<<vi[i++]<<" | ";
+      }
+      for(uint j=0; j<ml; j++){
+	std::cout<<vl[l++]<<" | ";
+      }
+      for(uint j=0; j<mul; j++){
+	std::cout<<vul[ul++]<<" | ";
+      }
+      for(uint j=0; j<mr; j++){
+	std::cout<<vr[r++]<<" | ";
+      }
+      std::cout<<std::endl;
+    }
+    std::cout<<"======================================="<<std::endl<<std::endl;
+  }
+
+
   void TupleList::permute(uint *perm, void *work)
   {
     const unsigned int_size  = mi*sizeof(sint),
@@ -452,18 +472,20 @@
     const unsigned real_size = mr*sizeof(real);
     const unsigned width = umax_2(umax_2(int_size,long_size),
 				  umax_2(ulong_size,real_size));
-    //const unsigned data_size = key>=mi ? sizeof(sort_data_long):sizeof(sort_data);
-    const unsigned data_size = sizeof(sort_data_long);
+    const unsigned data_size = key>=mi? 


More information about the moab-dev mailing list