From a5b45e8e2e99686ea73fa2793d7fec84f0d1a3ed Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 17 Dec 2002 04:36:31 +0000 Subject: "" svn path=/trunk/; revision=303 --- externals/grill/flext/flext.cw | Bin 202097 -> 202097 bytes externals/grill/flext/flext.doxy | 15 +- externals/grill/flext/flext.dsp | 2 +- externals/grill/flext/readme.txt | 8 +- externals/grill/flext/source/flclass.h | 41 +---- externals/grill/flext/source/flext.cpp | 2 +- externals/grill/flext/source/flprefix.h | 50 ++++-- externals/grill/flext/source/flsupport.h | 37 +++++ externals/grill/flext/source/flthr.cpp | 180 ++++++++-------------- externals/grill/flext/tutorial/thread1/thread1.cw | Bin 68426 -> 68426 bytes externals/grill/guitest/flgui.cpp | 16 +- externals/grill/guitest/flgui.h | 6 +- externals/grill/guitest/flguiobj.cpp | 64 ++++---- externals/grill/guitest/flguiobj.h | 6 +- externals/grill/guitest/main.cpp | 2 +- externals/grill/py/source/modmeth.cpp | 2 +- externals/grill/vasp/changes.txt | 3 + externals/grill/vasp/pd-ex/freeze1.pd | 164 +++++++++++--------- externals/grill/vasp/source/buflib.cpp | 112 +++++++++----- externals/grill/vasp/source/classes.cpp | 22 +-- externals/grill/vasp/source/classes.h | 13 +- externals/grill/vasp/source/main.cpp | 1 + externals/grill/vasp/source/obj_size.cpp | 10 +- externals/grill/vasp/source/obj_split.cpp | 13 +- externals/grill/vasp/source/obj_vasp.cpp | 6 +- externals/grill/vasp/source/opbase.cpp | 8 +- externals/grill/vasp/source/opbase.h | 16 +- externals/grill/vasp/source/ops_arith.h | 42 ++--- externals/grill/vasp/source/ops_assign.cpp | 10 +- externals/grill/vasp/source/ops_assign.h | 8 +- externals/grill/vasp/source/ops_carith.cpp | 2 +- externals/grill/vasp/source/ops_carith.h | 20 +-- externals/grill/vasp/source/ops_cmp.h | 62 ++++---- externals/grill/vasp/source/ops_cplx.cpp | 2 +- externals/grill/vasp/source/ops_cplx.h | 12 +- externals/grill/vasp/source/ops_dft.cpp | 4 +- externals/grill/vasp/source/ops_dft.h | 8 +- externals/grill/vasp/source/ops_feature.cpp | 28 +++- externals/grill/vasp/source/ops_feature.h | 8 +- externals/grill/vasp/source/ops_flt.cpp | 4 +- externals/grill/vasp/source/ops_flt.h | 10 +- externals/grill/vasp/source/ops_gate.cpp | 4 +- externals/grill/vasp/source/ops_gen.cpp | 10 +- externals/grill/vasp/source/ops_gen.h | 16 +- externals/grill/vasp/source/ops_qminmax.cpp | 12 +- externals/grill/vasp/source/ops_rearr.cpp | 16 +- externals/grill/vasp/source/ops_rearr.h | 12 +- externals/grill/vasp/source/ops_resmp.cpp | 14 +- externals/grill/vasp/source/ops_resmp.h | 4 +- externals/grill/vasp/source/ops_search.cpp | 20 ++- externals/grill/vasp/source/ops_search.h | 6 +- externals/grill/vasp/source/ops_trnsc.cpp | 2 +- externals/grill/vasp/source/ops_trnsc.h | 16 +- externals/grill/vasp/source/ops_wnd.cpp | 2 +- externals/grill/vasp/source/ops_wnd.h | 26 ++-- externals/grill/vasp/source/opvecs.cpp | 8 +- externals/grill/vasp/source/vasp.cpp | 73 ++++++--- externals/grill/vasp/source/vasp.h | 34 ++-- externals/grill/vasp/source/vecblk.cpp | 4 +- externals/grill/vasp/todo.txt | 8 +- 60 files changed, 702 insertions(+), 604 deletions(-) diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw index e6e05add..0cb21636 100644 Binary files a/externals/grill/flext/flext.cw and b/externals/grill/flext/flext.cw differ diff --git a/externals/grill/flext/flext.doxy b/externals/grill/flext/flext.doxy index 553294ee..a1aa48f9 100644 --- a/externals/grill/flext/flext.doxy +++ b/externals/grill/flext/flext.doxy @@ -1,10 +1,10 @@ -# Doxyfile 1.2.17 +# Doxyfile 1.3-rc2 #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- PROJECT_NAME = flext -PROJECT_NUMBER = "version 0.4.0" +PROJECT_NUMBER = "version 0.4.1" OUTPUT_DIRECTORY = f:/prog/max/flext/doc/ OUTPUT_LANGUAGE = English EXTRACT_ALL = NO @@ -14,6 +14,7 @@ EXTRACT_LOCAL_CLASSES = YES HIDE_UNDOC_MEMBERS = YES HIDE_UNDOC_CLASSES = YES HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ALWAYS_DETAILED_SEC = NO @@ -21,7 +22,6 @@ INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = INTERNAL_DOCS = YES -STRIP_CODE_COMMENTS = YES CASE_SENSE_NAMES = YES SHORT_NAMES = NO HIDE_SCOPE_NAMES = NO @@ -51,6 +51,7 @@ SHOW_USED_FILES = YES QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = NO +WARN_IF_DOC_ERROR = YES WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- @@ -73,6 +74,7 @@ FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- SOURCE_BROWSER = YES INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES #--------------------------------------------------------------------------- @@ -142,6 +144,13 @@ XML_DTD = #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES diff --git a/externals/grill/flext/flext.dsp b/externals/grill/flext/flext.dsp index 1de1cb26..d13680e9 100644 --- a/externals/grill/flext/flext.dsp +++ b/externals/grill/flext/flext.dsp @@ -89,7 +89,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "pd-msvc\td" # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GR /ZI /Od /I "c:\programme\audio\pd\src" /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "PD" /D "NT" /D "FLEXT_THREADS" /FR /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\packs\sndobj\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D FLEXT_SYS=2 /D "FLEXT_THREADS" /FR /YX"flext.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\packs\sndobj\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "FLEXT_SYS_PD" /D "FLEXT_THREADS" /FR /YX"flext.h" /FD /GZ /c # ADD BASE RSC /l 0xc07 /d "_DEBUG" # ADD RSC /l 0xc07 /d "_DEBUG" BSC32=bscmake.exe diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index b58df39c..7fbcc8dc 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -111,6 +111,10 @@ Version history: - SndObjs: fixed typo (numbers of output slots was wrong) and init bug - introduced a helper thread for launching flext threads in the background - threads are now handled on class (as opposed to object) level +- threads can now be terminated separately +- put more flext functions into flext static class +- replaced ChangePriority by RefPriority +- fixed setting of priorities... problems were caused by a compiler bug (MSVC 6) 0.4.0: - the use of the const keyword is enforced (e.g. the preferred type for symbols is now "const t_symbol *") @@ -274,12 +278,8 @@ TODO list: general: - documentation - add log messages for debugging version -- where to put flext source/lib in linux: /usr/local/lib,/usr/local/include ? -- clean up headers (eliminate flstdc.h?) -- check that SetupInOut is only called once - feed assist function with in/outlet description - MaxMSP: how to call separate help files for objects in a library? -- MaxMSP for OSX: add support bugs: - PD: problems with timed buffer redrawing (takes a lot of cpu time) diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index 6f74b5fe..66da8e7a 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -392,37 +392,8 @@ public: @{ */ - /*! \brief Check if current thread should terminate - \todo Check for currently running thread - */ - bool ShouldExit() const { return shouldexit; } - - //! Check if current thread is the realtime system's thread - bool IsSystemThread() const { pthread_t cur = pthread_self(); return pthread_equal(cur,thrid) != 0; } - - /*! \brief Yield to other threads - \remark A call to this is only needed for systems with cooperative multitasking like MacOS<=9 - */ - static void ThrYield() { sched_yield(); } - - typedef pthread_t thrid_t; - - /*! \brief Get current thread id - */ - static thrid_t GetThreadId(); - - /*! \brief Increase/Decrease priority of a thread - */ - static bool ChangePriority(int dp,thrid_t thr = GetThreadId()); - - /*! \brief Get priority of a thread - */ - static int GetPriority(thrid_t thr = GetThreadId()); - - /*! \brief Set priority of a thread - */ - static bool SetPriority(int p,thrid_t thr = GetThreadId()); - + //! Check if current thread should terminate + bool ShouldExit() const; #endif // FLEXT_THREADS @@ -467,12 +438,12 @@ protected: class thr_entry { public: - thr_entry(flext_base *t,void *(*m)(thr_params *),thr_params *p,pthread_t id = pthread_self()): th(t),meth(m),params(p),thrid(id),active(false),nxt(NULL) {} + thr_entry(flext_base *t,void *(*m)(thr_params *),thr_params *p,pthread_t id = pthread_self()); //! \brief Check if this class represents the current thread bool Is(pthread_t id = pthread_self()) const { return pthread_equal(thrid,id) != 0; } - bool active; + bool active,shouldexit; pthread_t thrid; void *(*meth)(thr_params *); thr_params *params; @@ -660,10 +631,6 @@ private: static bool cb_SetAttrib(flext_base *c,const t_symbol *s,int argc,const t_atom *argv) { return c->SetAttrib(s,argc,argv); } #ifdef FLEXT_THREADS - bool shouldexit; - int thrcount; - - static pthread_t thrid; // the thread that created the object (the system thread) ThrMutex qmutex; static thr_entry *thrhead,*thrtail; diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp index d0fdb766..764bfa98 100644 --- a/externals/grill/flext/source/flext.cpp +++ b/externals/grill/flext/source/flext.cpp @@ -130,7 +130,7 @@ flext_base::flext_base(): LOG1("%s - flext logging is on",thisName()); #ifdef FLEXT_THREADS - shouldexit = false; +// shouldexit = false; // thrhead = thrtail = NULL; #endif qhead = qtail = NULL; diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h index 34debe69..d2c7f173 100755 --- a/externals/grill/flext/source/flprefix.h +++ b/externals/grill/flext/source/flprefix.h @@ -15,41 +15,61 @@ WARRANTIES, see the file, "license.txt," in this distribution. #ifndef __FLEXT_PREFIX_H #define __FLEXT_PREFIX_H -// definitions for FLEXT_SYS +// --- definitions for FLEXT_SYS --------------------- #define FLEXT_SYS_UNKNOWN 0 -#define FLEXT_SYS_MAX 1 -#define FLEXT_SYS_PD 2 -// definitions for FLEXT_OS +#ifndef FLEXT_SYS_MAX + #define FLEXT_SYS_MAX 1 +#else + // already defined + #undef FLEXT_SYS_MAX + #define FLEXT_SYS_MAX 1 + #define FLEXT_SYS FLEXT_SYS_MAX +#endif + +#ifndef FLEXT_SYS_PD + #define FLEXT_SYS_PD 2 +#else + // already defined + #undef FLEXT_SYS_PD + #define FLEXT_SYS_PD 2 + #define FLEXT_SYS FLEXT_SYS_PD +#endif + +// --- definitions for FLEXT_OS ---------------------- #define FLEXT_OS_UNKNOWN 0 #define FLEXT_OS_WIN 1 #define FLEXT_OS_MACOS 2 #define FLEXT_OS_LINUX 3 #define FLEXT_OS_IRIX 4 -// definitions for FLEXT_CPU +// --- definitions for FLEXT_CPU --------------------- #define FLEXT_CPU_UNKNOWN 0 #define FLEXT_CPU_INTEL 1 #define FLEXT_CPU_PPC 2 #define FLEXT_CPU_MIPS 3 #define FLEXT_CPU_ALPHA 4 - - -// Old definitions -#if defined(MAXMSP) - #define FLEXT_SYS FLEXT_SYS_MAX -// #undef MAXMSP -#elif defined(PD) - #define FLEXT_SYS FLEXT_SYS_PD -// #undef PD -// #undef NT +// --------------------------------------------------- +// support old definitions + +#ifndef FLEXT_SYS + #if defined(MAXMSP) + #define FLEXT_SYS FLEXT_SYS_MAX + // #undef MAXMSP + #elif defined(PD) + #define FLEXT_SYS FLEXT_SYS_PD + // #undef PD + // #undef NT + #endif #endif #if defined(_DEBUG) #define FLEXT_DEBUG #endif +// --------------------------------------------------- + // Definition of supported real-time systems #if FLEXT_SYS == FLEXT_SYS_MAX #elif FLEXT_SYS == FLEXT_SYS_PD diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index 08036ff5..9429599d 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -391,6 +391,43 @@ public: @{ */ + //! thread type + typedef pthread_t thrid_t; + +protected: + //! system's thread id + static thrid_t thrid; // the system thread + +public: + + //! Check if current thread is the realtime system's thread + static bool IsSystemThread() { pthread_t cur = pthread_self(); return pthread_equal(cur,thrid) != 0; } + + /*! \brief Yield to other threads + \remark A call to this is only needed for systems with cooperative multitasking like MacOS<=9 + */ + static void ThrYield() { sched_yield(); } + + /*! \brief Get current thread id + */ + static thrid_t GetThreadId() { return pthread_self(); } + + /*! \brief Get current thread id + */ + static thrid_t GetSysThreadId() { return thrid; } + + /*! \brief Increase/Decrease priority of a thread + */ + static bool RelPriority(int dp,thrid_t ref = GetSysThreadId(),thrid_t thr = GetThreadId()); + + /*! \brief Get priority of a thread + */ + static int GetPriority(thrid_t thr = GetThreadId()); + + /*! \brief Set priority of a thread + */ + static bool SetPriority(int p,thrid_t thr = GetThreadId()); + /*! \brief Thread mutex \sa pthreads documentation */ diff --git a/externals/grill/flext/source/flthr.cpp b/externals/grill/flext/source/flthr.cpp index 97da5584..36184025 100644 --- a/externals/grill/flext/source/flthr.cpp +++ b/externals/grill/flext/source/flthr.cpp @@ -24,10 +24,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include //! Thread id of system thread -pthread_t flext_base::thrid; +flext::thrid_t flext::thrid; //! Thread id of helper thread -pthread_t flext_base::thrhelpid; +flext::thrid_t flext_base::thrhelpid; flext_base::thr_entry *flext_base::thrhead = NULL,*flext_base::thrtail = NULL; flext::ThrMutex flext_base::tlmutex; @@ -35,8 +35,17 @@ flext::ThrMutex flext_base::tlmutex; //! Helper thread should terminate bool thrhelpexit = false; +//! Helper thread conditional flext::ThrCond *thrhelpcond = NULL; + +flext_base::thr_entry::thr_entry(flext_base *t,void *(*m)(thr_params *),thr_params *p,pthread_t id): + th(t),meth(m),params(p),thrid(id), + active(false),shouldexit(false), + nxt(NULL) +{} + + //! Start helper thread bool flext_base::StartHelper() { @@ -75,15 +84,7 @@ void flext_base::ThrHelper(void *) // set thread priority one point below normal // so thread construction won't disturb real-time audio - sched_param parm; - int policy; - pthread_getschedparam(thrhelpid,&policy,&parm); - int prio = parm.sched_priority; - int schmin = sched_get_priority_min(policy); - if(prio > schmin) { - parm.sched_priority = prio-1; - pthread_setschedparam(thrhelpid,policy,&parm); - } + RelPriority(-1); thrhelpcond = new ThrCond; @@ -151,105 +152,19 @@ bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *me return true; } -/* -bool flext_base::StartThread(void *(*meth)(thr_params *p),thr_params *p,char *methname) +bool flext_base::ShouldExit() const { -#ifdef FLEXT_DEBUG - if(!p) { - ERRINTERNAL(); - return false; - } -#endif - - static bool init = false; - static pthread_attr_t attr; - if(!init) { - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED); - init = true; - } + for(thr_entry *ti = thrhead; ti; ti = ti->nxt) + if(ti->Is()) return ti->shouldexit; - // set thread priority one point below normal - // so thread construction won't disturb real-time audio - pthread_t id = pthread_self(); - sched_param parm; - int policy; - pthread_getschedparam(id,&policy,&parm); - int prio = parm.sched_priority; - int schmin = sched_get_priority_min(policy); - if(prio > schmin) { - parm.sched_priority = prio-1; - pthread_setschedparam(id,policy,&parm); - } - - pthread_t thrid; - int ret = pthread_create (&thrid,&attr,(void *(*)(void *))meth,p); - - // set thread priority back to normal - parm.sched_priority = prio; - pthread_setschedparam(id,policy,&parm); - - if(ret) { -#ifdef FLEXT_DEBUG - error((char *)(ret == EAGAIN?"%s - Unsufficient resources to launch thread!":"%s - Could not launch method!"),methname); -#else - error((char *)("%s - Could not launch method!"),methname); -#endif - - delete p; - return false; - } - else - return true; + // thread was not found -> EXIT!!! + return true; } -*/ bool flext_base::PushThread() { - tlmutex.Lock(); - -// post("Push thread"); - -/* - // make an entry into thread list - thr_entry *nt = new thr_entry; - if(thrtail) thrtail->nxt = nt; - else thrhead = nt; - thrtail = nt; -*/ - { -#if FLEXT_OS == FLEXT_OS_WIN - // set detached thread to lower priority class - DWORD err; - HANDLE thr = GetCurrentThread(); - DWORD cl = GetThreadPriority(thr); - if(!cl && (err = GetLastError())) - post("flext - error getting thread priority"); - else { - BOOL ret = SetThreadPriority(thr,cl-2); - if(!ret) { - err = GetLastError(); - if(!err) post("flext - error setting thread priority"); - } - } -#else - // set initial detached thread priority two points below normal - sched_param parm; - int policy; - if(pthread_getschedparam(nt->thrid,&policy,&parm)) - post("flext - can't get thread parameters"); - int prio = parm.sched_priority; - int schmin = sched_get_priority_min(policy); - if(prio > schmin) { - parm.sched_priority = prio-2; - if(pthread_setschedparam(nt->thrid,policy,&parm)) - post("flext - can't set thread parameters"); - } -#endif - } - - tlmutex.Unlock(); - + // set priority of newly created thread one point below the system thread's + RelPriority(-1); return true; } @@ -284,17 +199,33 @@ void flext_base::PopThread() tlmutex.Unlock(); } +//! Terminate all object threads void flext_base::TermThreads() { + thr_entry *t; + + // signal termination + for(t = thrhead; t; t = t->nxt) + if(t->th == this) t->shouldexit = true; + + // TODO: maybe there should be a thread conditional for every thread so that it can be signaled + // wait for thread termination - shouldexit = true; - for(int wi = 0; thrhead && wi < 100; ++wi) Sleep(0.01f); + for(int wi = 0; wi < 100; ++wi) { + int cnt = 0; + for(t = thrhead; t; t = t->nxt) + if(t->th == this) ++cnt; + if(!cnt) break; + Sleep(0.01f); + } + + // --- all object threads have terminated by now ------- qmutex.Lock(); // Lock message queue tlmutex.Lock(); // timeout -> hard termination - for(thr_entry *t = thrhead; t; ) + for(t = thrhead; t; ) if(t->th == this) { if(pthread_cancel(t->thrid)) post("%s - Thread could not be terminated!",thisName()); thr_entry *tn = t->nxt; @@ -307,26 +238,39 @@ void flext_base::TermThreads() qmutex.Unlock(); } -flext_base::thrid_t flext_base::GetThreadId() -{ - return pthread_self(); -} - -bool flext_base::ChangePriority(int dp,thrid_t id) +bool flext::RelPriority(int dp,thrid_t ref,thrid_t id) { sched_param parm; int policy; - if(pthread_getschedparam(id,&policy,&parm) < 0) { + if(pthread_getschedparam(ref,&policy,&parm) < 0) { #ifdef FLEXT_DEBUG - post("flext - failed to get parms"); + post("flext - failed to get thread priority"); #endif return false; } else { parm.sched_priority += dp; + + // MSVC++ 6 produces wrong code with the following lines!!! +// int schmin = sched_get_priority_min(policy); +// int schmax = sched_get_priority_max(policy); + + if(parm.sched_priority < sched_get_priority_min(policy)) { +#ifdef FLEXT_DEBUG + post("flext - minimum thread priority reached"); +#endif + parm.sched_priority = sched_get_priority_min(policy); + } + else if(parm.sched_priority > sched_get_priority_max(policy)) { +#ifdef FLEXT_DEBUG + post("flext - maximum thread priority reached"); +#endif + parm.sched_priority = sched_get_priority_max(policy); + } + if(pthread_setschedparam(id,policy,&parm) < 0) { #ifdef FLEXT_DEBUG - post("flext - failed to change priority"); + post("flext - failed to change thread priority"); #endif return false; } @@ -335,7 +279,7 @@ bool flext_base::ChangePriority(int dp,thrid_t id) } -int flext_base::GetPriority(thrid_t id) +int flext::GetPriority(thrid_t id) { sched_param parm; int policy; @@ -349,7 +293,7 @@ int flext_base::GetPriority(thrid_t id) } -bool flext_base::SetPriority(int p,thrid_t id) +bool flext::SetPriority(int p,thrid_t id) { sched_param parm; int policy; diff --git a/externals/grill/flext/tutorial/thread1/thread1.cw b/externals/grill/flext/tutorial/thread1/thread1.cw index f5cb4b53..3e7cce36 100644 Binary files a/externals/grill/flext/tutorial/thread1/thread1.cw and b/externals/grill/flext/tutorial/thread1/thread1.cw differ diff --git a/externals/grill/guitest/flgui.cpp b/externals/grill/guitest/flgui.cpp index 86d8e4ea..1bad0851 100644 --- a/externals/grill/guitest/flgui.cpp +++ b/externals/grill/guitest/flgui.cpp @@ -7,7 +7,7 @@ #include -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD t_class *flext_gui::px_class = NULL; t_class *flext_gui::pxkey_class = NULL; @@ -31,10 +31,10 @@ struct flext_gui::pxkey_object // no virtual table! flext_gui::flext_gui(int xs,int ys): objs(NULL), -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD xsize(xs),ysize(ys), #endif -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX curx(-1),cury(-1),curmod(-1), created(false), #endif @@ -43,7 +43,7 @@ flext_gui::flext_gui(int xs,int ys): canvas = new Canvas(thisCanvas()); objs = new GuiGroup(canvas); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD AddCanvas(); #else t_box *b = (t_box *)gensym("#B")->s_thing; @@ -58,7 +58,7 @@ flext_gui::flext_gui(int xs,int ys): flext_gui::~flext_gui() { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD RmvCanvas(); #endif @@ -69,7 +69,7 @@ flext_gui::~flext_gui() void flext_gui::setup(t_class *c) { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD SetWidget(c); pxkey_class = class_new(gensym("flext_gui key proxy"),NULL,NULL,sizeof(pxkey_object),CLASS_PD|CLASS_NOINLET, A_NULL); @@ -105,7 +105,7 @@ void flext_gui::setup(t_class *c) #endif } -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD int flext_gui::evmask = evMotion|evMouseDown|evKeyDown|evKeyUp; int flext_gui::curmod = 0; @@ -216,7 +216,7 @@ void flext_gui::pxkey_method(pxkey_object *obj,const t_symbol *s,int argc,t_atom } } } -#ifdef DEBUG +#if 0 //def FLEXT_DEBUG else post("unknown modifier %s",str); #endif diff --git a/externals/grill/guitest/flgui.h b/externals/grill/guitest/flgui.h index d9b302db..211a4935 100644 --- a/externals/grill/guitest/flgui.h +++ b/externals/grill/guitest/flgui.h @@ -4,7 +4,7 @@ #define FLEXT_VIRT #include -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD #pragma warning( disable : 4091 ) #include #endif @@ -72,7 +72,7 @@ protected: virtual bool g_Focus(GuiObj &obj,bool on,int mod) { return false; } */ -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD bool Selected() const { return selected; } void FixLines() { canvas_fixlinesfor( thisCanvas(), thisHdr() ); } @@ -143,7 +143,7 @@ private: virtual void m_Method(const CBParams &p); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD bool selected; int xsize,ysize; diff --git a/externals/grill/guitest/flguiobj.cpp b/externals/grill/guitest/flguiobj.cpp index b845ae5e..5641e9b5 100644 --- a/externals/grill/guitest/flguiobj.cpp +++ b/externals/grill/guitest/flguiobj.cpp @@ -12,26 +12,26 @@ #define ZONE 1000 -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD bool Canvas::store = true; bool Canvas::debug = false; #endif Canvas::Canvas(t_canvas *c): canvas(c) -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD ,buffer(new char[BUFSIZE]),bufix(0),waiting(0) #endif {} Canvas::~Canvas() { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(buffer) delete[] buffer; #endif } -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD void Canvas::Send(const char *t) { if(debug) post("GUI - %s",t); @@ -96,7 +96,7 @@ Canvas &Canvas::Tk(char *fmt,...) bool Canvas::Pre(int x,int y) { xpos = x,ypos = y; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD ++waiting; return true; #else @@ -113,7 +113,7 @@ bool Canvas::Pre(int x,int y) void Canvas::Post() { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(!--waiting) SendBuf(); #else if(svgp) { @@ -210,7 +210,7 @@ GuiSingle *GuiSingle::Find(const t_symbol *s) GuiObj &GuiSingle::MoveTo(int x,int y) { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(active) { canvas->TkC().Tk("coords %s %i %i\n",GetString(Id()), x, y); } @@ -221,7 +221,7 @@ GuiObj &GuiSingle::MoveTo(int x,int y) GuiObj &GuiSingle::MoveRel(int dx,int dy) { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(active) { canvas->TkC().Tk("move %s %i %i\n",GetString(Id()), dx, dy); } @@ -232,7 +232,7 @@ GuiObj &GuiSingle::MoveRel(int dx,int dy) GuiObj &GuiSingle::Delete() { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(active) { canvas->TkC().Tk("delete -tags %s\n",GetString(Id())); active = false; @@ -243,7 +243,7 @@ GuiObj &GuiSingle::Delete() GuiObj &GuiSingle::FillColor(unsigned long col) { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(active) { canvas->TkC().Tk("itemconfigure %s -fill #%06x\n",GetString(Id()),col); } @@ -253,7 +253,7 @@ GuiObj &GuiSingle::FillColor(unsigned long col) GuiObj &GuiSingle::Outline(unsigned long col) { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(active) { canvas->TkC().Tk("itemconfigure %s -outline #%06x\n",GetString(Id()),col); } @@ -263,7 +263,7 @@ GuiObj &GuiSingle::Outline(unsigned long col) GuiObj &GuiSingle::Focus() { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD if(active) { canvas->TkC().Tk("focus %s\n",GetString(Id())); } @@ -337,7 +337,7 @@ void GuiGroup::Clear() { for(Part *ix = head; ix; ) { Part *n = ix->nxt; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD RemoveTag(ix->obj); #endif if(ix->owner) delete ix->obj; @@ -350,7 +350,7 @@ void GuiGroup::Clear() void GuiGroup::Add(GuiObj *o,bool owner) { o->canvas = canvas; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD AddTag(o); // valid only for GuiSingle! #endif Part *n = new Part(o,owner); @@ -380,7 +380,7 @@ GuiSingle *GuiGroup::Detach(const t_symbol *s) if(p) p->nxt = ix->nxt; GuiSingle *ret = (GuiSingle *)(ix->obj); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD RemoveTag(ret); #endif if(head == ix) head = ix->nxt; @@ -398,7 +398,7 @@ GuiSingle *GuiGroup::Detach(const t_symbol *s) GuiObj &GuiGroup::MoveRel(int dx,int dy) { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("move %s %i %i\n",GetString(Id()), dx, dy); #endif for(Part *ix = head; ix; ix = ix->nxt) { @@ -409,7 +409,7 @@ GuiObj &GuiGroup::MoveRel(int dx,int dy) GuiObj &GuiGroup::Delete() { -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("delete -tags %s\n",GetString(Id())); for(Part *ix = head; ix; ix = ix->nxt) ix->obj->Inactive(); @@ -425,7 +425,7 @@ GuiObj &GuiGroup::Draw() } -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD void GuiGroup::AddTag(GuiObj *o) { @@ -542,7 +542,7 @@ GuiObj &GuiPoint::Set(int x,int y,long fl) fill = fl; rect(x,y,x,y); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC(); canvas->Tk("create line %i %i %i %i -tags %s",x,y,x+1,y,GetString(Id())); if(fill >= 0) canvas->Tk(" -fill #%06x",fill); @@ -555,7 +555,7 @@ GuiObj &GuiPoint::Set(int x,int y,long fl) GuiObj &GuiPoint::Draw() { -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX #endif return *this; } @@ -571,7 +571,7 @@ GuiObj &GuiCloud::Set(int n,const Pnt *p,long fl) rect(pnt[0] = p[0],p[0]); for(i = 1; i < n; ++i) rect.Add(pnt[i] = p[i]); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("create line"); for(i = 0; i < n; ++i) canvas->Tk(" %i %i",p[i].X(),p[i].Y()); @@ -586,7 +586,7 @@ GuiObj &GuiCloud::Set(int n,const Pnt *p,long fl) GuiObj &GuiCloud::Draw() { -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX #endif return *this; } @@ -604,7 +604,7 @@ GuiObj &GuiBox::Set(int x,int y,int xsz,int ysz,int wd,long fl,long outl) rect(x,y,x+xsz-1,y+ysz-1); width = wd,fill = fl,outln = outl; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("create rectangle %i %i %i %i -tags %s",x,y,x+xsz,y+ysz,GetString(Id())); if(wd >= 0) canvas->Tk(" -width %i",wd); if(fl >= 0) canvas->Tk(" -fill #%06x",fl); @@ -618,7 +618,7 @@ GuiObj &GuiBox::Set(int x,int y,int xsz,int ysz,int wd,long fl,long outl) GuiObj &GuiBox::Draw() { -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX ::Rect r; ::RGBColor col; int w = width; @@ -653,7 +653,7 @@ GuiObj &GuiRect::Set(int x,int y,int xsz,int ysz,int wd,long outl) rect(x,y,x+xsz-1,y+ysz-1); width = wd,outln = outl; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("create line %i %i %i %i %i %i %i %i %i %i -tags %s",x,y,x+xsz,y,x+xsz,y+ysz,x,y+ysz,x,y,GetString(Id())); if(width >= 0) canvas->Tk(" -width %i",width); if(outl >= 0) canvas->Tk(" -fill #%06x",outl); @@ -666,7 +666,7 @@ GuiObj &GuiRect::Set(int x,int y,int xsz,int ysz,int wd,long outl) GuiObj &GuiRect::Draw() { -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX #endif return *this; } @@ -678,7 +678,7 @@ GuiObj &GuiLine::Set(int x1,int y1,int x2,int y2,int wd,long fl) rect(p1(x1,y1),p2(x2,y2)); width = wd,fill = fl; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("create line %i %i %i %i -tags %s",x1,y1,x2,y2,GetString(Id())); if(width >= 0) canvas->Tk(" -width %i",width); if(fill >= 0) canvas->Tk(" -fill #%06x",fill); @@ -691,7 +691,7 @@ GuiObj &GuiLine::Set(int x1,int y1,int x2,int y2,int wd,long fl) GuiObj &GuiLine::Draw() { -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX ::Point p; ::RGBColor col; int w = width; @@ -724,7 +724,7 @@ GuiObj &GuiPoly::Set(int n,const Pnt *p,int wd,long fl) rect(pnt[0] = p[0],p[0]); for(i = 1; i < n; ++i) rect.Add(pnt[i] = p[i]); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("create line"); for(i = 0; i < n; ++i) canvas->Tk(" %i %i",p[i].X(),p[i].Y()); @@ -740,7 +740,7 @@ GuiObj &GuiPoly::Set(int n,const Pnt *p,int wd,long fl) GuiObj &GuiPoly::Draw() { -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX ::Point p; ::RGBColor col; int ox = Canv().X(),oy = Canv().Y(); @@ -777,7 +777,7 @@ GuiObj &GuiText::Set(int x,int y,const char *txt,long fl,just_t jt) rect(x,y,x,y); fill = fl,just = jt; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD canvas->TkC().Tk("create text %i %i -tags %s",x,y,GetString(Id())); if(txt) canvas->Tk(" -text %s",txt); if(fill >= 0) canvas->Tk(" -fill #%06x",fill); @@ -794,7 +794,7 @@ GuiObj &GuiText::Set(int x,int y,const char *txt,long fl,just_t jt) GuiObj &GuiText::Draw() { -#ifdef MAXMSP +#if FLEXT_SYS == FLEXT_SYS_MAX #endif return *this; } diff --git a/externals/grill/guitest/flguiobj.h b/externals/grill/guitest/flguiobj.h index 807b0f07..b4448bc2 100644 --- a/externals/grill/guitest/flguiobj.h +++ b/externals/grill/guitest/flguiobj.h @@ -12,7 +12,7 @@ public: Canvas(t_canvas *c); ~Canvas(); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD Canvas &Tk(char *fmt,...); Canvas &TkC(); Canvas &TkE(); @@ -31,7 +31,7 @@ protected: t_canvas *canvas; int xpos,ypos; -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD void Send(const char *t); void SendBuf(); @@ -339,7 +339,7 @@ public: GuiSingle *Remove(GuiSingle *obj); protected: -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD void AddTag(GuiObj *o); void RemoveTag(GuiObj *o); #endif diff --git a/externals/grill/guitest/main.cpp b/externals/grill/guitest/main.cpp index 775a206b..cfedfa86 100644 --- a/externals/grill/guitest/main.cpp +++ b/externals/grill/guitest/main.cpp @@ -82,7 +82,7 @@ void guitest::g_Properties() void guitest::g_Save(t_binbuf *b) { post("save"); -#ifdef PD +#if FLEXT_SYS == FLEXT_SYS_PD binbuf_addv(b, "ssiis;", gensym("#X"),gensym("obj"), (t_int)XLo(), (t_int)YLo(),MakeSymbol(thisName()) // here the arguments diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp index 50d4ac81..96108099 100644 --- a/externals/grill/py/source/modmeth.cpp +++ b/externals/grill/py/source/modmeth.cpp @@ -178,7 +178,7 @@ PyObject *py::py_priority(PyObject *self,PyObject *args) post("py/pyext - Syntax: _priority [int]"); } else - ChangePriority(val); + RelPriority(val); Py_INCREF(Py_None); return Py_None; diff --git a/externals/grill/vasp/changes.txt b/externals/grill/vasp/changes.txt index 26d0043d..96d60de4 100644 --- a/externals/grill/vasp/changes.txt +++ b/externals/grill/vasp/changes.txt @@ -14,6 +14,9 @@ Version history: - ADD: vasp.tilt,vasp.xtilt - attributes "fill","inter" - ADD: vasp.offset=,vasp.frames= - attributes "dir","slope" - CHANGE: update m_method_ virtual functions of same objects +- FIX: immediate vasp garbage collection is now done in separate thread +- ADD: vasp.size... objects: attribute "keep" determines whether buffer content should be preserved (default = 1) +- CHANGE: buffer reference checks upon all operations enforced (by new CVasp (checked vasp) class) 0.1.1: - FIX: bug in resize of immediate buffers diff --git a/externals/grill/vasp/pd-ex/freeze1.pd b/externals/grill/vasp/pd-ex/freeze1.pd index d3aba0f8..26aa9d5a 100644 --- a/externals/grill/vasp/pd-ex/freeze1.pd +++ b/externals/grill/vasp/pd-ex/freeze1.pd @@ -1,12 +1,11 @@ -#N canvas 30 168 943 479 12; -#X obj 18 361 vasp.u; -#N canvas 387 42 535 624 freeze 0; +#N canvas 33 61 967 503 12; +#N canvas 387 42 567 656 freeze 0; #X obj 26 130 vasp.split 2; #X obj 27 404 vasp.join 2; #X obj 27 74 vasp.cfft @detach 1; #X obj 27 461 vasp.c!fft @detach 1; #X obj 25 13 inlet; -#X obj 27 567 outlet; +#X obj 27 589 outlet; #X obj 173 236 * 0.01; #X obj 302 17 inlet; #X obj 26 100 vasp.polar @detach 1; @@ -16,7 +15,7 @@ #X obj 26 371 vasp.sync; #X obj 25 209 vasp.max? @detach 1; #X obj 381 17 inlet; -#X obj 162 569 outlet; +#X obj 162 591 outlet; #X obj 29 536 vasp.opt; #N canvas 0 0 456 306 non0 0; #X obj 26 162 outlet; @@ -38,26 +37,27 @@ #X obj 302 45 + 100; #X obj 326 117 expr pow(2. \, -$f1/1200); #X obj 300 76 dbtorms; -#N canvas 445 282 454 304 cplx 0; -#X obj 87 181 vasp.!; +#N canvas 445 282 474 324 cplx 0; #X obj 19 229 vasp.join; #X obj 19 73 t a b a; -#X obj 129 138 vasp.f?; -#X obj 21 14 inlet; +#X obj 149 137 vasp.f?; +#X obj 19 14 inlet; #X obj 19 258 outlet; -#X text 196 136 get length of source; -#X text 143 178 make immediate; -#X text 143 193 initialized to 0; +#X text 216 135 get length of source; +#X text 225 181 make immediate; +#X text 225 196 initialized to 0; #X text 101 230 make complex vasp; -#X obj 19 44 vasp.chk; -#X connect 0 0 1 1; -#X connect 1 0 5 0; -#X connect 2 0 1 0; -#X connect 2 1 0 0; -#X connect 2 2 3 0; -#X connect 3 0 0 1; -#X connect 4 0 10 0; -#X connect 10 0 2 0; +#X obj 87 176 vasp.! @detach 1; +#X obj 19 203 vasp.sync; +#X connect 0 0 4 0; +#X connect 1 0 10 0; +#X connect 1 1 9 0; +#X connect 1 2 2 0; +#X connect 2 0 9 1; +#X connect 3 0 1 0; +#X connect 9 0 10 1; +#X connect 10 0 0 0; +#X connect 10 1 0 1; #X restore 27 43 pd cplx; #X text 280 169 resample; #X text 185 211 find spectral peak; @@ -70,12 +70,15 @@ #X text 198 460 inverse FFT; #X text 263 316 randomize complex arguments; #X text 225 496 get spectral density; -#X text 100 536 normalize result; #X obj 25 171 vasp.xtilt 1 @detach 1 @inter 2; #X obj 27 290 vasp.pow @detach 1; #X obj 441 21 inlet; #X text 181 289 treat spectrum exponentially; -#X connect 0 0 35 0; +#X obj 395 389 loadbang; +#X msg 395 414 detach 1; +#X text 102 536 normalize result; +#X text 388 435 no attributes yet; +#X connect 0 0 34 0; #X connect 0 1 11 0; #X connect 1 0 9 0; #X connect 2 0 8 0; @@ -85,7 +88,7 @@ #X connect 7 0 19 0; #X connect 8 0 0 0; #X connect 9 0 3 0; -#X connect 10 0 36 0; +#X connect 10 0 35 0; #X connect 11 0 27 0; #X connect 12 0 1 0; #X connect 12 0 17 0; @@ -97,13 +100,15 @@ #X connect 17 0 15 0; #X connect 18 0 16 0; #X connect 19 0 21 0; -#X connect 20 0 35 1; +#X connect 20 0 34 1; #X connect 21 0 6 1; #X connect 22 0 2 0; #X connect 27 0 12 1; -#X connect 35 0 13 0; -#X connect 36 0 12 0; -#X connect 37 0 36 1; +#X connect 34 0 13 0; +#X connect 35 0 12 0; +#X connect 36 0 35 1; +#X connect 38 0 39 0; +#X connect 39 0 16 0; #X restore 18 331 pd freeze; #X obj 104 214 nbx 6 18 -100 0 0 1 empty empty noise_rejection(dB) 0 -8 0 12 -225271 -1 -1 -61 256; @@ -165,8 +170,8 @@ #X restore 448 250 pd open; #X msg 381 222 stop; #N canvas 0 0 450 300 graph10 0; -#X array src 1.23699e+006 float 0; -#X coords 0 1 1.23699e+006 -1 600 150 1; +#X array src 1e+006 float 0; +#X coords 0 1 999999 -1 600 150 1; #X restore 322 20 graph; #X msg 447 222 new; #X msg 482 222 again; @@ -181,7 +186,7 @@ #X obj 105 115 nbx 12 18 0 1e+008 0 1 empty empty length(frames) 0 -8 0 12 -225271 -1 -1 1e+006 256; #X obj 85 368 nbx 9 14 -1e+037 1e+037 0 0 empty empty spectral_density -0 -6 0 10 -262131 -1 -1 0.18217 256; +0 -6 0 10 -262131 -1 -1 0.015744 256; #X obj 332 197 cnv 15 100 20 empty empty play_src 5 8 0 10 -261681 -66577 0; #X obj 447 197 cnv 15 100 20 empty empty read_src 5 8 0 10 -261681 @@ -196,7 +201,7 @@ #X msg 614 223 play; #X obj 614 198 cnv 15 100 20 empty empty play_dst 5 8 0 10 -261681 -66577 0; -#N canvas 0 0 495 347 playsrc 0; +#N canvas 0 0 501 353 playsrc 0; #X obj 18 245 dac~; #X obj 19 21 inlet; #X obj 17 49 route play; @@ -211,11 +216,13 @@ #X obj 19 81 t b; #X obj 19 159 lister; #X obj 77 105 loadbang; +#X obj 109 239 outlet; #X connect 1 0 2 0; #X connect 2 0 11 0; #X connect 2 1 3 0; #X connect 3 0 0 0; #X connect 3 0 0 1; +#X connect 3 1 14 0; #X connect 4 0 7 0; #X connect 5 0 8 0; #X connect 6 0 9 0; @@ -230,18 +237,20 @@ #X connect 12 0 3 0; #X connect 13 0 10 0; #X restore 332 250 pd playsrc; -#N canvas 0 0 481 333 playdst 0; +#N canvas 0 0 483 335 playdst 0; #X obj 21 118 dac~; #X obj 19 21 inlet; #X obj 22 51 route play; #X obj 21 83 tabplay~ dst; +#X obj 98 118 outlet; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 2 1 3 0; #X connect 3 0 0 0; #X connect 3 0 0 1; +#X connect 3 1 4 0; #X restore 614 251 pd playdst; -#N canvas 249 202 495 438 copy 0; +#N canvas 249 202 519 462 copy 0; #X obj 27 26 inlet; #X obj 27 51 t b b; #X obj 316 19 inlet; @@ -252,45 +261,43 @@ #X obj 128 31 r \$0-offs; #X obj 211 31 r \$0-len; #X obj 316 87 f 1e+006; -#X obj 187 174 vasp.s @ref dst; #X obj 366 21 loadbang; #X obj 84 169 *; #X obj 117 169 *; #X obj 82 139 vasp.f?; -#X obj 125 366 print; #X obj 27 109 t a a; #X obj 27 259 vasp.sync; #X obj 26 328 vasp.f -1; #X text 167 288 copy src to dst; #X text 108 328 take all dst; -#X text 316 175 resize dst buffer; -#X text 341 201 set to zero; -#X obj 185 202 vasp.= 0 @detach 1; +#X text 311 193 resize dst buffer; +#X text 341 221 set to zero; +#X obj 185 222 vasp.= 0 @detach 1; #X obj 26 287 vasp.-> @detach 1; +#X obj 187 174 vasp.s @ref dst @detach 1; #X connect 0 0 1 0; #X connect 1 0 4 0; -#X connect 1 1 10 0; +#X connect 1 1 23 0; #X connect 2 0 9 0; -#X connect 4 0 16 0; -#X connect 5 0 17 0; +#X connect 4 0 14 0; +#X connect 5 0 15 0; #X connect 6 0 5 0; -#X connect 7 0 12 1; -#X connect 8 0 13 1; -#X connect 9 0 10 1; -#X connect 10 0 23 0; -#X connect 11 0 9 0; -#X connect 12 0 6 1; -#X connect 13 0 5 1; -#X connect 14 0 12 0; -#X connect 14 0 13 0; -#X connect 16 0 6 0; -#X connect 16 1 14 0; -#X connect 17 0 24 0; -#X connect 17 1 24 1; -#X connect 18 0 3 0; -#X connect 18 1 15 0; -#X connect 23 0 17 1; -#X connect 24 1 18 0; +#X connect 7 0 11 1; +#X connect 8 0 12 1; +#X connect 9 0 23 1; +#X connect 10 0 9 0; +#X connect 11 0 6 1; +#X connect 12 0 5 1; +#X connect 13 0 11 0; +#X connect 13 0 12 0; +#X connect 14 0 6 0; +#X connect 14 1 13 0; +#X connect 15 0 22 0; +#X connect 15 1 22 1; +#X connect 16 0 3 0; +#X connect 21 0 15 1; +#X connect 22 1 16 0; +#X connect 23 0 21 0; #X restore 18 159 pd copy; #X text 85 160 copy and resize; #X obj 323 170 hsl 600 15 0 1 0 1 \$0-r2 empty empty -2 -6 1152 8 -262131 @@ -327,21 +334,24 @@ #X obj 104 301 nbx 7 18 0 3 0 1 empty empty power 0 -8 0 12 -225271 -1 -1 1 256; #X text 10 35 (needs zexy!); -#X connect 1 0 0 0; -#X connect 1 1 19 0; -#X connect 2 0 1 1; -#X connect 3 0 1 2; -#X connect 6 0 5 0; -#X connect 7 0 4 0; -#X connect 8 0 27 0; -#X connect 10 0 7 0; -#X connect 11 0 7 0; -#X connect 12 0 6 0; -#X connect 13 0 6 0; -#X connect 14 0 27 0; -#X connect 17 0 29 0; -#X connect 18 0 29 1; -#X connect 24 0 28 0; -#X connect 25 0 28 0; -#X connect 29 0 1 0; -#X connect 36 0 1 3; +#X obj 18 410 vasp.u; +#X text 76 412 update graphics; +#X connect 0 0 37 0; +#X connect 0 1 18 0; +#X connect 1 0 0 1; +#X connect 2 0 0 2; +#X connect 5 0 4 0; +#X connect 6 0 3 0; +#X connect 7 0 26 0; +#X connect 9 0 6 0; +#X connect 10 0 6 0; +#X connect 11 0 5 0; +#X connect 12 0 5 0; +#X connect 13 0 26 0; +#X connect 16 0 28 0; +#X connect 17 0 28 1; +#X connect 23 0 27 0; +#X connect 24 0 27 0; +#X connect 26 0 13 0; +#X connect 28 0 0 0; +#X connect 35 0 0 3; diff --git a/externals/grill/vasp/source/buflib.cpp b/externals/grill/vasp/source/buflib.cpp index 03c2944e..78866a8e 100644 --- a/externals/grill/vasp/source/buflib.cpp +++ b/externals/grill/vasp/source/buflib.cpp @@ -52,7 +52,6 @@ public: static BufEntry *libhead = NULL,*libtail = NULL; static FreeEntry *freehead = NULL,*freetail = NULL; static I libcnt = 0,libtick = 0; -static t_clock *libclk = NULL; #ifdef FLEXT_THREADS static flext::ThrMutex libmtx; @@ -114,6 +113,73 @@ V BufLib::DecRef(t_symbol *s) } } +static V Collect() +{ +#ifdef FLEXT_THREADS + libmtx.Lock(); +#endif + + // collect garbage + BufEntry *e,*p; + for(p = NULL,e = libhead; e; ) { + if(e->refcnt <= 0 && e->tick+LIBTOL < libtick) { + ASSERT(e->refcnt == 0); + + BufEntry *n = e->nxt; + + if(p) p->nxt = n; + else libhead = n; + + if(!n) libtail = p; + else e->nxt = NULL; + + delete e; + + e = n; + } + else + p = e,e = e->nxt; + } + +#ifdef FLEXT_THREADS + libmtx.Unlock(); +#endif +} + + +#ifdef FLEXT_THREADS +static bool libthractive = false; +static pthread_t libthrid; +static bool libthrexit = false; // currently not used +static flext::ThrCond *libthrcond = NULL; + +static V *LibThr(V *) +{ + flext::RelPriority(-2); + + while(libthrexit) { + libthrcond->TimedWait(0.5f); + // TODO - should process return value of TimedWait + Collect(); + } + return NULL; +} +#endif + +static t_clock *libclk = NULL; +static V LibTick(V *) +{ +#ifdef FLEXT_THREADS + libthrcond->Signal(); +#else + Collect(); +#endif + + ++libtick; + clock_delay(libclk,LIBTICK); + +} + static t_symbol *GetLibSym() { if(freehead) { @@ -135,7 +201,7 @@ static t_symbol *GetLibSym() libcnt++; return gensym(tmp); } - + clock_delay(libclk,LIBTICK); } @@ -147,44 +213,20 @@ static V FreeLibSym(t_symbol *sym) freetail = f; } -static V LibTick(V *) + +BufEntry *BufLib::NewImm(I fr,BL zero) { #ifdef FLEXT_THREADS - libmtx.Lock(); -#endif - - // collect garbage - BufEntry *e,*p; - for(p = NULL,e = libhead; e; ) { - if(e->refcnt <= 0 && e->tick+LIBTOL < libtick) { - ASSERT(e->refcnt == 0); - - BufEntry *n = e->nxt; - - if(p) p->nxt = n; - else libhead = n; - - if(!n) libtail = p; - else e->nxt = NULL; - - delete e; - - e = n; + if(!libthractive) { + int ret = pthread_create(&libthrid,NULL,LibThr,NULL); + if(ret) + error("vasp - Could not launch helper thread"); + else { + libthrcond = new flext::ThrCond; + libthractive = true; } - else - p = e,e = e->nxt; } - - ++libtick; - clock_delay(libclk,LIBTICK); - -#ifdef FLEXT_THREADS - libmtx.Unlock(); #endif -} - -BufEntry *BufLib::NewImm(I fr,BL zero) -{ if(!libclk) { libclk = (t_clock *)clock_new(NULL,(t_method)LibTick); clock_delay(libclk,LIBTICK); diff --git a/externals/grill/vasp/source/classes.cpp b/externals/grill/vasp/source/classes.cpp index 582f5959..fa9ff7d4 100644 --- a/externals/grill/vasp/source/classes.cpp +++ b/externals/grill/vasp/source/classes.cpp @@ -94,7 +94,6 @@ vasp_op::vasp_op(BL op) FLEXT_ADDBANG(0,m_dobang); FLEXT_ADDMETHOD_(0,"vasp",m_vasp); FLEXT_ADDMETHOD_(0,"set",m_set); -// if(op) FLEXT_ADDMETHOD_(0,"to",m_to); FLEXT_ADDATTR_VAR("ref",m_getref,m_setref); if(op) FLEXT_ADDATTR_VAR("to",m_getto,m_setto); @@ -170,23 +169,6 @@ V vasp_op::m_update(I argc,const t_atom *argv) } } - -/* -V vasp_op::m_detach(BL thr) -{ -#ifdef FLEXT_THREADS - detach = thr; -#endif -} - -V vasp_op::m_prior(I p) -{ -#ifdef FLEXT_THREADS - prior = p; -#endif -} -*/ - V vasp_op::m_stop() {} /////////////////////////////////////////////////////////////////////////// @@ -201,10 +183,10 @@ V vasp_tx::m_bang() Lock(); #ifdef FLEXT_THREADS -// ChangePriority(prior); +// RelPriority(prior); #endif - if(ref.Ok()) + if(ref.Check()) { Vasp *ret = x_work(); if(ret) { diff --git a/externals/grill/vasp/source/classes.h b/externals/grill/vasp/source/classes.h index d6a31413..64719cd3 100644 --- a/externals/grill/vasp/source/classes.h +++ b/externals/grill/vasp/source/classes.h @@ -256,7 +256,8 @@ protected: \ virtual Vasp *tx_work() \ { \ OpParam p(thisName(),0); \ - return VaspOp::m_##op(p,ref,&dst); \ + CVasp cdst(dst); \ + return VaspOp::m_##op(p,CVasp(ref),&cdst); \ } \ virtual V m_help() { post("%s - " help,thisName()); } \ }; \ @@ -269,12 +270,13 @@ class vasp_ ## op: \ { \ FLEXT_HEADER(vasp_##op,vasp_binop) \ public: \ - vasp_##op(I argc,const t_atom *argv): vasp_binop(argc,argv,def,to) {} \ + vasp_##op(I argc,const t_atom *argv): vasp_binop(argc,argv,def,to) {} \ protected: \ virtual Vasp *tx_work(const Argument &arg) \ { \ OpParam p(thisName(),1); \ - return VaspOp::m_##op(p,ref,arg,&dst); \ + CVasp cdst(dst); \ + return VaspOp::m_##op(p,CVasp(ref),arg,&cdst); \ } \ virtual V m_help() { post("%s - " help,thisName()); } \ }; \ @@ -287,12 +289,13 @@ class vasp_ ## op: \ { \ FLEXT_HEADER(vasp_##op,vasp_anyop) \ public: \ - vasp_##op(I argc,const t_atom *argv): vasp_anyop(argc,argv,def,to) {} \ + vasp_##op(I argc,const t_atom *argv): vasp_anyop(argc,argv,def,to) {} \ protected: \ virtual Vasp *tx_work(const Argument &arg) \ { \ OpParam p(thisName(),args); \ - return VaspOp::m_##op(p,ref,arg,&dst); \ + CVasp cdst(dst); \ + return VaspOp::m_##op(p,CVasp(ref),arg,&cdst); \ } \ virtual V m_help() { post("%s - " help,thisName()); } \ }; \ diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp index 1603d107..b50cded2 100644 --- a/externals/grill/vasp/source/main.cpp +++ b/externals/grill/vasp/source/main.cpp @@ -36,6 +36,7 @@ V lib_setup() VASP_SETUP(check); // vasp.check VASP_SETUP(update); // vasp.update +// VASP_SETUP(post); // vasp.post VASP_SETUP(sync); // vasp.sync diff --git a/externals/grill/vasp/source/obj_size.cpp b/externals/grill/vasp/source/obj_size.cpp index 6c38184c..1d28b1cb 100644 --- a/externals/grill/vasp/source/obj_size.cpp +++ b/externals/grill/vasp/source/obj_size.cpp @@ -34,7 +34,7 @@ class vasp_size: public: vasp_size(I argc,t_atom *argv,BL abs = true): - size(0),sets(false) + size(0),sets(false),keep(true) { if(argc >= 1 && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0])); @@ -47,6 +47,7 @@ public: FLEXT_ADDMETHOD(1,m_arg); if(abs) FLEXT_ADDATTR_VAR("frames",size,m_arg); + FLEXT_ADDATTR_VAR1("keep",keep); } virtual V m_arg(F s) @@ -58,19 +59,20 @@ public: virtual Vasp *x_work() { Vasp *ret = new Vasp(ref); - if(sets) ret->Size(size); + if(sets) ret->Size(size,keep); return ret; } virtual V m_help() { post("%s - Set the size of the vector buffers",thisName()); } protected: I size; - BL sets; + BL sets,keep; private: FLEXT_CALLBACK_F(m_arg); FLEXT_CALLSET_I(m_arg); FLEXT_ATTRGET_I(size); + FLEXT_ATTRVAR_B(keep); }; FLEXT_LIB_V("vasp, vasp.size vasp.s",vasp_size) @@ -227,7 +229,7 @@ public: virtual V m_bang() { - if(!ref.Ok()) + if(!ref.Check()) post("%s - Invalid vasp!",thisName()); else if(ref.Vectors() > 1) post("%s - More than one vector in vasp!",thisName()); diff --git a/externals/grill/vasp/source/obj_split.cpp b/externals/grill/vasp/source/obj_split.cpp index 04eb3eea..e308e19c 100644 --- a/externals/grill/vasp/source/obj_split.cpp +++ b/externals/grill/vasp/source/obj_split.cpp @@ -62,7 +62,7 @@ public: } if(rem > 0) { Vasp v(ref.Frames(),ref.Vector(outs)); - for(I i = 1; i < rem; ++i) v += ref.Vector(outs+i); + for(I i = 1; i < rem; ++i) v.AddVector(ref.Vector(outs+i)); ToOutVasp(outs,v); } else @@ -122,7 +122,7 @@ public: ~vasp_join() { if(vi) delete[] vi; } virtual Vasp *x_work() { - Vasp *ret = new Vasp(ref); + CVasp *ret = new CVasp(ref); for(I i = 0; i < cnt-1; ++i) if(vi[i]) *ret += *vi[i]; return ret; } @@ -255,25 +255,26 @@ public: virtual Vasp *x_work() { - Vasp *ret = new Vasp(ref); - *ret += dst; + CVasp *ret = new CVasp(ref); + *ret += cdst; m_reset(); return ret; } - V m_reset() { ref.Clear(); dst.Clear(); rem = cnt; } + 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); } V m_add(I argc,t_atom *argv) { - dst += Vasp(argc,argv); + cdst += Vasp(argc,argv); if(cnt && !--rem) m_bang(); } virtual V m_help() { post("%s - Gather several vasps into one",thisName()); } private: I cnt,rem; + CVasp cdst; FLEXT_CALLBACK(m_reset) FLEXT_CALLBACK_V(m_add) diff --git a/externals/grill/vasp/source/obj_vasp.cpp b/externals/grill/vasp/source/obj_vasp.cpp index ba91a7c5..680bede7 100644 --- a/externals/grill/vasp/source/obj_vasp.cpp +++ b/externals/grill/vasp/source/obj_vasp.cpp @@ -189,8 +189,10 @@ public: virtual V m_bang() { - Vasp r(ref); - for(I i = CntOut()-1; i >= 0; --i) ToOutVasp(i,r); + if(ref.Check()) + for(I i = CntOut()-1; i >= 0; --i) ToOutVasp(i,ref); + else + post("%s - Invalid vasp",thisName()); } virtual V m_help() { post("%s - Output a vasp multiple times",thisName()); } diff --git a/externals/grill/vasp/source/opbase.cpp b/externals/grill/vasp/source/opbase.cpp index df4150f1..989a4952 100644 --- a/externals/grill/vasp/source/opbase.cpp +++ b/externals/grill/vasp/source/opbase.cpp @@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "opbase.h" #include "opdefs.h" -Vasp *VaspOp::m_run(OpParam &p,Vasp &src,Vasp *dst,VecOp::opfun *fun) +Vasp *VaspOp::m_run(OpParam &p,CVasp &src,CVasp *dst,VecOp::opfun *fun) { Vasp *ret = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,dst); @@ -24,7 +24,7 @@ Vasp *VaspOp::m_run(OpParam &p,Vasp &src,Vasp *dst,VecOp::opfun *fun) return ret; } -Vasp *VaspOp::m_cun(OpParam &p,Vasp &src,Vasp *dst,VecOp::opfun *fun) +Vasp *VaspOp::m_cun(OpParam &p,CVasp &src,CVasp *dst,VecOp::opfun *fun) { Vasp *ret = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,dst); @@ -36,7 +36,7 @@ Vasp *VaspOp::m_cun(OpParam &p,Vasp &src,Vasp *dst,VecOp::opfun *fun) return ret; } -Vasp *VaspOp::m_rbin(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,VecOp::opfun *fun) +Vasp *VaspOp::m_rbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,VecOp::opfun *fun) { Vasp *ret = NULL; BL argvasp = arg.IsVasp(); @@ -58,7 +58,7 @@ Vasp *VaspOp::m_rbin(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,VecOp::o return ret; } -Vasp *VaspOp::m_cbin(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,VecOp::opfun *fun) +Vasp *VaspOp::m_cbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,VecOp::opfun *fun) { Vasp *ret = NULL; BL argvasp = arg.IsVasp(); diff --git a/externals/grill/vasp/source/opbase.h b/externals/grill/vasp/source/opbase.h index a4d1347b..a429b7a6 100644 --- a/externals/grill/vasp/source/opbase.h +++ b/externals/grill/vasp/source/opbase.h @@ -29,10 +29,10 @@ namespace VecOp { namespace VaspOp { - RVecBlock *GetRVecs(const C *op,Vasp &src,Vasp *dst = NULL); - CVecBlock *GetCVecs(const C *op,Vasp &src,Vasp *dst = NULL,BL full = false); - RVecBlock *GetRVecs(const C *op,Vasp &src,const Vasp &arg,Vasp *dst = NULL,I multi = -1,BL ssize = true); - CVecBlock *GetCVecs(const C *op,Vasp &src,const Vasp &arg,Vasp *dst = NULL,I multi = -1,BL ssize = true,BL full = false); + RVecBlock *GetRVecs(const C *op,CVasp &src,CVasp *dst = NULL); + CVecBlock *GetCVecs(const C *op,CVasp &src,CVasp *dst = NULL,BL full = false); + RVecBlock *GetRVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst = NULL,I multi = -1,BL ssize = true); + CVecBlock *GetCVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst = NULL,I multi = -1,BL ssize = true,BL full = false); Vasp *DoOp(RVecBlock *vecs,VecOp::opfun *fun,OpParam &p,BL symm = false); Vasp *DoOp(CVecBlock *vecs,VecOp::opfun *fun,OpParam &p,BL symm = false); @@ -40,11 +40,11 @@ namespace VaspOp { // -------- transformations ----------------------------------- // unary functions - Vasp *m_run(OpParam &p,Vasp &src,Vasp *dst,VecOp::opfun *fun); // real unary (one vec or real) - Vasp *m_cun(OpParam &p,Vasp &src,Vasp *dst,VecOp::opfun *fun); // complex unary (one vec or complex) + Vasp *m_run(OpParam &p,CVasp &src,CVasp *dst,VecOp::opfun *fun); // real unary (one vec or real) + Vasp *m_cun(OpParam &p,CVasp &src,CVasp *dst,VecOp::opfun *fun); // complex unary (one vec or complex) // binary functions - Vasp *m_rbin(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,VecOp::opfun *fun); // real binary (one vec or real) - Vasp *m_cbin(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,VecOp::opfun *fun); // complex binary (one vec or complex) + Vasp *m_rbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,VecOp::opfun *fun); // real binary (one vec or real) + Vasp *m_cbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,VecOp::opfun *fun); // complex binary (one vec or complex) } #endif diff --git a/externals/grill/vasp/source/ops_arith.h b/externals/grill/vasp/source/ops_arith.h index 6e2bb879..d4fcd470 100644 --- a/externals/grill/vasp/source/ops_arith.h +++ b/externals/grill/vasp/source/ops_arith.h @@ -42,31 +42,31 @@ namespace VecOp { } namespace VaspOp { - inline Vasp *m_add(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_add); } // add to (one vec or real) - inline Vasp *m_sub(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_sub); } // sub from (one vec or real) - inline Vasp *m_subr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_subr); } // reverse sub from (one vec or real) - inline Vasp *m_mul(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_mul); } // mul with (one vec or real) - inline Vasp *m_div(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_div); } // div by (one vec or real) - inline Vasp *m_divr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_divr); } // reverse div by (one vec or real) - inline Vasp *m_mod(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_mod); } // modulo by (one vec or real) + inline Vasp *m_add(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_add); } // add to (one vec or real) + inline Vasp *m_sub(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_sub); } // sub from (one vec or real) + inline Vasp *m_subr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_subr); } // reverse sub from (one vec or real) + inline Vasp *m_mul(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_mul); } // mul with (one vec or real) + inline Vasp *m_div(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_div); } // div by (one vec or real) + inline Vasp *m_divr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_divr); } // reverse div by (one vec or real) + inline Vasp *m_mod(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_mod); } // modulo by (one vec or real) - inline Vasp *m_cadd(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cadd); } // complex add (pairs of vecs or complex) - inline Vasp *m_csub(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csub); } // complex sub (pairs of vecs or complex) - inline Vasp *m_csubr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csubr); } // reverse complex sub (pairs of vecs or complex) - inline Vasp *m_cmul(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cmul); } // complex mul (pairs of vecs or complex) - inline Vasp *m_cdiv(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdiv); } // complex div (pairs of vecs or complex) - inline Vasp *m_cdivr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdivr); } // complex reverse div (pairs of vecs or complex) + inline Vasp *m_cadd(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cadd); } // complex add (pairs of vecs or complex) + inline Vasp *m_csub(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csub); } // complex sub (pairs of vecs or complex) + inline Vasp *m_csubr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csubr); } // reverse complex sub (pairs of vecs or complex) + inline Vasp *m_cmul(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cmul); } // complex mul (pairs of vecs or complex) + inline Vasp *m_cdiv(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdiv); } // complex div (pairs of vecs or complex) + inline Vasp *m_cdivr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdivr); } // complex reverse div (pairs of vecs or complex) - inline Vasp *m_sqr(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sqr); } // unsigned square - inline Vasp *m_ssqr(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_ssqr); } // signed square - inline Vasp *m_csqr(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqr); } // complex square (with each two channels) -// inline Vasp *m_csqrt(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqrt); } // complex square root (how about branches?) + inline Vasp *m_sqr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sqr); } // unsigned square + inline Vasp *m_ssqr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_ssqr); } // signed square + inline Vasp *m_csqr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqr); } // complex square (with each two channels) +// inline Vasp *m_csqrt(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqrt); } // complex square root (how about branches?) - Vasp *m_cpowi(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // complex integer power (with each two channels) + Vasp *m_cpowi(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // complex integer power (with each two channels) - inline Vasp *m_sign(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sign); } // sign function - inline Vasp *m_abs(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_abs); } // absolute values - inline Vasp *m_cabs(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cabs); } // absolute values + inline Vasp *m_sign(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sign); } // sign function + inline Vasp *m_abs(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_abs); } // absolute values + inline Vasp *m_cabs(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cabs); } // absolute values } #endif diff --git a/externals/grill/vasp/source/ops_assign.cpp b/externals/grill/vasp/source/ops_assign.cpp index a8033bb9..2495d68a 100644 --- a/externals/grill/vasp/source/ops_assign.cpp +++ b/externals/grill/vasp/source/ops_assign.cpp @@ -32,7 +32,7 @@ VASP_BINARY("vasp.cset vasp.c=",cset,false,VASP_ARG_R(0),"Assigns a complex valu -Vasp *VaspOp::m_copy(OpParam &p,Vasp &src,Vasp &arg) +Vasp *VaspOp::m_copy(OpParam &p,CVasp &src,CVasp &arg) { Vasp *s = NULL,*d = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,&arg); @@ -45,7 +45,7 @@ Vasp *VaspOp::m_copy(OpParam &p,Vasp &src,Vasp &arg) return s; } -Vasp *VaspOp::m_ccopy(OpParam &p,Vasp &src,Vasp &arg) +Vasp *VaspOp::m_ccopy(OpParam &p,CVasp &src,CVasp &arg) { Vasp *s = NULL,*d = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,&arg); @@ -69,14 +69,14 @@ public: virtual V m_to(I,const t_atom *) { post("s - destination vasp is ignored!",thisName()); } - virtual Vasp *do_copy(OpParam &p,Vasp &dst) { return VaspOp::m_copy(p,ref,dst); } + virtual Vasp *do_copy(OpParam &p,CVasp &dst) { return VaspOp::m_copy(p,CVasp(ref),dst); } virtual Vasp *tx_work(const Argument &arg) { OpParam p(thisName(),0); if(arg.CanbeVasp()) { - Vasp dst = arg.GetAVasp(); + CVasp dst(arg.GetAVasp()); Vasp *ret = do_copy(p,dst); ToOutVasp(1,dst); return ret; @@ -100,7 +100,7 @@ public: vasp_ccopy(I argc,const t_atom *argv): vasp_copy(argc,argv) {} - virtual Vasp *do_copy(OpParam &p,Vasp &dst) { return VaspOp::m_ccopy(p,ref,dst); } + virtual Vasp *do_copy(OpParam &p,CVasp &dst) { return VaspOp::m_ccopy(p,CVasp(ref),dst); } virtual V m_help() { post("%s - Copies complex pairs of the triggering vasp to the argument vasp",thisName()); } }; diff --git a/externals/grill/vasp/source/ops_assign.h b/externals/grill/vasp/source/ops_assign.h index e80501f0..e27b3798 100644 --- a/externals/grill/vasp/source/ops_assign.h +++ b/externals/grill/vasp/source/ops_assign.h @@ -24,11 +24,11 @@ namespace VecOp { } namespace VaspOp { - inline Vasp *m_set(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_set); } // copy to (one vec or real) - inline Vasp *m_cset(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cset); } // complex copy (pairs of vecs or complex) + inline Vasp *m_set(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_set); } // copy to (one vec or real) + inline Vasp *m_cset(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cset); } // complex copy (pairs of vecs or complex) - Vasp *m_copy(OpParam &p,Vasp &src,Vasp &dst); - Vasp *m_ccopy(OpParam &p,Vasp &src,Vasp &dst); + Vasp *m_copy(OpParam &p,CVasp &src,CVasp &dst); + Vasp *m_ccopy(OpParam &p,CVasp &src,CVasp &dst); } #endif diff --git a/externals/grill/vasp/source/ops_carith.cpp b/externals/grill/vasp/source/ops_carith.cpp index cf00b439..cece7031 100644 --- a/externals/grill/vasp/source/ops_carith.cpp +++ b/externals/grill/vasp/source/ops_carith.cpp @@ -71,7 +71,7 @@ template V f_cpowi(T &rv,T &iv,T ra,T ia,OpParam &p) BL VecOp::d_cpowi(OpParam &p) { d__cop(f_cpowi,p); } -Vasp *VaspOp::m_cpowi(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) +Vasp *VaspOp::m_cpowi(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { Vasp *ret = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,dst); diff --git a/externals/grill/vasp/source/ops_carith.h b/externals/grill/vasp/source/ops_carith.h index 7f841750..3910c0ad 100644 --- a/externals/grill/vasp/source/ops_carith.h +++ b/externals/grill/vasp/source/ops_carith.h @@ -30,19 +30,19 @@ namespace VecOp { } namespace VaspOp { - inline Vasp *m_cadd(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cadd); } // complex add (pairs of vecs or complex) - inline Vasp *m_csub(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csub); } // complex sub (pairs of vecs or complex) - inline Vasp *m_csubr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csubr); } // reverse complex sub (pairs of vecs or complex) - inline Vasp *m_cmul(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cmul); } // complex mul (pairs of vecs or complex) - inline Vasp *m_cdiv(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdiv); } // complex div (pairs of vecs or complex) - inline Vasp *m_cdivr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdivr); } // complex reverse div (pairs of vecs or complex) + inline Vasp *m_cadd(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cadd); } // complex add (pairs of vecs or complex) + inline Vasp *m_csub(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csub); } // complex sub (pairs of vecs or complex) + inline Vasp *m_csubr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csubr); } // reverse complex sub (pairs of vecs or complex) + inline Vasp *m_cmul(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cmul); } // complex mul (pairs of vecs or complex) + inline Vasp *m_cdiv(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdiv); } // complex div (pairs of vecs or complex) + inline Vasp *m_cdivr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdivr); } // complex reverse div (pairs of vecs or complex) - inline Vasp *m_csqr(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqr); } // complex square (with each two channels) -// inline Vasp *m_csqrt(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqrt); } // complex square root (how about branches?) + inline Vasp *m_csqr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqr); } // complex square (with each two channels) +// inline Vasp *m_csqrt(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqrt); } // complex square root (how about branches?) - Vasp *m_cpowi(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // complex integer power (with each two channels) + Vasp *m_cpowi(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // complex integer power (with each two channels) - inline Vasp *m_cabs(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cabs); } // absolute values + inline Vasp *m_cabs(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cabs); } // absolute values } #endif diff --git a/externals/grill/vasp/source/ops_cmp.h b/externals/grill/vasp/source/ops_cmp.h index 87af3a19..8fab0e27 100644 --- a/externals/grill/vasp/source/ops_cmp.h +++ b/externals/grill/vasp/source/ops_cmp.h @@ -50,37 +50,37 @@ namespace VecOp { } namespace VaspOp { - inline Vasp *m_lwr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_lwr); } // lower than - inline Vasp *m_gtr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_gtr); } // greater than - inline Vasp *m_alwr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_alwr); } // abs lower than - inline Vasp *m_agtr(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_agtr); } // abs greater than - inline Vasp *m_leq(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_leq); } // abs lower than - inline Vasp *m_geq(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_geq); } // abs greater than - inline Vasp *m_aleq(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_aleq); } // lower than - inline Vasp *m_ageq(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_ageq); } // greater than - inline Vasp *m_equ(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_equ); } // lower than - inline Vasp *m_neq(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_neq); } // greater than - - inline Vasp *m_min(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_min); } // min (one vec or real) - inline Vasp *m_max(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_max); } // max (one vec or real) - - inline Vasp *m_rmin(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_rmin); } // complex (radius) min (pairs of vecs or complex) - inline Vasp *m_rmax(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_rmax); } // complex (radius) max (pairs of vecs or complex) - - inline Vasp *m_minmax(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_minmax); } // min/max - - inline Vasp *m_qmin(OpParam &p,Vasp &src) { return m_run(p,src,NULL,VecOp::d_minq); } // get minimum sample value - inline Vasp *m_qmax(OpParam &p,Vasp &src) { return m_run(p,src,NULL,VecOp::d_maxq); } // get maximum sample value - inline Vasp *m_qamin(OpParam &p,Vasp &src) { return m_run(p,src,NULL,VecOp::d_aminq); } // get minimum sample value - inline Vasp *m_qamax(OpParam &p,Vasp &src) { return m_run(p,src,NULL,VecOp::d_amaxq); } // get maximum sample value - - inline Vasp *m_qrmin(OpParam &p,Vasp &src) { return m_cun(p,src,NULL,VecOp::d_rminq); } // get minimum sample value - inline Vasp *m_qrmax(OpParam &p,Vasp &src) { return m_cun(p,src,NULL,VecOp::d_rmaxq); } // get maximum sample value - - Vasp *m_gate(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // gate - Vasp *m_igate(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // inverse gate - Vasp *m_rgate(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // radius gate - Vasp *m_rigate(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // inverse radius gate + inline Vasp *m_lwr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_lwr); } // lower than + inline Vasp *m_gtr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_gtr); } // greater than + inline Vasp *m_alwr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_alwr); } // abs lower than + inline Vasp *m_agtr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_agtr); } // abs greater than + inline Vasp *m_leq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_leq); } // abs lower than + inline Vasp *m_geq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_geq); } // abs greater than + inline Vasp *m_aleq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_aleq); } // lower than + inline Vasp *m_ageq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_ageq); } // greater than + inline Vasp *m_equ(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_equ); } // lower than + inline Vasp *m_neq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_neq); } // greater than + + inline Vasp *m_min(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_min); } // min (one vec or real) + inline Vasp *m_max(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_max); } // max (one vec or real) + + inline Vasp *m_rmin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_rmin); } // complex (radius) min (pairs of vecs or complex) + inline Vasp *m_rmax(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_rmax); } // complex (radius) max (pairs of vecs or complex) + + inline Vasp *m_minmax(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_minmax); } // min/max + + inline Vasp *m_qmin(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_minq); } // get minimum sample value + inline Vasp *m_qmax(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_maxq); } // get maximum sample value + inline Vasp *m_qamin(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_aminq); } // get minimum sample value + inline Vasp *m_qamax(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_amaxq); } // get maximum sample value + + inline Vasp *m_qrmin(OpParam &p,CVasp &src) { return m_cun(p,src,NULL,VecOp::d_rminq); } // get minimum sample value + inline Vasp *m_qrmax(OpParam &p,CVasp &src) { return m_cun(p,src,NULL,VecOp::d_rmaxq); } // get maximum sample value + + Vasp *m_gate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // gate + Vasp *m_igate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // inverse gate + Vasp *m_rgate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // radius gate + Vasp *m_rigate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // inverse radius gate } #endif diff --git a/externals/grill/vasp/source/ops_cplx.cpp b/externals/grill/vasp/source/ops_cplx.cpp index 5311b2db..b2f01788 100644 --- a/externals/grill/vasp/source/ops_cplx.cpp +++ b/externals/grill/vasp/source/ops_cplx.cpp @@ -40,7 +40,7 @@ template V f_radd(T &rv,T &iv,T ra,T ia,T rb,T) BL VecOp::d_radd(OpParam &p) { d__cbin(f_radd,p); } -Vasp *VaspOp::m_radd(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) +Vasp *VaspOp::m_radd(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { Vasp *ret = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,dst); diff --git a/externals/grill/vasp/source/ops_cplx.h b/externals/grill/vasp/source/ops_cplx.h index de1426f2..b3aaa4c6 100644 --- a/externals/grill/vasp/source/ops_cplx.h +++ b/externals/grill/vasp/source/ops_cplx.h @@ -28,15 +28,15 @@ namespace VecOp { } namespace VaspOp { - inline Vasp *m_polar(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_polar); } // cartesian -> polar (each two) - inline Vasp *m_rect(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_rect); } // polar -> cartesian (each two) + inline Vasp *m_polar(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_polar); } // cartesian -> polar (each two) + inline Vasp *m_rect(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_rect); } // polar -> cartesian (each two) - Vasp *m_radd(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // radius offset + Vasp *m_radd(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // radius offset - inline Vasp *m_cnorm(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cnorm); } // complex normalize + inline Vasp *m_cnorm(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cnorm); } // complex normalize -// inline Vasp *m_cswap(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cswap); } // swap real and imaginary parts - inline Vasp *m_cconj(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cconj); } // complex conjugate +// inline Vasp *m_cswap(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cswap); } // swap real and imaginary parts + inline Vasp *m_cconj(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cconj); } // complex conjugate } #endif diff --git a/externals/grill/vasp/source/ops_dft.cpp b/externals/grill/vasp/source/ops_dft.cpp index dec49a26..827c2a03 100644 --- a/externals/grill/vasp/source/ops_dft.cpp +++ b/externals/grill/vasp/source/ops_dft.cpp @@ -584,7 +584,7 @@ static I radix2(I size) return j == size?i:-1; } -Vasp *VaspOp::m_rfft(OpParam &p,Vasp &src,Vasp *dst,BL inv) +Vasp *VaspOp::m_rfft(OpParam &p,CVasp &src,CVasp *dst,BL inv) { RVecBlock *vecs = GetRVecs(p.opname,src,dst); if(vecs) { @@ -614,7 +614,7 @@ Vasp *VaspOp::m_rfft(OpParam &p,Vasp &src,Vasp *dst,BL inv) return NULL; } -Vasp *VaspOp::m_cfft(OpParam &p,Vasp &src,Vasp *dst,BL inv) +Vasp *VaspOp::m_cfft(OpParam &p,CVasp &src,CVasp *dst,BL inv) { CVecBlock *vecs = GetCVecs(p.opname,src,dst,true); if(vecs) { diff --git a/externals/grill/vasp/source/ops_dft.h b/externals/grill/vasp/source/ops_dft.h index f2f3fe40..24b9a23d 100644 --- a/externals/grill/vasp/source/ops_dft.h +++ b/externals/grill/vasp/source/ops_dft.h @@ -16,10 +16,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. // Fourier transforms namespace VaspOp { - Vasp *m_rfft(OpParam &p,Vasp &src,Vasp *dst = NULL,BL inv = false); // real forward - inline Vasp *m_rifft(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_rfft(p,src,dst,true); } // real inverse - Vasp *m_cfft(OpParam &p,Vasp &src,Vasp *dst = NULL,BL inv = false); // complex forward - inline Vasp *m_cifft(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cfft(p,src,dst,true); } // complex inverse + Vasp *m_rfft(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); // real forward + inline Vasp *m_rifft(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_rfft(p,src,dst,true); } // real inverse + Vasp *m_cfft(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); // complex forward + inline Vasp *m_cifft(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cfft(p,src,dst,true); } // complex inverse } #endif diff --git a/externals/grill/vasp/source/ops_feature.cpp b/externals/grill/vasp/source/ops_feature.cpp index ede711e2..3e33f313 100644 --- a/externals/grill/vasp/source/ops_feature.cpp +++ b/externals/grill/vasp/source/ops_feature.cpp @@ -101,7 +101,7 @@ inline BL d_rvalleys(OpParam &p) { return d_vlpk(p,lower); } \param inv true for valley operation \return normalized destination vasp */ -Vasp *VaspOp::m_peaks(OpParam &p,Vasp &src,Vasp *dst,BL inv) +Vasp *VaspOp::m_peaks(OpParam &p,CVasp &src,CVasp *dst,BL inv) { Vasp *ret = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,dst); @@ -123,7 +123,7 @@ Vasp *VaspOp::m_peaks(OpParam &p,Vasp &src,Vasp *dst,BL inv) \param inv true for valley operation \return normalized destination vasp */ -Vasp *VaspOp::m_rpeaks(OpParam &p,Vasp &src,Vasp *dst,BL inv) +Vasp *VaspOp::m_rpeaks(OpParam &p,CVasp &src,CVasp *dst,BL inv) { Vasp *ret = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,dst); @@ -146,7 +146,11 @@ public: vasp_anyop(argc,argv,VASP_ARG(),true,XletCode(xlet::tp_float,0)) {} - virtual Vasp *do_peaks(OpParam &p) { return VaspOp::m_peaks(p,ref,&dst); } + virtual Vasp *do_peaks(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_peaks(p,CVasp(ref),&cdst); + } virtual Vasp *tx_work(const Argument &arg) { @@ -174,7 +178,11 @@ class vasp_valleys: FLEXT_HEADER(vasp_valleys,vasp_peaks) public: vasp_valleys(I argc,const t_atom *argv): vasp_peaks(argc,argv) {} - virtual Vasp *do_peaks(OpParam &p) { return VaspOp::m_valleys(p,ref,&dst); } + virtual Vasp *do_peaks(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_valleys(p,CVasp(ref),&cdst); + } }; FLEXT_LIB_V("vasp, vasp.valleys",vasp_valleys) @@ -185,7 +193,11 @@ class vasp_rpeaks: FLEXT_HEADER(vasp_rpeaks,vasp_peaks) public: vasp_rpeaks(I argc,const t_atom *argv): vasp_peaks(argc,argv) {} - virtual Vasp *do_peaks(OpParam &p) { return VaspOp::m_rpeaks(p,ref,&dst); } + virtual Vasp *do_peaks(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_rpeaks(p,CVasp(ref),&cdst); + } }; FLEXT_LIB_V("vasp, vasp.rpeaks",vasp_rpeaks) @@ -196,7 +208,11 @@ class vasp_rvalleys: FLEXT_HEADER(vasp_rvalleys,vasp_peaks) public: vasp_rvalleys(I argc,const t_atom *argv): vasp_peaks(argc,argv) {} - virtual Vasp *do_peaks(OpParam &p) { return VaspOp::m_rvalleys(p,ref,&dst); } + virtual Vasp *do_peaks(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_rvalleys(p,CVasp(ref),&cdst); + } }; FLEXT_LIB_V("vasp, vasp.rvalleys",vasp_rvalleys) diff --git a/externals/grill/vasp/source/ops_feature.h b/externals/grill/vasp/source/ops_feature.h index 05efc8b5..95293bad 100644 --- a/externals/grill/vasp/source/ops_feature.h +++ b/externals/grill/vasp/source/ops_feature.h @@ -20,10 +20,10 @@ namespace VecOp { namespace VaspOp { // extrema functions - Vasp *m_peaks(OpParam &p,Vasp &src,Vasp *dst = NULL,BL inv = false); //! find peaks - inline Vasp *m_valleys(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_peaks(p,src,dst,true); } //! find valleys - Vasp *m_rpeaks(OpParam &p,Vasp &src,Vasp *dst = NULL,BL inv = false); //! find radius peaks - inline Vasp *m_rvalleys(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_rpeaks(p,src,dst,true); } //! find radius valleys + Vasp *m_peaks(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); //! find peaks + inline Vasp *m_valleys(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_peaks(p,src,dst,true); } //! find valleys + Vasp *m_rpeaks(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); //! find radius peaks + inline Vasp *m_rvalleys(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_rpeaks(p,src,dst,true); } //! find radius valleys } #endif diff --git a/externals/grill/vasp/source/ops_flt.cpp b/externals/grill/vasp/source/ops_flt.cpp index 7784b081..fae66f56 100644 --- a/externals/grill/vasp/source/ops_flt.cpp +++ b/externals/grill/vasp/source/ops_flt.cpp @@ -105,7 +105,7 @@ BL VecOp::d_flp(OpParam &p) -Vasp *VaspOp::m_fhp(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL hp) +Vasp *VaspOp::m_fhp(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL hp) { Vasp *ret = NULL; if(arg.IsList() && arg.GetList().Count() >= 1) { @@ -186,7 +186,7 @@ BL VecOp::d_dif(OpParam &p) \param inv true for differentiation \return normalized destination vasp */ -Vasp *VaspOp::m_int(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL inv) +Vasp *VaspOp::m_int(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL inv) { Vasp *ret = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,dst); diff --git a/externals/grill/vasp/source/ops_flt.h b/externals/grill/vasp/source/ops_flt.h index 0ab37111..21761d90 100644 --- a/externals/grill/vasp/source/ops_flt.h +++ b/externals/grill/vasp/source/ops_flt.h @@ -27,15 +27,15 @@ namespace VecOp { namespace VaspOp { // passive filters - Vasp *m_fhp(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL,BL hp = true); //! hi pass - inline Vasp *m_flp(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_fhp(p,src,arg,dst,false); } //! lo pass + Vasp *m_fhp(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL hp = true); //! hi pass + inline Vasp *m_flp(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_fhp(p,src,arg,dst,false); } //! lo pass // int/dif functions - Vasp *m_int(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL,BL inv = false); //! integrate - inline Vasp *m_dif(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_int(p,src,arg,dst,true); } //! differentiate + Vasp *m_int(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL inv = false); //! integrate + inline Vasp *m_dif(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_int(p,src,arg,dst,true); } //! differentiate // fix denormals/NANs - inline Vasp *m_fix(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_fix); } // ! NAN/denormal filter + inline Vasp *m_fix(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_fix); } // ! NAN/denormal filter } #endif diff --git a/externals/grill/vasp/source/ops_gate.cpp b/externals/grill/vasp/source/ops_gate.cpp index 97faf682..3dd15fbb 100644 --- a/externals/grill/vasp/source/ops_gate.cpp +++ b/externals/grill/vasp/source/ops_gate.cpp @@ -43,7 +43,7 @@ BL VecOp::d_rigate(OpParam &p) { d__cbin(f_rigate,p); } -Vasp *VaspOp::m_gate(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) +Vasp *VaspOp::m_gate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { Vasp *ret = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,dst); @@ -62,7 +62,7 @@ Vasp *VaspOp::m_gate(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) } -Vasp *VaspOp::m_rgate(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) +Vasp *VaspOp::m_rgate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { Vasp *ret = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,dst); diff --git a/externals/grill/vasp/source/ops_gen.cpp b/externals/grill/vasp/source/ops_gen.cpp index f45be684..fb354468 100644 --- a/externals/grill/vasp/source/ops_gen.cpp +++ b/externals/grill/vasp/source/ops_gen.cpp @@ -48,7 +48,7 @@ BL VecOp::d_mosc(OpParam &p) \todo Replace period length by frequency specification */ -Vasp *VaspOp::m_osc(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL mul) +Vasp *VaspOp::m_osc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul) { Vasp *ret = NULL; if(arg.IsList() && arg.GetList().Count() >= 1) { @@ -109,7 +109,7 @@ BL VecOp::d_mcosc(OpParam &p) \todo Replace period length by frequency specification */ -Vasp *VaspOp::m_cosc(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL mul) +Vasp *VaspOp::m_cosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul) { Vasp *ret = NULL; if(arg.IsList() && arg.GetList().Count() >= 1) { @@ -172,7 +172,7 @@ BL VecOp::d_mphasor(OpParam &p) \todo Replace period length by frequency specification */ -Vasp *VaspOp::m_phasor(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL mul) +Vasp *VaspOp::m_phasor(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul) { Vasp *ret = NULL; if(arg.IsList() && arg.GetList().Count() >= 1) { @@ -220,7 +220,7 @@ BL VecOp::d_noise(OpParam &p) \return normalized destination vasp */ -Vasp *VaspOp::m_noise(OpParam &p,Vasp &src,Vasp *dst) +Vasp *VaspOp::m_noise(OpParam &p,CVasp &src,CVasp *dst) { Vasp *ret = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,dst); @@ -250,7 +250,7 @@ BL VecOp::d_cnoise(OpParam &p) \todo Replace period length by frequency specification */ -Vasp *VaspOp::m_cnoise(OpParam &p,Vasp &src,Vasp *dst) +Vasp *VaspOp::m_cnoise(OpParam &p,CVasp &src,CVasp *dst) { Vasp *ret = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,dst); diff --git a/externals/grill/vasp/source/ops_gen.h b/externals/grill/vasp/source/ops_gen.h index 9d1902d5..eff28710 100644 --- a/externals/grill/vasp/source/ops_gen.h +++ b/externals/grill/vasp/source/ops_gen.h @@ -27,14 +27,14 @@ namespace VecOp { } namespace VaspOp { - Vasp *m_osc(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL mul = false); // real osc - inline Vasp *m_mosc(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_osc(p,src,arg,dst,true); } // * real osc - Vasp *m_cosc(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL mul = false); // complex osc (phase rotates) - inline Vasp *m_mcosc(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_cosc(p,src,arg,dst,true); } // * complex osc (phase rotates) - Vasp *m_phasor(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL mul = false); // phasor - inline Vasp *m_mphasor(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_phasor(p,src,arg,dst,true); } // * phasor - Vasp *m_noise(OpParam &p,Vasp &src,Vasp *dst); // real noise - Vasp *m_cnoise(OpParam &p,Vasp &src,Vasp *dst); // complex noise (arg and abs random) + Vasp *m_osc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul = false); // real osc + inline Vasp *m_mosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_osc(p,src,arg,dst,true); } // * real osc + Vasp *m_cosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul = false); // complex osc (phase rotates) + inline Vasp *m_mcosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_cosc(p,src,arg,dst,true); } // * complex osc (phase rotates) + Vasp *m_phasor(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul = false); // phasor + inline Vasp *m_mphasor(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_phasor(p,src,arg,dst,true); } // * phasor + Vasp *m_noise(OpParam &p,CVasp &src,CVasp *dst); // real noise + Vasp *m_cnoise(OpParam &p,CVasp &src,CVasp *dst); // complex noise (arg and abs random) } #endif diff --git a/externals/grill/vasp/source/ops_qminmax.cpp b/externals/grill/vasp/source/ops_qminmax.cpp index adcb15d2..debbfbd2 100644 --- a/externals/grill/vasp/source/ops_qminmax.cpp +++ b/externals/grill/vasp/source/ops_qminmax.cpp @@ -84,7 +84,7 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = BIG; - Vasp *ret = VaspOp::m_qmin(p,ref); + Vasp *ret = VaspOp::m_qmin(p,CVasp(ref)); if(p.norm.minmax == BIG) p.norm.minmax = 0; return ret; } @@ -124,7 +124,7 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = BIG; - Vasp *ret = VaspOp::m_qamin(p,ref); + Vasp *ret = VaspOp::m_qamin(p,CVasp(ref)); if(p.norm.minmax == BIG) p.norm.minmax = 0; return ret; } @@ -157,7 +157,7 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = -BIG; - Vasp *ret = VaspOp::m_qmax(p,ref); + Vasp *ret = VaspOp::m_qmax(p,CVasp(ref)); if(p.norm.minmax == -BIG) p.norm.minmax = 0; return ret; } @@ -190,7 +190,7 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = 0; - return VaspOp::m_qamax(p,ref); + return VaspOp::m_qamax(p,CVasp(ref)); } virtual V m_help() { post("%s - Get a vasp's maximum absolute sample value",thisName()); } @@ -225,7 +225,7 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = BIG; - Vasp *ret = VaspOp::m_qrmin(p,ref); + Vasp *ret = VaspOp::m_qrmin(p,CVasp(ref)); if(p.norm.minmax == BIG) p.norm.minmax = 0; return ret; } @@ -266,7 +266,7 @@ public: virtual Vasp *do_opt(OpParam &p) { p.norm.minmax = 0; - return VaspOp::m_qrmax(p,ref); + return VaspOp::m_qrmax(p,CVasp(ref)); } virtual V m_help() { post("%s - Get a vasp's maximum complex radius",thisName()); } diff --git a/externals/grill/vasp/source/ops_rearr.cpp b/externals/grill/vasp/source/ops_rearr.cpp index bee58c56..80093c17 100644 --- a/externals/grill/vasp/source/ops_rearr.cpp +++ b/externals/grill/vasp/source/ops_rearr.cpp @@ -16,7 +16,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. /*! \brief vasp shift or rotation \todo units for shift */ -Vasp *VaspOp::m_shift(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL shift,BL symm) +Vasp *VaspOp::m_shift(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL shift,BL symm) { Vasp *ret = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,dst); @@ -114,7 +114,11 @@ public: xsf_none = 0,xsf_zero,xsf_edge }; - virtual Vasp *do_shift(OpParam &p) { return VaspOp::m_shift(p,ref,arg,&dst); } + virtual Vasp *do_shift(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_shift(p,CVasp(ref),arg,&cdst); + } virtual Vasp *tx_work(const Argument &arg) { @@ -144,7 +148,11 @@ public: vasp_xshift(I argc,const t_atom *argv): vasp_shift(argc,argv) {} - virtual Vasp *do_shift(OpParam &p) { return VaspOp::m_xshift(p,ref,arg,&dst); } + virtual Vasp *do_shift(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_xshift(p,CVasp(ref),arg,&cdst); + } virtual V m_help() { post("%s - Shifts buffer data symmetrically (in two halves)",thisName()); } }; @@ -225,7 +233,7 @@ BL VecOp::d_mirr(OpParam &p) /*! \brief vasp mirror */ -Vasp *VaspOp::m_mirr(OpParam &p,Vasp &src,Vasp *dst,BL symm) +Vasp *VaspOp::m_mirr(OpParam &p,CVasp &src,CVasp *dst,BL symm) { Vasp *ret = NULL; RVecBlock *vecs = GetRVecs(p.opname,src,dst); diff --git a/externals/grill/vasp/source/ops_rearr.h b/externals/grill/vasp/source/ops_rearr.h index d1c6ce73..aa412937 100644 --- a/externals/grill/vasp/source/ops_rearr.h +++ b/externals/grill/vasp/source/ops_rearr.h @@ -22,12 +22,12 @@ namespace VecOp { } namespace VaspOp { - Vasp *m_shift(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL,BL sh = true,BL symm = false); // shift buffer - inline Vasp *m_xshift(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_shift(p,src,arg,dst,true,true); } // shift buffer (symmetrically) - inline Vasp *m_rot(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_shift(p,src,arg,dst,false,false); } // rotate buffer - inline Vasp *m_xrot(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_shift(p,src,arg,dst,false,true); } // rotate buffer (symmetrically) - Vasp *m_mirr(OpParam &p,Vasp &src,Vasp *dst = NULL,BL symm = false); //! mirror buffer - inline Vasp *m_xmirr(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_mirr(p,src,dst,true); } //! mirror buffer (symmetrically) + Vasp *m_shift(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL sh = true,BL symm = false); // shift buffer + inline Vasp *m_xshift(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_shift(p,src,arg,dst,true,true); } // shift buffer (symmetrically) + inline Vasp *m_rot(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_shift(p,src,arg,dst,false,false); } // rotate buffer + inline Vasp *m_xrot(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_shift(p,src,arg,dst,false,true); } // rotate buffer (symmetrically) + Vasp *m_mirr(OpParam &p,CVasp &src,CVasp *dst = NULL,BL symm = false); //! mirror buffer + inline Vasp *m_xmirr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_mirr(p,src,dst,true); } //! mirror buffer (symmetrically) } diff --git a/externals/grill/vasp/source/ops_resmp.cpp b/externals/grill/vasp/source/ops_resmp.cpp index cb51dbac..16780df8 100644 --- a/externals/grill/vasp/source/ops_resmp.cpp +++ b/externals/grill/vasp/source/ops_resmp.cpp @@ -176,7 +176,7 @@ BL VecOp::d_tilt(OpParam &p) \param mode interpolation mode \return normalized destination vasp */ -Vasp *VaspOp::m_tilt(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL symm) +Vasp *VaspOp::m_tilt(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL symm) { Vasp *ret = NULL; if(arg.IsList() && arg.GetList().Count() >= 1) { @@ -222,7 +222,11 @@ public: xti_inpl = 0,xti_none,xti_lin,xti_4p }; - virtual Vasp *do_shift(OpParam &p) { return VaspOp::m_tilt(p,ref,arg,&dst); } + virtual Vasp *do_shift(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_tilt(p,CVasp(ref),arg,&cdst); + } virtual Vasp *tx_work(const Argument &arg) { @@ -255,7 +259,11 @@ public: vasp_xtilt(I argc,t_atom *argv): vasp_tilt(argc,argv) {} - virtual Vasp *do_shift(OpParam &p) { return VaspOp::m_xtilt(p,ref,arg,&dst); } + virtual Vasp *do_shift(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_xtilt(p,CVasp(ref),arg,&cdst); + } virtual V m_help() { post("%s - Resamples buffer data symmetrically (in two halves)",thisName()); } }; diff --git a/externals/grill/vasp/source/ops_resmp.h b/externals/grill/vasp/source/ops_resmp.h index 9c4a8bde..e164ee0b 100644 --- a/externals/grill/vasp/source/ops_resmp.h +++ b/externals/grill/vasp/source/ops_resmp.h @@ -20,9 +20,9 @@ namespace VecOp { } namespace VaspOp { - Vasp *m_tilt(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL,BL symm = false); + Vasp *m_tilt(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL symm = false); // Symmetric resampling (around center sample) - inline Vasp *m_xtilt(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_tilt(p,src,arg,dst,true); } + inline Vasp *m_xtilt(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_tilt(p,src,arg,dst,true); } } #endif diff --git a/externals/grill/vasp/source/ops_search.cpp b/externals/grill/vasp/source/ops_search.cpp index 4202a77c..f514d6f3 100644 --- a/externals/grill/vasp/source/ops_search.cpp +++ b/externals/grill/vasp/source/ops_search.cpp @@ -70,17 +70,17 @@ BL VecOp::d_search(OpParam &p) return true; } -Vasp *VaspOp::m_search(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL st) +Vasp *VaspOp::m_search(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL st) { Vasp *ret = NULL; if(src.Vectors() > 1) post("%s - More than one vector in vasp!",p.opName()); else if(arg.CanbeFloat() || (arg.IsList() && arg.GetList().Count() >= 1)) { - I fr = src.ChkFrames(); + I fr = src.Frames(); I o = src.Vector(0).Offset(); I sz = src.Buffer(0)->Frames(); - Vasp all(src); + CVasp all(src); if(st) { // search start point p.srch.offs = o; @@ -112,7 +112,7 @@ Vasp *VaspOp::m_search(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL st) if(ret) { ret->Offset(o); ret->Frames(fr); - ret->Frames(ret->ChkFrames()); + ret->Frames(ret->ChkFrames()); // What's that???? } delete vecs; @@ -167,7 +167,11 @@ class vasp_soffset: FLEXT_HEADER(vasp_soffset,vasp_search) public: vasp_soffset(I argc,t_atom *argv): vasp_search(argc,argv) {} - virtual Vasp *do_work(OpParam &p) { return VaspOp::m_soffset(p,ref,arg,&dst); } + virtual Vasp *do_work(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_soffset(p,CVasp(ref),arg,&cdst); + } }; FLEXT_LIB_V("vasp, vasp.offset= vasp.o=",vasp_soffset) @@ -178,7 +182,11 @@ class vasp_sframes: FLEXT_HEADER(vasp_sframes,vasp_search) public: vasp_sframes(I argc,t_atom *argv): vasp_search(argc,argv) {} - virtual Vasp *do_work(OpParam &p) { return VaspOp::m_sframes(p,ref,arg,&dst); } + virtual Vasp *do_work(OpParam &p) + { + CVasp cdst(dst); + return VaspOp::m_sframes(p,CVasp(ref),arg,&cdst); + } }; FLEXT_LIB_V("vasp, vasp.frames= vasp.f=",vasp_sframes) diff --git a/externals/grill/vasp/source/ops_search.h b/externals/grill/vasp/source/ops_search.h index e7a04e5c..ef199f71 100644 --- a/externals/grill/vasp/source/ops_search.h +++ b/externals/grill/vasp/source/ops_search.h @@ -21,9 +21,9 @@ namespace VecOp { namespace VaspOp { // search functions - Vasp *m_search(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL st); //! find values - inline Vasp *m_soffset(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_search(p,src,arg,dst,true); } - inline Vasp *m_sframes(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_search(p,src,arg,dst,false); } + Vasp *m_search(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL st); //! find values + inline Vasp *m_soffset(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_search(p,src,arg,dst,true); } + inline Vasp *m_sframes(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_search(p,src,arg,dst,false); } } #endif diff --git a/externals/grill/vasp/source/ops_trnsc.cpp b/externals/grill/vasp/source/ops_trnsc.cpp index ac4cea1f..88089fbb 100644 --- a/externals/grill/vasp/source/ops_trnsc.cpp +++ b/externals/grill/vasp/source/ops_trnsc.cpp @@ -33,7 +33,7 @@ template V f_crpow(T &rv,T &iv,T ra,T ia,T rb,T) BL VecOp::d_rpow(OpParam &p) { d__cbin(f_crpow,p); } -Vasp *VaspOp::m_rpow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) +Vasp *VaspOp::m_rpow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { Vasp *ret = NULL; CVecBlock *vecs = GetCVecs(p.opname,src,dst); diff --git a/externals/grill/vasp/source/ops_trnsc.h b/externals/grill/vasp/source/ops_trnsc.h index 81009298..ee919ea9 100644 --- a/externals/grill/vasp/source/ops_trnsc.h +++ b/externals/grill/vasp/source/ops_trnsc.h @@ -29,18 +29,18 @@ namespace VecOp { } namespace VaspOp { - inline Vasp *m_pow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_pow); } // power + inline Vasp *m_pow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_pow); } // power - Vasp *m_rpow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst = NULL); // radius power (with each two channels) + Vasp *m_rpow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // radius power (with each two channels) - inline Vasp *m_sqrt(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sqrt); } // square root (from abs value) - inline Vasp *m_ssqrt(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_ssqrt); } // square root (from abs value) + inline Vasp *m_sqrt(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sqrt); } // square root (from abs value) + inline Vasp *m_ssqrt(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_ssqrt); } // square root (from abs value) - inline Vasp *m_exp(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_exp); } // exponential function - inline Vasp *m_log(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_log); } // natural logarithm + inline Vasp *m_exp(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_exp); } // exponential function + inline Vasp *m_log(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_log); } // natural logarithm -// inline Vasp *m_cexp(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cexp); } // complex exponential function -// inline Vasp *m_clog(OpParam &p,Vasp &src,Vasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_clog); } // complex logarithm (how about branches?) +// inline Vasp *m_cexp(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cexp); } // complex exponential function +// inline Vasp *m_clog(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_clog); } // complex logarithm (how about branches?) } diff --git a/externals/grill/vasp/source/ops_wnd.cpp b/externals/grill/vasp/source/ops_wnd.cpp index daee3a9e..278e7bf1 100644 --- a/externals/grill/vasp/source/ops_wnd.cpp +++ b/externals/grill/vasp/source/ops_wnd.cpp @@ -141,7 +141,7 @@ BL VecOp::d_window(OpParam &p) return true; } -Vasp *VaspOp::m_window(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL inv,BL mul,BL symm) +Vasp *VaspOp::m_window(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL inv,BL mul,BL symm) { static const int wndnum = 8; static const char *wndtps[wndnum] = {"lin","sin","hanning","hamming","blackman","connes","welch","lanczos" /*,"gaussian","kaiser"*/}; diff --git a/externals/grill/vasp/source/ops_wnd.h b/externals/grill/vasp/source/ops_wnd.h index 21bafb59..9103d978 100644 --- a/externals/grill/vasp/source/ops_wnd.h +++ b/externals/grill/vasp/source/ops_wnd.h @@ -16,24 +16,26 @@ WARRANTIES, see the file, "license.txt," in this distribution. // Window functions namespace VecOp { +/* BL d_bevel(OpParam &p); BL d_mbevel(OpParam &p); - +*/ BL d_window(OpParam &p); } namespace VaspOp { - Vasp *m_bevelup(OpParam &p,Vasp &src,Vasp *dst,BL up = true,BL mul = false); // bevel up - inline Vasp *m_mbevelup(OpParam &p,Vasp &src,Vasp *dst) { return m_bevelup(p,src,dst,true,true); } // * bevel up (fade in) - inline Vasp *m_beveldn(OpParam &p,Vasp &src,Vasp *dst) { return m_bevelup(p,src,dst,false,false); } // bevel down - inline Vasp *m_mbeveldn(OpParam &p,Vasp &src,Vasp *dst) { return m_bevelup(p,src,dst,false,true); } // * bevel down (fade out) - - Vasp *m_window(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst,BL inv = false,BL mul = false,BL symm = false); // window curve - inline Vasp *m_mwindow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_window(p,src,arg,dst,false,true,false); } // * window curve - inline Vasp *m_iwindow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_window(p,src,arg,dst,true,false,false); } // inverse window curve - inline Vasp *m_miwindow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_window(p,src,arg,dst,true,true,false); } // * inverse window curve - inline Vasp *m_xwindow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_window(p,src,arg,dst,false,false,true); } // symmetrical window curve - inline Vasp *m_mxwindow(OpParam &p,Vasp &src,const Argument &arg,Vasp *dst) { return m_window(p,src,arg,dst,false,true,true); } // * symmetrical window curve +/* + Vasp *m_bevelup(OpParam &p,CVasp &src,CVasp *dst,BL up = true,BL mul = false); // bevel up + inline Vasp *m_mbevelup(OpParam &p,CVasp &src,CVasp *dst) { return m_bevelup(p,src,dst,true,true); } // * bevel up (fade in) + inline Vasp *m_beveldn(OpParam &p,CVasp &src,CVasp *dst) { return m_bevelup(p,src,dst,false,false); } // bevel down + inline Vasp *m_mbeveldn(OpParam &p,CVasp &src,CVasp *dst) { return m_bevelup(p,src,dst,false,true); } // * bevel down (fade out) +*/ + Vasp *m_window(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL inv = false,BL mul = false,BL symm = false); // window curve + inline Vasp *m_mwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,false,true,false); } // * window curve + inline Vasp *m_iwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,true,false,false); } // inverse window curve + inline Vasp *m_miwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,true,true,false); } // * inverse window curve + inline Vasp *m_xwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,false,false,true); } // symmetrical window curve + inline Vasp *m_mxwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,false,true,true); } // * symmetrical window curve } #endif diff --git a/externals/grill/vasp/source/opvecs.cpp b/externals/grill/vasp/source/opvecs.cpp index 1a226eb3..e29f39bc 100644 --- a/externals/grill/vasp/source/opvecs.cpp +++ b/externals/grill/vasp/source/opvecs.cpp @@ -65,7 +65,7 @@ inline BL corrlen(I &frms,VBuffer &b) \remark working size is maximum common vector size */ -RVecBlock *VaspOp::GetRVecs(const C *op,Vasp &src,Vasp *dst) +RVecBlock *VaspOp::GetRVecs(const C *op,CVasp &src,CVasp *dst) { I nvecs = src.Vectors(); if(dst && dst->Ok() && dst->Vectors() != nvecs) { @@ -116,7 +116,7 @@ RVecBlock *VaspOp::GetRVecs(const C *op,Vasp &src,Vasp *dst) \param full true if imaginary part is compulsory \return struct with vector data */ -CVecBlock *VaspOp::GetCVecs(const C *op,Vasp &src,Vasp *dst,BL full) +CVecBlock *VaspOp::GetCVecs(const C *op,CVasp &src,CVasp *dst,BL full) { I nvecs = src.Vectors(); if(dst && dst->Ok() && dst->Vectors() != nvecs) { @@ -193,7 +193,7 @@ CVecBlock *VaspOp::GetCVecs(const C *op,Vasp &src,Vasp *dst,BL full) \param multi 0 off/1 on/-1 auto... controls whether argument vector is single- or multi-vectored \return struct with vector data */ -RVecBlock *VaspOp::GetRVecs(const C *op,Vasp &src,const Vasp &arg,Vasp *dst,I multi,BL ssize) +RVecBlock *VaspOp::GetRVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst,I multi,BL ssize) { if(!arg.Ok()) { post("%s - invalid argument vasp detected and ignored",op); @@ -285,7 +285,7 @@ RVecBlock *VaspOp::GetRVecs(const C *op,Vasp &src,const Vasp &arg,Vasp *dst,I mu \param full true if imaginary part is compulsory \return struct with vector data */ -CVecBlock *VaspOp::GetCVecs(const C *op,Vasp &src,const Vasp &arg,Vasp *dst,I multi,BL ssize,BL full) +CVecBlock *VaspOp::GetCVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst,I multi,BL ssize,BL full) { if(!arg.Ok()) { post("%s - invalid argument vasp detected and ignored",op); diff --git a/externals/grill/vasp/source/vasp.cpp b/externals/grill/vasp/source/vasp.cpp index efb3b7a6..66bffccb 100644 --- a/externals/grill/vasp/source/vasp.cpp +++ b/externals/grill/vasp/source/vasp.cpp @@ -54,13 +54,20 @@ Vasp::Vasp(I fr,const Ref &r): refs(0),chns(0),ref(NULL), frames(fr) { - operator +=(r); + AddVector(r); } Vasp::~Vasp() { + Clear(); +} + +Vasp &Vasp::Clear() +{ + refs = frames = chns = 0; if(ref) delete[] ref; + return *this; } @@ -131,7 +138,7 @@ Vasp &Vasp::operator =(const Vasp &v) } -Vasp &Vasp::operator +=(const Ref &r) +Vasp &Vasp::AddVector(const Ref &r) { Resize(chns+1); ref[chns++] = r; @@ -139,23 +146,6 @@ Vasp &Vasp::operator +=(const Ref &r) } -Vasp &Vasp::operator +=(const Vasp &v) -{ - if(v.Ok()) { - if(!Ok()) *this = v; - else { - if(Frames() != v.Frames()) { - post("vasp - Frame count of joined vasps is different - taking the minimum"); - Frames(min(Frames(),v.Frames())); - } - - Resize(Vectors()+v.Vectors()); - for(I i = 0; i < v.Vectors(); ++i) *this += v.Vector(i); - } - } - return *this; -} - // parse argument list Vasp &Vasp::operator ()(I argc,const t_atom *argv) { @@ -291,37 +281,37 @@ V Vasp::Channel(I c) } -V Vasp::Size(I s) +V Vasp::Size(I s,BL keep) { for(I i = 0; i < Vectors(); ++i) { VBuffer *buf = Buffer(i); if(buf) { - buf->Frames(s,true); + buf->Frames(s,keep); delete buf; } } } -V Vasp::SizeD(I sd) +V Vasp::SizeD(I sd,BL keep) { for(I i = 0; i < Vectors(); ++i) { VBuffer *buf = Buffer(i); if(buf) { I s = buf->Frames()+sd; - buf->Frames(s >= 0?s:0,true); + buf->Frames(s >= 0?s:0,keep); delete buf; } } } -V Vasp::SizeM(R f) +V Vasp::SizeM(R f,BL keep) { for(I i = 0; i < Vectors(); ++i) { VBuffer *buf = Buffer(i); if(buf) { I s = (I)(buf->Frames()*f); - buf->Frames(s >= 0?s:0,true); + buf->Frames(s >= 0?s:0,keep); delete buf; } } @@ -359,3 +349,36 @@ I Vasp::ChkFrames() const return frms < 0?0:frms; } + +// ------------------------------------ + +CVasp::CVasp() {} + +CVasp::CVasp(const Vasp &v): + Vasp(v) +{ + if(!Check()) + Clear(); + else + Frames(ChkFrames()); +} + +CVasp &CVasp::operator +=(const CVasp &v) +{ + if(v.Ok()) { + if(!Ok()) *this = v; + else { + I f = Frames(),vf = v.Frames(); + + if(f != vf) { + post("vasp - Frame count of joined vasps is different - taking the minimum"); + Frames(min(f,vf)); + } + + Resize(Vectors()+v.Vectors()); + for(I i = 0; i < v.Vectors(); ++i) AddVector(v.Vector(i)); + } + } + return *this; +} + diff --git a/externals/grill/vasp/source/vasp.h b/externals/grill/vasp/source/vasp.h index 94e1ad73..3f76b5bd 100644 --- a/externals/grill/vasp/source/vasp.h +++ b/externals/grill/vasp/source/vasp.h @@ -60,13 +60,8 @@ public: Vasp &operator =(const Vasp &v); Vasp &operator ()(I argc,const t_atom *argv /*,BL withvasp = false*/); - // add another vector - Vasp &operator +=(const Ref &r); - // add vectors of another vasp - Vasp &operator +=(const Vasp &v); - // set used channels to 0 - Vasp &Clear() { frames = 0; chns = 0; return *this; } + Vasp &Clear(); // used vectors I Vectors() const { return chns; } @@ -83,13 +78,13 @@ public: V FramesR(R f) { if(f) FramesM(1./f); else Frames(0); } // set buffer sizes - V Size(I fr); + V Size(I fr,BL keep = true); // set frame count differentially - V SizeD(I frd); + V SizeD(I frd,BL keep = true); // set frame count - V SizeM(R f); + V SizeM(R f,BL keep = true); // set frame count - V SizeR(R f) { if(f) SizeM(1./f); else Size(0); } + V SizeR(R f,BL keep = true) { if(f) SizeM(1./f,keep); else Size(0,false); } // actual length of the vasp (in frames) I ChkFrames() const; @@ -120,6 +115,9 @@ public: // get buffer associated to a channel VBuffer *Buffer(I ix) const; + // add another vector + Vasp &AddVector(const Ref &r); + // Real/Complex VBuffer *ReBuffer() const { return Buffer(0); } VBuffer *ImBuffer() const { return Buffer(1); } @@ -141,4 +139,20 @@ protected: V Resize(I rcnt); }; +/*! \brief Checked vasp + \remark Only use that for immediate operation! +*/ +class CVasp: + public Vasp +{ +public: + CVasp(); + CVasp(const Vasp &v); + + // add vectors of another vasp + CVasp &operator +=(const CVasp &v); + +}; + + #endif diff --git a/externals/grill/vasp/source/vecblk.cpp b/externals/grill/vasp/source/vecblk.cpp index 8310cc2f..80917237 100644 --- a/externals/grill/vasp/source/vecblk.cpp +++ b/externals/grill/vasp/source/vecblk.cpp @@ -39,7 +39,7 @@ Vasp *VecBlock::_DstVasp(I n) { Vasp *ret = new Vasp; ret->Frames(Frames()); - for(I i = 0; i < n; ++i) *ret += Vasp::Ref(*_Dst(i)); + for(I i = 0; i < n; ++i) ret->AddVector(Vasp::Ref(*_Dst(i))); return ret; } @@ -47,7 +47,7 @@ Vasp *VecBlock::_SrcVasp(I n) { Vasp *ret = new Vasp; ret->Frames(Frames()); - for(I i = 0; i < n; ++i) *ret += Vasp::Ref(*_Src(i)); + for(I i = 0; i < n; ++i) ret->AddVector(Vasp::Ref(*_Src(i))); return ret; } diff --git a/externals/grill/vasp/todo.txt b/externals/grill/vasp/todo.txt index 584d552d..4504fee0 100644 --- a/externals/grill/vasp/todo.txt +++ b/externals/grill/vasp/todo.txt @@ -21,6 +21,8 @@ warning, treat as 0, calculate unit operation, loop, mirror on buffer end, stay - make in place rotation more efficient (use temporary space) +- introduce "groups" for attribute organisation (e.g. detach etc.) + objects: --------------------- - wave object for table-lookup oscs. @@ -43,17 +45,11 @@ objects: bugs: --------------------- -- vasp.join doesn't like length -1 - -- immediate vasp garbage collection causes clicks.... do it in a separate thread! - tests: --------------------- -- vasp.size always keeps the data... do we want that? -> flag if yes/no - in-place operation (src == dst), test if strides are equal! - should frame count always be pre-evaluated (e.g. in vasp.f+ etc. ?) -- review/change questionable permutation algorithm - test DFT objects on strided buffers - check for odd remainder frame on symmetric operations!! -- cgit v1.2.1