nprocs = _nprocs;
rank = _rank;
masterdefault = 0;
+ jobListInitialized = false;
}
void paraq::addRange(const string& paraid, double min, double max, double step)
return false;
}
-int paraq::nextParas()
+void paraq::initJobList()
{
- if( thisjob == -1 ) {
+ if( ! jobListInitialized ) {
map<string,double> jobZero;
jobList.push_back( jobZero );
-
+
for( map< string, vector< double > >::iterator paraIt = paraMap.begin(); paraIt != paraMap.end(); ++paraIt )
while( jobList.begin()->find(paraIt->first) == jobList.begin()->end() ) {
for( vector<double>::iterator valIt = paraIt->second.begin(); valIt != paraIt->second.end(); ++valIt ) {
}
jobList.erase( jobList.begin() );
}
+ jobListInitialized = true;
+ }
+}
+int paraq::nextParas()
+{
+ if( thisjob == -1 ) {
+ initJobList();
thisjob = rank;
}
else
thisjob += nprocs;
+ if( jobList.begin()->size() == 0 ) return 0;
+
if( thisjob < jobList.size() ) return 1;
else
return 0;
return masterdefault;
}
+
+int paraq::getTotalJobs() {
+ initJobList();
+ return jobList.size();
+}
double& operator[] (string paraid);
void addRange(const string& paraid, double range[3]) { addRange(paraid, range[0], range[1], range[2]); }
void setDefault(const string& paraid, double value) { defaultPara[paraid] = value; }
+ int getTotalJobs();
private:
int nprocs, rank;
map<string,double> defaultPara;
map< string, vector<double> > paraMap;
vector< map<string,double> > jobList;
+ void initJobList();
bool inParas(vector<double>& paraVec, double& tofind);
double masterdefault;
+ bool jobListInitialized;
};
#endif