aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vasp/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-04-06 02:44:31 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-04-06 02:44:31 +0000
commit4b30c6a7955f3ec61b6d9112b2a42e83e03f8729 (patch)
treeb07c9bac9cae52f4c1441e70034e867ccce04c17 /externals/grill/vasp/source
parent5d0898c3082a45cc05953e78705314b44da64a3f (diff)
""
svn path=/trunk/; revision=548
Diffstat (limited to 'externals/grill/vasp/source')
-rw-r--r--externals/grill/vasp/source/main.cpp2
-rw-r--r--externals/grill/vasp/source/opparam.h2
-rw-r--r--externals/grill/vasp/source/ops_search.cpp74
3 files changed, 44 insertions, 34 deletions
diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp
index 2f7d9f11..e1c3e42d 100644
--- a/externals/grill/vasp/source/main.cpp
+++ b/externals/grill/vasp/source/main.cpp
@@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "classes.h"
-const C *VASP_VERSION = "0.1.3pre7";
+const C *VASP_VERSION = "0.1.3pre8";
#include "opfuns.h"
diff --git a/externals/grill/vasp/source/opparam.h b/externals/grill/vasp/source/opparam.h
index 0b6e5bd5..473b76c4 100644
--- a/externals/grill/vasp/source/opparam.h
+++ b/externals/grill/vasp/source/opparam.h
@@ -111,7 +111,7 @@ public:
struct { R arg; } rbin;
struct { R rarg,iarg; } cbin;
struct { I *order; } perm;
- struct { R val; I offs,dif,dir,slope; } srch;
+ struct { R val; I offs,dif,dir,slope; BL incl; } srch;
};
private:
diff --git a/externals/grill/vasp/source/ops_search.cpp b/externals/grill/vasp/source/ops_search.cpp
index 7e8bbee6..d805437d 100644
--- a/externals/grill/vasp/source/ops_search.cpp
+++ b/externals/grill/vasp/source/ops_search.cpp
@@ -22,37 +22,43 @@ BL VecOp::d_search(OpParam &p)
I i,ofl = -1,ofr = -1;
- if(p.srch.dir <= 0) {
- BL y = cur >= val;
- i = off-1;
- _D_WHILE(i >= 0)
- BL y2 = p.rsdt[i] >= val;
- if(y != y2) {
- if(p.srch.slope <= 0 && y2) break;
- if(p.srch.slope >= 0 && !y2) break;
- }
- y = y2;
- --i;
- _E_WHILE
-
- if(i >= 0) ofl = i;
- }
-
- if(p.srch.dir >= 0) {
- BL y = cur >= val;
- i = off+1;
- _D_WHILE(i < p.frames)
- BL y2 = p.rsdt[i] >= val;
- if(y != y2) {
- if(p.srch.slope <= 0 && !y2) break;
- if(p.srch.slope >= 0 && y2) break;
- }
- y = y2;
- ++i;
- _E_WHILE
-
- if(i < p.frames) ofr = i;
- }
+ if(p.srch.incl && cur == val) {
+ // if @incl attribute is set and current sample matches
+ ofl = ofr = off;
+ }
+ else {
+ if(p.srch.dir <= 0) {
+ BL y = cur >= val;
+ i = off-1;
+ _D_WHILE(i >= 0)
+ BL y2 = p.rsdt[i] >= val;
+ if(y != y2) {
+ if(p.srch.slope <= 0 && y2) break;
+ if(p.srch.slope >= 0 && !y2) break;
+ }
+ y = y2;
+ --i;
+ _E_WHILE
+
+ if(i >= 0) ofl = i;
+ }
+
+ if(p.srch.dir >= 0) {
+ BL y = cur >= val;
+ i = off+1;
+ _D_WHILE(i < p.frames)
+ BL y2 = p.rsdt[i] >= val;
+ if(y != y2) {
+ if(p.srch.slope <= 0 && !y2) break;
+ if(p.srch.slope >= 0 && y2) break;
+ }
+ y = y2;
+ ++i;
+ _E_WHILE
+
+ if(i < p.frames) ofr = i;
+ }
+ }
if(!p.srch.dir) {
if(ofl >= 0) {
@@ -133,13 +139,14 @@ public:
vasp_search(I argc,t_atom *argv):
vasp_anyop(argc,argv,VASP_ARG_R(0),false,XletCode(xlet::tp_float,0)),
- slope(0),dir(0)
+ slope(0),dir(0),incl(false)
{}
static V Setup(t_classid c)
{
FLEXT_CADDATTR_VAR1(c,"dir",dir);
FLEXT_CADDATTR_VAR1(c,"slope",slope);
+ FLEXT_CADDATTR_VAR1(c,"incl",incl);
}
virtual Vasp *do_work(OpParam &p) = 0;
@@ -149,6 +156,7 @@ public:
OpParam p(thisName(),1);
p.srch.dir = dir;
p.srch.slope = slope;
+ p.srch.incl = incl;
Vasp *ret = do_work(p);
if(ret) ToOutFloat(1,p.srch.dif);
@@ -157,10 +165,12 @@ public:
protected:
I dir,slope;
+ BL incl;
private:
FLEXT_ATTRVAR_I(dir)
FLEXT_ATTRVAR_I(slope)
+ FLEXT_ATTRVAR_B(incl)
};