Import Geant4 10.3.1 source tree

This commit is contained in:
Gabriele Cosmo
2017-02-28 16:16:20 +01:00
parent a3452e42ac
commit 4597adb7c4
267 changed files with 14761 additions and 24650 deletions
+18 -6
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UIcommand.cc 89953 2015-05-06 08:09:12Z gcosmo $
// $Id: G4UIcommand.cc 102562 2017-02-09 08:27:31Z gcosmo $
//
//
@@ -37,6 +37,7 @@
#include "G4Tokenizer.hh"
#include "G4ios.hh"
#include <sstream>
#include <iomanip>
G4UIcommand::G4UIcommand()
: messenger(0), toBeBroadcasted(false), toBeFlushed(false), workerThreadOnly(false),
@@ -386,7 +387,10 @@ G4String G4UIcommand::ConvertToString(G4int intValue)
G4String G4UIcommand::ConvertToString(G4double doubleValue)
{
std::ostringstream os;
os << doubleValue;
if(G4UImanager::DoublePrecisionStr())
{ os << std::setprecision(17) << doubleValue; }
else
{ os << doubleValue; }
G4String vl = os.str();
return vl;
}
@@ -397,7 +401,10 @@ G4String G4UIcommand::ConvertToString(G4double doubleValue,const char* unitName)
G4double uv = ValueOf(unitName);
std::ostringstream os;
os << doubleValue/uv << " " << unitName;
if(G4UImanager::DoublePrecisionStr())
{ os << std::setprecision(17) << doubleValue/uv << " " << unitName; }
else
{ os << doubleValue/uv << " " << unitName; }
G4String vl = os.str();
return vl;
}
@@ -405,7 +412,10 @@ G4String G4UIcommand::ConvertToString(G4double doubleValue,const char* unitName)
G4String G4UIcommand::ConvertToString(G4ThreeVector vec)
{
std::ostringstream os;
os << vec.x() << " " << vec.y() << " " << vec.z();
if(G4UImanager::DoublePrecisionStr())
{ os << std::setprecision(17) << vec.x() << " " << vec.y() << " " << vec.z(); }
else
{ os << vec.x() << " " << vec.y() << " " << vec.z(); }
G4String vl = os.str();
return vl;
}
@@ -416,8 +426,10 @@ G4String G4UIcommand::ConvertToString(G4ThreeVector vec,const char* unitName)
G4double uv = ValueOf(unitName);
std::ostringstream os;
os << vec.x()/uv << " " << vec.y()/uv << " " << vec.z()/uv
<< " " << unitName;
if(G4UImanager::DoublePrecisionStr())
{ os << std::setprecision(17) << vec.x()/uv << " " << vec.y()/uv << " " << vec.z()/uv << " " << unitName; }
else
{ os << vec.x()/uv << " " << vec.y()/uv << " " << vec.z()/uv << " " << unitName; }
G4String vl = os.str();
return vl;
}
+16 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UIcontrolMessenger.cc 98731 2016-08-09 10:49:49Z gcosmo $
// $Id: G4UIcontrolMessenger.cc 102562 2017-02-09 08:27:31Z gcosmo $
//
#include <stdlib.h>
@@ -34,6 +34,7 @@
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIaliasList.hh"
@@ -107,6 +108,11 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
verboseCommand->SetRange("switch >= 0 && switch <=2");
verboseCommand->SetDefaultValue(2);
doublePrecCommand = new G4UIcmdWithABool("/control/useDoublePrecision",this);
doublePrecCommand->SetGuidance("Use double precision for printing out the current parameter value(s).");
doublePrecCommand->SetParameterName("useDoublePrecision",true);
doublePrecCommand->SetDefaultValue(true);
historyCommand = new G4UIcmdWithAString("/control/saveHistory",this);
historyCommand->SetGuidance("Store command history to a file.");
historyCommand->SetGuidance("Defaul file name is G4history.macro.");
@@ -327,6 +333,7 @@ G4UIcontrolMessenger::~G4UIcontrolMessenger()
delete ExecuteCommand;
delete suppressAbortionCommand;
delete verboseCommand;
delete doublePrecCommand;
delete historyCommand;
delete stopStoreHistoryCommand;
delete ManualCommand;
@@ -378,6 +385,10 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
UI->SetVerboseLevel(verboseCommand->GetNewIntValue(newValue));
}
if(command==doublePrecCommand)
{
G4UImanager::UseDoublePrecisionStr(doublePrecCommand->GetNewBoolValue(newValue));
}
if(command==historyCommand)
{
UI->StoreHistory(newValue);
@@ -639,6 +650,10 @@ G4String G4UIcontrolMessenger::GetCurrentValue(G4UIcommand * command)
{
currentValue = verboseCommand->ConvertToString(UI->GetVerboseLevel());
}
if(command==doublePrecCommand)
{
currentValue = doublePrecCommand->ConvertToString(G4UImanager::DoublePrecisionStr());
}
if(command==suppressAbortionCommand)
{
currentValue = suppressAbortionCommand->ConvertToString(G4StateManager::GetStateManager()->GetSuppressAbortion());
+2 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4UImanager.cc 94366 2015-11-13 08:15:49Z gcosmo $
// $Id: G4UImanager.cc 102562 2017-02-09 08:27:31Z gcosmo $
//
//
// ---------------------------------------------------------------------
@@ -52,6 +52,7 @@
G4ThreadLocal G4UImanager * G4UImanager::fUImanager = 0;
G4ThreadLocal G4bool G4UImanager::fUImanagerHasBeenKilled = false;
G4UImanager * G4UImanager::fMasterUImanager = 0;
G4bool G4UImanager::doublePrecisionStr = false;
G4int G4UImanager::igThreadID = -1;