From 28d14094386a69ddf05ca810114538fb2c31f8c7 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 9 Apr 2003 02:40:20 +0000 Subject: "" svn path=/trunk/; revision=554 --- externals/grill/vasp/source/obj_chns.cpp | 52 ++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'externals/grill/vasp/source/obj_chns.cpp') 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) + + -- cgit v1.2.1