long timestamp;
if(comargs.idonly) {
- cout << programid << headMaster() << endl << flush;
+ cout << programid << headMaster(true) << endl << flush;
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() {
}
}
-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();
}
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;
+}
vector<obs*> observables;
sim* Sim;
void mainLoop();
- string headMaster();
+ string headMaster( bool hashedrange=false );
void addPara(const string& paraid, const double& paraDefault);
void addComOption(const char* name, int has_arg, int *flag, int val, const char* optdesc, const char* argdesc);
vector< pair<int,char*> > parsedSpecOps;
int nextParas();
comoption* getOptionByVal(int val);
static void readCacheArgs(const string& arg, string& cachedir, int& cachemode);
+ unsigned long hash(const string& str);
};
#endif
for( map< string, vector<double*> >::iterator paraIt = rangeMap.begin(); paraIt != rangeMap.end(); ++paraIt )
if( paraIt->second.size() > 0 )
for( vector<double*>::iterator rangeIt = paraIt->second.begin(); rangeIt != paraIt->second.end(); ++rangeIt)
- rangestring << "-" << paraIt->first << (*rangeIt)[0] << "_" << (*rangeIt)[1] << "_" << (*rangeIt)[2];
+ rangestring << "_" << paraIt->first << (*rangeIt)[0] << "-" << (*rangeIt)[1] << "-" << (*rangeIt)[2];
for (vector<paralink>::iterator linkit = linkedParas.begin(); linkit != linkedParas.end(); ++linkit)
- rangestring << "-" << linkit->first << "--" << linkit->linktype << "--" << linkit->second;
+ rangestring << "_" << linkit->first << "--" << linkit->linktype << "--" << linkit->second;
for( map<string,double>::iterator defIt = defaultPara.begin(); defIt != defaultPara.end(); ++defIt )
if( rangeMap.find(defIt->first) == rangeMap.end() ) {
}
if (!linkedpara)
- rangestring << "-" << defIt->first << defIt->second;
+ rangestring << "_" << defIt->first << defIt->second;
}
return rangestring.str();
of[subname] = new ofstream;
if ( fulldir != "" ) {
- if(rank>0) of[subname]->open( (fulldir + "/rank" + cRank + "-" + subname + ".tmp").c_str() );
- else of[subname]->open( (fulldir + "/" + signature + "-" + subname + ".dat").c_str() );
+ if(rank>0) of[subname]->open( (fulldir + "/rank" + cRank + "_" + subname + ".tmp").c_str() );
+ else of[subname]->open( (fulldir + "/" + signature + "_" + subname + ".dat").c_str() );
if ( !of[subname]->is_open() ) {
logf << "WRITEOUT: Could not open output-file!" << endl << flush;
}
else {
ofit->second->close();
- rename((fulldir + "/rank" + cRank + "-" + ofit->first + ".tmp").c_str(),
- (fulldir + "/rank" + cRank + "-" + ofit->first + ".part").c_str());
+ rename((fulldir + "/rank" + cRank + "_" + ofit->first + ".tmp").c_str(),
+ (fulldir + "/rank" + cRank + "_" + ofit->first + ".part").c_str());
}
}
if( cRank[0] == '0' )
myfile = string(dirp->d_name);
if(myfile.length() > 3 && myfile.substr(myfile.length()-4) == "part" &&
- subname == myfile.substr( myfile.find("-")+1, myfile.rfind(".")-myfile.find("-")-1 ) ) {
+ subname == myfile.substr( myfile.find("_")+1, myfile.rfind(".")-myfile.find("_")-1 ) ) {
closedir(dp);
return myfile;
}