]> git.treefish.org Git - phys/latlib.git/commitdiff
...
authorAlex Schmidt <alex@treefish.org>
Tue, 18 Jun 2013 19:19:13 +0000 (21:19 +0200)
committerAlex Schmidt <alex@treefish.org>
Tue, 18 Jun 2013 19:19:13 +0000 (21:19 +0200)
configcache.cpp
configcache.h

index 35e85488d34e1a315301a283ad310e77df8a54b7..f642e9f26fc99e2e4f8a685d9673738a56c8e2ea 100644 (file)
@@ -73,7 +73,7 @@ bool configcache::isValidInFile(const string& infile, infiledesc *filedesc)
 
   filedesc->filename = infile;
   filedesc->doVirtualEquilibration = false;
 
   filedesc->filename = infile;
   filedesc->doVirtualEquilibration = false;
-  filedesc->firstConfig = true;
+  filedesc->firstUsedConfig = true;
 
   if( infile.size() < 4 ) return false;
 
 
   if( infile.size() < 4 ) return false;
 
@@ -194,6 +194,7 @@ void configcache::readConfig(bool& readnewconfig, int& nequileft, vector<unsigne
   while(true)
     {
       vector<infiledesc>::iterator inFileIt = getNextInfile(excludeFileHashes);
   while(true)
     {
       vector<infiledesc>::iterator inFileIt = getNextInfile(excludeFileHashes);
+      int iDidVirtualSkips;
 
       if( (!inFile.is_open()) && inFileIt == inFiles.end() ) {
        cout << "RETURNING..." << endl;
 
       if( (!inFile.is_open()) && inFileIt == inFiles.end() ) {
        cout << "RETURNING..." << endl;
@@ -221,26 +222,29 @@ void configcache::readConfig(bool& readnewconfig, int& nequileft, vector<unsigne
          if (openFileDesc.doVirtualEquilibration) {
            if(log) *log << "CCACHE: Trying virtual equilibration." << endl << flush;
            openFileDesc.doVirtualEquilibration = false;
          if (openFileDesc.doVirtualEquilibration) {
            if(log) *log << "CCACHE: Trying virtual equilibration." << endl << flush;
            openFileDesc.doVirtualEquilibration = false;
-           for (int iskip=0; iskip < (NEQUI-openFileDesc.nequi)/openFileDesc.nskip; iskip++) {
+           for (iDidVirtualSkips=0; iDidVirtualSkips < (NEQUI-openFileDesc.nequi)/openFileDesc.nskip; iDidVirtualSkips++) {
              if( readFullBlock(tmpConfig, configSize) != configSize || ! inFile.is_open() )
                break;
              if( readFullBlock(tmpConfig, configSize) != configSize || ! inFile.is_open() )
                break;
-             else if ( (NEQUI-openFileDesc.nequi) - (iskip+1)*openFileDesc.nskip < nequileft_internal ) {
+             else if ( (NEQUI-openFileDesc.nequi) - (iDidVirtualSkips+1)*openFileDesc.nskip < nequileft_internal ) {
                memcpy(configMem, tmpConfig, configSize);
                memcpy(configMem, tmpConfig, configSize);
-               nequileft_internal = NEQUI - openFileDesc.nequi - (iskip+1)*openFileDesc.nskip;
+               nequileft_internal = NEQUI - openFileDesc.nequi - (iDidVirtualSkips+1)*openFileDesc.nskip;
                cout << "blabla:" << nequileft_internal << endl;
                readnewconfig = true;
                cout << "blabla:" << nequileft_internal << endl;
                readnewconfig = true;
+               openFileDesc.firstUsedConfig = false;
              }
            }
              }
            }
-           openFileDesc.firstConfig = false;
          }
 
          if( readFullBlock(tmpConfig, configSize) == configSize && inFile.is_open() )
            {
              memcpy(configMem, tmpConfig, configSize);
              readnewconfig = true;
          }
 
          if( readFullBlock(tmpConfig, configSize) == configSize && inFile.is_open() )
            {
              memcpy(configMem, tmpConfig, configSize);
              readnewconfig = true;
-             if (openFileDesc.firstConfig) {
-               openFileDesc.firstConfig = false;
-               nequileft_internal = NEQUI - openFileDesc.nequi;
+             if (openFileDesc.firstUsedConfig) {
+               openFileDesc.firstUsedConfig = false;
+               if (NEQUI < openFileDesc.nequi)
+                 nequileft_internal = NEQUI - openFileDesc.nequi - iDidVirtualSkips*openFileDesc.nskip;
+               else
+                 nequileft_internal = NEQUI - openFileDesc.nequi;
              }
              nequileft_internal -= openFileDesc.nskip;
              cout << "sadasd:" << nequileft_internal << endl;
              }
              nequileft_internal -= openFileDesc.nskip;
              cout << "sadasd:" << nequileft_internal << endl;
index 869fed6735f58f2a09b72adb0736b7507384efa8..62db2f309d06fac44c871c65bb6bbe81fa75c497 100644 (file)
@@ -30,7 +30,7 @@ struct infiledesc {
   int nskip;
   bool doVirtualEquilibration;
   bool extended;
   int nskip;
   bool doVirtualEquilibration;
   bool extended;
-  bool firstConfig;
+  bool firstUsedConfig;
 };
 
 class configcache{
 };
 
 class configcache{