Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 77651 2013-11-27 08:47:55Z gcosmo $
|
||||
$Id: History 85912 2014-11-06 08:57:43Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -16,6 +16,64 @@ committal in the CVS repository !
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
05 November, 2014 Robert Hatcher (intercoms-V10-00-15)
|
||||
- Rename a few inline method parameter names from 's' to 's0'
|
||||
to avoid a clash with CLHEP global 's'
|
||||
|
||||
23 October, 2014 A. Dotti (intercoms-V10-00-14)
|
||||
- Add G4cout support for generic (non worker) threads via new method:
|
||||
G4UImanger::SetUpForSpecialThread(G4String prefix)
|
||||
Requires global-V10-00-38
|
||||
|
||||
8 October, 2014 M. Asai (intercoms-V10-00-12, -13)
|
||||
- Adding a mechanism to make UI commands defined in a worker thread
|
||||
to be registered to the G4UImanager of the master thread.
|
||||
|
||||
23 September, 2014 G. Cosmo (intercoms-V10-00-11)
|
||||
- G4UImanager.hh : Renamed getThreadId() method to GetThreadId() and made
|
||||
post-const...
|
||||
|
||||
23 September, 2014 L. Garnier (intercoms-V10-00-10)
|
||||
- G4UImanager.hh : Add getThreadId() method instead of a public member
|
||||
|
||||
23 September, 2014 L. Garnier (intercoms-V10-00-09)
|
||||
- G4UImanager.hh : Change threadId from private to public
|
||||
|
||||
12 August, 2014 L. Garnier (intercoms-V10-00-08)
|
||||
- G4UImanager.hh : add "G4MTcoutDestination* GetThreadCout()"
|
||||
to get the cout destination of this thread
|
||||
|
||||
4 May, 2014 M. Asai (intercoms-V10-00-07)
|
||||
- G4GenericMessenger.cc : Fix core dump when GetCurrentValue()
|
||||
method is invoked for a command defined by DeclareMethod().
|
||||
|
||||
4 May, 2014 M. Asai (intercoms-V10-00-06)
|
||||
- Introducing new UI commands /control/doif and /control/getVal.
|
||||
|
||||
3 May, 2014 M. Asai (intercoms-V10-00-05)
|
||||
- Fix the treatment of double-quotes in G4UImanager::ForeachS().
|
||||
Addressing bug report #1614.
|
||||
|
||||
16 April, 2014 G. Cosmo (intercoms-V10-00-04)
|
||||
- Removed unnecessary source file G4AnyType.cc, as all symbols are inlined.
|
||||
- Corrected inclusion protection flag in G4GenericMessenger.hh.
|
||||
Addressing old problem report #1527.
|
||||
|
||||
9 April, 2014 L. Garnier (intercoms-V10-00-03)
|
||||
- Fix DEV-140 : "/control/macroPath" now also apply to macros
|
||||
called inside a loop.
|
||||
|
||||
16 March, 2014 M. Asai (intercoms-V10-00-02)
|
||||
- Introducing /control/cout/ignoreInitializationCout command to
|
||||
omit G4cout from threads during initialization, as they should
|
||||
be identical to the masther thread.
|
||||
|
||||
07 March, 2014 K. Murakami (intercoms-V10-00-01)
|
||||
- G4UIparameter : improve dignostic message of CandidateCheck().
|
||||
|
||||
04 March, 2014 M. Asai (intercoms-V10-00-00)
|
||||
- G4GenericMessenger : introducing three additional methods to make
|
||||
it Geant4-v10.0-compliant. Addressing to bug report #1580.
|
||||
|
||||
26 November, 2013 M. Asai (intercoms-V09-06-16)
|
||||
- G4GenericMessenger : introducing two methods for declaring a method
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//
|
||||
|
||||
#ifndef G4GenericMessenger_h
|
||||
#define G4GenericMmessenger_h 1
|
||||
#define G4GenericMessenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
@@ -67,13 +67,16 @@ public:
|
||||
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1, G4ApplicationState s2, G4ApplicationState s3) {command->AvailableForStates(s0,s1,s2,s3); return *this;}
|
||||
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1, G4ApplicationState s2, G4ApplicationState s3, G4ApplicationState s4) {command->AvailableForStates(s0,s1,s2,s3,s4); return *this;}
|
||||
Command& SetRange(const G4String& range) {command->SetRange(range.c_str()); return *this;}
|
||||
Command& SetGuidance(const G4String& s) { command->SetGuidance(s); return *this; }
|
||||
Command& SetGuidance(const G4String& s0) { command->SetGuidance(s0); return *this; }
|
||||
Command& SetUnit(const G4String&, UnitSpec = UnitDefault);
|
||||
Command& SetUnitCategory(const G4String& u) {return SetUnit(u, UnitCategory);}
|
||||
Command& SetDefaultUnit(const G4String& u) {return SetUnit(u, UnitDefault);}
|
||||
Command& SetParameterName(const G4String&, G4bool, G4bool =false);
|
||||
Command& SetDefaultValue(const G4String&);
|
||||
Command& SetCandidates(const G4String&);
|
||||
Command& SetToBeBroadcasted(G4bool s0) { command->SetToBeBroadcasted(s0); return *this; }
|
||||
Command& SetToBeFlushed(G4bool s0) { command->SetToBeFlushed(s0); return *this; }
|
||||
Command& SetWorkerThreadOnly(G4bool s0) { command->SetWorkerThreadOnly(s0); return *this; }
|
||||
|
||||
G4UIcommand* command;
|
||||
const std::type_info* type;
|
||||
|
||||
@@ -60,6 +60,7 @@ class G4LocalThreadCoutMessenger: public G4UImessenger
|
||||
G4UIcmdWithABool* bufferCoutCmd;
|
||||
G4UIcmdWithAString* prefixCmd;
|
||||
G4UIcmdWithAnInteger* ignoreCmd;
|
||||
G4UIcmdWithABool* ignoreInitCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcontrolMessenger.hh 67965 2013-03-13 09:35:29Z gcosmo $
|
||||
// $Id: G4UIcontrolMessenger.hh 80641 2014-05-05 15:10:28Z gcosmo $
|
||||
//
|
||||
|
||||
#ifndef G4UIcontrolMessenger_h
|
||||
@@ -55,12 +55,14 @@ class G4UIcommand;
|
||||
// /control/unalias
|
||||
// /control/listAlias
|
||||
// /control/getEnv
|
||||
// /control/getVal
|
||||
// /control/echo
|
||||
// /control/shell
|
||||
// /control/manual
|
||||
// /control/createHTML
|
||||
// /control/maximumStoredHistory
|
||||
// /control/if
|
||||
// /control/doif
|
||||
// /control/add
|
||||
// /control/subtract
|
||||
// /control/multiply
|
||||
@@ -86,6 +88,7 @@ class G4UIcontrolMessenger : public G4UImessenger
|
||||
G4UIcmdWithAString * unaliasCommand;
|
||||
G4UIcmdWithoutParameter * listAliasCommand;
|
||||
G4UIcmdWithAString * getEnvCmd;
|
||||
G4UIcommand * getValCmd;
|
||||
G4UIcmdWithAString * echoCmd;
|
||||
G4UIcmdWithAString * shellCommand;
|
||||
G4UIcommand * loopCommand;
|
||||
@@ -94,6 +97,7 @@ class G4UIcontrolMessenger : public G4UImessenger
|
||||
G4UIcmdWithAString * HTMLCommand;
|
||||
G4UIcmdWithAnInteger * maxStoredHistCommand;
|
||||
G4UIcommand * ifCommand;
|
||||
G4UIcommand * doifCommand;
|
||||
G4UIcommand * addCommand;
|
||||
G4UIcommand * subtractCommand;
|
||||
G4UIcommand * multiplyCommand;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UImanager.hh 77651 2013-11-27 08:47:55Z gcosmo $
|
||||
// $Id: G4UImanager.hh 85249 2014-10-27 08:28:57Z gcosmo $
|
||||
//
|
||||
|
||||
#ifndef G4UImanager_h
|
||||
@@ -272,8 +272,12 @@ class G4UImanager : public G4VStateDependent
|
||||
std::vector<G4String>* GetCommandStack();
|
||||
void RegisterBridge(G4UIbridge* brg);
|
||||
|
||||
public:
|
||||
void SetUpForAThread(G4int tId);
|
||||
//Setups as before but for a non-worker thread (e.g. vis)
|
||||
void SetUpForSpecialThread(G4String aPrefix);
|
||||
|
||||
inline G4int GetThreadID() const
|
||||
{ return threadID; }
|
||||
|
||||
private:
|
||||
G4int threadID;
|
||||
@@ -286,6 +290,9 @@ class G4UImanager : public G4VStateDependent
|
||||
void SetThreadPrefixString(const G4String& s = "W");
|
||||
void SetThreadUseBuffer(G4bool flg = true);
|
||||
void SetThreadIgnore(G4int tid = 0);
|
||||
void SetThreadIgnoreInit(G4bool flg = true);
|
||||
inline G4MTcoutDestination* GetThreadCout() {return threadCout;};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UImessenger.hh 74278 2013-10-02 15:04:18Z gcosmo $
|
||||
// $Id: G4UImessenger.hh 84281 2014-10-13 07:21:50Z gcosmo $
|
||||
//
|
||||
|
||||
#ifndef G4UImessenger_h
|
||||
@@ -89,6 +89,11 @@ class G4UImessenger
|
||||
template <typename T> T* CreateCommand(const G4String& cname,
|
||||
const G4String& dsc);
|
||||
|
||||
protected:
|
||||
G4bool commandsShouldBeInMaster;
|
||||
public:
|
||||
G4bool CommandsShouldBeInMaster() const
|
||||
{ return commandsShouldBeInMaster; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 75773 2013-11-06 09:14:23Z gcosmo $
|
||||
# $Id: sources.cmake 80403 2014-04-16 07:56:30Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -29,6 +29,10 @@ include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
|
||||
include(Geant4MacroDefineModule)
|
||||
GEANT4_DEFINE_MODULE(NAME G4intercoms
|
||||
HEADERS
|
||||
G4AnyMethod.hh
|
||||
G4AnyType.hh
|
||||
G4GenericMessenger.hh
|
||||
G4LocalThreadCoutMessenger.hh
|
||||
G4UIaliasList.hh
|
||||
G4UIbatch.hh
|
||||
G4UIbridge.hh
|
||||
@@ -53,11 +57,9 @@ GEANT4_DEFINE_MODULE(NAME G4intercoms
|
||||
G4UnitsMessenger.hh
|
||||
G4VFlavoredParallelWorld.hh
|
||||
G4VGlobalFastSimulationManager.hh
|
||||
G4GenericMessenger.hh
|
||||
G4LocalThreadCoutMessenger.hh
|
||||
G4AnyType.hh
|
||||
G4AnyMethod.hh
|
||||
SOURCES
|
||||
G4LocalThreadCoutMessenger.cc
|
||||
G4GenericMessenger.cc
|
||||
G4UIaliasList.cc
|
||||
G4UIbatch.cc
|
||||
G4UIbridge.cc
|
||||
@@ -79,9 +81,6 @@ GEANT4_DEFINE_MODULE(NAME G4intercoms
|
||||
G4UIsession.cc
|
||||
G4UnitsMessenger.cc
|
||||
G4VGlobalFastSimulationManager.cc
|
||||
G4LocalThreadCoutMessenger.cc
|
||||
G4GenericMessenger.cc
|
||||
G4AnyType.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4globman
|
||||
GLOBAL_DEPENDENCIES
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIaliasList.cc,v 1.6 2006-06-29 19:08:33 gunter Exp $
|
||||
//
|
||||
|
||||
#include "G4AnyType.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
// The definitions of these specializations have been moved to the
|
||||
// to the header file to solve Windows linking problem
|
||||
|
||||
#if 0
|
||||
|
||||
template <> void G4AnyType::Ref<bool>::FromString(const std::string& val) {
|
||||
fRef = G4UIcommand::ConvertToBool(val.c_str());
|
||||
}
|
||||
|
||||
template <> void G4AnyType::Ref<G4String>::FromString(const std::string& val) {
|
||||
if (val[0] == '"' ) fRef = val.substr(1,val.size()-2);
|
||||
else fRef = val;
|
||||
}
|
||||
|
||||
template <> void G4AnyType::Ref<G4ThreeVector>::FromString(const std::string& val) {
|
||||
fRef = G4UIcommand::ConvertTo3Vector(val.c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -142,6 +142,10 @@ G4String G4GenericMessenger::GetCurrentValue(G4UIcommand* command) {
|
||||
Property& p = properties[command->GetCommandName()];
|
||||
return p.variable.ToString();
|
||||
}
|
||||
else if ( methods.find(command->GetCommandName()) != methods.end()) {
|
||||
G4cout<<" GetCurrentValue() is not available for a command defined by G4GenericMessenger::DeclareMethod()."<<G4endl;
|
||||
return G4String();
|
||||
}
|
||||
else {
|
||||
throw G4InvalidUICommand();
|
||||
}
|
||||
|
||||
@@ -95,6 +95,14 @@ G4LocalThreadCoutMessenger::G4LocalThreadCoutMessenger()
|
||||
ignoreCmd->SetParameterName("threadID",true);
|
||||
ignoreCmd->SetDefaultValue(0);
|
||||
ignoreCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
ignoreInitCmd = new G4UIcmdWithABool("/control/cout/ignoreInitializationCout",this);
|
||||
ignoreInitCmd->SetGuidance("Omit cout from threads during initialization, as they should be identical to the masther thread.");
|
||||
ignoreInitCmd->SetGuidance("This command takes effect only if cout destination is screen without buffering.");
|
||||
ignoreInitCmd->SetGuidance("This command does not affect to cerr.");
|
||||
ignoreInitCmd->SetParameterName("IgnoreInit",true);
|
||||
ignoreInitCmd->SetDefaultValue(true);
|
||||
ignoreInitCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
G4LocalThreadCoutMessenger::~G4LocalThreadCoutMessenger()
|
||||
@@ -104,6 +112,7 @@ G4LocalThreadCoutMessenger::~G4LocalThreadCoutMessenger()
|
||||
delete bufferCoutCmd;
|
||||
delete prefixCmd;
|
||||
delete ignoreCmd;
|
||||
delete ignoreInitCmd;
|
||||
delete coutDir;
|
||||
}
|
||||
|
||||
@@ -130,5 +139,7 @@ void G4LocalThreadCoutMessenger::SetNewValue(G4UIcommand* command,G4String newVa
|
||||
{ UI->SetThreadPrefixString(newVal); }
|
||||
else if(command == ignoreCmd)
|
||||
{ UI->SetThreadIgnore(StoI(newVal)); }
|
||||
else if(command == ignoreInitCmd)
|
||||
{ UI->SetThreadIgnoreInit(StoB(newVal)); }
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4UIbatch.cc 67965 2013-03-13 09:35:29Z gcosmo $
|
||||
// $Id: G4UIbatch.cc 83401 2014-08-21 15:03:26Z gcosmo $
|
||||
//
|
||||
// ====================================================================
|
||||
// G4UIbatch.cc
|
||||
@@ -72,8 +72,8 @@ G4UIbatch::G4UIbatch(const char* fileName, G4UIsession* prevSession)
|
||||
{
|
||||
macroStream.open(fileName, std::ios::in);
|
||||
if(macroStream.fail()) {
|
||||
G4cerr << "***** Can not open a macro file <"
|
||||
<< fileName << ">"
|
||||
G4cerr << "ERROR: Can not open a macro file <"
|
||||
<< fileName << ">. Set macro path with \"/control/macroPath\" if needed."
|
||||
<< G4endl;
|
||||
} else {
|
||||
isOpened= true;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcommand.cc 77563 2013-11-26 09:03:18Z gcosmo $
|
||||
// $Id: G4UIcommand.cc 84281 2014-10-13 07:21:50Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -71,6 +71,10 @@ token(IDENTIFIER),paramERR(0)
|
||||
availabelStateList.push_back(G4State_Abort);
|
||||
}
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4Threading.hh"
|
||||
#endif
|
||||
|
||||
void G4UIcommand::G4UIcommandCommonConstructorCode
|
||||
(const char * theCommandPath)
|
||||
{
|
||||
@@ -78,8 +82,18 @@ void G4UIcommand::G4UIcommandCommonConstructorCode
|
||||
commandName = theCommandPath;
|
||||
G4int commandNameIndex = commandName.last('/');
|
||||
commandName.remove(0,commandNameIndex+1);
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
if(messenger && messenger->CommandsShouldBeInMaster()
|
||||
&& G4Threading::IsWorkerThread())
|
||||
{
|
||||
toBeBroadcasted = false;
|
||||
G4UImanager::GetMasterUIpointer()->AddNewCommand(this);
|
||||
}
|
||||
else
|
||||
{ G4UImanager::GetUIpointer()->AddNewCommand(this); }
|
||||
#else
|
||||
G4UImanager::GetUIpointer()->AddNewCommand(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
G4UIcommand::~G4UIcommand()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcontrolMessenger.cc 68725 2013-04-05 09:27:45Z gcosmo $
|
||||
// $Id: G4UIcontrolMessenger.cc 80641 2014-05-05 15:10:28Z gcosmo $
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -138,6 +138,15 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
getEnvCmd = new G4UIcmdWithAString("/control/getEnv",this);
|
||||
getEnvCmd->SetGuidance("Get a shell environment variable and define it as an alias.");
|
||||
|
||||
getValCmd = new G4UIcommand("/control/getVal",this);
|
||||
getValCmd->SetGuidance("Get the current value of the UI command and define it as an alias.");
|
||||
getValCmd->SetGuidance("Command is ignored if the UI command does not support GetCurrentValue().");
|
||||
getValCmd->SetGuidance(" Syntax : <alias_name> <UI_command>");
|
||||
G4UIparameter* aliName = new G4UIparameter("alias_name",'s',false);
|
||||
getValCmd->SetParameter(aliName);
|
||||
G4UIparameter* comName = new G4UIparameter("UI_command",'s',false);
|
||||
getValCmd->SetParameter(comName);
|
||||
|
||||
echoCmd = new G4UIcmdWithAString("/control/echo",this);
|
||||
echoCmd->SetGuidance("Display the aliased value.");
|
||||
|
||||
@@ -177,6 +186,20 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
ifCommand->SetParameter(macroFileParam);
|
||||
ifCommand->SetToBeBroadcasted(false);
|
||||
|
||||
doifCommand = new G4UIcommand("/control/doif",this);
|
||||
doifCommand->SetGuidance("Execute a macro file if the expression is true.");
|
||||
doifCommand->SetGuidance(" Syntax : <double> <comp> <double> <UI_command>");
|
||||
G4UIparameter* doleftParam = new G4UIparameter("left",'d',false);
|
||||
doifCommand->SetParameter(doleftParam);
|
||||
G4UIparameter* docompParam = new G4UIparameter("comp",'s',false);
|
||||
docompParam->SetParameterCandidates("> >= < <= == !=");
|
||||
doifCommand->SetParameter(docompParam);
|
||||
G4UIparameter* dorightParam = new G4UIparameter("right",'d',false);
|
||||
doifCommand->SetParameter(dorightParam);
|
||||
G4UIparameter* comParam = new G4UIparameter("UI_command",'s',false);
|
||||
doifCommand->SetParameter(comParam);
|
||||
doifCommand->SetToBeBroadcasted(false);
|
||||
|
||||
addCommand = new G4UIcommand("/control/add",this);
|
||||
addCommand->SetGuidance("Define a new alias as the sum of two values.");
|
||||
addCommand->SetGuidance(" Syntax : <new_alias> <value1> <value2>");
|
||||
@@ -188,6 +211,7 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
addCommand->SetParameter(val1a);
|
||||
G4UIparameter* val1b = new G4UIparameter("value2",'d',false);
|
||||
addCommand->SetParameter(val1b);
|
||||
addCommand->SetToBeBroadcasted(false);
|
||||
|
||||
subtractCommand = new G4UIcommand("/control/subtract",this);
|
||||
subtractCommand->SetGuidance("Define a new alias as the subtraction of two values.");
|
||||
@@ -200,6 +224,7 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
subtractCommand->SetParameter(val2a);
|
||||
G4UIparameter* val2b = new G4UIparameter("value2",'d',false);
|
||||
subtractCommand->SetParameter(val2b);
|
||||
subtractCommand->SetToBeBroadcasted(false);
|
||||
|
||||
multiplyCommand = new G4UIcommand("/control/multiply",this);
|
||||
multiplyCommand->SetGuidance("Define a new alias as the multiplification of two values.");
|
||||
@@ -212,6 +237,7 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
multiplyCommand->SetParameter(val3a);
|
||||
G4UIparameter* val3b = new G4UIparameter("value2",'d',false);
|
||||
multiplyCommand->SetParameter(val3b);
|
||||
multiplyCommand->SetToBeBroadcasted(false);
|
||||
|
||||
divideCommand = new G4UIcommand("/control/divide",this);
|
||||
divideCommand->SetGuidance("Define a new alias as the division of two values.");
|
||||
@@ -225,6 +251,7 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
G4UIparameter* val4b = new G4UIparameter("value2",'d',false);
|
||||
val4b->SetParameterRange("value2 != 0.");
|
||||
divideCommand->SetParameter(val4b);
|
||||
divideCommand->SetToBeBroadcasted(false);
|
||||
|
||||
remainderCommand = new G4UIcommand("/control/remainder",this);
|
||||
remainderCommand->SetGuidance("Define a new alias as the remainder of two values.");
|
||||
@@ -238,6 +265,7 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
G4UIparameter* val5b = new G4UIparameter("value2",'i',false);
|
||||
val4b->SetParameterRange("value2 != 0");
|
||||
remainderCommand->SetParameter(val5b);
|
||||
remainderCommand->SetToBeBroadcasted(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -254,6 +282,7 @@ G4UIcontrolMessenger::~G4UIcontrolMessenger()
|
||||
delete unaliasCommand;
|
||||
delete listAliasCommand;
|
||||
delete getEnvCmd;
|
||||
delete getValCmd;
|
||||
delete echoCmd;
|
||||
delete shellCommand;
|
||||
delete loopCommand;
|
||||
@@ -261,6 +290,7 @@ G4UIcontrolMessenger::~G4UIcontrolMessenger()
|
||||
delete HTMLCommand;
|
||||
delete maxStoredHistCommand;
|
||||
delete ifCommand;
|
||||
delete doifCommand;
|
||||
delete addCommand;
|
||||
delete subtractCommand;
|
||||
delete multiplyCommand;
|
||||
@@ -327,6 +357,19 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
else
|
||||
{ G4cerr << "<" << newValue << "> is not defined as a shell variable. Command ignored." << G4endl; }
|
||||
}
|
||||
if(command==getValCmd)
|
||||
{
|
||||
G4Tokenizer next(newValue);
|
||||
G4String aliName = next();
|
||||
G4String com = next();
|
||||
G4String curVal = UI->GetCurrentValues(com);
|
||||
if(!(curVal.isNull()))
|
||||
{
|
||||
G4String st = "/control/alias ";
|
||||
st += aliName + " " + curVal;
|
||||
UI->ApplyCommand(st);
|
||||
}
|
||||
}
|
||||
if(command==echoCmd)
|
||||
{ G4cout << UI->SolveAlias(newValue) << G4endl; }
|
||||
if(command==shellCommand)
|
||||
@@ -365,6 +408,39 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
else if(comp=="!=") x = (l!=r);
|
||||
if(x) UI->ExecuteMacroFile(mac);
|
||||
}
|
||||
if(command==doifCommand)
|
||||
{
|
||||
G4Tokenizer next(newValue);
|
||||
G4double l = StoD(next());
|
||||
G4String comp = next();
|
||||
G4double r = StoD(next());
|
||||
|
||||
G4String c1 = next();
|
||||
G4String ca;
|
||||
while(!((ca=next()).isNull()))
|
||||
{
|
||||
c1 += " ";
|
||||
c1 += ca;
|
||||
}
|
||||
if(c1(0)=='"')
|
||||
{
|
||||
G4String strippedValue;
|
||||
if(c1(c1.length()-1)=='"')
|
||||
{ strippedValue = c1(1,c1.length()-2); }
|
||||
else
|
||||
{ strippedValue = c1(1,c1.length()-1); }
|
||||
c1 = strippedValue;
|
||||
}
|
||||
|
||||
G4bool x = false;
|
||||
if(comp==">") x = (l>r);
|
||||
else if(comp==">=") x = (l>=r);
|
||||
else if(comp=="<") x = (l<r);
|
||||
else if(comp=="<=") x = (l<=r);
|
||||
else if(comp=="==") x = (l==r);
|
||||
else if(comp=="!=") x = (l!=r);
|
||||
if(x) UI->ApplyCommand(c1);
|
||||
}
|
||||
if(command==addCommand)
|
||||
{
|
||||
G4Tokenizer next(newValue);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UImanager.cc 77651 2013-11-27 08:47:55Z gcosmo $
|
||||
// $Id: G4UImanager.cc 85249 2014-10-27 08:28:57Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -341,7 +341,20 @@ void G4UImanager::ForeachS(const char* valueList)
|
||||
c1 += " ";
|
||||
c1 += ca;
|
||||
}
|
||||
Foreach(mf,vn,c1);
|
||||
|
||||
G4String aliasValue = c1;
|
||||
if(aliasValue(0)=='"')
|
||||
{
|
||||
G4String strippedValue;
|
||||
if(aliasValue(aliasValue.length()-1)=='"')
|
||||
{ strippedValue = aliasValue(1,aliasValue.length()-2); }
|
||||
else
|
||||
{ strippedValue = aliasValue(1,aliasValue.length()-1); }
|
||||
aliasValue = strippedValue;
|
||||
}
|
||||
|
||||
// Foreach(mf,vn,c1);
|
||||
Foreach(mf,vn,aliasValue);
|
||||
}
|
||||
|
||||
void G4UImanager::Foreach(const char * macroFile,const char * variableName,
|
||||
@@ -356,7 +369,7 @@ void G4UImanager::Foreach(const char * macroFile,const char * variableName,
|
||||
vl += " ";
|
||||
vl += cd;
|
||||
SetAlias(vl);
|
||||
ExecuteMacroFile(macroFile);
|
||||
ExecuteMacroFile(FindMacroPath(macroFile));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,6 +718,16 @@ void G4UImanager::SetUpForAThread(G4int tId)
|
||||
threadCout->SetIgnoreCout(igThreadID);
|
||||
}
|
||||
|
||||
void G4UImanager::SetUpForSpecialThread(G4String pref)
|
||||
{
|
||||
threadID = G4Threading::GENERICTHREAD_ID;
|
||||
G4Threading::G4SetThreadId(threadID);
|
||||
G4iosInitialization();
|
||||
threadCout = new G4MTcoutDestination(threadID);
|
||||
threadCout->SetPrefixString(pref);
|
||||
threadCout->SetIgnoreCout(igThreadID);
|
||||
}
|
||||
|
||||
void G4UImanager::SetCoutFileName(const G4String& fileN, G4bool ifAppend)
|
||||
{
|
||||
// for sequential mode, ignore this method.
|
||||
@@ -760,3 +783,10 @@ void G4UImanager::SetThreadIgnore(G4int tid)
|
||||
threadCout->SetIgnoreCout(tid);
|
||||
}
|
||||
|
||||
void G4UImanager::SetThreadIgnoreInit(G4bool flg)
|
||||
{
|
||||
// for sequential mode, ignore this method.
|
||||
if(threadID<0) { return; }
|
||||
threadCout->SetIgnoreInit(flg);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UImessenger.cc 74278 2013-10-02 15:04:18Z gcosmo $
|
||||
// $Id: G4UImessenger.cc 84281 2014-10-13 07:21:50Z gcosmo $
|
||||
//
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
@@ -36,13 +36,13 @@
|
||||
#include <sstream>
|
||||
|
||||
G4UImessenger::G4UImessenger()
|
||||
: baseDir(NULL), baseDirName("")
|
||||
: baseDir(NULL), baseDirName(""), commandsShouldBeInMaster(false)
|
||||
{
|
||||
}
|
||||
|
||||
G4UImessenger::G4UImessenger(const G4String& path, const G4String& dsc,
|
||||
G4bool commandsToBeBroadcasted)
|
||||
: baseDir(NULL), baseDirName("")
|
||||
: baseDir(NULL), baseDirName(""), commandsShouldBeInMaster(false)
|
||||
{
|
||||
CreateDirectory(path, dsc, commandsToBeBroadcasted);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIparameter.cc 67965 2013-03-13 09:35:29Z gcosmo $
|
||||
// $Id: G4UIparameter.cc 79626 2014-03-10 11:18:47Z gcosmo $
|
||||
//
|
||||
|
||||
#include "G4UIparameter.hh"
|
||||
@@ -157,7 +157,8 @@ CandidateCheck(const char* newValue) {
|
||||
iToken++;
|
||||
if(aToken==newValue) return iToken;
|
||||
}
|
||||
G4cerr << "parameter value is not listed in the candidate List." << G4endl;
|
||||
G4cerr << "parameter value (" << newValue
|
||||
<< ") is not listed in the candidate List." << G4endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user