35 #include "hurricane/Commons.h"
46 enum FunctionFlags { NoFlags = 0
47 , NoTechnoUpdate = (1<<0)
60 , SmartTruncate = (1<<4)
70 static void checkGridBound (
double value );
71 static void checkLambdaBound (
double value );
72 static void checkPhysicalBound (
double value,
UnitPower p );
78 static inline Unit fromMicrons (
double value );
79 static inline Unit fromNanos (
double value );
82 static inline Unit grid (
double value );
84 static inline Unit physicalToDbu (
double value,
UnitPower p );
89 static void setPrecision (
unsigned int precision,
unsigned int flags=NoFlags );
91 static double getUnitPower (
UnitPower p );
92 static void setPhysicalsPerGrid (
double gridsPerLambda,
UnitPower p );
93 static double getPhysicalsPerGrid ();
94 static double physicalToGrid (
double physical,
UnitPower p );
96 static inline DbU::Unit getPolygonStep ();
97 static inline void setPolygonStep (
DbU::Unit );
115 static inline double toGrid (
double u );
117 static inline double toLambda (
double u );
120 static inline double toMicrons (
Unit u );
121 static inline double toNanos (
Unit u );
125 static inline double getGrid (
double u );
127 static inline double getLambda (
double u );
129 static inline double getPhysical (
double u,
UnitPower p );
131 static string getValueString (
double u,
int mode=SmartTruncate );
132 static Record* getValueRecord (
const Unit* u );
133 static Slot* getValueSlot (
const string& name,
const Unit* u );
135 static void getStringMode (
unsigned int& mode,
UnitPower& p );
137 static void _updateBounds ();
141 static const Unit Min;
142 static const Unit Max;
145 static const unsigned int _maximalPrecision;
146 static unsigned int _precision;
147 static double _resolution;
148 static double _gridsPerLambda;
149 static double _physicalsPerGrid;
150 static unsigned int _stringMode;
155 static double _gridMax;
156 static double _lambdaMax;
157 static double _physicalMax;
171 inline double DbU::toGrid (
double u ) {
return _resolution*u; }
175 inline double DbU::toPhysical (
double u, UnitPower p ) {
return (_physicalsPerGrid*_resolution*u)/getUnitPower(p); }
176 inline double DbU::toMicrons ( Unit u ) {
return toPhysical(u,UnitPower::Micro); }
177 inline double DbU::toNanos ( Unit u ) {
return toPhysical(u,UnitPower::Nano); }
178 inline DbU::Unit DbU::getPolygonStep () {
return _polygonStep; }
191 inline double DbU::getPhysical (
double u, UnitPower p ) {
return toPhysical(u,p); }
195 inline void DbU::setPolygonStep (
DbU::Unit step ) { _polygonStep = step; }
199 {
DbU::Unit modulo = u % step;
return (modulo) ? (u + step - modulo) : u; }
202 {
DbU::Unit modulo = u % step;
return (modulo) ? (u - modulo) : u; }
213 inline std::string getString (
const std::pair<Hurricane::DbU::Unit,Hurricane::DbU::Unit>& p )
215 return "const std::pair<DbU::Unit,DbU::Unit>";
220 inline Hurricane::Record* getRecord (
const std::pair<Hurricane::DbU::Unit,Hurricane::DbU::Unit>& p )
222 Hurricane::Record* record = NULL;
223 record =
new Hurricane::Record (
"const std::pair<DbU::Unit,DbU::Unit>" );
224 record->add( Hurricane::DbU::getValueSlot(
"first" , &p.first ) );
225 record->add( Hurricane::DbU::getValueSlot(
"second", &p.second) );
231 inline std::string getString (
const std::array<Hurricane::DbU::Unit*,3>& a )
233 return "const array<DbU::Unit*,3>";
238 inline Hurricane::Record* getRecord (
const std::array<Hurricane::DbU::Unit*,3>& a )
240 Hurricane::Record* record = NULL;
241 record =
new Hurricane::Record (
"const array<DbU::Unit*,3>" );
243 for (
size_t i=0 ; i<a.size() ; ++i ) {
244 std::string label =
"[" + getString(i) +
"] ";
245 record->add( Hurricane::DbU::getValueSlot(label, a[i]) );
252 inline std::string getString (
const std::vector<Hurricane::DbU::Unit>* v )
254 std::string name =
"const std::vector<DbU::Unit>:";
255 return name + getString<size_t>(v->size());
260 inline Hurricane::Record* getRecord (
const std::vector<Hurricane::DbU::Unit>* v )
262 Hurricane::Record* record = NULL;
263 record =
new Hurricane::Record (
"const vector<DbU::Unit>" );
265 for (
size_t i=0 ; i<v->size() ; ++i ) {
266 std::string label =
"[" + getString(i) +
"] ";
267 record->add( Hurricane::DbU::getValueSlot(label, &(*v)[i]) );
The whole DataBase (API).
Definition: DataBase.h:40
DataBase Unit managment (API).
Definition: DbU.h:43
static DbU::Unit getRealSnapGridStep()
SnapMode
Definition: DbU.h:62
@ Nearest
Definition: DbU.h:64
@ Inferior
Definition: DbU.h:62
@ Superior
Definition: DbU.h:63
static Unit fromPhysical(double value, UnitPower p)
Definition: DbU.h:166
static double getResolution()
static Unit grid(double value)
Definition: DbU.h:182
static void setRealSnapGridStep(DbU::Unit step)
Definition: DbU.h:193
static double toGrid(Unit u)
Definition: DbU.h:170
static Unit fromGrid(double value)
Definition: DbU.h:164
static Unit getDb(Unit u)
Definition: DbU.h:185
static double toLambda(Unit u)
Definition: DbU.h:172
static Unit fromLambda(double value)
Definition: DbU.h:165
std::int64_t Unit
Definition: DbU.h:67
UnitPower
Definition: DbU.h:49
@ Nano
Definition: DbU.h:50
@ Pico
Definition: DbU.h:49
@ Kilo
Definition: DbU.h:54
@ Micro
Definition: DbU.h:51
@ Milli
Definition: DbU.h:52
@ Unity
Definition: DbU.h:53
static unsigned int getPrecision()
static DbU::Unit getSymbolicSnapGridStep()
StringMode
Definition: DbU.h:56
@ Symbolic
Definition: DbU.h:58
@ Grid
Definition: DbU.h:57
static DbU::Unit getOnCustomGrid(DbU::Unit u, DbU::Unit step, SnapMode mode=Nearest)
static DbU::Unit getOnRealSnapGrid(DbU::Unit u, SnapMode mode=Nearest)
static unsigned int getMaximalPrecision()
static void setStringMode(unsigned int mode, UnitPower p=Nano)
static DbU::Unit getOnPhysicalGrid(DbU::Unit u, SnapMode mode=Superior)
Definition: DbU.h:196
static double getGridsPerLambda()
static void setSymbolicSnapGridStep(DbU::Unit step)
Definition: DbU.h:194
static Unit lambda(double value)
Definition: DbU.h:183
static double toPhysical(Unit u, UnitPower p)
Definition: DbU.h:174
static void setGridsPerLambda(double gridsPerLambda, unsigned int flags=NoFlags)
static Unit db(Unit value)
Definition: DbU.h:181
static void setPrecision(unsigned int precision, unsigned int flags=NoFlags)
static DbU::Unit getOnSymbolicSnapGrid(DbU::Unit u, SnapMode mode=Nearest)
static double getGrid(Unit u)
Definition: DbU.h:186
static string getValueString(Unit u, int mode=SmartTruncate)
static double getLambda(Unit u)
Definition: DbU.h:188
static Unit toDb(Unit u)
Definition: DbU.h:169
static Unit fromDb(Unit value)
Definition: DbU.h:163
The namespace dedicated to Hurricane.
Definition: Generalities.dox:5