7.13 Special data classes

This section describe special data classes mglDataV, mglDataF, mglDataT and mglDataR which sometime can noticeable speed up drawing or data handling. These classes are defined in #include <mgl2/data.h>. Note, that all plotting and data handling routines can be done using usual mglData or mglDataC classes. Also these special classes are usable in C++ code only.

Class mglDataV

represent variable with values equidistantly distributed in given range.

Constructor on mglDataV: mglDataV (const mglDataV & d)

Copy constructor.

Constructor on mglDataV: mglDataV (long nx=1, long ny=1, long nz=1, mreal v1=0, mreal v2=NaN, char dir='x')

Create variable with "sizes" nxxnyxnz which changes from v1 to v2 (or is constant if v2=NaN) along dir direction.

Method on mglDataV: void Create (long nx=1, long ny=1, long nz=1)

Set "sizes" nxxnyxnz.

Method on mglDataV: void Fill (mreal x1, mreal x2=NaN, char dir='x')

Set ranges of the variable.

Method on mglDataV: void Freq (mreal dp, char dir='x')

Set as frequency variable with increment dp.

Class mglDataF

represent function which values are evaluated (instead of access to data array as in mglData).

Constructor on mglDataF: mglDataF (const mglDataF & d)

Copy constructor.

Constructor on mglDataF: mglDataF (long nx=1, long ny=1, long nz=1)

Create variable with "sizes" nxxnyxnz with zero function.

Method on mglDataF: void Create (long nx=1, long ny=1, long nz=1)

Set "sizes" nxxnyxnz.

Method on mglDataF: void SetRanges (mglPoint p1, mglPoint p2)

Set ranges for internal x,y,z variables.

Method on mglDataF: void SetFormula (const char *func)

Set string which will be evaluated at function calls. Note this variant is about 10 times slower than SetFunc() one.

Method on mglDataF: void SetFunc (mreal (*f)(mreal x,mreal y,mreal z,void *p), void *p=NULL)

Set pointer to function which will be used for data.

Class mglDataT

represent named reference to column of another data array.

Constructor on mglDataT: mglDataT (const mglDataT & d)

Copy constructor.

Constructor on mglDataT: mglDataT (const mglDataA & d, long col=0)

Create variable which reference col-th column of data d.

Method on mglDataT: void SetInd (long col, wchar_t name)
Method on mglDataT: void SetInd (long col, const wchar_t * name)

Set reference to another column of the same data and its name.

Class mglDataR

represent named reference to row of another data array.

Constructor on mglDataR: mglDataR (const mglDataR & d)

Copy constructor.

Constructor on mglDataR: mglDataR (const mglDataA & d, long row=0)

Create variable which reference row-th row of data d.

Method on mglDataR: void SetInd (long row, wchar_t name)
Method on mglDataR: void SetInd (long row, const wchar_t * name)

Set reference to another row of the same data and its name.

Class mglDataW

represent FFT frequency as data array.

Constructor on mglDataW: mglDataW (const mglDataW & d)

Copy constructor.

Constructor on mglDataW: mglDataW (long xx=1, long yy=1, long zz=1, double dp=0, char dir='x')

Set frequency sizes, direction dir and increment dp.

Method on mglDataR: void Freq (double dp, char dir='x')

Equidistantly fill the data with step dp in direction dir.

Class mglDataS

incapsulate std::vector and present it as data array.

Variable of mglDataS: std::vector<mreal> dat

Data array itself.

Constructor on mglDataS: mglDataS (const mglDataS & d)

Copy constructor.

Constructor on mglDataS: mglDataS (const std::vector<mreal> & d)

Create copy data from d.

Constructor on mglDataS: mglDataS (size_t s)

Allocate memory for s .

Method on mglDataS: void reserve (size_t num)

Reserve space for num elements.

Method on mglDataS: void push_back (double v)

Appends value v to the end of data.