ivutils
Loading...
Searching...
No Matches
QPLTRecord Class Reference

Access to QPLT data format. More...

#include <loggerio.h>

Inheritance diagram for QPLTRecord:
Collaboration diagram for QPLTRecord:

Public Member Functions

 QPLTRecord (size_t ds=sizeof(double), size_t dlen=1)
 constructor parameter dlen is the length of each slice
 
virtual int SetDimensions (int D_, int dims_[4], const std::vector< std::string > *names_=NULL, const Vector_3 *b0_=NULL, const Vector_3 *b1_=NULL) override
 Sets dimensions for displaying data.
 
virtual void CopyHeader (const SeqRecord &orig) override
 Copies data_size and seqlen from left argumnet to the right one.
 
virtual int ReadHeaderFromFile (const std::string &name) override
 Reads seqlen form file name and calculates data_size by means of numslices and seqlen written there.
 
virtual int OpenRecord (const std::string &name, const char *mode="w", const int shift=-1) override
 opens a file if the mode is "w" then replaces the old file if it exists and starts new record if the mode is "a" then appends the old file if it exists (after checking format ) or starts new record if not if the mode is "r" analyses the given file (checks it format) and can perform GetData() if the mode is "ar" can do both reading and appending other combinations of r and w are not supported record will start from shift slice
 
virtual int AppendData (const void *rec, size_t arrlen=1, bool recorded=true) override
 appends next arrlen records to a file from rec array if arrlen exceeds the maximum number left for current slice, appends the correct number of elements only DATA IS APPENDED BY COPYING FROM MEMORY (using fwrite) <- this behaviour may be changed in the future... returns the number of elements appended
 
virtual int SetTextHeader (const std::string &head_) override
 Set slice (frame) text header .
 
virtual int NextSlice (bool recorded=true) override
 switches to the next slice
 
virtual int CloseRecord () override
 closes the file
 
int GetData (void *rec, size_t slicenum, size_t beg=0, size_t end=0) override
 gets data from slice slicenum starting from beg till end all counters start from zero returns the number of elements read
 
- Public Member Functions inherited from SeqRecord
 SeqRecord (size_t ds=sizeof(double), size_t dlen=1, bool if_header_=true)
 constructor parameter dlen is the length of each slice
 
int SetDataSize (size_t ds)
 returns -2 if file is open: can't change existing file
 
virtual int SetSliceLookup (const std::vector< int > &slookup_, ptrdiff_t numslice_limit=-1)
 Lookup for slice number shift with respect to current position.
 
const size_t GetCurrentSlice () const
 Gets the current slice (frame) being recorded.
 

Protected Attributes

uint32_t D
 grid dimension
 
uint32_t dims [4]
 grid sizes for dimensions 0...D-1
 
size_t full_hsz
 full header size
 
Vector_3 b0
 Real space mesh limits.
 
std::string text_head
 information to put in each frame
 
- Protected Attributes inherited from SeqRecord
size_t data_size
 length of unit data in bytes
 
size_t seqlen
 length of the data sequence
 
FILE * file
 current file
 
size_t rest
 the maximum number left for the last slice
 
size_t numslices
 the current number of slices
 
bool if_header
 presence of header at the begining of the file
 
long long pos
 position in file
 
size_t full_hsz
 full header size
 
ptrdiff_t numlim = -1
 num slices limit for the file, -1 if not used
 
std::vector< int > slookup
 slice shift lookup table
 
int max_slice_shift = 0
 span of slice shifts (positive only)
 

Detailed Description

Access to QPLT data format.

Member Function Documentation

◆ CloseRecord()

virtual int QPLTRecord::CloseRecord ( )
inlineoverridevirtual

closes the file

Returns
the current slice number

Reimplemented from SeqRecord.

◆ NextSlice()

virtual int QPLTRecord::NextSlice ( bool  recorded = true)
inlineoverridevirtual

switches to the next slice

Returns
the current slice number or <0 in case of error

Reimplemented from SeqRecord.

◆ OpenRecord()

virtual int QPLTRecord::OpenRecord ( const std::string &  name,
const char *  mode = "w",
const int  shift = -1 
)
inlineoverridevirtual

opens a file if the mode is "w" then replaces the old file if it exists and starts new record if the mode is "a" then appends the old file if it exists (after checking format ) or starts new record if not if the mode is "r" analyses the given file (checks it format) and can perform GetData() if the mode is "ar" can do both reading and appending other combinations of r and w are not supported record will start from shift slice

Returns
the current slice number, -2 if file is already open

Reimplemented from SeqRecord.

◆ ReadHeaderFromFile()

virtual int QPLTRecord::ReadHeaderFromFile ( const std::string &  name)
inlineoverridevirtual

Reads seqlen form file name and calculates data_size by means of numslices and seqlen written there.

This function was produced to automaticaly detect SeqRecord parameters for a file. The function does neither set file parameter nor the numslices feild of SeqRecord rec.

Reimplemented from SeqRecord.

◆ SetDimensions()

virtual int QPLTRecord::SetDimensions ( int  D_,
int  dims_[4],
const std::vector< std::string > *  names_ = NULL,
const Vector_3 b0_ = NULL,
const Vector_3 b1_ = NULL 
)
inlineoverridevirtual

Sets dimensions for displaying data.

Flips according to QPLT format (x axis is the first changing). Vectors

  • b0 and
  • b1 define mesh box coordinates.

Reimplemented from SeqRecord.

◆ SetTextHeader()

virtual int QPLTRecord::SetTextHeader ( const std::string &  head_)
inlineoverridevirtual

Set slice (frame) text header .

Supported by QPLT format. The information will be used while writing the next slice header.

Reimplemented from SeqRecord.


The documentation for this class was generated from the following file: