Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Accumulables Namespace Reference

Functions

G4MergeMode GetMergeMode (const G4String &mergeModeName)
 
template<typename T >
G4MergeFunction< T > GetMergeFunction (G4MergeMode mergeMode)
 
template<G4bool >
G4MergeFunction< G4boolGetMergeFunction (G4MergeMode mergeMode)
 

Function Documentation

◆ GetMergeFunction() [1/2]

template<typename T >
G4MergeFunction< T > G4Accumulables::GetMergeFunction ( G4MergeMode mergeMode)

Definition at line 57 of file G4MergeMode.hh.

58{
59 switch ( mergeMode ) {
61 // return std::bind([](const T& x, const T& y) { return x + y; });
62 return [](const T& x, const T& y) { return x + y; };
63
65 return [](const T& x, const T& y) { return x * y; };
66
68 // return std::bind([](const T& x, const T& y) { return std::max(x,y);});
69 return [](const T& x, const T& y) { return std::max(x,y); };
70
72 // return std::bind([](const T& x, const T& y) { return std::min(x,y);});
73 return [](const T& x, const T& y) { return std::min(x,y); };
74 }
75
76 // Must never get here, but we need a return to satisfy MSVC
77 G4Exception("G4Accumulables::GetMergeFunction<T>",
78 "Analysis_F001", FatalException,
79 "Undefined merge mode");
80 return [](const T&, const T&) { return T(); };
81}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)

◆ GetMergeFunction() [2/2]

template<G4bool >
G4MergeFunction< G4bool > G4Accumulables::GetMergeFunction ( G4MergeMode mergeMode)

Definition at line 84 of file G4MergeMode.hh.

85{
86 switch ( mergeMode ) {
89 // return std::bind([](const T& x, const T& y) { return x + y; });
90 return [](const G4bool& x, const G4bool& y) { return x || y; };
91
94 return [](const G4bool& x, const G4bool& y) { return x && y; };
95 }
96}
bool G4bool
Definition G4Types.hh:86

◆ GetMergeMode()

G4MergeMode G4Accumulables::GetMergeMode ( const G4String & mergeModeName)

Definition at line 35 of file G4MergeMode.cc.

36{
37 if (mergeModeName == "+") return G4MergeMode::kAddition;
38 if (mergeModeName == "*") return G4MergeMode::kMultiplication;
39
40 G4ExceptionDescription description;
41 description << "\"" << mergeModeName << "\" merge mode is not supported." << G4endl
42 << "Addition will be applied.";
43 G4Exception("G4Analysis::GetMergeMode", "Analysis_W001", JustWarning, description);
45}
@ JustWarning
std::ostringstream G4ExceptionDescription
#define G4endl
Definition G4ios.hh:67