#include "latlib/hypercache.h"
#include "latlib/progress.h"
+#include "latlib/datread.h"
+
o815::sim::sim(o815 *_O815, const int& _confmemSize) {
O815 = _O815;
log = O815->out->log;
nequi = O815->comargs.nequi;
nskip = O815->comargs.nskip;
confmemSize = confmemSize;
+
+ startConfiguration = NULL;
+
+ if ( O815->comargs.startconfig != "" ) {
+ *log << "SIM: Fetching startconfig from " << O815->comargs.startconfig << endl;
+
+ datread dataReader(confmemSize);
+ dataReader.openFile(O815->comargs.startconfig);
+
+ if ( dataReader.fisopen() ) {
+ startConfiguration = new char[confmemSize];
+
+ if ( dataReader.readFullBlock(startConfiguration) < 0 ) {
+ *log << "SIM: Error while reading config from " << O815->comargs.startconfig << endl;
+ delete[] startConfiguration;
+ startConfiguration = NULL;
+ }
+ }
+ else {
+ *log << "SIM: Could not open startconfigfile " << O815->comargs.startconfig << endl;
+ }
+ }
+
+}
+
+o815::sim::~sim ()
+{
+ if (startConfiguration != NULL)
+ delete[] startConfiguration;
}
void o815::sim::nextConfig() {
hypercache::writeC();
}
}
+
+void o815::sim::resetConfig() {
+ if ( startConfiguration != NULL )
+ memcpy(confMem, startConfiguration, confmemSize);
+ else
+ _resetConfig();
+}