diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2002-12-17 04:36:31 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2002-12-17 04:36:31 +0000 |
commit | a5b45e8e2e99686ea73fa2793d7fec84f0d1a3ed (patch) | |
tree | 4b31406382bacd13aa784ea22d584ac634f8d8ad /externals/grill/vasp/source/vasp.cpp | |
parent | a0cb0bd2e02740e50ec16dde2fb4e07f1702d1d0 (diff) |
""
svn path=/trunk/; revision=303
Diffstat (limited to 'externals/grill/vasp/source/vasp.cpp')
-rw-r--r-- | externals/grill/vasp/source/vasp.cpp | 73 |
1 files changed, 48 insertions, 25 deletions
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; +} + |