aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vasp/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-04-09 02:40:20 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-04-09 02:40:20 +0000
commit28d14094386a69ddf05ca810114538fb2c31f8c7 (patch)
tree7d5bc28bece3f89de8e95be623e355d30ca856ed /externals/grill/vasp/source
parentc91ebcd16ef0672a909b6e6a1ba144272d062768 (diff)
""
svn path=/trunk/; revision=554
Diffstat (limited to 'externals/grill/vasp/source')
-rw-r--r--externals/grill/vasp/source/main.cpp3
-rwxr-xr-xexternals/grill/vasp/source/obj_chns.cpp52
-rw-r--r--externals/grill/vasp/source/obj_frames.cpp8
-rw-r--r--externals/grill/vasp/source/obj_imm.cpp2
-rw-r--r--externals/grill/vasp/source/obj_offs.cpp4
-rw-r--r--externals/grill/vasp/source/obj_part.cpp2
-rw-r--r--externals/grill/vasp/source/obj_peaks.cpp2
-rw-r--r--externals/grill/vasp/source/obj_radio.cpp4
-rw-r--r--externals/grill/vasp/source/obj_size.cpp8
-rw-r--r--externals/grill/vasp/source/obj_split.cpp12
-rw-r--r--externals/grill/vasp/source/obj_sync.cpp2
-rw-r--r--externals/grill/vasp/source/obj_vasp.cpp6
-rw-r--r--externals/grill/vasp/source/obj_vecs.cpp2
-rw-r--r--externals/grill/vasp/source/opfuns.h2
-rw-r--r--externals/grill/vasp/source/opparam.h6
-rw-r--r--externals/grill/vasp/source/ops_qminmax.cpp125
16 files changed, 156 insertions, 84 deletions
diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp
index e1c3e42d..67d151ac 100644
--- a/externals/grill/vasp/source/main.cpp
+++ b/externals/grill/vasp/source/main.cpp
@@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "classes.h"
-const C *VASP_VERSION = "0.1.3pre8";
+const C *VASP_VERSION = "0.1.3pre10";
#include "opfuns.h"
@@ -64,6 +64,7 @@ static V vasp_main()
VASP_SETUP(channel); // vasp.channel
VASP_SETUP(qchannel); // vasp.channel?
+ VASP_SETUP(qchannels); // vasp.channels?
VASP_SETUP(split);
VASP_SETUP(join);
diff --git a/externals/grill/vasp/source/obj_chns.cpp b/externals/grill/vasp/source/obj_chns.cpp
index 8b38374f..370624de 100755
--- a/externals/grill/vasp/source/obj_chns.cpp
+++ b/externals/grill/vasp/source/obj_chns.cpp
@@ -11,6 +11,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "main.h"
#include "classes.h"
#include "util.h"
+#include "buflib.h"
/*! \class vasp_channel
@@ -29,7 +30,7 @@ class vasp_channel:
FLEXT_HEADER_S(vasp_channel,vasp_tx,Setup)
public:
- vasp_channel(I argc,t_atom *argv):
+ vasp_channel(I argc,const t_atom *argv):
ix(0)
{
if(argc >= 1 && CanbeInt(argv[0]))
@@ -97,8 +98,12 @@ public:
virtual V m_bang()
{
- if(ref.Ok())
+ if(ref.Ok()) {
+ if(ref.Vectors() > 1)
+ post("%s - more vectors in vasp, only considering first",thisName());
+
ToOutInt(0,ref.Vector(0).Channel());
+ }
else
post("%s - Invalid vasp, no output",thisName());
}
@@ -109,4 +114,47 @@ public:
FLEXT_LIB("vasp, vasp.channel? vasp.c?",vasp_qchannel)
+/*! \class vasp_qchannels
+ \remark \b vasp.channels?
+ \brief Gets number of channels of a vasp.
+ \since 0.1.3
+ \param inlet vasp - is stored and output triggered
+ \param inlet bang - triggers output
+ \param inlet set - vasp to be stored
+ \retval outlet int - channels of stored vasp
+
+ \note No output for invalid vasp?
+*/
+class vasp_qchannels:
+ public vasp_op
+{
+ FLEXT_HEADER(vasp_qchannels,vasp_op)
+
+public:
+ vasp_qchannels()
+ {
+ AddInAnything();
+ AddOutInt();
+ }
+
+ virtual V m_bang()
+ {
+ if(ref.Ok()) {
+ if(ref.Vectors() > 1)
+ post("%s - more vectors in vasp, only considering first",thisName());
+
+ VBuffer *buf = BufLib::Get(ref.Vector(0).Symbol());
+ ToOutInt(0,buf->Channels());
+ delete buf;
+ }
+ else
+ post("%s - Invalid vasp, no output",thisName());
+ }
+
+ virtual V m_help() { post("%s - Get channel index of 0th vector in vasp",thisName()); }
+};
+
+FLEXT_LIB("vasp, vasp.channels?",vasp_qchannels)
+
+
diff --git a/externals/grill/vasp/source/obj_frames.cpp b/externals/grill/vasp/source/obj_frames.cpp
index 3ecd0af1..8438370d 100644
--- a/externals/grill/vasp/source/obj_frames.cpp
+++ b/externals/grill/vasp/source/obj_frames.cpp
@@ -32,7 +32,7 @@ class vasp_frames:
FLEXT_HEADER_S(vasp_frames,vasp_tx,Setup)
public:
- vasp_frames(I argc,t_atom *argv,BL abs = true):
+ vasp_frames(I argc,const t_atom *argv,BL abs = true):
frms(0),setf(false)
{
if(argc && CanbeFloat(argv[0]))
@@ -101,7 +101,7 @@ class vasp_dframes:
FLEXT_HEADER(vasp_dframes,vasp_frames)
public:
- vasp_dframes(I argc,t_atom *argv): vasp_frames(argc,argv) {}
+ vasp_dframes(I argc,const t_atom *argv): vasp_frames(argc,argv) {}
virtual Vasp *x_work()
{
@@ -134,7 +134,7 @@ class vasp_mframes:
FLEXT_HEADER_S(vasp_mframes,vasp_frames,Setup)
public:
- vasp_mframes(I argc,t_atom *argv):
+ vasp_mframes(I argc,const t_atom *argv):
vasp_frames(argc,argv,false)
{
if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0]));
@@ -187,7 +187,7 @@ class vasp_rframes:
FLEXT_HEADER(vasp_rframes,vasp_mframes)
public:
- vasp_rframes(I argc,t_atom *argv): vasp_mframes(argc,argv) {}
+ vasp_rframes(I argc,const t_atom *argv): vasp_mframes(argc,argv) {}
virtual Vasp *x_work()
{
diff --git a/externals/grill/vasp/source/obj_imm.cpp b/externals/grill/vasp/source/obj_imm.cpp
index ce11d74c..ba421ff4 100644
--- a/externals/grill/vasp/source/obj_imm.cpp
+++ b/externals/grill/vasp/source/obj_imm.cpp
@@ -37,7 +37,7 @@ class vasp_imm:
FLEXT_HEADER_S(vasp_imm,vasp_op,Setup)
public:
- vasp_imm(I argc,t_atom *argv):
+ vasp_imm(I argc,const t_atom *argv):
frms(0),zero(true)
{
if(argc >= 1 && CanbeInt(argv[0]))
diff --git a/externals/grill/vasp/source/obj_offs.cpp b/externals/grill/vasp/source/obj_offs.cpp
index c2682a30..0eec0fde 100644
--- a/externals/grill/vasp/source/obj_offs.cpp
+++ b/externals/grill/vasp/source/obj_offs.cpp
@@ -33,7 +33,7 @@ class vasp_offset:
FLEXT_HEADER_S(vasp_offset,vasp_tx,Setup)
public:
- vasp_offset(I argc,t_atom *argv):
+ vasp_offset(I argc,const t_atom *argv):
offs(0),seto(false)
{
if(argc >= 1 && CanbeFloat(argv[0]))
@@ -100,7 +100,7 @@ class vasp_doffset:
FLEXT_HEADER(vasp_doffset,vasp_offset)
public:
- vasp_doffset(I argc,t_atom *argv): vasp_offset(argc,argv) {}
+ vasp_doffset(I argc,const t_atom *argv): vasp_offset(argc,argv) {}
virtual Vasp *x_work()
{
diff --git a/externals/grill/vasp/source/obj_part.cpp b/externals/grill/vasp/source/obj_part.cpp
index 1e41a537..03de8e47 100644
--- a/externals/grill/vasp/source/obj_part.cpp
+++ b/externals/grill/vasp/source/obj_part.cpp
@@ -34,7 +34,7 @@ class vasp_part:
FLEXT_HEADER_S(vasp_part,vasp_op,Setup)
public:
- vasp_part(I argc,t_atom *argv):
+ vasp_part(I argc,const t_atom *argv):
parts(0),part(NULL)
{
m_part(argc,argv);
diff --git a/externals/grill/vasp/source/obj_peaks.cpp b/externals/grill/vasp/source/obj_peaks.cpp
index 3f708ea6..e7d7dd80 100644
--- a/externals/grill/vasp/source/obj_peaks.cpp
+++ b/externals/grill/vasp/source/obj_peaks.cpp
@@ -34,7 +34,7 @@ class vasp_qpeaks:
FLEXT_HEADER_S(vasp_qpeaks,vasp_op,Setup)
public:
- vasp_qpeaks(I argc,t_atom *argv):
+ vasp_qpeaks(I argc,const t_atom *argv):
peaks(1)
{
if(argc >= 1 && CanbeInt(argv[0]))
diff --git a/externals/grill/vasp/source/obj_radio.cpp b/externals/grill/vasp/source/obj_radio.cpp
index 1746db07..72b70daa 100644
--- a/externals/grill/vasp/source/obj_radio.cpp
+++ b/externals/grill/vasp/source/obj_radio.cpp
@@ -42,7 +42,7 @@ public:
FLEXT_CADDMETHOD(c,0,m_any);
}
- virtual V m_any(const t_symbol *s,I argc,t_atom *argv);
+ virtual V m_any(const t_symbol *s,I argc,const t_atom *argv);
virtual V m_help() { post("%s - split into radio and non-radio messages",thisName()); }
private:
@@ -52,7 +52,7 @@ private:
FLEXT_LIB("vasp, vasp.radio",vasp_radio)
-V vasp_radio::m_any(const t_symbol *s,I argc,t_atom *argv)
+V vasp_radio::m_any(const t_symbol *s,I argc,const t_atom *argv)
{
ToOutAnything(s == vasp_base::sym_radio?0:1,s,argc,argv);
}
diff --git a/externals/grill/vasp/source/obj_size.cpp b/externals/grill/vasp/source/obj_size.cpp
index 6c2eba4b..7a31137b 100644
--- a/externals/grill/vasp/source/obj_size.cpp
+++ b/externals/grill/vasp/source/obj_size.cpp
@@ -33,7 +33,7 @@ class vasp_size:
FLEXT_HEADER_S(vasp_size,vasp_tx,Setup)
public:
- vasp_size(I argc,t_atom *argv,BL abs = true):
+ vasp_size(I argc,const t_atom *argv,BL abs = true):
size(0),sets(false),keep(true),zero(true)
{
if(argc >= 1 && CanbeFloat(argv[0]))
@@ -105,7 +105,7 @@ class vasp_dsize:
FLEXT_HEADER(vasp_dsize,vasp_size)
public:
- vasp_dsize(I argc,t_atom *argv): vasp_size(argc,argv) {}
+ vasp_dsize(I argc,const t_atom *argv): vasp_size(argc,argv) {}
virtual Vasp *x_work()
{
@@ -138,7 +138,7 @@ class vasp_msize:
FLEXT_HEADER_S(vasp_msize,vasp_size,Setup)
public:
- vasp_msize(I argc,t_atom *argv):
+ vasp_msize(I argc,const t_atom *argv):
vasp_size(argc,argv,false)
{
if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0]));
@@ -191,7 +191,7 @@ class vasp_rsize:
FLEXT_HEADER(vasp_rsize,vasp_msize)
public:
- vasp_rsize(I argc,t_atom *argv): vasp_msize(argc,argv) {}
+ vasp_rsize(I argc,const t_atom *argv): vasp_msize(argc,argv) {}
virtual Vasp *x_work()
{
diff --git a/externals/grill/vasp/source/obj_split.cpp b/externals/grill/vasp/source/obj_split.cpp
index 4535bfb1..db489885 100644
--- a/externals/grill/vasp/source/obj_split.cpp
+++ b/externals/grill/vasp/source/obj_split.cpp
@@ -32,7 +32,7 @@ class vasp_split:
FLEXT_HEADER(vasp_split,vasp_op)
public:
- vasp_split(I argc,t_atom *argv)
+ vasp_split(I argc,const t_atom *argv)
{
I cnt = -1;
if(argc) {
@@ -98,7 +98,7 @@ class vasp_join:
FLEXT_HEADER_S(vasp_join,vasp_tx,Setup)
public:
- vasp_join(I argc,t_atom *argv):
+ vasp_join(I argc,const t_atom *argv):
cnt(-1),vi(NULL)
{
if(argc) {
@@ -175,7 +175,7 @@ class vasp_spit:
FLEXT_HEADER(vasp_spit,vasp_op)
public:
- vasp_spit(I argc,t_atom *argv)
+ vasp_spit(I argc,const t_atom *argv)
{
I n = 1;
if(argc >= 1) n = GetAInt(argv[0]);
@@ -237,7 +237,7 @@ class vasp_gather:
FLEXT_HEADER_S(vasp_gather,vasp_tx,Setup)
public:
- vasp_gather(I argc,t_atom *argv)
+ vasp_gather(I argc,const t_atom *argv)
{
cnt = 0;
if(argc >= 1) cnt = GetAInt(argv[0]);
@@ -267,9 +267,9 @@ public:
V m_reset() { ref.Clear(); cdst.Clear(); rem = cnt; }
- virtual I m_set(I argc,t_atom *argv) { rem = cnt; return vasp_tx::m_set(argc,argv); }
+ virtual I m_set(I argc,const t_atom *argv) { rem = cnt; return vasp_tx::m_set(argc,argv); }
- V m_add(I argc,t_atom *argv)
+ V m_add(I argc,const t_atom *argv)
{
cdst += Vasp(argc,argv);
if(cnt && !--rem) m_bang();
diff --git a/externals/grill/vasp/source/obj_sync.cpp b/externals/grill/vasp/source/obj_sync.cpp
index f91131e0..c27ec028 100644
--- a/externals/grill/vasp/source/obj_sync.cpp
+++ b/externals/grill/vasp/source/obj_sync.cpp
@@ -34,7 +34,7 @@ class vasp_sync:
FLEXT_HEADER_S(vasp_sync,vasp_op,Setup)
public:
- vasp_sync(I argc,t_atom *argv):
+ vasp_sync(I argc,const t_atom *argv):
autoreset(true),vasponly(false)
{
I cnt = -1;
diff --git a/externals/grill/vasp/source/obj_vasp.cpp b/externals/grill/vasp/source/obj_vasp.cpp
index 802db581..fdef29bd 100644
--- a/externals/grill/vasp/source/obj_vasp.cpp
+++ b/externals/grill/vasp/source/obj_vasp.cpp
@@ -36,7 +36,7 @@ class vasp_v:
public:
- vasp_v(I argc,t_atom *argv)
+ vasp_v(I argc,const t_atom *argv)
{
m_set(argc,argv);
@@ -53,7 +53,7 @@ public:
FLEXT_CADDMETHOD_(c,1,"radio",a_radio);
}
- V a_radio(I,t_atom *) {}
+ V a_radio(I,const t_atom *) {}
virtual Vasp *x_work() { return new Vasp(ref); }
@@ -174,7 +174,7 @@ class vasp_multi:
public:
- vasp_multi(I argc,t_atom *argv)
+ vasp_multi(I argc,const t_atom *argv)
{
I cnt = -1;
if(argc) {
diff --git a/externals/grill/vasp/source/obj_vecs.cpp b/externals/grill/vasp/source/obj_vecs.cpp
index b55103ae..2b567058 100644
--- a/externals/grill/vasp/source/obj_vecs.cpp
+++ b/externals/grill/vasp/source/obj_vecs.cpp
@@ -33,7 +33,7 @@ class vasp_vector:
FLEXT_HEADER_S(vasp_vector,vasp_tx,Setup)
public:
- vasp_vector(I argc,t_atom *argv):
+ vasp_vector(I argc,const t_atom *argv):
ix(0)
{
if(argc >= 1 && CanbeInt(argv[0]))
diff --git a/externals/grill/vasp/source/opfuns.h b/externals/grill/vasp/source/opfuns.h
index 51b1fd06..7abbec6f 100644
--- a/externals/grill/vasp/source/opfuns.h
+++ b/externals/grill/vasp/source/opfuns.h
@@ -460,7 +460,7 @@ namespace VecOp {
#define DEFOP(T,FUN,OP,KIND) \
-namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND(T,f_##OP<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/opparam.h b/externals/grill/vasp/source/opparam.h
index 473b76c4..1c0193d4 100644
--- a/externals/grill/vasp/source/opparam.h
+++ b/externals/grill/vasp/source/opparam.h
@@ -83,9 +83,9 @@ public:
Arg &SetV(S *r,I rs,S *i = NULL,I is = 0);
Arg &SetE(const Env *bp);
- typedef struct env_t { const Env *env; };
- typedef struct v_t { S *rdt,*idt; I rs,is; };
- typedef struct x_t { R r,i; };
+ struct env_t { const Env *env; };
+ struct v_t { S *rdt,*idt; I rs,is; };
+ struct x_t { R r,i; };
enum { arg_ = 0,arg_x,arg_v,arg_env } argtp;
union {
diff --git a/externals/grill/vasp/source/ops_qminmax.cpp b/externals/grill/vasp/source/ops_qminmax.cpp
index f834c2c3..2e2bcc30 100644
--- a/externals/grill/vasp/source/ops_qminmax.cpp
+++ b/externals/grill/vasp/source/ops_qminmax.cpp
@@ -28,33 +28,41 @@ WARRANTIES, see the file, "license.txt," in this distribution.
\param inlet set - vasp to be stored
\retval outlet float - minimum sample value
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qmin:
- public vasp_unop
+ public vasp_op
{
- FLEXT_HEADER(vasp_qmin,vasp_unop)
+ FLEXT_HEADER(vasp_qmin,vasp_op)
public:
- vasp_qmin(): vasp_unop(true,XletCode(xlet::tp_float,0)) {}
+ vasp_qmin() {
+ AddInAnything();
+ AddOutList();
+ }
- virtual Vasp *do_opt(OpParam &p)
+ virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = BIG;
- CVasp cref(ref);
- Vasp *ret = VaspOp::m_qmin(p,cref);
- if(p.norm.minmax == BIG) p.norm.minmax = 0;
- return ret;
+ Vasp *ret = VaspOp::m_qmin(p,v);
+ delete ret;
+ return p.norm.minmax == BIG?0:p.norm.minmax;
}
- virtual Vasp *tx_work()
+ virtual V m_bang()
{
- OpParam p(thisName(),0);
- Vasp *ret = do_opt(p);
- ToOutFloat(1,p.norm.minmax);
- return ret;
+ if(!ref.Ok()) return;
+
+ AtomList ret(ref.Vectors());
+ OpParam p(thisName(),0);
+
+ for(I i = 0; i < ret.Count(); ++i) {
+ Vasp vasp(ref.Frames(),ref.Vector(i));
+ CVasp ref(vasp);
+ F v = do_opt(p,ref);
+ SetFloat(ret[i],v);
+ }
+ ToOutList(0,ret);
}
virtual V m_help() { post("%s - Get a vasp's minimum sample value",thisName()); }
@@ -70,7 +78,7 @@ FLEXT_LIB("vasp, vasp.min?",vasp_qmin)
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
- \retval outlet float - minimum sample value
+ \retval outlet float - minimum absolute sample value
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
@@ -81,15 +89,14 @@ class vasp_qamin:
{
FLEXT_HEADER(vasp_qamin,vasp_qmin)
public:
- virtual Vasp *do_opt(OpParam &p)
+ virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = BIG;
- CVasp cref(ref);
- Vasp *ret = VaspOp::m_qamin(p,cref);
- if(p.norm.minmax == BIG) p.norm.minmax = 0;
- return ret;
+ Vasp *ret = VaspOp::m_qmin(p,v);
+ delete ret;
+ return p.norm.minmax == BIG?0:p.norm.minmax;
}
-
+
virtual V m_help() { post("%s - Get a vasp's minimum absolute sample value",thisName()); }
};
@@ -104,7 +111,7 @@ FLEXT_LIB("vasp, vasp.amin?",vasp_qamin)
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
- \retval outlet float - minimum sample value
+ \retval outlet float - maximum sample value
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
@@ -115,13 +122,12 @@ class vasp_qmax:
{
FLEXT_HEADER(vasp_qmax,vasp_qmin)
public:
- virtual Vasp *do_opt(OpParam &p)
+ virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = -BIG;
- CVasp cref(ref);
- Vasp *ret = VaspOp::m_qmax(p,cref);
- if(p.norm.minmax == -BIG) p.norm.minmax = 0;
- return ret;
+ Vasp *ret = VaspOp::m_qmax(p,v);
+ delete ret;
+ return p.norm.minmax == -BIG?0:p.norm.minmax;
}
virtual V m_help() { post("%s - Get a vasp's maximum sample value",thisName()); }
@@ -138,7 +144,7 @@ FLEXT_LIB("vasp, vasp.max?",vasp_qmax)
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
- \retval outlet float - minimum sample value
+ \retval outlet float - maximum absolute sample value
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
@@ -149,11 +155,12 @@ class vasp_qamax:
{
FLEXT_HEADER(vasp_qamax,vasp_qmax)
public:
- virtual Vasp *do_opt(OpParam &p)
+ virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = 0;
- CVasp cref(ref);
- return VaspOp::m_qamax(p,cref);
+ Vasp *ret = VaspOp::m_qamax(p,v);
+ delete ret;
+ return p.norm.minmax;
}
virtual V m_help() { post("%s - Get a vasp's maximum absolute sample value",thisName()); }
@@ -171,35 +178,50 @@ FLEXT_LIB("vasp, vasp.amax?",vasp_qamax)
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
- \retval outlet float - minimum sample value
+ \retval outlet list - minimum radius value per complex vector pair
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qrmin:
- public vasp_unop
+ public vasp_op
{
- FLEXT_HEADER(vasp_qrmin,vasp_unop)
-
+ FLEXT_HEADER(vasp_qrmin,vasp_op)
public:
- vasp_qrmin(): vasp_unop(true,XletCode(xlet::tp_float,0)) {}
+ vasp_qrmin() {
+ AddInAnything();
+ AddOutList();
+ }
- virtual Vasp *do_opt(OpParam &p)
+ virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = BIG;
- CVasp cref(ref);
- Vasp *ret = VaspOp::m_qrmin(p,cref);
- if(p.norm.minmax == BIG) p.norm.minmax = 0;
- return ret;
+ Vasp *ret = VaspOp::m_qrmin(p,v);
+ delete ret;
+ return sqrt(p.norm.minmax == BIG?0:p.norm.minmax);
}
- virtual Vasp *tx_work()
+ virtual V m_bang()
{
- OpParam p(thisName(),0);
- Vasp *ret = do_opt(p);
- ToOutFloat(1,sqrt(p.norm.minmax));
- return ret;
+ if(!ref.Ok()) return;
+
+ AtomList ret(ref.Vectors()/2);
+ OpParam p(thisName(),0);
+
+ for(I i = 0; i < ret.Count(); ++i) {
+ Vasp vasp(ref.Frames(),ref.Vector(i*2));
+ vasp.AddVector(ref.Vector(i*2+1));
+ CVasp ref(vasp);
+ F v = do_opt(p,ref);
+ SetFloat(ret[i],v);
+ }
+
+ if(ref.Vectors()%2) {
+ post("%s - omitting dangling vector of complex pairs",thisName());
+ }
+
+ ToOutList(0,ret);
}
virtual V m_help() { post("%s - Get a vasp's minimum complex radius",thisName()); }
@@ -216,7 +238,7 @@ FLEXT_LIB("vasp, vasp.rmin?",vasp_qrmin)
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
- \retval outlet float - minimum sample value
+ \retval outlet float - maximum radius value per complex vector pair
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
@@ -227,11 +249,12 @@ class vasp_qrmax:
{
FLEXT_HEADER(vasp_qrmax,vasp_qrmin)
public:
- virtual Vasp *do_opt(OpParam &p)
+ virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = 0;
- CVasp cref(ref);
- return VaspOp::m_qrmax(p,cref);
+ Vasp *ret = VaspOp::m_qrmax(p,v);
+ delete ret;
+ return sqrt(p.norm.minmax);
}
virtual V m_help() { post("%s - Get a vasp's maximum complex radius",thisName()); }