[Kst] Getdata library
D. V. Wiebe
dwiebe at physics.utoronto.ca
Wed Aug 22 22:11:20 CEST 2007
On Wed, Aug 22, 2007 at 03:52:12PM -0400, Adam D. Hincks wrote:
> >This is a bug. If applications using getdata (viz. kst) want to subtract
> >two from the number of available frames, they need to do that themselves.
> >It shouldn't happen in the library.
> It is a pretty deliberate bug, it looks like. Here's the source:
> nf -= 2;
> if (nf < 0)
> nf = 0;
> Who is in charge of the library -- shall I consider this bug "submitted"?
It's a "bug by design". From kst's point of view, it's the right thing
to do, so when Barth wrote getdata, it went in there so kst would
function properly. Since so much other analysis software now uses the getdata
library, it should be moved out of getdata and into the kst's dirfile
I can do it. I'm nominally in charge of keeping getdata.
> >Are you asking for a GetNSamples, which would take a field name?
> Essentially yes. Something like:
> int GetNSamples(const char *filename_in, const char *field, int frame_num,
> int *error_code);
> But recall, these are _extra_ samples after the last frame. So it would
> have to be able handle something like this:
> n_extra = GetNSamples("/data/dirfile",
> GetNFrames("/data/dirfile", &err, "My_Field"),
> An alternative would be something that always checks past the last frame
> and doesn't have frame_num as an input:
> int GetExtraSamples(const char *filename_in, const char *field, int
I was thinking of something as simple as:
int GetNSamples(const char* filename_in, const char *field,
/* ... */
/* ... */
return (size_on_disk / sizeof(type_on_disk));
which would tell you the total number of samples available for a
given field. Then, to get the extra samples, you can do
n_extra = GetNSamples - GetNFrames * GetSamplesPerFrame;
This is the most generically useful function that returns a number of
samples for a supplied frame, so this is the one I'd prefer to implement.
Don Wiebe dwiebe at physics.utoronto.ca
Department of Physics
University of Toronto Office: ES4150
60 St. George St. Tele: +1-416-946-0946
Toronto ON M5S 1A7 Lab: +1-416-946-0516
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kst/attachments/20070822/fc83d982/attachment.pgp
More information about the Kst