From 28d14094386a69ddf05ca810114538fb2c31f8c7 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 9 Apr 2003 02:40:20 +0000 Subject: "" svn path=/trunk/; revision=554 --- externals/grill/fftease/makefile.pd-darwin | 4 +- externals/grill/flext/flext.cw | Bin 506677 -> 506677 bytes externals/grill/flext/readme.txt | 2 + externals/grill/flext/source/flext.cpp | 4 - externals/grill/flext/source/flsupport.cpp | 6 ++ externals/grill/flext/source/flthr.cpp | 8 +- externals/grill/pool/makefile.pd-darwin | 4 +- externals/grill/vasp/changes.txt | 2 + externals/grill/vasp/makefile.pd-darwin | 12 +-- externals/grill/vasp/makefile.pd-linux | 6 +- externals/grill/vasp/source/main.cpp | 3 +- externals/grill/vasp/source/obj_chns.cpp | 52 +++++++++++- externals/grill/vasp/source/obj_frames.cpp | 8 +- externals/grill/vasp/source/obj_imm.cpp | 2 +- externals/grill/vasp/source/obj_offs.cpp | 4 +- externals/grill/vasp/source/obj_part.cpp | 2 +- externals/grill/vasp/source/obj_peaks.cpp | 2 +- externals/grill/vasp/source/obj_radio.cpp | 4 +- externals/grill/vasp/source/obj_size.cpp | 8 +- externals/grill/vasp/source/obj_split.cpp | 12 +-- externals/grill/vasp/source/obj_sync.cpp | 2 +- externals/grill/vasp/source/obj_vasp.cpp | 6 +- externals/grill/vasp/source/obj_vecs.cpp | 2 +- externals/grill/vasp/source/opfuns.h | 2 +- externals/grill/vasp/source/opparam.h | 6 +- externals/grill/vasp/source/ops_qminmax.cpp | 125 ++++++++++++++++------------ externals/grill/vasp/vasp.cw | Bin 356360 -> 356360 bytes externals/grill/xsample/xsample.cw | Bin 213671 -> 213671 bytes 28 files changed, 186 insertions(+), 102 deletions(-) (limited to 'externals/grill') diff --git a/externals/grill/fftease/makefile.pd-darwin b/externals/grill/fftease/makefile.pd-darwin index 12c262a4..b33a5ff9 100644 --- a/externals/grill/fftease/makefile.pd-darwin +++ b/externals/grill/fftease/makefile.pd-darwin @@ -48,7 +48,7 @@ $(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(FLEXTLIB) $(MAK touch $@ $(TARGDIR): - mkdir $(TARGDIR) + -mkdir $(TARGDIR) $(TARGDIR)/%.o : $(DIR)/%.cpp $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES)) $< -o $@ @@ -61,7 +61,7 @@ $(TARGET) : $(patsubst %.c,$(TARGDIR)/%.co,$(patsubst %.cpp,$(TARGDIR)/%.o,$(SRC chmod 755 $@ $(INSTPATH): - mkdir $(INSTPATH) + -mkdir $(INSTPATH) install:: $(INSTPATH) diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw index c38d4c10..0afabe2e 100644 Binary files a/externals/grill/flext/flext.cw and b/externals/grill/flext/flext.cw differ diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index cb9f90a1..9afb459d 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -122,6 +122,8 @@ Version history: - added flext::Forward function to send messages to bound symbols - added "zero" flag to flext::buffer resize operation - fixed bug for Max/MSP buffer resize with preservation of contents +- fixed bug with thread initialization (caused PD@OSX to crash on startup) +- flext::setup is only run once now 0.4.2: - started port for jMax diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index e6003466..a5ee5a59 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -169,10 +169,6 @@ void flext_base::Setup(t_classid id) AddMethod(id,0,"getattributes",(methfun)cb_ListAttrib); SetProxies(c); - -#ifdef FLEXT_THREADS - thrid = GetThreadId(); -#endif } #if FLEXT_SYS == FLEXT_SYS_JMAX diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index dcac4c75..26ddc51f 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -31,6 +31,11 @@ const t_symbol *flext::sym_signal = NULL; void flext::Setup() { + static bool issetup = false; + if(issetup) + return; + else issetup = true; + #if FLEXT_SYS == FLEXT_SYS_PD sym_anything = &s_anything; sym_pointer = &s_pointer; @@ -57,6 +62,7 @@ void flext::Setup() #endif #ifdef FLEXT_THREADS + thrid = GetThreadId(); StartHelper(); #endif } diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index d15e33d0..df8fb1a1 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -43,6 +43,12 @@ static flext::ThrCond *thrhelpcond = NULL; bool flext::StartHelper() { if(thrhelpid) return true; + + if(!thrid) { + // system thread has not been set + ERRINTERNAL(); + return false; + } bool ok = false; #if FLEXT_THREADS == FLEXT_THR_POSIX @@ -96,7 +102,7 @@ void flext::ThrHelper(void *) pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); #endif -// post("Helper"); +// post("Helper thread started"); // set thread priority one point below normal // so thread construction won't disturb real-time audio diff --git a/externals/grill/pool/makefile.pd-darwin b/externals/grill/pool/makefile.pd-darwin index 5cc81b82..c71935d8 100644 --- a/externals/grill/pool/makefile.pd-darwin +++ b/externals/grill/pool/makefile.pd-darwin @@ -45,7 +45,7 @@ $(patsubst %,$(DIR)/%,$(SRCS)): $(patsubst %,$(DIR)/%,$(HDRS)) $(FLEXTLIB) $(CON touch $@ $(TARGDIR): - mkdir $(TARGDIR) + -mkdir $(TARGDIR) $(TARGDIR)/%.o : $(DIR)/%.cpp $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ @@ -55,7 +55,7 @@ $(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) chmod 755 $@ $(INSTPATH): - mkdir $(INSTPATH) + -mkdir $(INSTPATH) install:: $(INSTPATH) diff --git a/externals/grill/vasp/changes.txt b/externals/grill/vasp/changes.txt index 9c812a17..c9c7a34e 100644 --- a/externals/grill/vasp/changes.txt +++ b/externals/grill/vasp/changes.txt @@ -18,6 +18,8 @@ Version history: [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 +- ADD: [vasp.channels?] reports number of channels in the first vasp vector (buffer/array) +- CHANGE: vasp.min?, vasp.max?, vasp.amin?, vasp.amax?, vasp.rmin?, vasp.rmax? no longer return the reference vasp / return a list of vector maxima/minima 0.1.2: - FIX: bug in vasp.frames* ... wrong argument diff --git a/externals/grill/vasp/makefile.pd-darwin b/externals/grill/vasp/makefile.pd-darwin index 89e96614..7d9eeb8a 100755 --- a/externals/grill/vasp/makefile.pd-darwin +++ b/externals/grill/vasp/makefile.pd-darwin @@ -44,7 +44,7 @@ $(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(MAKEFILE) touch $(patsubst %,$(SRCDIR)/%,$(SRCS)) $(TARGDIR): - mkdir $(TARGDIR) + -mkdir $(TARGDIR) $(TARGDIR)/%.o : $(SRCDIR)/%.cpp $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@ @@ -55,20 +55,20 @@ $(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB) $(INSTDIR): - mkdir $(INSTDIR) + -mkdir $(INSTDIR) $(INSTDIR)/vasp: $(INSTDIR) - mkdir $(INSTDIR)/vasp + -mkdir $(INSTDIR)/vasp install:: $(INSTDIR)/vasp -install:: $(TARGET) pd - cp -R $^ $(INSTDIR)/vasp +install:: $(TARGET) pd/* + -cp $^ $(INSTDIR)/vasp # chown -R root.root $(INSTDIR)/vasp $(HELPDIR)/vasp: - mkdir $(HELPDIR)/vasp + -mkdir $(HELPDIR)/vasp install-help:: $(HELPDIR)/vasp diff --git a/externals/grill/vasp/makefile.pd-linux b/externals/grill/vasp/makefile.pd-linux index 6f9342cb..3bb424c0 100644 --- a/externals/grill/vasp/makefile.pd-linux +++ b/externals/grill/vasp/makefile.pd-linux @@ -61,8 +61,8 @@ $(INSTDIR)/vasp: $(INSTDIR) install:: $(INSTDIR)/vasp -install:: $(TARGET) pd - cp -R $^ $(INSTDIR)/vasp +install:: $(TARGET) pd/* + -cp $^ $(INSTDIR)/vasp # chown -R root.root $(INSTDIR)/vasp @@ -72,7 +72,7 @@ $(HELPDIR)/vasp: install-help:: $(HELPDIR)/vasp install-help:: ./pd-help - cp $^/*.* $(HELPDIR)/vasp + cp $^/* $(HELPDIR)/vasp # chown -R root.root $(HELPDIR)/vasp diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp index e1c3e42d..67d151ac 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.3pre8"; +const C *VASP_VERSION = "0.1.3pre10"; #include "opfuns.h" @@ -64,6 +64,7 @@ static V vasp_main() VASP_SETUP(channel); // vasp.channel VASP_SETUP(qchannel); // vasp.channel? + VASP_SETUP(qchannels); // vasp.channels? VASP_SETUP(split); VASP_SETUP(join); diff --git a/externals/grill/vasp/source/obj_chns.cpp b/externals/grill/vasp/source/obj_chns.cpp index 8b38374f..370624de 100755 --- a/externals/grill/vasp/source/obj_chns.cpp +++ b/externals/grill/vasp/source/obj_chns.cpp @@ -11,6 +11,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "main.h" #include "classes.h" #include "util.h" +#include "buflib.h" /*! \class vasp_channel @@ -29,7 +30,7 @@ class vasp_channel: FLEXT_HEADER_S(vasp_channel,vasp_tx,Setup) public: - vasp_channel(I argc,t_atom *argv): + vasp_channel(I argc,const t_atom *argv): ix(0) { if(argc >= 1 && CanbeInt(argv[0])) @@ -97,8 +98,12 @@ public: virtual V m_bang() { - if(ref.Ok()) + if(ref.Ok()) { + if(ref.Vectors() > 1) + post("%s - more vectors in vasp, only considering first",thisName()); + ToOutInt(0,ref.Vector(0).Channel()); + } else post("%s - Invalid vasp, no output",thisName()); } @@ -109,4 +114,47 @@ public: FLEXT_LIB("vasp, vasp.channel? vasp.c?",vasp_qchannel) +/*! \class vasp_qchannels + \remark \b vasp.channels? + \brief Gets number of channels of a vasp. + \since 0.1.3 + \param inlet vasp - is stored and output triggered + \param inlet bang - triggers output + \param inlet set - vasp to be stored + \retval outlet int - channels of stored vasp + + \note No output for invalid vasp? +*/ +class vasp_qchannels: + public vasp_op +{ + FLEXT_HEADER(vasp_qchannels,vasp_op) + +public: + vasp_qchannels() + { + AddInAnything(); + AddOutInt(); + } + + virtual V m_bang() + { + if(ref.Ok()) { + if(ref.Vectors() > 1) + post("%s - more vectors in vasp, only considering first",thisName()); + + VBuffer *buf = BufLib::Get(ref.Vector(0).Symbol()); + ToOutInt(0,buf->Channels()); + delete buf; + } + else + post("%s - Invalid vasp, no output",thisName()); + } + + virtual V m_help() { post("%s - Get channel index of 0th vector in vasp",thisName()); } +}; + +FLEXT_LIB("vasp, vasp.channels?",vasp_qchannels) + + diff --git a/externals/grill/vasp/source/obj_frames.cpp b/externals/grill/vasp/source/obj_frames.cpp index 3ecd0af1..8438370d 100644 --- a/externals/grill/vasp/source/obj_frames.cpp +++ b/externals/grill/vasp/source/obj_frames.cpp @@ -32,7 +32,7 @@ class vasp_frames: FLEXT_HEADER_S(vasp_frames,vasp_tx,Setup) public: - vasp_frames(I argc,t_atom *argv,BL abs = true): + vasp_frames(I argc,const t_atom *argv,BL abs = true): frms(0),setf(false) { if(argc && CanbeFloat(argv[0])) @@ -101,7 +101,7 @@ class vasp_dframes: FLEXT_HEADER(vasp_dframes,vasp_frames) public: - vasp_dframes(I argc,t_atom *argv): vasp_frames(argc,argv) {} + vasp_dframes(I argc,const t_atom *argv): vasp_frames(argc,argv) {} virtual Vasp *x_work() { @@ -134,7 +134,7 @@ class vasp_mframes: FLEXT_HEADER_S(vasp_mframes,vasp_frames,Setup) public: - vasp_mframes(I argc,t_atom *argv): + vasp_mframes(I argc,const t_atom *argv): vasp_frames(argc,argv,false) { if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0])); @@ -187,7 +187,7 @@ class vasp_rframes: FLEXT_HEADER(vasp_rframes,vasp_mframes) public: - vasp_rframes(I argc,t_atom *argv): vasp_mframes(argc,argv) {} + vasp_rframes(I argc,const t_atom *argv): vasp_mframes(argc,argv) {} virtual Vasp *x_work() { diff --git a/externals/grill/vasp/source/obj_imm.cpp b/externals/grill/vasp/source/obj_imm.cpp index ce11d74c..ba421ff4 100644 --- a/externals/grill/vasp/source/obj_imm.cpp +++ b/externals/grill/vasp/source/obj_imm.cpp @@ -37,7 +37,7 @@ class vasp_imm: FLEXT_HEADER_S(vasp_imm,vasp_op,Setup) public: - vasp_imm(I argc,t_atom *argv): + vasp_imm(I argc,const t_atom *argv): frms(0),zero(true) { if(argc >= 1 && CanbeInt(argv[0])) diff --git a/externals/grill/vasp/source/obj_offs.cpp b/externals/grill/vasp/source/obj_offs.cpp index c2682a30..0eec0fde 100644 --- a/externals/grill/vasp/source/obj_offs.cpp +++ b/externals/grill/vasp/source/obj_offs.cpp @@ -33,7 +33,7 @@ class vasp_offset: FLEXT_HEADER_S(vasp_offset,vasp_tx,Setup) public: - vasp_offset(I argc,t_atom *argv): + vasp_offset(I argc,const t_atom *argv): offs(0),seto(false) { if(argc >= 1 && CanbeFloat(argv[0])) @@ -100,7 +100,7 @@ class vasp_doffset: FLEXT_HEADER(vasp_doffset,vasp_offset) public: - vasp_doffset(I argc,t_atom *argv): vasp_offset(argc,argv) {} + vasp_doffset(I argc,const t_atom *argv): vasp_offset(argc,argv) {} virtual Vasp *x_work() { diff --git a/externals/grill/vasp/source/obj_part.cpp b/externals/grill/vasp/source/obj_part.cpp index 1e41a537..03de8e47 100644 --- a/externals/grill/vasp/source/obj_part.cpp +++ b/externals/grill/vasp/source/obj_part.cpp @@ -34,7 +34,7 @@ class vasp_part: FLEXT_HEADER_S(vasp_part,vasp_op,Setup) public: - vasp_part(I argc,t_atom *argv): + vasp_part(I argc,const t_atom *argv): parts(0),part(NULL) { m_part(argc,argv); diff --git a/externals/grill/vasp/source/obj_peaks.cpp b/externals/grill/vasp/source/obj_peaks.cpp index 3f708ea6..e7d7dd80 100644 --- a/externals/grill/vasp/source/obj_peaks.cpp +++ b/externals/grill/vasp/source/obj_peaks.cpp @@ -34,7 +34,7 @@ class vasp_qpeaks: FLEXT_HEADER_S(vasp_qpeaks,vasp_op,Setup) public: - vasp_qpeaks(I argc,t_atom *argv): + vasp_qpeaks(I argc,const t_atom *argv): peaks(1) { if(argc >= 1 && CanbeInt(argv[0])) diff --git a/externals/grill/vasp/source/obj_radio.cpp b/externals/grill/vasp/source/obj_radio.cpp index 1746db07..72b70daa 100644 --- a/externals/grill/vasp/source/obj_radio.cpp +++ b/externals/grill/vasp/source/obj_radio.cpp @@ -42,7 +42,7 @@ public: FLEXT_CADDMETHOD(c,0,m_any); } - virtual V m_any(const t_symbol *s,I argc,t_atom *argv); + virtual V m_any(const t_symbol *s,I argc,const t_atom *argv); virtual V m_help() { post("%s - split into radio and non-radio messages",thisName()); } private: @@ -52,7 +52,7 @@ private: FLEXT_LIB("vasp, vasp.radio",vasp_radio) -V vasp_radio::m_any(const t_symbol *s,I argc,t_atom *argv) +V vasp_radio::m_any(const t_symbol *s,I argc,const t_atom *argv) { ToOutAnything(s == vasp_base::sym_radio?0:1,s,argc,argv); } diff --git a/externals/grill/vasp/source/obj_size.cpp b/externals/grill/vasp/source/obj_size.cpp index 6c2eba4b..7a31137b 100644 --- a/externals/grill/vasp/source/obj_size.cpp +++ b/externals/grill/vasp/source/obj_size.cpp @@ -33,7 +33,7 @@ class vasp_size: FLEXT_HEADER_S(vasp_size,vasp_tx,Setup) public: - vasp_size(I argc,t_atom *argv,BL abs = true): + vasp_size(I argc,const t_atom *argv,BL abs = true): size(0),sets(false),keep(true),zero(true) { if(argc >= 1 && CanbeFloat(argv[0])) @@ -105,7 +105,7 @@ class vasp_dsize: FLEXT_HEADER(vasp_dsize,vasp_size) public: - vasp_dsize(I argc,t_atom *argv): vasp_size(argc,argv) {} + vasp_dsize(I argc,const t_atom *argv): vasp_size(argc,argv) {} virtual Vasp *x_work() { @@ -138,7 +138,7 @@ class vasp_msize: FLEXT_HEADER_S(vasp_msize,vasp_size,Setup) public: - vasp_msize(I argc,t_atom *argv): + vasp_msize(I argc,const t_atom *argv): vasp_size(argc,argv,false) { if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0])); @@ -191,7 +191,7 @@ class vasp_rsize: FLEXT_HEADER(vasp_rsize,vasp_msize) public: - vasp_rsize(I argc,t_atom *argv): vasp_msize(argc,argv) {} + vasp_rsize(I argc,const t_atom *argv): vasp_msize(argc,argv) {} virtual Vasp *x_work() { diff --git a/externals/grill/vasp/source/obj_split.cpp b/externals/grill/vasp/source/obj_split.cpp index 4535bfb1..db489885 100644 --- a/externals/grill/vasp/source/obj_split.cpp +++ b/externals/grill/vasp/source/obj_split.cpp @@ -32,7 +32,7 @@ class vasp_split: FLEXT_HEADER(vasp_split,vasp_op) public: - vasp_split(I argc,t_atom *argv) + vasp_split(I argc,const t_atom *argv) { I cnt = -1; if(argc) { @@ -98,7 +98,7 @@ class vasp_join: FLEXT_HEADER_S(vasp_join,vasp_tx,Setup) public: - vasp_join(I argc,t_atom *argv): + vasp_join(I argc,const t_atom *argv): cnt(-1),vi(NULL) { if(argc) { @@ -175,7 +175,7 @@ class vasp_spit: FLEXT_HEADER(vasp_spit,vasp_op) public: - vasp_spit(I argc,t_atom *argv) + vasp_spit(I argc,const t_atom *argv) { I n = 1; if(argc >= 1) n = GetAInt(argv[0]); @@ -237,7 +237,7 @@ class vasp_gather: FLEXT_HEADER_S(vasp_gather,vasp_tx,Setup) public: - vasp_gather(I argc,t_atom *argv) + vasp_gather(I argc,const t_atom *argv) { cnt = 0; if(argc >= 1) cnt = GetAInt(argv[0]); @@ -267,9 +267,9 @@ public: V m_reset() { ref.Clear(); cdst.Clear(); rem = cnt; } - virtual I m_set(I argc,t_atom *argv) { rem = cnt; return vasp_tx::m_set(argc,argv); } + virtual I m_set(I argc,const t_atom *argv) { rem = cnt; return vasp_tx::m_set(argc,argv); } - V m_add(I argc,t_atom *argv) + V m_add(I argc,const t_atom *argv) { cdst += Vasp(argc,argv); if(cnt && !--rem) m_bang(); diff --git a/externals/grill/vasp/source/obj_sync.cpp b/externals/grill/vasp/source/obj_sync.cpp index f91131e0..c27ec028 100644 --- a/externals/grill/vasp/source/obj_sync.cpp +++ b/externals/grill/vasp/source/obj_sync.cpp @@ -34,7 +34,7 @@ class vasp_sync: FLEXT_HEADER_S(vasp_sync,vasp_op,Setup) public: - vasp_sync(I argc,t_atom *argv): + vasp_sync(I argc,const t_atom *argv): autoreset(true),vasponly(false) { I cnt = -1; diff --git a/externals/grill/vasp/source/obj_vasp.cpp b/externals/grill/vasp/source/obj_vasp.cpp index 802db581..fdef29bd 100644 --- a/externals/grill/vasp/source/obj_vasp.cpp +++ b/externals/grill/vasp/source/obj_vasp.cpp @@ -36,7 +36,7 @@ class vasp_v: public: - vasp_v(I argc,t_atom *argv) + vasp_v(I argc,const t_atom *argv) { m_set(argc,argv); @@ -53,7 +53,7 @@ public: FLEXT_CADDMETHOD_(c,1,"radio",a_radio); } - V a_radio(I,t_atom *) {} + V a_radio(I,const t_atom *) {} virtual Vasp *x_work() { return new Vasp(ref); } @@ -174,7 +174,7 @@ class vasp_multi: public: - vasp_multi(I argc,t_atom *argv) + vasp_multi(I argc,const t_atom *argv) { I cnt = -1; if(argc) { diff --git a/externals/grill/vasp/source/obj_vecs.cpp b/externals/grill/vasp/source/obj_vecs.cpp index b55103ae..2b567058 100644 --- a/externals/grill/vasp/source/obj_vecs.cpp +++ b/externals/grill/vasp/source/obj_vecs.cpp @@ -33,7 +33,7 @@ class vasp_vector: FLEXT_HEADER_S(vasp_vector,vasp_tx,Setup) public: - vasp_vector(I argc,t_atom *argv): + vasp_vector(I argc,const t_atom *argv): ix(0) { if(argc >= 1 && CanbeInt(argv[0])) diff --git a/externals/grill/vasp/source/opfuns.h b/externals/grill/vasp/source/opfuns.h index 51b1fd06..7abbec6f 100644 --- a/externals/grill/vasp/source/opfuns.h +++ b/externals/grill/vasp/source/opfuns.h @@ -460,7 +460,7 @@ namespace VecOp { #define DEFOP(T,FUN,OP,KIND) \ -namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND(T,f_##OP,p); } } +namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND(T,f_##OP < T > ,p); } } #define DEFVEC_R(T,OP) \ diff --git a/externals/grill/vasp/source/opparam.h b/externals/grill/vasp/source/opparam.h index 473b76c4..1c0193d4 100644 --- a/externals/grill/vasp/source/opparam.h +++ b/externals/grill/vasp/source/opparam.h @@ -83,9 +83,9 @@ public: Arg &SetV(S *r,I rs,S *i = NULL,I is = 0); Arg &SetE(const Env *bp); - typedef struct env_t { const Env *env; }; - typedef struct v_t { S *rdt,*idt; I rs,is; }; - typedef struct x_t { R r,i; }; + struct env_t { const Env *env; }; + struct v_t { S *rdt,*idt; I rs,is; }; + struct x_t { R r,i; }; enum { arg_ = 0,arg_x,arg_v,arg_env } argtp; union { diff --git a/externals/grill/vasp/source/ops_qminmax.cpp b/externals/grill/vasp/source/ops_qminmax.cpp index f834c2c3..2e2bcc30 100644 --- a/externals/grill/vasp/source/ops_qminmax.cpp +++ b/externals/grill/vasp/source/ops_qminmax.cpp @@ -28,33 +28,41 @@ WARRANTIES, see the file, "license.txt," in this distribution. \param inlet set - vasp to be stored \retval outlet float - minimum sample value - \todo Should we provide a cmdln default vasp? - \todo Should we inhibit output for invalid vasps? \remark Returns 0 for a vasp with 0 frames */ class vasp_qmin: - public vasp_unop + public vasp_op { - FLEXT_HEADER(vasp_qmin,vasp_unop) + FLEXT_HEADER(vasp_qmin,vasp_op) public: - vasp_qmin(): vasp_unop(true,XletCode(xlet::tp_float,0)) {} + vasp_qmin() { + AddInAnything(); + AddOutList(); + } - virtual Vasp *do_opt(OpParam &p) + virtual F do_opt(OpParam &p,CVasp &v) { p.norm.minmax = BIG; - CVasp cref(ref); - Vasp *ret = VaspOp::m_qmin(p,cref); - if(p.norm.minmax == BIG) p.norm.minmax = 0; - return ret; + Vasp *ret = VaspOp::m_qmin(p,v); + delete ret; + return p.norm.minmax == BIG?0:p.norm.minmax; } - virtual Vasp *tx_work() + virtual V m_bang() { - OpParam p(thisName(),0); - Vasp *ret = do_opt(p); - ToOutFloat(1,p.norm.minmax); - return ret; + if(!ref.Ok()) return; + + AtomList ret(ref.Vectors()); + OpParam p(thisName(),0); + + for(I i = 0; i < ret.Count(); ++i) { + Vasp vasp(ref.Frames(),ref.Vector(i)); + CVasp ref(vasp); + F v = do_opt(p,ref); + SetFloat(ret[i],v); + } + ToOutList(0,ret); } virtual V m_help() { post("%s - Get a vasp's minimum sample value",thisName()); } @@ -70,7 +78,7 @@ FLEXT_LIB("vasp, vasp.min?",vasp_qmin) \param inlet vasp - is stored and output triggered \param inlet bang - triggers output \param inlet set - vasp to be stored - \retval outlet float - minimum sample value + \retval outlet float - minimum absolute sample value \todo Should we provide a cmdln default vasp? \todo Should we inhibit output for invalid vasps? @@ -81,15 +89,14 @@ class vasp_qamin: { FLEXT_HEADER(vasp_qamin,vasp_qmin) public: - virtual Vasp *do_opt(OpParam &p) + virtual F do_opt(OpParam &p,CVasp &v) { p.norm.minmax = BIG; - CVasp cref(ref); - Vasp *ret = VaspOp::m_qamin(p,cref); - if(p.norm.minmax == BIG) p.norm.minmax = 0; - return ret; + Vasp *ret = VaspOp::m_qmin(p,v); + delete ret; + return p.norm.minmax == BIG?0:p.norm.minmax; } - + virtual V m_help() { post("%s - Get a vasp's minimum absolute sample value",thisName()); } }; @@ -104,7 +111,7 @@ FLEXT_LIB("vasp, vasp.amin?",vasp_qamin) \param inlet vasp - is stored and output triggered \param inlet bang - triggers output \param inlet set - vasp to be stored - \retval outlet float - minimum sample value + \retval outlet float - maximum sample value \todo Should we provide a cmdln default vasp? \todo Should we inhibit output for invalid vasps? @@ -115,13 +122,12 @@ class vasp_qmax: { FLEXT_HEADER(vasp_qmax,vasp_qmin) public: - virtual Vasp *do_opt(OpParam &p) + virtual F do_opt(OpParam &p,CVasp &v) { p.norm.minmax = -BIG; - CVasp cref(ref); - Vasp *ret = VaspOp::m_qmax(p,cref); - if(p.norm.minmax == -BIG) p.norm.minmax = 0; - return ret; + Vasp *ret = VaspOp::m_qmax(p,v); + delete ret; + return p.norm.minmax == -BIG?0:p.norm.minmax; } virtual V m_help() { post("%s - Get a vasp's maximum sample value",thisName()); } @@ -138,7 +144,7 @@ FLEXT_LIB("vasp, vasp.max?",vasp_qmax) \param inlet vasp - is stored and output triggered \param inlet bang - triggers output \param inlet set - vasp to be stored - \retval outlet float - minimum sample value + \retval outlet float - maximum absolute sample value \todo Should we provide a cmdln default vasp? \todo Should we inhibit output for invalid vasps? @@ -149,11 +155,12 @@ class vasp_qamax: { FLEXT_HEADER(vasp_qamax,vasp_qmax) public: - virtual Vasp *do_opt(OpParam &p) + virtual F do_opt(OpParam &p,CVasp &v) { p.norm.minmax = 0; - CVasp cref(ref); - return VaspOp::m_qamax(p,cref); + Vasp *ret = VaspOp::m_qamax(p,v); + delete ret; + return p.norm.minmax; } virtual V m_help() { post("%s - Get a vasp's maximum absolute sample value",thisName()); } @@ -171,35 +178,50 @@ FLEXT_LIB("vasp, vasp.amax?",vasp_qamax) \param inlet vasp - is stored and output triggered \param inlet bang - triggers output \param inlet set - vasp to be stored - \retval outlet float - minimum sample value + \retval outlet list - minimum radius value per complex vector pair \todo Should we provide a cmdln default vasp? \todo Should we inhibit output for invalid vasps? \remark Returns 0 for a vasp with 0 frames */ class vasp_qrmin: - public vasp_unop + public vasp_op { - FLEXT_HEADER(vasp_qrmin,vasp_unop) - + FLEXT_HEADER(vasp_qrmin,vasp_op) public: - vasp_qrmin(): vasp_unop(true,XletCode(xlet::tp_float,0)) {} + vasp_qrmin() { + AddInAnything(); + AddOutList(); + } - virtual Vasp *do_opt(OpParam &p) + virtual F do_opt(OpParam &p,CVasp &v) { p.norm.minmax = BIG; - CVasp cref(ref); - Vasp *ret = VaspOp::m_qrmin(p,cref); - if(p.norm.minmax == BIG) p.norm.minmax = 0; - return ret; + Vasp *ret = VaspOp::m_qrmin(p,v); + delete ret; + return sqrt(p.norm.minmax == BIG?0:p.norm.minmax); } - virtual Vasp *tx_work() + virtual V m_bang() { - OpParam p(thisName(),0); - Vasp *ret = do_opt(p); - ToOutFloat(1,sqrt(p.norm.minmax)); - return ret; + if(!ref.Ok()) return; + + AtomList ret(ref.Vectors()/2); + OpParam p(thisName(),0); + + for(I i = 0; i < ret.Count(); ++i) { + Vasp vasp(ref.Frames(),ref.Vector(i*2)); + vasp.AddVector(ref.Vector(i*2+1)); + CVasp ref(vasp); + F v = do_opt(p,ref); + SetFloat(ret[i],v); + } + + if(ref.Vectors()%2) { + post("%s - omitting dangling vector of complex pairs",thisName()); + } + + ToOutList(0,ret); } virtual V m_help() { post("%s - Get a vasp's minimum complex radius",thisName()); } @@ -216,7 +238,7 @@ FLEXT_LIB("vasp, vasp.rmin?",vasp_qrmin) \param inlet vasp - is stored and output triggered \param inlet bang - triggers output \param inlet set - vasp to be stored - \retval outlet float - minimum sample value + \retval outlet float - maximum radius value per complex vector pair \todo Should we provide a cmdln default vasp? \todo Should we inhibit output for invalid vasps? @@ -227,11 +249,12 @@ class vasp_qrmax: { FLEXT_HEADER(vasp_qrmax,vasp_qrmin) public: - virtual Vasp *do_opt(OpParam &p) + virtual F do_opt(OpParam &p,CVasp &v) { p.norm.minmax = 0; - CVasp cref(ref); - return VaspOp::m_qrmax(p,cref); + Vasp *ret = VaspOp::m_qrmax(p,v); + delete ret; + return sqrt(p.norm.minmax); } virtual V m_help() { post("%s - Get a vasp's maximum complex radius",thisName()); } diff --git a/externals/grill/vasp/vasp.cw b/externals/grill/vasp/vasp.cw index b41468f0..18ee45f9 100644 Binary files a/externals/grill/vasp/vasp.cw and b/externals/grill/vasp/vasp.cw differ diff --git a/externals/grill/xsample/xsample.cw b/externals/grill/xsample/xsample.cw index b0cc0812..efe28b36 100755 Binary files a/externals/grill/xsample/xsample.cw and b/externals/grill/xsample/xsample.cw differ -- cgit v1.2.1