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.
mglDataV
¶represent variable with values equidistantly distributed in given range.
mglDataV
:
mglDataV (const mglDataV &
d)
¶Copy constructor.
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.
mglDataV
: void
Create (long
nx=1
, long
ny=1
, long
nz=1
)
¶Set "sizes" nxxnyxnz.
mglDataV
: void
Fill (mreal
x1, mreal
x2=NaN
, char
dir='x'
)
¶Set ranges of the variable.
mglDataV
: void
Freq (mreal
dp, char
dir='x'
)
¶Set as frequency variable with increment dp.
mglDataF
¶represent function which values are evaluated (instead of access to data array as in mglData
).
mglDataF
:
mglDataF (const mglDataF &
d)
¶Copy constructor.
mglDataF
:
mglDataF (long
nx=1
, long
ny=1
, long
nz=1
)
¶Create variable with "sizes" nxxnyxnz with zero function.
mglDataF
: void
Create (long
nx=1
, long
ny=1
, long
nz=1
)
¶Set "sizes" nxxnyxnz.
mglDataF
: void
SetRanges (mglPoint
p1, mglPoint
p2)
¶Set ranges for internal x,y,z variables.
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.
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.
mglDataT
¶represent named reference to column of another data array.
mglDataT
:
mglDataT (const mglDataT &
d)
¶Copy constructor.
mglDataT
:
mglDataT (const mglDataA &
d, long
col=0
)
¶Create variable which reference col-th column of data d.
mglDataT
: void
SetInd (long
col, wchar_t
name)
¶mglDataT
: void
SetInd (long
col, const wchar_t *
name)
¶Set reference to another column of the same data and its name.
mglDataR
¶represent named reference to row of another data array.
mglDataR
:
mglDataR (const mglDataR &
d)
¶Copy constructor.
mglDataR
:
mglDataR (const mglDataA &
d, long
row=0
)
¶Create variable which reference row-th row of data d.
mglDataR
: void
SetInd (long
row, wchar_t
name)
¶mglDataR
: void
SetInd (long
row, const wchar_t *
name)
¶Set reference to another row of the same data and its name.
mglDataW
¶represent FFT frequency as data array.
mglDataW
:
mglDataW (const mglDataW &
d)
¶Copy constructor.
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.
mglDataR
: void
Freq (double
dp, char
dir='x'
)
¶Equidistantly fill the data with step dp in direction dir.
mglDataS
¶incapsulate std::vector and present it as data array.
mglDataS
: std::vector<mreal>
dat ¶Data array itself.
mglDataS
:
mglDataS (const mglDataS &
d)
¶Copy constructor.
mglDataS
:
mglDataS (const std::vector<mreal> &
d)
¶Create copy data from d.
mglDataS
:
mglDataS (size_t
s)
¶Allocate memory for s .
mglDataS
: void
reserve (size_t
num)
¶Reserve space for num elements.
mglDataS
: void
push_back (double
v)
¶Appends value v to the end of data.