#include <sstream>
+#include "latlib/progress.h"
+
o815::o815(int argc, char **argv, const string& _programid) {
long timestamp;
(*obsit)->start();
while( nextParas() ) {
+ *out->log << endl << "O815: < ";
+ for (vector<string>::iterator parait = paraQ->allParaIds.begin(); parait != paraQ->allParaIds.end(); ++parait)
+ *out->log << *parait << "=" << (*paraQ)[*parait] << " ";
+ *out->log << ">" << endl << flush;
+
+ progress measProg(comargs.nmeas);
+
+ *out->log << "OBS: Starting measurements." << endl << flush;
+
+ for( int imeas=0; imeas<comargs.nmeas; imeas++ ) {
+ bool nextAlready = false;
+ for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
+ if( hypercache::readO( (*obsit)->ocid ) != -1 ) {
+ if (!nextAlready) {
+ Sim->nextConfig();
+ nextAlready = true;
+ }
+ (*obsit)->meas(false);
+ hypercache::writeO( (*obsit)->ocid );
+ }
+ else
+ (*obsit)->meas(true);
+ }
+ while( measProg.madeStep(imeas) )
+ *out->log << "O815: " << measProg.done()*100 << "% of measurements done." << endl << flush;
+ }
+ for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit)
+ (*obsit)->finish();
}
-
- /*
- for (int i=0; i<100; i++) {
- for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit) {
- (*obsit)->meas();
- }
- }
- */
-
- for (vector<obs*>::iterator obsit = observables.begin(); obsit != observables.end(); ++obsit)
- (*obsit)->finish();
}
void o815::parseArgs(int argc, char **argv) {
if(rank==0)
cout << "#end" << endl << flush;
}
+ hypercache::finalize();
delete out;
MPI_Finalize();
}
else
return 0;
}
+
+void o815::addPara(const string& paraid, const double& paraDefault) {
+ hypercache::addPara(paraid);
+ paraQ->setDefault(paraid, paraDefault);
+}
public:
obs(const string& _obsid, const string& _datadesc, o815 *_O815, const int& _obsmemSize);
void finish();
- void meas();
+ void meas(bool loadedobs);
void start();
string getDataDesc() { return datadesc; };
+ int ocid;
private:
virtual void _meas(bool loadedobs)=0;
virtual void _finish()=0;
char *obsMem;
string obsid, simid, datadesc;
ostream *out, *log;
- int ocid;
};
class sim {
sim* Sim;
void mainLoop();
string headMaster();
+ void addPara(const string& paraid, const double& paraDefault);
private:
MPI_Status mpiStatus;