ndm 0.2.8
Loading...
Searching...
No Matches
NDM::Axis Class Reference

Axis object in n-dimensional space. More...

#include <Axis.hh>

Public Types

enum  EMode { kAligned = 0 , kFixed = 1 }
 Mode for axis. More...
 

Public Member Functions

 Axis (double min=0.0, double max=1.0, EMode mode=kAligned, double delta=1)
 
virtual ~Axis ()
 
void print () const
 Prints axis info.
 
void find (double v, double &min, double &max, std::string &path, int levelrequest=-1, int levelmax=100)
 Find bin and print info for given value.
 
void expand (char direction='>', int power=1)
 Expand range.
 
void shrink (char direction='>', int power=1)
 Shrink range.
 
void min (double m)
 Sets user defined minimum.
 
void max (double m)
 Sets user defined maximum.
 
void is_bin (bool b)
 Sets user defined maximum.
 
void minmax (double min, double max)
 Sets user defined minimum and maximum.
 
void level (unsigned int l)
 Sets level.
 
double min () const
 Returns user defined minimum.
 
double max () const
 Returns user defined maximum.
 
bool is_bin () const
 Returns user defined maximum.
 
double maxb () const
 Returns internal maximum.
 
double maxb_user () const
 Returns internal maximum2.
 
void info (std::string i)
 Sets info string.
 
std::string info () const
 Returns info string.
 
double to_user (double v) const
 Convert interal to user format.
 
double to_internal (double v) const
 Convert user to internal format.
 
unsigned int level () const
 Returns level.
 
void split (std::vector< double > &mins, int level)
 

Private Member Functions

int decimels_right (double num, double mult=10, double min=0.01, double max=0.99)
 
int decimels_left (double num, double mult=10, double min=0.01)
 
void find (double &v, int &levelrequest, int &levelmax, int &currentlevel, double &min, double &max, std::string &path)
 
void modify_range (char direction='>', int power=1)
 
void recalculate_range ()
 

Private Attributes

double mMin {0.0}
 User defined minimum.
 
double mMax {1.0}
 User defined maximum.
 
bool mIsBin {false}
 Min max is in bin/user format.
 
EMode mMode {kAligned}
 Axis mode.
 
double mMaxB {1}
 Internal maximum.
 
double mShift {0}
 Shift to the internal min/max parameters.
 
double mMultiply {1}
 Multiply to the internal min/max parameters.
 
unsigned int mLevel {0}
 Level of division.
 
double mMinDelta {1}
 Minimal delta of axis range.
 
std::string mInfo {}
 Some additional info for axis.
 

Detailed Description

Axis object in n-dimensional space.

Author
Martin Vala vala..nosp@m.mart.nosp@m.in@gm.nosp@m.ail..nosp@m.com

Definition at line 12 of file Axis.hh.

Member Enumeration Documentation

◆ EMode

Mode for axis.

Definition at line 15 of file Axis.hh.

Constructor & Destructor Documentation

◆ Axis()

NDM::Axis::Axis ( double min = 0.0,
double max = 1.0,
EMode mode = kAligned,
double delta = 1 )

Constructor

Definition at line 10 of file Axis.cc.

References max(), min(), mMax, mMin, mMinDelta, mMode, and recalculate_range().

◆ ~Axis()

NDM::Axis::~Axis ( )
virtual

Destructor

Definition at line 26 of file Axis.cc.

Member Function Documentation

◆ decimels_left()

int NDM::Axis::decimels_left ( double num,
double mult = 10,
double min = 0.01 )
private

Calculate number of decimels on left side of dot

Definition at line 245 of file Axis.cc.

References min().

Referenced by recalculate_range().

◆ decimels_right()

int NDM::Axis::decimels_right ( double num,
double mult = 10,
double min = 0.01,
double max = 0.99 )
private

Calculate number of decimels on rigth side of dot

Definition at line 225 of file Axis.cc.

References max(), and min().

Referenced by recalculate_range().

◆ expand()

void NDM::Axis::expand ( char direction = '>',
int power = 1 )

Expand range.

Expand range by 2^power to left '<' or right '>' direction

Definition at line 156 of file Axis.cc.

References modify_range().

◆ find() [1/2]

void NDM::Axis::find ( double & v,
int & levelrequest,
int & levelmax,
int & currentlevel,
double & min,
double & max,
std::string & path )
private

Find bin and print info for given value with maximum depth 'levelmax'

Definition at line 116 of file Axis.cc.

References find(), max(), min(), mMinDelta, and to_user().

◆ find() [2/2]

void NDM::Axis::find ( double v,
double & min,
double & max,
std::string & path,
int levelrequest = -1,
int levelmax = 100 )

Find bin and print info for given value.

Find bin and print info for given value with maximum depth 'levelmax'

Definition at line 83 of file Axis.cc.

References find(), max(), maxb(), min(), mMax, mMin, to_internal(), and to_user().

Referenced by find(), and find().

◆ info() [1/2]

std::string NDM::Axis::info ( ) const
inline

Returns info string.

Definition at line 54 of file Axis.hh.

References mInfo.

◆ info() [2/2]

void NDM::Axis::info ( std::string i)
inline

Sets info string.

Definition at line 52 of file Axis.hh.

References mInfo.

Referenced by NDM::Config::load().

◆ is_bin() [1/2]

bool NDM::Axis::is_bin ( ) const
inline

Returns user defined maximum.

Definition at line 45 of file Axis.hh.

References mIsBin.

◆ is_bin() [2/2]

void NDM::Axis::is_bin ( bool b)
inline

Sets user defined maximum.

Definition at line 34 of file Axis.hh.

References mIsBin.

Referenced by NDM::Config::load().

◆ level() [1/2]

unsigned int NDM::Axis::level ( ) const
inline

