Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
global.h
Go to the documentation of this file.
1
30#pragma once
31
34
35namespace abacus {
36
37
39
58public:
59
61
76 double eps = 1.0e-4,
77 double machineEps = 1.0e-7,
78 double infinity = 1.0e32) :
79 eps_(eps),
80 machineEps_(machineEps),
81 infinity_(infinity),
82 paramTable_(100)
83 {
84 }
85
87 virtual ~AbacusGlobal() {};
88
90
96 friend OGDF_EXPORT std::ostream &operator<<(std::ostream &out, const AbacusGlobal &rhs);
97
98#if 0
100
108#if 0
109 virtual AbaOStream& lout() const;
110#endif
111
113
121#if 0
122 virtual AbaOStream& fout() const;
123#endif
124#endif
125
127 double eps() const { return eps_; }
128
130
133 void eps(double e) { eps_ = e; }
134
136
144 double machineEps() const { return machineEps_; }
145
147
150 void machineEps(double e) { machineEps_ = e; }
151
153
159 double infinity() const {
160 return infinity_;
161 }
162
164
172 void infinity(double x) { infinity_ = x; }
173
174
176
179 bool isInfinity(double x) const {
180 return ( x >= infinity_ );
181 }
182
184
187 bool isMinusInfinity(double x) const {
188 return ( x <= -infinity_ );
189 }
190
192
196 bool equal(double x, double y) const {
197 return ( fabs(x-y) < machineEps_ );
198 }
199
200
202 bool isInteger(double x) const {
203 return isInteger(x, machineEps_);
204 }
205
207 bool isInteger(double x, double eps) const;
208
210
215 void readParameters(const string &fileName);
216
218
224 void insertParameter(const char *name, const char *value);
225
227
238 int getParameter(const char *name, int &param) const;
239 int getParameter(const char *name, unsigned int &param) const;
240 int getParameter(const char *name, double &param) const;
241 int getParameter(const char *name, string &param) const;
242 int getParameter(const char *name, bool &param) const;
243 int getParameter(const char *name, char &param) const;
244
246
269 int &param,
270 const char *name,
271 int minVal,
272 int maxVal) const;
273
276 unsigned &param,
277 const char *name,
278 unsigned minVal,
279 unsigned maxVal) const;
280
283 double &param,
284 const char *name,
285 double minVal,
286 double maxVal) const;
287
289 void assignParameter(bool &param, const char *name) const;
290
292
302 string &param,
303 const char *name,
304 unsigned nFeasible = 0,
305 const char *feasible[] = nullptr) const;
306
308
314 void assignParameter(char &param, const char *name,
315 const char *feasible=nullptr) const;
316
318
329 int &param,
330 const char *name,
331 int minVal,
332 int maxVal,
333 int defVal) const;
334
337 unsigned &param,
338 const char *name,
339 unsigned minVal,
340 unsigned maxVal,
341 unsigned defVal) const;
342
345 double &param,
346 const char *name,
347 double minVal,
348 double maxVal,
349 double defVal) const;
350
352 void assignParameter(bool &param, const char *name, bool defVal) const;
353
355
366 string &param,
367 const char *name,
368 unsigned nFeasible,
369 const char *feasible[],
370 const char *defVal) const;
371
373
379 void assignParameter(char &param, const char *name,
380 const char *feasible, char defVal) const;
381
383
397 int findParameter(const char *name, unsigned nFeasible, const int *feasible) const;
398
400 int findParameter(const char *name,
401 unsigned nFeasible, const char *feasible[]) const;
402
404 int findParameter(const char *name,const char *feasible) const;
405
406private:
407
408 double eps_;
409
411
416
417 double infinity_;
418
420
423};
424
425}
Hash tables.
Definition hash.h:124
Global data and functions.
Definition global.h:57
void eps(double e)
Sets the zero tolerance to e.
Definition global.h:133
friend std::ostream & operator<<(std::ostream &out, const AbacusGlobal &rhs)
The output operator writes some of the data members to an ouput stream out.
int findParameter(const char *name, const char *feasible) const
See AbacusGlobal::findParameter(const char *name, unsigned nFeasible, const int *feasible) for descri...
virtual ~AbacusGlobal()
The destructor.
Definition global.h:87
double machineEps_
The machine dependent zero tolerance, which is used to , e.g., to test if a floating point value is 0...
Definition global.h:415
void assignParameter(string &param, const char *name, unsigned nFeasible, const char *feasible[], const char *defVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
void machineEps(double e)
Sets the machine dependent zero tolerance to e.
Definition global.h:150
bool equal(double x, double y) const
Returns whether the absolute difference between x and y is less than the machine dependent zero toler...
Definition global.h:196
void assignParameter(string &param, const char *name, unsigned nFeasible=0, const char *feasible[]=nullptr) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
int findParameter(const char *name, unsigned nFeasible, const int *feasible) const
Searches for parameter name in the parameter table.
void assignParameter(double &param, const char *name, double minVal, double maxVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
void assignParameter(unsigned &param, const char *name, unsigned minVal, unsigned maxVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
double infinity_
An "infinite" big number.
Definition global.h:417
int getParameter(const char *name, int &param) const
Searches for parameter name in the parameter table and returns its value in param.
void assignParameter(char &param, const char *name, const char *feasible, char defVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
void assignParameter(double &param, const char *name, double minVal, double maxVal, double defVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
int getParameter(const char *name, double &param) const
void readParameters(const string &fileName)
Opens the parameter file fileName, reads all parameters, and inserts them in the parameter table.
void assignParameter(bool &param, const char *name) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
int getParameter(const char *name, char &param) const
void assignParameter(unsigned &param, const char *name, unsigned minVal, unsigned maxVal, unsigned defVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
AbacusGlobal(double eps=1.0e-4, double machineEps=1.0e-7, double infinity=1.0e32)
The constructor.
Definition global.h:75
double eps() const
Returns the zero tolerance.
Definition global.h:127
int getParameter(const char *name, unsigned int &param) const
double infinity() const
Provides a floating point value of "infinite" size.
Definition global.h:159
bool isInteger(double x) const
Returns whether the value x differs at most by the machine dependent zero tolerance from an integer v...
Definition global.h:202
int findParameter(const char *name, unsigned nFeasible, const char *feasible[]) const
See AbacusGlobal::findParameter(const char *name, unsigned nFeasible, const int *feasible) for descri...
void assignParameter(char &param, const char *name, const char *feasible=nullptr) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
AbaHash< string, string > paramTable_
Definition global.h:419
void assignParameter(int &param, const char *name, int minVal, int maxVal, int defVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
void assignParameter(int &param, const char *name, int minVal, int maxVal) const
Searches for parameter name in the parameter table and returns its value in param.
bool isMinusInfinity(double x) const
Returns true if x is regarded as infinite small, false otherwise.
Definition global.h:187
int getParameter(const char *name, string &param) const
double eps_
A zero tolerance.
Definition global.h:408
bool isInfinity(double x) const
Returns true if x is regarded as "infinite" large, false otherwise.
Definition global.h:179
int getParameter(const char *name, bool &param) const
void insertParameter(const char *name, const char *value)
Inserts parameter name with value value into the parameter table.
void infinity(double x)
Sets the "infinite value" to x.
Definition global.h:172
AbacusGlobal(const AbacusGlobal &rhs)
void assignParameter(bool &param, const char *name, bool defVal) const
See AbacusGlobal::assignParameter(int&,const char*,int,int) for a description.
bool isInteger(double x, double eps) const
Returns whether the value x differs at most by eps from an integer value.
double machineEps() const
Provides a machine dependent zero tolerance.
Definition global.h:144
const AbacusGlobal & operator=(const AbacusGlobal &rhs)
Base class of all other classes of ABACUS.
Definition abacusroot.h:68
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
hash table.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()