Message: Re: Writing UIcommands with units, and G4BestUnit interface Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Writing UIcommands with units, and G4BestUnit interface 

Forum: (Graphical) User Interfaces
Re: None Writing UIcommands with units, and G4BestUnit interface (Michael H. Kelsey)
Re: None RE: Writing UIcommands with units, and G4BestUnit interface (Makoto Asai)
Re: None Re: Writing UIcommands with units, and G4BestUnit interface (Michael H. Kelsey)
Re: None RE: Writing UIcommands with units, and G4BestUnit interface (Makoto Asai)
Date: 23 Dec, 2010
From: Michael H. Kelsey <Michael H. Kelsey>

Asai, Makoto writes:
> I thought all of your un-defined number of parameters except the
> last one are numbers rather than strings, e.g.
>  /your/command 1.2 3.4 5.6 .... 8.9 cm
> And you want to make the last unit parameter optional so that the
> user may omit it, i.e.
>  /your/command 1.2 3.4 5.6 .... 8.9 

Those are the actions to read in user input, and I have those working
correctly now (including the nice use of ValueOf() to test for the unit
string.

What I'm trying to do now is the inverse case:  Given a std::vector<double>,
generate the formatted string with values and a unit at the end.  This
corresponds to the functions in G4UIcmdWit3ThreeVectorAndUnit.hh named

 G4String ConvertToStringWithBestUnit(G4ThreeVector vec);
 G4String ConvertToStringWithDefaultUnit(G4ThreeVector vec);

In my case, the argument will be a const std::vector<double>, of course.

The problem I've got is with the "BestUnit" business, which takes a value
and category, and returns the string corresponding to the most appropriate
unit name.  I can't get that string by itself, only combined with a
formatted numeric value.

      -- Mike

 Add Message Add Message
to: "Re: Writing UIcommands with units, and G4BestUnit interface"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]