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/buflib.cpp2
-rw-r--r--externals/grill/vasp/source/main.cpp2
-rw-r--r--externals/grill/vasp/source/obj_size.cpp8
-rw-r--r--externals/grill/vasp/source/opdefs.h64
-rw-r--r--externals/grill/vasp/source/opfuns.h5
-rwxr-xr-xexternals/grill/vasp/source/oploop.h20
-rw-r--r--externals/grill/vasp/source/vasp.cpp12
-rw-r--r--externals/grill/vasp/source/vasp.h8
-rw-r--r--externals/grill/vasp/source/vbuffer.h6
9 files changed, 78 insertions, 49 deletions
diff --git a/externals/grill/vasp/source/buflib.cpp b/externals/grill/vasp/source/buflib.cpp
index 3b92d1e9..d4a6338e 100644
--- a/externals/grill/vasp/source/buflib.cpp
+++ b/externals/grill/vasp/source/buflib.cpp
@@ -297,6 +297,6 @@ VSymbol ImmBuf::Symbol() const { return entry->sym; }
I ImmBuf::Frames() const { return entry->len; }
-V ImmBuf::Frames(I fr,BL keep) { entry = BufLib::Resize(entry,fr,keep); }
+V ImmBuf::Frames(I fr,BL keep,BL zero) { entry = BufLib::Resize(entry,fr,keep,zero); }
S *ImmBuf::Data() { return entry->data; }
diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp
index 5f63895a..f1cbee10 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.3pre1";
+const C *VASP_VERSION = "0.1.3pre3";
#include "opfuns.h"
diff --git a/externals/grill/vasp/source/obj_size.cpp b/externals/grill/vasp/source/obj_size.cpp
index d8245471..6c2eba4b 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),keep(true)
+ size(0),sets(false),keep(true),zero(true)
{
if(argc >= 1 && CanbeFloat(argv[0]))
m_arg(GetAFloat(argv[0]));
@@ -52,6 +52,7 @@ public:
{
FLEXT_CADDMETHOD(c,1,m_arg);
FLEXT_CADDATTR_VAR1(c,"keep",keep);
+ FLEXT_CADDATTR_VAR1(c,"zero",zero);
}
virtual V m_arg(F s)
@@ -63,20 +64,21 @@ public:
virtual Vasp *x_work()
{
Vasp *ret = new Vasp(ref);
- if(sets) ret->Size(size,keep);
+ if(sets) ret->Size(size,keep,zero);
return ret;
}
virtual V m_help() { post("%s - Set the size of the vector buffers",thisName()); }
protected:
I size;
- BL sets,keep;
+ BL sets,keep,zero;
private:
FLEXT_CALLBACK_F(m_arg);
FLEXT_CALLSET_I(m_arg);
FLEXT_ATTRGET_I(size);
FLEXT_ATTRVAR_B(keep);
+ FLEXT_ATTRVAR_B(zero);
};
FLEXT_LIB_V("vasp, vasp.size vasp.s",vasp_size)
diff --git a/externals/grill/vasp/source/opdefs.h b/externals/grill/vasp/source/opdefs.h
index 8d7d522c..71774db6 100644
--- a/externals/grill/vasp/source/opdefs.h
+++ b/externals/grill/vasp/source/opdefs.h
@@ -313,13 +313,6 @@ template<class T,class ARG,class OP> BL V__cop(ARG p,register const S *sr,regist
return true;
}
-template<class T,class CL> inline BL _D__run(OpParam &p) { return V__run<T,CL>(p.rsdt,p.rss,p.rddt,p.rds,p.frames); }
-template<class T,class CL> inline BL _D__cun(OpParam &p) { return V__cun<T,CL>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); }
-template<class T,class CL> inline BL _D__rbin(OpParam &p) { return _F__rbin<T,CL>(p); }
-template<class T,class CL> inline BL _D__cbin(OpParam &p) { return _F__cbin<T,CL>(p); }
-template<class T,class CL> inline BL _D__rop(OpParam &p) { return V__rop<T,OpParam &,CL>(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames); }
-template<class T,class CL> inline BL _D__cop(OpParam &p) { return V__cop<T,OpParam &,CL>(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); }
-
template<class T> BL _d__run(V fun(T &v,T a),OpParam &p)
{
@@ -423,21 +416,54 @@ template<class T> BL _d__cop(V fun(T &rv,T &iv,T ra,T ia,OpParam &p),OpParam &p)
}
+/*
+template<class T,class CL> inline BL _D__run(OpParam &p) { return V__run<T,CL>(p.rsdt,p.rss,p.rddt,p.rds,p.frames); }
+template<class T,class CL> inline BL _D__cun(OpParam &p) { return V__cun<T,CL>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); }
+template<class T,class CL> inline BL _D__rbin(OpParam &p) { return _F__rbin<T,CL>(p); }
+template<class T,class CL> inline BL _D__cbin(OpParam &p) { return _F__cbin<T,CL>(p); }
+template<class T,class CL> inline BL _D__rop(OpParam &p) { return V__rop<T,OpParam &,CL>(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames); }
+template<class T,class CL> inline BL _D__cop(OpParam &p) { return V__cop<T,OpParam &,CL>(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); }
#ifdef VASP_COMPACT
- template<class T,class CL> inline BL D__run(OpParam &p) { return _d__run<T>(CL::run,p); }
- template<class T,class CL> inline BL D__cun(OpParam &p) { return _d__cun<T>(CL::cun,p); }
- template<class T,class CL> inline BL D__rbin(OpParam &p) { return _d__rbin<T>(CL::rbin,p); }
- template<class T,class CL> inline BL D__cbin(OpParam &p) { return _d__cbin<T>(CL::cbin,p); }
- template<class T,class CL> inline BL D__rop(OpParam &p) { return _d__rop<T>(CL::rop,p); }
- template<class T,class CL> inline BL D__cop(OpParam &p) { return _d__cop<T>(CL::cop,p); }
+ template<class T,class CL> BL D__run(OpParam &p) { return _d__run<T>(CL::run,p); }
+ template<class T,class CL> BL D__cun(OpParam &p) { return _d__cun<T>(CL::cun,p); }
+ template<class T,class CL> BL D__rbin(OpParam &p) { return _d__rbin<T>(CL::rbin,p); }
+ template<class T,class CL> BL D__cbin(OpParam &p) { return _d__cbin<T>(CL::cbin,p); }
+ template<class T,class CL> BL D__rop(OpParam &p) { return _d__rop<T>(CL::rop,p); }
+ template<class T,class CL> BL D__cop(OpParam &p) { return _d__cop<T>(CL::cop,p); }
+#else
+ template<class T,class CL> BL D__run(OpParam &p) { return CL::run_opt()?_D__run<T,CL>(p):_d__run<T>(CL::run,p); }
+ template<class T,class CL> BL D__cun(OpParam &p) { return CL::cun_opt()?_D__cun<T,CL>(p):_d__cun<T>(CL::cun,p); }
+ template<class T,class CL> BL D__rbin(OpParam &p) { return CL::rbin_opt()?_D__rbin<T,CL>(p):_d__rbin<T>(CL::rbin,p); }
+ template<class T,class CL> BL D__cbin(OpParam &p) { return CL::cbin_opt()?_D__cbin<T,CL>(p):_d__cbin<T>(CL::cbin,p); }
+ template<class T,class CL> BL D__rop(OpParam &p) { return CL::rop_opt()?_D__rop<T,CL>(p):_d__rop<T>(CL::rop,p); }
+ template<class T,class CL> BL D__cop(OpParam &p) { return CL::cop_opt()?_D__cop<T,CL>(p):_d__cop<T>(CL::cop,p); }
+#endif
+*/
+
+// MSVC 6 can't handle optimization here!! (silently produces wrong code!!!)
+
+#define _D__run(T,CL,p) V__run<T,CL>(p.rsdt,p.rss,p.rddt,p.rds,p.frames)
+#define _D__cun(T,CL,p) V__cun<T,CL>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames)
+#define _D__rbin(T,CL,p) _F__rbin<T,CL>(p)
+#define _D__cbin(T,CL,p) _F__cbin<T,CL>(p)
+#define _D__rop(T,CL,p) V__rop<T,OpParam &,CL>(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames)
+#define _D__cop(T,CL,p) V__cop<T,OpParam &,CL>(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames)
+
+#if defined(VASP_COMPACT) || (defined(_MSC_VER) && _MSC_VER <= 1200)
+ #define D__run(T,CL,p) _d__run<T>(CL::run,p)
+ #define D__cun(T,CL,p) _d__cun<T>(CL::cun,p)
+ #define D__rbin(T,CL,p) _d__rbin<T>(CL::rbin,p)
+ #define D__cbin(T,CL,p) _d__cbin<T>(CL::cbin,p)
+ #define D__rop(T,CL,p) _d__rop<T>(CL::rop,p)
+ #define D__cop(T,CL,p) _d__cop<T>(CL::cop,p)
#else
- template<class T,class CL> inline BL D__run(OpParam &p) { return CL::run_opt()?_D__run<T,CL>(p):_d__run<T>(CL::run,p); }
- template<class T,class CL> inline BL D__cun(OpParam &p) { return CL::cun_opt()?_D__cun<T,CL>(p):_d__cun<T>(CL::cun,p); }
- template<class T,class CL> inline BL D__rbin(OpParam &p) { return CL::rbin_opt()?_D__rbin<T,CL>(p):_d__rbin<T>(CL::rbin,p); }
- template<class T,class CL> inline BL D__cbin(OpParam &p) { return CL::cbin_opt()?_D__cbin<T,CL>(p):_d__cbin<T>(CL::cbin,p); }
- template<class T,class CL> inline BL D__rop(OpParam &p) { return CL::rop_opt()?_D__rop<T,CL>(p):_d__rop<T>(CL::rop,p); }
- template<class T,class CL> inline BL D__cop(OpParam &p) { return CL::cop_opt()?_D__cop<T,CL>(p):_d__cop<T>(CL::cop,p); }
+ #define D__run(T,CL,p) ( CL::run_opt()?_D__run(T,CL,p):_d__run<T>(CL::run,p) )
+ #define D__cun(T,CL,p) ( CL::cun_opt()?_D__cun(T,CL,p):_d__cun<T>(CL::cun,p) )
+ #define D__rbin(T,CL,p) ( CL::rbin_opt()?_D__rbin(T,CL,p):_d__rbin<T>(CL::rbin,p) )
+ #define D__cbin(T,CL,p) ( CL::cbin_opt()?_D__cbin(T,CL,p):_d__cbin<T>(CL::cbin,p) )
+ #define D__rop(T,CL,p) ( CL::rop_opt()?_D__rop(T,CL,p):_d__rop<T>(CL::rop,p) )
+ #define D__cop(T,CL,p) ( CL::cop_opt()?_D__cop(T,CL,p):_d__cop<T>(CL::cop,p) )
#endif
diff --git a/externals/grill/vasp/source/opfuns.h b/externals/grill/vasp/source/opfuns.h
index 2228641d..3a14eb95 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; }
+ static V run(T &v,T a) { v = a*a; post("sq"); }
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; }
};
@@ -449,8 +449,9 @@ namespace VecOp {
}
+
#define DEFOP(T,FUN,OP,KIND) \
-namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND<T,f_##OP<T> >(p); } }
+namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND(T,f_##OP<T>,p); } }
#define DEFVEC_R(T,OP) \
diff --git a/externals/grill/vasp/source/oploop.h b/externals/grill/vasp/source/oploop.h
index 603cd7ce..9518edf1 100755
--- a/externals/grill/vasp/source/oploop.h
+++ b/externals/grill/vasp/source/oploop.h
@@ -67,11 +67,11 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define _DE_LOOP(VAR,LEN,BODY) { \
for(VAR = 0; VAR < LEN; flext_base::ThrYield()) { \
register const I __m__ = _D_MIN(LEN,VAR+_D_BLOCK); \
- for(; VAR <= __m__-4; VAR += 4) { \
- BODY; \
- BODY; \
- BODY; \
- BODY; \
+ for(; VAR <= __m__-4; ) { \
+ BODY; ++VAR; \
+ BODY; ++VAR; \
+ BODY; ++VAR; \
+ BODY; ++VAR; \
} \
for(; VAR < __m__; ++VAR) { \
BODY; \
@@ -82,11 +82,11 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#else
#define _DE_LOOP(VAR,LEN,BODY) { \
- for(VAR = 0; VAR <= LEN-4; VAR += 4) { \
- BODY; \
- BODY; \
- BODY; \
- BODY; \
+ for(VAR = 0; VAR <= LEN-4; ) { \
+ BODY; ++VAR; \
+ BODY; ++VAR; \
+ BODY; ++VAR; \
+ BODY; ++VAR; \
} \
for(; VAR < LEN; ++VAR) { \
BODY; \
diff --git a/externals/grill/vasp/source/vasp.cpp b/externals/grill/vasp/source/vasp.cpp
index 66bffccb..09ecb8ff 100644
--- a/externals/grill/vasp/source/vasp.cpp
+++ b/externals/grill/vasp/source/vasp.cpp
@@ -281,37 +281,37 @@ V Vasp::Channel(I c)
}
-V Vasp::Size(I s,BL keep)
+V Vasp::Size(I s,BL keep,BL zero)
{
for(I i = 0; i < Vectors(); ++i) {
VBuffer *buf = Buffer(i);
if(buf) {
- buf->Frames(s,keep);
+ buf->Frames(s,keep,zero);
delete buf;
}
}
}
-V Vasp::SizeD(I sd,BL keep)
+V Vasp::SizeD(I sd,BL keep,BL zero)
{
for(I i = 0; i < Vectors(); ++i) {
VBuffer *buf = Buffer(i);
if(buf) {
I s = buf->Frames()+sd;
- buf->Frames(s >= 0?s:0,keep);
+ buf->Frames(s >= 0?s:0,keep,zero);
delete buf;
}
}
}
-V Vasp::SizeM(R f,BL keep)
+V Vasp::SizeM(R f,BL keep,BL zero)
{
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,keep);
+ buf->Frames(s >= 0?s:0,keep,zero);
delete buf;
}
}
diff --git a/externals/grill/vasp/source/vasp.h b/externals/grill/vasp/source/vasp.h
index 3f76b5bd..ed63846f 100644
--- a/externals/grill/vasp/source/vasp.h
+++ b/externals/grill/vasp/source/vasp.h
@@ -78,13 +78,13 @@ public:
V FramesR(R f) { if(f) FramesM(1./f); else Frames(0); }
// set buffer sizes
- V Size(I fr,BL keep = true);
+ V Size(I fr,BL keep = true,BL zero = true);
// set frame count differentially
- V SizeD(I frd,BL keep = true);
+ V SizeD(I frd,BL keep = true,BL zero = true);
// set frame count
- V SizeM(R f,BL keep = true);
+ V SizeM(R f,BL keep = true,BL zero = true);
// set frame count
- V SizeR(R f,BL keep = true) { if(f) SizeM(1./f,keep); else Size(0,false); }
+ V SizeR(R f,BL keep = true,BL zero = true) { if(f) SizeM(1./f,keep,zero); else Size(0,false); }
// actual length of the vasp (in frames)
I ChkFrames() const;
diff --git a/externals/grill/vasp/source/vbuffer.h b/externals/grill/vasp/source/vbuffer.h
index 01a57af0..e616ad1c 100644
--- a/externals/grill/vasp/source/vbuffer.h
+++ b/externals/grill/vasp/source/vbuffer.h
@@ -47,7 +47,7 @@ public:
virtual BL Ok() const = 0;
virtual I Frames() const = 0;
- virtual V Frames(I fr,BL keep) = 0;
+ virtual V Frames(I fr,BL keep,BL zero) = 0;
virtual I Channels() const = 0;
virtual S *Data() = 0;
@@ -91,7 +91,7 @@ public:
SysBuf &Set(const VSymbol &s,I chn = 0,I len = -1,I offs = 0);
virtual I Frames() const { return buf.Frames(); }
- virtual V Frames(I fr,BL keep) { buf.Frames(fr,keep); }
+ virtual V Frames(I fr,BL keep,BL zero) { buf.Frames(fr,keep,zero); }
virtual I Channels() const { return buf.Channels(); }
virtual S *Data() { return buf.Data(); }
@@ -115,7 +115,7 @@ public:
virtual VSymbol Symbol() const;
virtual I Frames() const;
- virtual V Frames(I fr,BL keep);
+ virtual V Frames(I fr,BL keep,BL zero);
virtual I Channels() const { return 1; }
virtual S *Data();