aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vasp/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/vasp/source')
-rw-r--r--externals/grill/vasp/source/classes.cpp20
-rw-r--r--externals/grill/vasp/source/classes.h13
-rw-r--r--externals/grill/vasp/source/main.cpp4
-rw-r--r--externals/grill/vasp/source/obj_imm.cpp2
-rw-r--r--externals/grill/vasp/source/obj_part.cpp2
-rw-r--r--externals/grill/vasp/source/opfuns.h11
-rw-r--r--externals/grill/vasp/source/ops_arith.cpp44
-rw-r--r--externals/grill/vasp/source/ops_arith.h6
-rw-r--r--externals/grill/vasp/source/ops_dft.cpp2
-rw-r--r--externals/grill/vasp/source/ops_qminmax.cpp2
10 files changed, 83 insertions, 23 deletions
diff --git a/externals/grill/vasp/source/classes.cpp b/externals/grill/vasp/source/classes.cpp
index 2c7770a4..42697a1e 100644
--- a/externals/grill/vasp/source/classes.cpp
+++ b/externals/grill/vasp/source/classes.cpp
@@ -35,6 +35,8 @@ V vasp_base::Setup(t_classid c)
FLEXT_CADDMETHOD_(c,0,"radio",m_radio);
+ FLEXT_CADDATTR_VAR1(c,"defer",deferred);
+
// LATER!
/*
FLEXT_CADDATTR_VAR1(c,"argchk",argchk);
@@ -44,7 +46,7 @@ V vasp_base::Setup(t_classid c)
}
vasp_base::vasp_base():
- refresh(false),argchk(false),
+ refresh(false),argchk(false),deferred(false),
unit(xsu_sample),loglvl(0)
{}
@@ -74,7 +76,10 @@ BL vasp_base::ToOutVasp(I oix,Vasp &v)
{
AtomList *lst = v.MakeList(false);
if(lst) {
- ToOutAnything(oix,sym_vasp,lst->Count(),lst->Atoms());
+ if(deferred)
+ ToQueueAnything(oix,sym_vasp,lst->Count(),lst->Atoms());
+ else
+ ToOutAnything(oix,sym_vasp,lst->Count(),lst->Atoms());
delete lst;
return true;
}
@@ -86,8 +91,8 @@ BL vasp_base::ToOutVasp(I oix,Vasp &v)
///////////////////////////////////////////////////////////////////////////
vasp_op::vasp_op(BL op)
-#ifdef FLEXT_THREADS
:detach(false),prior(-2)
+#ifdef FLEXT_THREADS
// ,thrid(0)
#endif
{
@@ -106,10 +111,8 @@ V vasp_op::Setup(t_classid c)
FLEXT_CADDATTR_VAR(c,"update",m_getupd,m_setupd);
-#ifdef FLEXT_THREADS
FLEXT_CADDATTR_VAR1(c,"detach",detach);
FLEXT_CADDATTR_VAR1(c,"prior",prior);
-#endif
}
V vasp_op::m_dobang()
@@ -194,12 +197,7 @@ V vasp_tx::m_bang()
{
Vasp *ret = x_work();
if(ret) {
- AtomList *lst = ret->MakeList(false);
- if(lst) {
- ToOutAnything(0,sym_vasp,lst->Count(),lst->Atoms());
- delete lst;
- }
- else
+ if(!ToOutVasp(0,*ret))
post("%s - empty list",thisName());
if(refresh) ret->Refresh();
delete ret;
diff --git a/externals/grill/vasp/source/classes.h b/externals/grill/vasp/source/classes.h
index d90e9beb..c0ecad32 100644
--- a/externals/grill/vasp/source/classes.h
+++ b/externals/grill/vasp/source/classes.h
@@ -46,6 +46,7 @@ protected:
*/
BL refresh; // immediate graphics refresh?
BL argchk; // pre-operation argument feasibility check
+ BL deferred; // queue outgoing vasp messages
xs_unit unit; // time units
I loglvl; // noise level for log messages
@@ -59,6 +60,7 @@ private:
FLEXT_CALLBACK_V(m_radio)
FLEXT_ATTRVAR_B(argchk)
+ FLEXT_ATTRVAR_B(deferred)
FLEXT_ATTRVAR_I(loglvl)
FLEXT_ATTRVAR_E(unit,xs_unit)
};
@@ -104,8 +106,6 @@ protected:
V Lock() { runmtx.Lock(); }
V Unlock() { runmtx.Unlock(); }
- BL detach; // detached operation?
- I prior; // thread priority
// thrid_t thrid;
#else
FLEXT_CALLBACK(m_bang)
@@ -113,6 +113,9 @@ protected:
V Lock() {}
V Unlock() {}
#endif
+ BL detach; // detached operation?
+ I prior; // thread priority
+
FLEXT_CALLBACK_V(m_vasp)
FLEXT_CALLBACK_V(m_set)
@@ -122,10 +125,8 @@ protected:
FLEXT_CALLBACK(m_stop)
FLEXT_CALLVAR_V(m_getupd,m_setupd)
-#ifdef FLEXT_THREADS
FLEXT_ATTRVAR_B(detach)
FLEXT_ATTRVAR_I(prior)
-#endif
private:
static V Setup(t_classid);
@@ -271,7 +272,7 @@ FLEXT_LIB("vasp," name,vasp_##op)
#define VASP_BINARY(name,op,to,def,help) \
-class vasp_ ## op: \
+class vasp_##op: \
public vasp_binop \
{ \
FLEXT_HEADER(vasp_##op,vasp_binop) \
@@ -290,7 +291,7 @@ FLEXT_LIB_V("vasp," name,vasp_##op)
#define VASP_ANYOP(name,op,args,to,def,help) \
-class vasp_ ## op: \
+class vasp_##op: \
public vasp_anyop \
{ \
FLEXT_HEADER(vasp_##op,vasp_anyop) \
diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp
index f1cbee10..4539a13a 100644
--- a/externals/grill/vasp/source/main.cpp
+++ b/externals/grill/vasp/source/main.cpp
@@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "classes.h"
-const C *VASP_VERSION = "0.1.3pre3";
+const C *VASP_VERSION = "0.1.3pre4";
#include "opfuns.h"
@@ -99,6 +99,8 @@ V lib_setup()
VASP__SETUP(abs)
VASP__SETUP(cabs)
+ VASP_SETUP(qsum)
+
VASP__SETUP(lwr)
VASP__SETUP(gtr)
VASP__SETUP(alwr)
diff --git a/externals/grill/vasp/source/obj_imm.cpp b/externals/grill/vasp/source/obj_imm.cpp
index 5b98a590..3e26677f 100644
--- a/externals/grill/vasp/source/obj_imm.cpp
+++ b/externals/grill/vasp/source/obj_imm.cpp
@@ -69,7 +69,7 @@ public:
{
ImmBuf ibuf(frms);
Vasp ret(frms,Vasp::Ref(ibuf));
- ToOutVasp(0,ret);
+ ToOutVasp(0,ret);
}
}
else if(ref.Vectors() > 1)
diff --git a/externals/grill/vasp/source/obj_part.cpp b/externals/grill/vasp/source/obj_part.cpp
index 2e7044d0..1e41a537 100644
--- a/externals/grill/vasp/source/obj_part.cpp
+++ b/externals/grill/vasp/source/obj_part.cpp
@@ -81,7 +81,7 @@ public:
return;
}
- I fr = ref.Frames(),o = 0;
+ I fr = ref.ChkFrames(),o = 0,f = 0;
for(I i = 0; i < parts && (fr < 0 || fr); ++i) {
I p = part[i];
if(fr >= 0) { p = min(p,fr); fr -= p; }
diff --git a/externals/grill/vasp/source/opfuns.h b/externals/grill/vasp/source/opfuns.h
index 3a14eb95..51b1fd06 100644
--- a/externals/grill/vasp/source/opfuns.h
+++ b/externals/grill/vasp/source/opfuns.h
@@ -121,7 +121,7 @@ namespace VecOp {
template<class T> class f_sqr {
public:
static I run_opt() { return 3; }
- static V run(T &v,T a) { v = a*a; post("sq"); }
+ static V run(T &v,T a) { v = a*a; }
static I cun_opt() { return 1; }
static V cun(T &rv,T &iv,T ra,T ia) { rv = ra*ra-ia*ia; iv = ra*ia*2; }
};
@@ -133,6 +133,15 @@ namespace VecOp {
};
+ template<class T> class f_sumq {
+ public:
+ static I rop_opt() { return 2; }
+ static V rop(T &,T ra,OpParam &p)
+ {
+ p.norm.minmax += ra;
+ }
+ };
+
// transcendent
template<class T> class f_powi {
diff --git a/externals/grill/vasp/source/ops_arith.cpp b/externals/grill/vasp/source/ops_arith.cpp
index fb8ad4b7..2239fc46 100644
--- a/externals/grill/vasp/source/ops_arith.cpp
+++ b/externals/grill/vasp/source/ops_arith.cpp
@@ -33,3 +33,47 @@ VASP_UNARY("vasp.ssqr",ssqr,true,"Calculates the square with preservation of the
VASP_UNARY("vasp.sign",sign,true,"Calculates the sign (signum function)")
VASP_UNARY("vasp.abs",abs,true,"Calculates the absolute value")
+
+
+/*! \class vasp_qsum
+ \remark \b vasp.sum?
+ \brief Get sum of sample values
+ \since 0.1.3
+ \param inlet vasp - is stored and output triggered
+ \param inlet bang - triggers output
+ \param inlet set - vasp to be stored
+ \retval outlet float - sample value sum
+
+ \todo Should we provide a cmdln default vasp?
+ \todo Should we inhibit output for invalid vasps?
+ \remark Returns 0 for a vasp with 0 frames
+*/
+class vasp_qsum:
+ public vasp_unop
+{
+ FLEXT_HEADER(vasp_qsum,vasp_unop)
+
+public:
+ vasp_qsum(): vasp_unop(true,XletCode(xlet::tp_float,0)) {}
+
+ virtual Vasp *do_opt(OpParam &p)
+ {
+ p.norm.minmax = 0;
+ CVasp cref(ref);
+ Vasp *ret = VaspOp::m_qsum(p,cref);
+ return ret;
+ }
+
+ virtual Vasp *tx_work()
+ {
+ OpParam p(thisName(),0);
+ Vasp *ret = do_opt(p);
+ ToOutFloat(1,p.norm.minmax);
+ return ret;
+ }
+
+ virtual V m_help() { post("%s - Get the sum of a vasp's sample values",thisName()); }
+};
+
+FLEXT_LIB("vasp, vasp.sum?",vasp_qsum)
+
diff --git a/externals/grill/vasp/source/ops_arith.h b/externals/grill/vasp/source/ops_arith.h
index 064ecb0e..dd8f88b3 100644
--- a/externals/grill/vasp/source/ops_arith.h
+++ b/externals/grill/vasp/source/ops_arith.h
@@ -2,7 +2,7 @@
VASP modular - vector assembling signal processor / objects for Max/MSP and PD
-Copyright (c) 2002 Thomas Grill (xovo@gmx.net)
+Copyright (c) 2002-2003 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
@@ -29,6 +29,8 @@ DEFOP(S,d_ssqr,ssqr,run)
DEFOP(S,d_sign,sign,run)
DEFOP(S,d_abs,abs,run)
+DEFOP(S,d_sumq,sumq,rop)
+
namespace VaspOp {
@@ -45,6 +47,8 @@ namespace VaspOp {
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_qsum(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_sumq); } // get sum of sample values
}
#endif
diff --git a/externals/grill/vasp/source/ops_dft.cpp b/externals/grill/vasp/source/ops_dft.cpp
index 827c2a03..354f126b 100644
--- a/externals/grill/vasp/source/ops_dft.cpp
+++ b/externals/grill/vasp/source/ops_dft.cpp
@@ -62,7 +62,7 @@ static BL fft_fwd_real_any(I cnt,F *rsdt,I _rss,F *rddt,I _rds)
rstmp = rsdt;
istmp = new F[cnt];
- memset(istmp,0,cnt*sizeof(*istmp));
+ flext::ZeroMem(istmp,cnt*sizeof(*istmp));
F *rdtmp = rdt?new F[cnt]:rddt;
F *idtmp = new F[cnt];
diff --git a/externals/grill/vasp/source/ops_qminmax.cpp b/externals/grill/vasp/source/ops_qminmax.cpp
index f7e4144e..f834c2c3 100644
--- a/externals/grill/vasp/source/ops_qminmax.cpp
+++ b/externals/grill/vasp/source/ops_qminmax.cpp
@@ -240,3 +240,5 @@ public:
FLEXT_LIB("vasp, vasp.rmax?",vasp_qrmax)
+
+