X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/b57bffe30e8f531f21f0d50e4dc5f58275d8522e..238fccf7dd50a69b5825f4544b3e247bfbf4e417:/paraq.cpp diff --git a/paraq.cpp b/paraq.cpp index b1e3292..87ec773 100644 --- a/paraq.cpp +++ b/paraq.cpp @@ -60,6 +60,8 @@ void paraq::addRange(const string& paraid, double min, double max, double step) for( double paraval = min; paraval <= max+0.5*step; paraval += step+(step==0) ) if( ! inParas(paraMap[paraid], paraval) ) paraMap[paraid].push_back( paraval ); + + uniqueAllParaIdsAdd(paraid); } bool paraq::inParas( vector& paraVec, double& tofind ) @@ -112,10 +114,40 @@ double& paraq::operator[] (string paraid) { return defaultPara[paraid]; } - return masterdefault; + cerr << "PARAQ: Parameter " << paraid << " does not exist!" << endl << flush; + exit(1); } int paraq::getTotalJobs() { initJobList(); return jobList.size(); } + +void paraq::uniqueAllParaIdsAdd(const string& paraid) { + for (vector::iterator allparait = allParaIds.begin(); allparait != allParaIds.end(); ++allparait) + if ( *allparait == paraid ) + return; + + allParaIds.push_back(paraid); +} + +string paraq::getParaNames() { + stringstream paranames; + + for (vector::iterator parait = allParaIds.begin(); parait != allParaIds.end(); ++parait) + paranames << *parait << ":"; + + return paranames.str(); +} + +string paraq::getParaVals() { + stringstream paravals; + + for (vector::iterator parait = allParaIds.begin(); parait != allParaIds.end(); ++parait) { + if ( parait != allParaIds.begin() ) + paravals << "\t"; + paravals << (*this)[*parait]; + } + + return paravals.str(); +}