[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: standard units in software
Hi Matt,
the scheme you suggest is convenient for local
calculations, but how do you transfer variables to another
routines? You still seem to need a convention or another call
parameter to define the unit...
Regards,
Eugene
On Mon, 24 Nov 2008, Matthew Shepherd wrote:
>
> In CLEO we had a set of constants defined in a file called units.h
>
> One would then write things like:
>
> 0.25*k_GeV, 120*k_MeV, 15*k_m, ...
>
> The constants were multiplicative factors to convert the numbers to standard
> units. This was very nice since one never had to think about what the
> standard units were and the code looks much nicer:
>
> if( energy > 30*k_MeV ){
> ...
> }
>
> I would advocate a similar approach for us.
>
> -Matt
>
>
> On Nov 24, 2008, at 9:13 AM, David Lawrence wrote:
>
>>
>> Hi Mark,
>>
>> I distinctly remember discussing this at a software meeting a long time
>> ago. However, it does not appear to have made it into the coding
>> conventions and a quick scan of meeting minutes was none too fruitful.
>>
>> I think we should add this to the coding conventions with the exact units
>> you suggest using Tesla for the magnetic field. Would you mind adding the
>> entry to the coding conventions wiki page? Then, we can discuss it and
>> ratify it at the software meeting next week.
>>
>> Regards,
>> -David
>>
>> Mark M. Ito wrote:
>>> Folks,
>>>
>>> Do we have an official set of standard units written down somewhere? I am
>>> talking about things like
>>>
>>> centimeters
>>> nanoseconds
>>> GeV
>>> Tesla? kilogauss?
>>>
>>> where one can assume a given quantity in the software is in standard units
>>> unless stated otherwise explicitly.
>>>
>>> -- Mark
>>>
>>
>> --
>>
>> ------------------------------------------------------------------------
>> David Lawrence Ph.D.
>> Staff Scientist Office: (757)269-5567 [[[ [ [ [
>> Jefferson Lab Pager: (757)584-5567 [ [ [ [ [ [
>> http://www.jlab.org/~davidl davidl@jlab.org [[[ [[ [[ [[[
>> ------------------------------------------------------------------------
>>
>>
>