return NULL;
}
-/* returns number of equilibration-steps left with new read configuration
- or zero if no new configuration was read */
-void configcache::readConfig(bool& readnewconfig, int& nequileft, vector<unsigned long> *excludeFileHashes)
+void configcache::readConfig(bool *readnewconfig, int *nequileft, vector<unsigned long> *excludeFileHashes)
{
- readnewconfig = false;
+ *readnewconfig = false;
if(DATADIR == "" || MODE == CACHE_MODE_DISABLED) return;
int iDidVirtualSkips;
if( (!inFile.is_open()) && inFileIt == inFiles.end() ) {
- if (readnewconfig)
- nequileft = nequileft_internal;
+ if (*readnewconfig)
+ *nequileft = nequileft_internal;
return;
}
else if ( (NEQUI-openFileDesc.nequi) - (iDidVirtualSkips+1)*openFileDesc.nskip < nequileft_internal ) {
memcpy(configMem, tmpConfig, configSize);
nequileft_internal = NEQUI - openFileDesc.nequi - (iDidVirtualSkips+1)*openFileDesc.nskip;
- readnewconfig = true;
+ *readnewconfig = true;
firstUsedConfig = false;
}
}
if( readFullBlock(tmpConfig, configSize) == configSize && inFile.is_open() )
{
memcpy(configMem, tmpConfig, configSize);
- readnewconfig = true;
+ *readnewconfig = true;
if (firstUsedConfig) {
firstUsedConfig = false;
if (openFileDesc.nequi < NEQUI)
nequileft_internal = NEQUI - openFileDesc.nequi;
}
nequileft_internal -= openFileDesc.nskip;
- nequileft = nequileft_internal;
+ *nequileft = nequileft_internal;
return;
}
else {
~configcache();
configcache(const string& cacheid, const int& nequi, const int& nskip, const string& datadir, char **configmem, const int& configMemSize,
const int& cachemode=CACHE_MODE_FULL, ostream *_log=NULL);
- void readConfig(bool& readnewconfig, int& nequileft, vector<unsigned long> *excludeFileHashes=NULL);
+ void readConfig(bool *readnewconfig, int *nequileft, vector<unsigned long> *excludeFileHashes=NULL);
void writeConfig(int actnequi);
void addPara(const string& parid, const double& val=0);
void setPara(const string& parid, const double& value);
bool hypercache::readC() {
bool readAtLeastOneConfig;
- C->readConfig(readAtLeastOneConfig, nequileft, &parentConfigs);
+ C->readConfig(&readAtLeastOneConfig, &nequileft, &parentConfigs);
if ( nequileft < 0 && readAtLeastOneConfig )
activeCFile = fileOfPath(C->getInFileName());
int nequileftReadConfig_ex;
memcpy (tmpconfig, C->getConfigMem(), C->getConfigSize());
- C->readConfig(readnewconfig_ex, nequileftReadConfig_ex, NULL);
+ C->readConfig(&readnewconfig_ex, &nequileftReadConfig_ex, NULL);
if (! readnewconfig_ex) {
*log << "HYPERCACHE: No more excluded config-files for possible equilibration available." << endl << flush;
/* storing most equilibrated config */
if ( nequileft < mostEquilibratedConfig.first && readAtLeastOneConfig ) {
- //*log << "HYPERCACHE: Storing a copy of so far most equilibrated config with nequileft = " << nequileft << endl << flush;
mostEquilibratedConfig.first = nequileft;
memcpy(mostEquilibratedConfig.second, C->getConfigMem(), C->getConfigSize());
}
*log << "HYPERCACHE: Injecting back most equilibrated stored config with nequileft = " << mostEquilibratedConfig.first << endl << flush;
nequileft = mostEquilibratedConfig.first;
memcpy(C->getConfigMem(), mostEquilibratedConfig.second, C->getConfigSize());
- //readAtLeastOneConfig = false;
}
return readAtLeastOneConfig;
lastWrittenObsEquis = NEQUI-nequileft-NSKIP;
}
-void hypercache::readO(int obsid, bool& readnewconfig, int& nequileft) {
- Os[obsid]->readConfig(readnewconfig, nequileft);
+void hypercache::readO(int obsid, bool *readNewObsConfig, int *nequiObsLeft) {
+ Os[obsid]->readConfig(readNewObsConfig, nequiObsLeft);
- if ( nequileft < 0 ) {
+ if ( *readNewObsConfig && *nequiObsLeft < 0 ) {
unsigned long *parentconfig = (unsigned long*)Os[obsid]->getHeader("concurrent_cfile");
if ( parentconfig != NULL )
addParentConfig(parentconfig);
static void addPara(const string& parid, const double& val=0);
static void setPara(const string& parid, const double& value);
- static void readO(int obsid, bool& readnewconfig, int& nequileft);
+ static void readO(int obsid, bool *readNewObsConfig, int *nequiObsLeft);
static bool readC();
static void writeO(int obsid);
static void writeC();
bool readnewObs;
int nequileftNewObs;
- hypercache::readO( (*obsit)->ocid, readnewObs, nequileftNewObs );
+ hypercache::readO( (*obsit)->ocid, &readnewObs, &nequileftNewObs );
if ( readnewObs && nequileftNewObs < 0 ) {
(*obsit)->meas(true);