From 562cca23c790b0fc24613a41610f69d5dc2ca115 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 24 Feb 2011 10:00:46 +0000 Subject: [PATCH] Added DbU::physicalToGrid method. --- hurricane/src/hurricane/hurricane/DbU.h | 2 ++ hurricane/src/viewer/Script.cpp | 6 +----- hurricane/src/viewer/hurricane/viewer/Script.h | 10 +++------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/hurricane/src/hurricane/hurricane/DbU.h b/hurricane/src/hurricane/hurricane/DbU.h index 9b0f2adb..a8344fa2 100644 --- a/hurricane/src/hurricane/hurricane/DbU.h +++ b/hurricane/src/hurricane/hurricane/DbU.h @@ -77,6 +77,7 @@ namespace Hurricane { static inline Unit db ( long value ); static inline Unit grid ( double value ); static inline Unit lambda ( double value ); + static inline Unit physicalToDbu ( double value, UnitPower p ); // Precision & Resolution Managment. static unsigned int getPrecision (); static unsigned int getMaximalPrecision (); @@ -135,6 +136,7 @@ namespace Hurricane { inline DbU::Unit DbU::db ( long value ) { return value; } inline DbU::Unit DbU::grid ( double value ) { return (long)rint( value/_resolution ); } inline DbU::Unit DbU::lambda ( double value ) { return grid(value*_gridsPerLambda); } + inline DbU::Unit DbU::physicalToDbu ( double value, UnitPower p ) { return (long)rint((value*getUnitPower(p))/_physicalsPerGrid); } inline long DbU::getDb ( DbU::Unit u ) { return u; } inline double DbU::getGrid ( DbU::Unit u ) { return _resolution*(double)u; } inline double DbU::getGrid ( double u ) { return _resolution*u; } diff --git a/hurricane/src/viewer/Script.cpp b/hurricane/src/viewer/Script.cpp index 028ba968..6e8e5221 100644 --- a/hurricane/src/viewer/Script.cpp +++ b/hurricane/src/viewer/Script.cpp @@ -9,17 +9,13 @@ // $Id$ // // +-----------------------------------------------------------------+ -// | | // | C O R I O L I S | // | V L S I B a c k e n d D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./hurricane/viewer/Script.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | // +-----------------------------------------------------------------+ diff --git a/hurricane/src/viewer/hurricane/viewer/Script.h b/hurricane/src/viewer/hurricane/viewer/Script.h index cf1a88ed..3ac4ad41 100644 --- a/hurricane/src/viewer/hurricane/viewer/Script.h +++ b/hurricane/src/viewer/hurricane/viewer/Script.h @@ -2,14 +2,13 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2011, All Rights Reserved // // =================================================================== // // $Id$ // -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | H U R R I C A N E | // | V L S I B a c k e n d D a t a - B a s e | // | | @@ -17,10 +16,7 @@ // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./hurricane/viewer/Script.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ # ifndef __ISOBAR_SCRIPT__