]> git.treefish.org Git - phys/latlib.git/blobdiff - o815/o815.cpp
...
[phys/latlib.git] / o815 / o815.cpp
index f078db3a0dcb16dd9d017d5409c49551af100a23..c55928192bfb2586075323d029ab04316863f6e6 100644 (file)
@@ -111,7 +111,7 @@ void o815::postParaInit() {
   long timestamp;
 
   if(comargs.idonly) {
   long timestamp;
 
   if(comargs.idonly) {
-    cout << programid << headMaster() << endl << flush;
+    cout << programid << headMaster(true) << endl << flush;
     exit(0);
   }
 
     exit(0);
   }
 
@@ -123,7 +123,7 @@ void o815::postParaInit() {
     exit(0);
   }
   
     exit(0);
   }
   
-  out = new writeout(comargs.outdir, programid+headMaster(), rank, numprocs);
+  out = new writeout(comargs.outdir, programid+headMaster(true), rank, numprocs);
 }
 
 void o815::mainLoop() {
 }
 
 void o815::mainLoop() {
@@ -274,12 +274,16 @@ void o815::listArg(int *target, int tlen, char *listarg) {
     }
 }
 
     }
 }
 
-string o815::headMaster()
+string o815::headMaster(bool hashedrange)
 {
   stringstream hm;
   
 {
   stringstream hm;
   
-  hm << "-L" << comargs.lsize[0] << "_" << comargs.lsize[1] << "-E" << comargs.nequi << "-S" << comargs.nskip << "-N" << comargs.nmeas 
-     << paraQ->rangeString();
+  hm << "_L" << comargs.lsize[0] << "x" << comargs.lsize[1] << "_E" << comargs.nequi << "_S" << comargs.nskip << "_N" << comargs.nmeas;
+
+  if( ! hashedrange )
+    hm << paraQ->rangeString();
+  else
+    hm << "_" << hash( paraQ->rangeString() );
   
   return hm.str();
 }
   
   return hm.str();
 }
@@ -338,3 +342,13 @@ void o815::readCacheArgs(const string& arg, string& cachedir, int& cachemode)
 
   cachedir = arg.substr( 0, arg.rfind(":") );
 }
 
   cachedir = arg.substr( 0, arg.rfind(":") );
 }
+
+unsigned long o815::hash(const string& str)
+{
+  unsigned long hash = 5381;
+
+  for(string::const_iterator it=str.begin();it!=str.end();it++) 
+    hash = ((hash << 5) + hash) + *it; /* hash * 33 + character */
+
+  return hash;
+}