X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/ebc593f61243a8ead77dbe9128fdac77377d6734..061e6469f58f3e3e892f1cd1f6fdd2aad9c644e8:/o815/o815.cpp diff --git a/o815/o815.cpp b/o815/o815.cpp index df5d635..c559281 100644 --- a/o815/o815.cpp +++ b/o815/o815.cpp @@ -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; +}