From 4b30c6a7955f3ec61b6d9112b2a42e83e03f8729 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 6 Apr 2003 02:44:31 +0000 Subject: "" svn path=/trunk/; revision=548 --- externals/grill/vasp/changes.txt | 1 + externals/grill/vasp/pd-help/vasp_sframes.pd | 111 +++++++++++++----- externals/grill/vasp/pd-help/vasp_soffset.pd | 162 ++++++++++++++++++--------- externals/grill/vasp/source/main.cpp | 2 +- externals/grill/vasp/source/opparam.h | 2 +- externals/grill/vasp/source/ops_search.cpp | 74 ++++++------ externals/grill/vasp/todo.txt | 3 +- 7 files changed, 240 insertions(+), 115 deletions(-) (limited to 'externals/grill/vasp') diff --git a/externals/grill/vasp/changes.txt b/externals/grill/vasp/changes.txt index c4df2400..9c812a17 100644 --- a/externals/grill/vasp/changes.txt +++ b/externals/grill/vasp/changes.txt @@ -17,6 +17,7 @@ Version history: - CHANGE: changed behavior of vasp.spit on uneven vector counts [vasp a b c( -> [vasp.spit 2] now outputs a(outlet 2), b(outlet 1), c(outlet 2), bang(outlet 3) - REMOVE: eliminated [vasp.cconj] as an object as it can easily be replaced by an abstraction +- ADD: vasp.search (vasp.o=, vasp.f=) objects... @incl attribute (default false) to include current sample into search 0.1.2: - FIX: bug in vasp.frames* ... wrong argument diff --git a/externals/grill/vasp/pd-help/vasp_sframes.pd b/externals/grill/vasp/pd-help/vasp_sframes.pd index 510f50b4..6e7ee2d1 100644 --- a/externals/grill/vasp/pd-help/vasp_sframes.pd +++ b/externals/grill/vasp/pd-help/vasp_sframes.pd @@ -1,4 +1,4 @@ -#N canvas 39 37 929 624 10; +#N canvas 39 37 931 626 10; #X obj 58 31 cnv 15 15 15 empty empty vasp.frames= 0 10 1 14 -262144 -1 0; #N canvas 0 0 450 300 graph1 0; @@ -16,7 +16,7 @@ #X connect 0 0 3 0; #X connect 2 0 1 0; #X connect 3 0 1 0; -#X restore 798 498 pd init; +#X restore 798 533 pd init; #X obj 57 402 vasp.update; #X text 113 443 abbreviation; #N canvas 0 0 450 300 graph1 0; @@ -45,8 +45,28 @@ value is negative; #X obj 190 260 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 -1; #X text 218 274 the value 0.7 appears in the ramp; -#X text 218 259 2 generate noise until the position \, where; -#N canvas 77 60 429 598 dir_and_target 0; +#X obj 540 400 cnv 15 15 15 empty empty --> 0 10 0 14 -262144 -24198 +0; +#X msg 562 499 vasp bufsfram2; +#N canvas 249 259 328 183 clear 0; +#X obj 74 54 inlet; +#X obj 74 77 vasp.= 0; +#X obj 74 100 vasp.u; +#X obj 168 53 r \$0-clear; +#X msg 168 76 vasp bufsfram2; +#X obj 168 99 vasp.= 0; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 3 0 4 0; +#X connect 4 0 5 0; +#X restore 562 525 pd clear; +#X text 537 376 3 more features!; +#X text 56 56 search for a value (starting at the end) and set the +length of the vasp according to it; +#X text 55 482 related objects:; +#X obj 139 502 vasp.f; +#X obj 204 502 vasp.s; +#N canvas 77 60 522 606 dir_and_slope 0; #X text 46 56 forward; #X text 48 154 backward; #X text 31 22 search direction; @@ -64,7 +84,7 @@ value is negative; #X obj 210 111 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 -1 -1; #X text 228 111 (clear); -#X floatatom 234 175 12 0 0 0 - - -; +#X floatatom 224 177 12 0 0 0 - - -; #X msg 126 336 slope 1; #X msg 110 367 slope 0; #X msg 97 399 slope -1; @@ -72,7 +92,7 @@ value is negative; #X obj 264 376 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 -1 -1; #X text 282 376 (clear); -#X floatatom 300 423 12 0 0 0 - - -; +#X floatatom 283 426 12 0 0 0 - - -; #X text 29 290 find values with positive and/or negative slope; #X obj 185 197 vasp.-> bufsfram2; #X obj 239 481 vasp.noise; @@ -82,6 +102,14 @@ value is negative; #X obj 185 153 vasp.f= 0; #X msg 185 71 vasp 44101 bufsfram1; #X msg 239 336 vasp 0 bufsfram1; +#X text 40 438 query; +#X msg 109 436 getslope; +#X obj 369 424 prepend set; +#X msg 368 445; +#X obj 317 175 prepend set; +#X msg 316 196; +#X text 50 191 query; +#X msg 109 191 getdir; #X connect 8 0 9 0; #X connect 10 0 30 0; #X connect 11 0 30 0; @@ -98,32 +126,59 @@ value is negative; #X connect 28 1 26 0; #X connect 29 0 28 0; #X connect 29 1 23 0; +#X connect 29 2 35 0; #X connect 30 0 25 0; #X connect 30 1 16 0; +#X connect 30 2 37 0; #X connect 31 0 13 0; #X connect 32 0 20 0; -#X restore 586 418 pd dir_and_target; -#X obj 538 415 cnv 15 15 15 empty empty --> 0 10 0 14 -262144 -24198 -0; -#X msg 562 464 vasp bufsfram2; -#N canvas 249 259 328 183 clear 0; -#X obj 74 54 inlet; -#X obj 74 77 vasp.= 0; -#X obj 74 100 vasp.u; -#X obj 168 53 r \$0-clear; -#X msg 168 76 vasp bufsfram2; -#X obj 168 99 vasp.= 0; +#X connect 34 0 29 0; +#X connect 35 0 36 0; +#X connect 37 0 38 0; +#X connect 40 0 30 0; +#X restore 588 403 pd dir_and_slope; +#X text 218 259 2 generate noise up to the position where; +#N canvas 80 75 458 321 incl 0; +#X obj 168 260 vasp.noise; +#X obj 168 281 vasp.u; +#X obj 168 214 vasp.o?; +#X obj 170 135 t a b; +#X obj 195 161 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 +-1 -1; +#X text 213 161 (clear); +#X floatatom 261 211 5 0 0 0 - - -; +#X text 24 17 include current sample; +#X obj 170 109 vasp.u; +#X msg 68 93 incl 0; +#X msg 68 143 incl 1; +#X text 21 73 don't include (default); +#X text 20 126 do include; +#X text 21 188 query; +#X msg 68 189 getincl; +#X obj 300 210 prepend set; +#X msg 170 61 vasp bufsfram1; +#X msg 168 239 vasp bufsfram2 \$1; +#X obj 170 86 vasp.= env 0.5 40000 -0.5 60000; +#X msg 301 231; +#X obj 170 185 vasp.frames= -0.5; #X connect 0 0 1 0; -#X connect 1 0 2 0; -#X connect 3 0 4 0; -#X connect 4 0 5 0; -#X restore 562 490 pd clear; -#X text 537 398 3 more features!; -#X text 56 56 search for a value (starting at the end) and set the -length of the vasp according to it; -#X text 55 482 related objects:; -#X obj 139 502 vasp.f; -#X obj 204 502 vasp.s; +#X connect 2 0 17 0; +#X connect 3 0 20 0; +#X connect 3 1 4 0; +#X connect 8 0 3 0; +#X connect 9 0 20 0; +#X connect 10 0 20 0; +#X connect 14 0 20 0; +#X connect 15 0 19 0; +#X connect 16 0 18 0; +#X connect 17 0 0 0; +#X connect 18 0 8 0; +#X connect 20 0 2 0; +#X connect 20 1 6 0; +#X connect 20 2 15 0; +#X restore 588 428 pd incl; +#X obj 540 430 cnv 15 15 15 empty empty --> 0 10 0 14 -262144 -24198 +0; #X connect 9 0 3 0; #X connect 11 0 14 0; #X connect 12 0 13 0; @@ -133,4 +188,4 @@ length of the vasp according to it; #X connect 18 1 9 0; #X connect 20 0 11 0; #X connect 22 0 12 0; -#X connect 27 0 28 0; +#X connect 25 0 26 0; diff --git a/externals/grill/vasp/pd-help/vasp_soffset.pd b/externals/grill/vasp/pd-help/vasp_soffset.pd index 8a515a2a..6b77de7c 100644 --- a/externals/grill/vasp/pd-help/vasp_soffset.pd +++ b/externals/grill/vasp/pd-help/vasp_soffset.pd @@ -1,4 +1,4 @@ -#N canvas 31 15 964 662 10; +#N canvas 23 9 968 641 10; #X text 54 77 argument/right inlet: value; #X obj 58 27 cnv 15 15 15 empty empty vasp.offset= 0 10 1 14 -262144 -1 0; @@ -8,7 +8,7 @@ #X array bufsoffs1 1000 float 0; #X coords 0 1 999 -1 300 100 1; #X restore 551 88 graph; -#N canvas 466 356 387 251 init 0; +#N canvas 466 356 391 255 init 0; #X obj 33 19 loadbang; #X msg 33 45 symbol bufsoffs1; #X msg 151 45 symbol bufsoffs2; @@ -38,7 +38,7 @@ #X obj 64 325 vasp.o?; #X msg 64 346 vasp bufsoffs2 \$1; #X text 54 59 search for a value set it as offset; -#X floatatom 161 271 5 0 0; +#X floatatom 161 271 5 0 0 0 - - -; #X obj 170 130 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 -1; #X obj 170 221 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 @@ -52,21 +52,74 @@ #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 2 0 3 0; -#X restore 683 549 pd clear_buffer; -#X msg 683 528 vasp bufsoffs2; -#X text 703 508 clear second buffer; -#X obj 683 509 bng 15 250 50 0 empty \$0-clear empty 0 -6 576 8 -262144 +#X restore 633 556 pd clear_buffer; +#X msg 633 535 vasp bufsoffs2; +#X text 653 515 clear second buffer; +#X obj 633 516 bng 15 250 50 0 empty \$0-clear empty 0 -6 576 8 -262144 -1 -1; -#X obj 162 445 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 +#X obj 147 445 bng 15 250 50 0 empty empty empty 0 -6 0 8 -24198 -1 -1; -#N canvas 77 60 409 578 dir_and_target 0; +#X obj 64 151 vasp.= env -1 0 1 500 -1 1000; +#X obj 102 496 t a b; +#X obj 127 517 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 +-1 -1; +#X text 145 517 (clear); +#X obj 612 391 cnv 15 15 15 empty empty --> 0 10 0 14 -262144 -24198 +0; +#X text 214 232 where the ramp is at 0.2; +#X obj 64 242 vasp.offset= 0.2; +#X text 174 444 3 start searching at frame 501; +#X msg 102 475 vasp bufsoffs1 501; +#X text 133 419 the search always starts at the offset point; +#N canvas 80 75 454 317 incl 0; +#X obj 168 260 vasp.noise; +#X obj 168 281 vasp.u; +#X msg 168 239 vasp bufsoffs2 \$1; +#X obj 168 214 vasp.o?; +#X obj 170 135 t a b; +#X obj 195 161 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 +-1 -1; +#X text 213 161 (clear); +#X floatatom 261 211 5 0 0 0 - - -; +#X text 24 17 include current sample; +#X msg 170 61 vasp bufsoffs1; +#X obj 170 185 vasp.offset= 0.5; +#X obj 170 109 vasp.u; +#X obj 170 86 vasp.= env 0.5 500 -0.5 700; +#X msg 68 93 incl 0; +#X msg 68 143 incl 1; +#X text 21 73 don't include (default); +#X text 20 126 do include; +#X text 21 188 query; +#X msg 68 189 getincl; +#X obj 300 210 prepend set; +#X msg 301 231; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 2 0; +#X connect 4 0 10 0; +#X connect 4 1 5 0; +#X connect 9 0 12 0; +#X connect 10 0 3 0; +#X connect 10 1 7 0; +#X connect 10 2 19 0; +#X connect 11 0 4 0; +#X connect 12 0 11 0; +#X connect 13 0 10 0; +#X connect 14 0 10 0; +#X connect 18 0 10 0; +#X connect 19 0 20 0; +#X restore 660 421 pd incl; +#X obj 612 423 cnv 15 15 15 empty empty --> 0 10 0 14 -262144 -24198 +0; +#N canvas 77 60 447 584 dir_and_slope 0; #X text 46 56 forward; #X text 48 154 backward; #X text 31 22 search direction; -#X text 58 369 both; -#X text 28 401 negative; -#X text 58 337 positive; -#X text 28 314 target slope; +#X text 56 371 both; +#X text 26 403 negative; +#X text 56 339 positive; +#X text 26 316 target slope; #X text 46 99 both (nearest); #X obj 183 210 vasp.noise; #X obj 183 231 vasp.u; @@ -81,22 +134,32 @@ #X text 228 111 (clear); #X obj 185 135 vasp.offset= 0.1; #X msg 185 71 vasp bufsoffs1 500; -#X floatatom 276 161 5 0 0; -#X msg 126 336 slope 1; -#X msg 110 367 slope 0; -#X msg 97 399 slope -1; -#X obj 239 484 vasp.noise; -#X obj 239 505 vasp.u; -#X msg 239 463 vasp bufsoffs2 \$1; -#X obj 239 438 vasp.o?; -#X obj 239 355 t a b; -#X obj 264 376 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 +#X floatatom 276 161 5 0 0 0 - - -; +#X msg 124 338 slope 1; +#X msg 108 369 slope 0; +#X msg 95 401 slope -1; +#X obj 237 486 vasp.noise; +#X obj 237 507 vasp.u; +#X msg 237 465 vasp bufsoffs2 \$1; +#X obj 237 440 vasp.o?; +#X obj 237 357 t a b; +#X obj 262 378 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 -1 -1; -#X text 282 376 (clear); -#X obj 239 400 vasp.offset= 0.1; -#X floatatom 330 426 5 0 0; -#X text 29 290 find values with positive and/or negative slope; -#X msg 239 336 vasp bufsoffs1; +#X text 280 378 (clear); +#X obj 237 402 vasp.offset= 0.1; +#X floatatom 308 430 5 0 0 0 - - -; +#X text 27 292 find values with positive and/or negative slope; +#X msg 237 338 vasp bufsoffs1; +#X text 47 197 query; +#X msg 104 197 getdir; +#X text 50 434 query; +#X msg 109 437 getslope; +#X obj 315 158 prepend set; +#X msg 314 180; +#X obj 315 158 prepend set; +#X msg 314 180; +#X obj 354 431 prepend set; +#X msg 355 452; #X connect 8 0 9 0; #X connect 10 0 8 0; #X connect 11 0 18 0; @@ -107,6 +170,7 @@ #X connect 15 1 16 0; #X connect 18 0 14 0; #X connect 18 1 20 0; +#X connect 18 2 39 0; #X connect 19 0 15 0; #X connect 21 0 31 0; #X connect 22 0 31 0; @@ -118,24 +182,18 @@ #X connect 28 1 29 0; #X connect 31 0 27 0; #X connect 31 1 32 0; +#X connect 31 2 43 0; #X connect 34 0 28 0; -#X restore 612 422 pd dir_and_target; -#X obj 64 151 vasp.= env -1 0 1 500 -1 1000; -#X obj 102 496 t a b; -#X obj 127 517 bng 15 250 50 0 \$0-clear empty empty 0 -6 1152 8 -262144 --1 -1; -#X text 145 517 (clear); -#X text 148 418 the search always starts at the offsetpoint; -#X text 566 403 more features!; -#X obj 564 419 cnv 15 15 15 empty empty --> 0 10 0 14 -262144 -24198 -0; -#X text 214 232 where the ramp is at 0.2; -#X obj 64 242 vasp.offset= 0.2; -#X text 189 443 3 start searching at frame 501; -#X msg 102 475 vasp bufsoffs1 501; +#X connect 36 0 18 0; +#X connect 38 0 31 0; +#X connect 39 0 40 0; +#X connect 41 0 42 0; +#X connect 43 0 44 0; +#X restore 660 394 pd dir_and_slope; +#X text 614 375 3 more features!; #X connect 3 0 10 0; -#X connect 8 0 30 0; -#X connect 9 0 38 0; +#X connect 8 0 29 0; +#X connect 9 0 35 0; #X connect 11 0 12 0; #X connect 18 0 19 0; #X connect 19 0 11 0; @@ -143,11 +201,11 @@ #X connect 23 0 9 0; #X connect 25 0 24 0; #X connect 27 0 25 0; -#X connect 28 0 40 0; -#X connect 30 0 7 0; -#X connect 31 0 38 0; -#X connect 31 1 32 0; -#X connect 38 0 18 0; -#X connect 38 0 3 0; -#X connect 38 1 21 0; -#X connect 40 0 31 0; +#X connect 28 0 37 0; +#X connect 29 0 7 0; +#X connect 30 0 35 0; +#X connect 30 1 31 0; +#X connect 35 0 18 0; +#X connect 35 0 3 0; +#X connect 35 1 21 0; +#X connect 37 0 30 0; 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) }; diff --git a/externals/grill/vasp/todo.txt b/externals/grill/vasp/todo.txt index 8086a03f..21926ce4 100644 --- a/externals/grill/vasp/todo.txt +++ b/externals/grill/vasp/todo.txt @@ -25,6 +25,8 @@ warning, treat as 0, calculate unit operation, loop, mirror on buffer end, stay - reduce number of warnings for wrong offset, frame size etc. +- review vasp.f=, vasp.o= for quasi-constant envelopes + objects: --------------------- @@ -35,7 +37,6 @@ objects: - slope: frequency distortion with given exponent -- vasp.trigger object... in PD [t a] is ok, what about Max? - vasp.expr - vasp.state.... current vasp, operation, progress meter -- cgit v1.2.1