]> git.treefish.org Git - phys/latlib.git/blobdiff - o815/o815.cpp
...
[phys/latlib.git] / o815 / o815.cpp
index df5d6351ff34617da7e6ef9f1e94b52f01bfee6c..c55928192bfb2586075323d029ab04316863f6e6 100644 (file)
@@ -111,7 +111,7 @@ void o815::postParaInit() {
   long timestamp;
 
   if(comargs.idonly) {
-    cout << programid << headMaster() << endl << flush;
+    cout << programid << headMaster(true) << endl << flush;
     exit(0);
   }
 
@@ -123,7 +123,7 @@ void o815::postParaInit() {
     exit(0);
   }
   
-  out = new writeout(comargs.outdir, programid+headMaster(), rank, numprocs);
+  out = new writeout(comargs.outdir, programid+headMaster(true), rank, numprocs);
 }
 
 void o815::mainLoop() {
@@ -233,7 +233,7 @@ void o815::parseArgs(int argc, char **argv, comoption specOps[]) {
     case 'C':
       readCacheArgs(optarg, comargs.confcache.first, comargs.confcache.second);
       break;
-    case 'w':
+    case 'W':
       comargs.outdir = optarg;
       break;
     default:
@@ -274,12 +274,16 @@ void o815::listArg(int *target, int tlen, char *listarg) {
     }
 }
 
-string o815::headMaster()
+string o815::headMaster(bool hashedrange)
 {
   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();
 }
@@ -338,3 +342,13 @@ void o815::readCacheArgs(const string& arg, string& cachedir, int& cachemode)
 
   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;
+}