[Kst] branches/work/kst/1.5/kst/src/libkstmath

Andrew Walker arwalker at sumusltd.com
Wed Jul 4 01:36:02 CEST 2007


SVN commit 683027 by arwalker:

BUG:145289 Ensure that equations always update by avoiding optimisation when necessary

 M  +9 -5      kstequation.cpp  
 M  +9 -12     kstequation.h  


--- branches/work/kst/1.5/kst/src/libkstmath/kstequation.cpp #683026:683027
@@ -219,7 +219,7 @@
 
   KstObject::UpdateType rc = NO_CHANGE; // if force, rc = UPDATE anyway.
   if (force || xUpdated || usedUpdated) {
-    _isValid = FillY(force);
+    _isValid = FillY(force, usedUpdated);
     rc = UPDATE;
   }
   v = *_yOutVector;
@@ -381,9 +381,10 @@
 /*                      Fill Y: Evaluates the equation                  */
 /*                                                                      */
 /************************************************************************/
-bool KstEquation::FillY(bool force) {
-  int v_shift=0, v_new;
-  int i0=0;
+bool KstEquation::FillY(bool force, bool usedUpdated) {
+  int v_shift = 0;
+  int v_new;
+  int i0 = 0;
   int ns;
 
   writeLockInputsAndOutputs();
@@ -409,7 +410,7 @@
     if (!xv->resize(_ns)) {
       // FIXME: handle error?
       unlockInputsAndOutputs();
-      return false;    
+      return false;
     }
     if (!yv->resize(_ns)) {
       // FIXME: handle error?
@@ -419,6 +420,9 @@
     yv->zero();
     i0 = 0; // other vectors may have diffent lengths, so start over
     v_shift = _ns;
+  } else if (usedUpdated) {
+    i0 = 0;
+    v_shift = _ns;
   } else {
     // calculate shift and new samples
     // only do shift optimization if all used vectors are same size and shift
--- branches/work/kst/1.5/kst/src/libkstmath/kstequation.h #683026:683027
@@ -67,9 +67,9 @@
     virtual QString yVTag() const { return (*_yOutVector)->tagName(); }
 
     const KstCurveHintList *curveHints() const;
-    
+
     virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap);
-    
+
     virtual void replaceDependency(KstDataObjectPtr oldObject, KstDataObjectPtr newObject);
 
     virtual void replaceDependency(KstVectorPtr oldVector, KstVectorPtr newVector);
@@ -81,25 +81,22 @@
     void reParse();
 
   private:
-    QString _equation;
-
+    KstVectorMap::Iterator _xInVector, _xOutVector, _yOutVector;
+    Equation::Node *_pe;
     KstVectorMap VectorsUsed;
     KstScalarMap ScalarsUsed;
-    void setupConnections();
-
-    void commonConstructor(const QString& in_tag, const QString& equation);
-
-    bool FillY(bool force = false);
+    QString _equation;
     bool _isValid : 1;
     bool _doInterp : 1;
-
     int _numNew, _numShifted, _interp, _ns;
 
+    void setupConnections();
+    void commonConstructor(const QString& in_tag, const QString& equation);
+    bool FillY(bool force, bool usedUpdated);
+
     static const QString XINVECTOR;
     static const QString XOUTVECTOR;
     static const QString YOUTVECTOR;
-    KstVectorMap::Iterator _xInVector, _xOutVector, _yOutVector;
-    Equation::Node *_pe;
 };
 
 typedef KstSharedPtr<KstEquation> KstEquationPtr;


More information about the Kst mailing list