[Kst] kst_fastskip_branch: kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Jan 13 01:13:56 CET 2005


CVS commit by staikos: 

a start for fast skip.  seems to work with INDEX from the ascii source so far.


  M +42 -20    kstrvector.cpp   1.70.2.1
  M +2 -0      kstrvector.h   1.28.2.1


--- kdeextragear-2/kst/kst/kstrvector.cpp  #1.70:1.70.2.1
@@ -121,4 +121,5 @@ void KstRVector::commonRVConstructor(Kst
                                      int in_n, int in_skip, bool in_DoSkip,
                                      bool in_DoAve) {
+  _dontUseSkipAccel = false;
   _numSamples = 0;
   _scalars["sum"]->setValue(0.0);
@@ -171,4 +172,5 @@ void KstRVector::change(KstDataSourcePtr
   }
 
+  _dontUseSkipAccel = false;
   _file = in_file;
   ReqF0 = in_f0;
@@ -196,4 +198,5 @@ void KstRVector::changeFile(KstDataSourc
     KstDebug::self()->log(i18n("Data file for vector %1 was not opened.").arg(tagName()), KstDebug::Warning);
   }
+  _dontUseSkipAccel = false;
   _file = in_file;
   if (_file) {
@@ -493,4 +496,21 @@ KstObject::UpdateType KstRVector::doUpda
       }
     }
+    if (!_dontUseSkipAccel) {
+      int rc;
+      int lastRead = -1;
+      // FIXME: DoAve ??
+      rc = _file->readField(_v + _numSamples, _field, new_f0, (new_nf - NF)/Skip, Skip, &lastRead);
+      if (rc != -9999) {
+        kdDebug() << "USED SKIP FOR READ - " << _field << " - rc=" << rc << " for Skip=" << Skip << " s=" << new_f0 << " n=" << (DoAve ? (new_nf - NF)/Skip : -1) << endl;
+        if (rc >= 0) {
+          n_read = rc;
+        } else {
+          n_read = 0;
+        }
+      } else {
+        _dontUseSkipAccel = true;
+      }
+    }
+    if (_dontUseSkipAccel) {
     n_read = 0;
     /** read each sample from the File */
@@ -517,4 +537,5 @@ KstObject::UpdateType KstRVector::doUpda
       }
     }
+    }
   } else {
     // reallocate V if necessary
@@ -613,4 +634,5 @@ void KstRVector::reload() {
         KST::dataSourceList.lock().writeLock();
         KST::dataSourceList.remove(_file);
+        _dontUseSkipAccel = false;
         _file = newsrc;
         _file->writeLock();

--- kdeextragear-2/kst/kst/kstrvector.h  #1.28:1.28.2.1
@@ -159,4 +159,6 @@ private:
 
   void checkIntegrity(); // must be called with a lock
+
+  bool _dontUseSkipAccel;
 };
 




More information about the Kst mailing list