Import Geant4 11.2.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2023-06-30 09:09:57 +02:00
parent aef78ca386
commit dd1f179cda
3780 changed files with 212808 additions and 142780 deletions
+98 -122
View File
@@ -34,11 +34,11 @@
#ifndef G4GenericMessenger_hh
#define G4GenericMessenger_hh 1
#include "G4UImessenger.hh"
#include "G4UIcommand.hh"
#include "G4AnyType.hh"
#include "G4AnyMethod.hh"
#include "G4AnyType.hh"
#include "G4ApplicationState.hh"
#include "G4UIcommand.hh"
#include "G4UImessenger.hh"
#include <map>
#include <vector>
@@ -48,160 +48,136 @@ class G4UIdirectory;
class G4GenericMessenger : public G4UImessenger
{
public:
// Contructor
G4GenericMessenger(void* obj, const G4String& dir = "", const G4String& doc = "");
G4GenericMessenger(void* obj, const G4String& dir = "",
const G4String& doc = "");
// Contructor
~G4GenericMessenger() override;
// Destructor
~G4GenericMessenger() override;
G4String GetCurrentValue(G4UIcommand* command) override;
// The concrete, but generic implementation of this method.
G4String GetCurrentValue(G4UIcommand* command) override;
void SetNewValue(G4UIcommand* command, G4String newValue) override;
// The concrete, generic implementation of this method converts
// the string "newValue" to action.
void SetNewValue(G4UIcommand* command, G4String newValue) override;
public:
public:
struct Command
{
enum UnitSpec
{
UnitCategory,
UnitDefault
};
Command(G4UIcommand* cmd, const std::type_info& ti)
: command(cmd)
, type(&ti)
{}
Command() = default;
enum UnitSpec
{
UnitCategory,
UnitDefault
};
Command(G4UIcommand* cmd, const std::type_info& ti) : command(cmd), type(&ti) {}
Command() = default;
Command& SetStates(G4ApplicationState s0)
{
command->AvailableForStates(s0);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1)
{
command->AvailableForStates(s0, s1);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1,
G4ApplicationState s2)
{
command->AvailableForStates(s0, s1, s2);
return *this;
}
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& 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& SetParameterName(G4int pIdx, const G4String&, G4bool, G4bool = false);
Command& SetParameterName(const G4String&, const G4String&, const G4String&,
G4bool, G4bool = false);
Command& SetDefaultValue(const G4String&);
Command& SetDefaultValue(G4int pIdx, const G4String&);
Command& SetCandidates(const G4String&);
Command& SetCandidates(G4int pIdx, 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;
}
Command& SetStates(G4ApplicationState s0)
{
command->AvailableForStates(s0);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1)
{
command->AvailableForStates(s0, s1);
return *this;
}
Command& SetStates(G4ApplicationState s0, G4ApplicationState s1, G4ApplicationState s2)
{
command->AvailableForStates(s0, s1, s2);
return *this;
}
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& 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& SetParameterName(G4int pIdx, const G4String&, G4bool, G4bool = false);
Command& SetParameterName(const G4String&, const G4String&, const G4String&, G4bool,
G4bool = false);
Command& SetDefaultValue(const G4String&);
Command& SetDefaultValue(G4int pIdx, const G4String&);
Command& SetCandidates(const G4String&);
Command& SetCandidates(G4int pIdx, 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 = nullptr;
const std::type_info* type = nullptr;
G4UIcommand* command = nullptr;
const std::type_info* type = nullptr;
};
struct Property : public Command
{
Property(const G4AnyType& var, G4UIcommand* cmd)
: Command(cmd, var.TypeInfo())
, variable(var)
{}
Property() = default;
G4AnyType variable;
Property(const G4AnyType& var, G4UIcommand* cmd)
: Command(cmd, var.TypeInfo()), variable(var)
{}
Property() = default;
G4AnyType variable;
};
struct Method : public Command
{
Method(const G4AnyMethod& fun, void* obj, G4UIcommand* cmd)
: Command(cmd, fun.ArgType())
, method(fun)
, object(obj)
{}
Method() = default;
G4AnyMethod method;
void* object = nullptr;
Method(const G4AnyMethod& fun, void* obj, G4UIcommand* cmd)
: Command(cmd, fun.ArgType()), method(fun), object(obj)
{}
Method() = default;
G4AnyMethod method;
void* object = nullptr;
};
// Declare Methods
Command& DeclareProperty(const G4String& name, const G4AnyType& variable,
const G4String& doc = "");
Command& DeclarePropertyWithUnit(const G4String& name,
const G4String& defaultUnit,
const G4AnyType& variable,
const G4String& doc = "");
Command& DeclareMethod(const G4String& name, const G4AnyMethod& fun,
const G4String& doc = "");
Command& DeclareMethodWithUnit(const G4String& name,
const G4String& defaultUnit,
const G4AnyMethod& fun,
const G4String& doc = "");
Command& DeclarePropertyWithUnit(const G4String& name, const G4String& defaultUnit,
const G4AnyType& variable, const G4String& doc = "");
Command& DeclareMethod(const G4String& name, const G4AnyMethod& fun, const G4String& doc = "");
Command& DeclareMethodWithUnit(const G4String& name, const G4String& defaultUnit,
const G4AnyMethod& fun, const G4String& doc = "");
void SetDirectory(const G4String& dir) { directory = dir; }
void SetGuidance(const G4String& s);
void Sort(G4bool val = true)
{
if(dircmd != nullptr)
{
if (dircmd != nullptr) {
dircmd->Sort(val);
}
}
private:
std::map<G4String, Property> properties;
std::map<G4String, Method> methods;
G4UIdirectory* dircmd = nullptr;