Returns level.

Definition at line 62 of file Axis.hh.

References mLevel.

◆ level() [2/2]

void NDM::Axis::level ( unsigned int l)
inline

Sets level.

Definition at line 38 of file Axis.hh.

References mLevel.

Referenced by split().

◆ max() [1/2]

double NDM::Axis::max ( ) const
inline

Returns user defined maximum.

Definition at line 43 of file Axis.hh.

References mMax.

◆ max() [2/2]

void NDM::Axis::max ( double m)
inline

Sets user defined maximum.

Definition at line 32 of file Axis.hh.

References mMax.

Referenced by Axis(), decimels_right(), find(), find(), and minmax().

◆ maxb()

double NDM::Axis::maxb ( ) const
inline

Returns internal maximum.

Definition at line 47 of file Axis.hh.

References mMaxB.

Referenced by find().

◆ maxb_user()

double NDM::Axis::maxb_user ( ) const
inline

Returns internal maximum2.

Definition at line 49 of file Axis.hh.

References mMax, mMultiply, and mShift.

Referenced by print(), and recalculate_range().

◆ min() [1/2]

double NDM::Axis::min ( ) const
inline

Returns user defined minimum.

Definition at line 41 of file Axis.hh.

References mMin.

◆ min() [2/2]

void NDM::Axis::min ( double m)
inline

Sets user defined minimum.

Definition at line 30 of file Axis.hh.

References mMin.

Referenced by Axis(), decimels_left(), decimels_right(), find(), find(), and minmax().

◆ minmax()

void NDM::Axis::minmax ( double min,
double max )

Sets user defined minimum and maximum.

Setting min and max

Definition at line 74 of file Axis.cc.

References max(), min(), mMax, and mMin.

◆ modify_range()

void NDM::Axis::modify_range ( char direction = '>',
int power = 1 )
private

Modify (expand/shrink) range by 2^power ('+' for up or '-'for down) to left '<' or right '>' direction

Definition at line 172 of file Axis.cc.

References mMax, mMaxB, mMin, print(), and recalculate_range().

Referenced by expand(), and shrink().

◆ print()

void NDM::Axis::print ( ) const

Prints axis info.

Print axis information

Definition at line 215 of file Axis.cc.

References maxb_user(), mLevel, mMax, mMaxB, mMin, mMode, mMultiply, and mShift.

Referenced by modify_range().

◆ recalculate_range()

void NDM::Axis::recalculate_range ( )
private

Recalculate range correctly

Definition at line 33 of file Axis.cc.

References decimels_left(), decimels_right(), maxb_user(), mMax, mMaxB, mMin, mMode, mMultiply, and mShift.

Referenced by Axis(), and modify_range().

◆ shrink()

void NDM::Axis::shrink ( char direction = '>',
int power = 1 )

Shrink range.

Shrink range by 2^power to left '<' or right '>' direction

Definition at line 164 of file Axis.cc.

References modify_range().

◆ split()

void NDM::Axis::split ( std::vector< double > & mins,
int level )

Returns list of minimums for specific level

Definition at line 266 of file Axis.cc.

References level(), mMax, mMaxB, to_internal(), and to_user().

Referenced by NDM::Space::points().

◆ to_internal()

double NDM::Axis::to_internal ( double v) const
inline

Convert user to internal format.

Definition at line 59 of file Axis.hh.

References mMultiply, and mShift.

Referenced by find(), and split().

◆ to_user()

double NDM::Axis::to_user ( double v) const
inline

Convert interal to user format.

Definition at line 57 of file Axis.hh.

References mMultiply, and mShift.

Referenced by find(), find(), and split().

Member Data Documentation

◆ mInfo

std::string NDM::Axis::mInfo {}
private

Some additional info for axis.

Definition at line 75 of file Axis.hh.

Referenced by info(), and info().

◆ mIsBin

bool NDM::Axis::mIsBin {false}
private

Min max is in bin/user format.

Definition at line 68 of file Axis.hh.

Referenced by is_bin(), and is_bin().

◆ mLevel

unsigned int NDM::Axis::mLevel {0}
private

Level of division.

Definition at line 73 of file Axis.hh.

Referenced by level(), level(), and print().

◆ mMax

double NDM::Axis::mMax {1.0}
private

User defined maximum.

Definition at line 67 of file Axis.hh.

Referenced by Axis(), find(), max(), max(), maxb_user(), minmax(), modify_range(), print(), recalculate_range(), and split().

◆ mMaxB

double NDM::Axis::mMaxB {1}
private

Internal maximum.

Definition at line 70 of file Axis.hh.

Referenced by maxb(), modify_range(), print(), recalculate_range(), and split().

◆ mMin

double NDM::Axis::mMin {0.0}
private

User defined minimum.

Definition at line 66 of file Axis.hh.

Referenced by Axis(), find(), min(), min(), minmax(), modify_range(), print(), and recalculate_range().

◆ mMinDelta

double NDM::Axis::mMinDelta {1}
private

Minimal delta of axis range.

Definition at line 74 of file Axis.hh.

Referenced by Axis(), and find().

◆ mMode

EMode NDM::Axis::mMode {kAligned}
private

Axis mode.

Definition at line 69 of file Axis.hh.

Referenced by Axis(), print(), and recalculate_range().

◆ mMultiply

double NDM::Axis::mMultiply {1}
private

Multiply to the internal min/max parameters.

Definition at line 72 of file Axis.hh.

Referenced by maxb_user(), print(), recalculate_range(), to_internal(), and to_user().

◆ mShift

double NDM::Axis::mShift {0}
private

Shift to the internal min/max parameters.

Definition at line 71 of file Axis.hh.

Referenced by maxb_user(), print(), recalculate_range(), to_internal(), and to_user().


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