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

#include <G4ITModelManager.hh>

Classes

struct  ModelInfo
 

Public Member Functions

 G4ITModelManager ()
 
 ~G4ITModelManager ()
 
void Initialize ()
 
 G4ITModelManager (const G4ITModelManager &other)=delete
 
G4ITModelManageroperator= (const G4ITModelManager &rhs)=delete
 
void SetModel (G4VITStepModel *aModel, G4double startingTime, G4double endTime=DBL_MAX)
 
std::vector< G4VITStepModel * > GetActiveModels (G4double globalTime) const
 

Protected Attributes

std::vector< ModelInfofModelInfoList
 
G4bool fIsInitialized {false}
 

Detailed Description

G4ITModelManager chooses which model to use according to the global simulation time.

Deprecated
This class will be removed

Definition at line 59 of file G4ITModelManager.hh.

Constructor & Destructor Documentation

◆ G4ITModelManager() [1/2]

G4ITModelManager::G4ITModelManager ( )
default

◆ ~G4ITModelManager()

G4ITModelManager::~G4ITModelManager ( )
default

◆ G4ITModelManager() [2/2]

G4ITModelManager::G4ITModelManager ( const G4ITModelManager & other)
delete

Member Function Documentation

◆ GetActiveModels()

std::vector< G4VITStepModel * > G4ITModelManager::GetActiveModels ( G4double globalTime) const

Definition at line 79 of file G4ITModelManager.cc.

80{
81 std::vector<G4VITStepModel*> activeModels;
82
83 for (const auto& modelInfo : fModelInfoList)
84 {
85 if (modelInfo.fStartingTime < globalTime && modelInfo.fEndTime > globalTime)
86 {
87 activeModels.push_back(modelInfo.fpModel.get());
88 }
89 }
90
91 return activeModels;
92}
std::vector< ModelInfo > fModelInfoList

◆ Initialize()

void G4ITModelManager::Initialize ( )

Definition at line 47 of file G4ITModelManager.cc.

48{
49 std::sort(fModelInfoList.begin(), fModelInfoList.end(),
50 [](const ModelInfo& lhs, const ModelInfo& rhs) {
51 return lhs.fStartingTime < rhs.fStartingTime;
52 });
53
54 for (const auto& modelInfo : fModelInfoList)
55 {
56 modelInfo.fpModel->Initialize();
57 }
58
59 fIsInitialized = true;
60}

◆ operator=()

G4ITModelManager & G4ITModelManager::operator= ( const G4ITModelManager & rhs)
delete

◆ SetModel()

void G4ITModelManager::SetModel ( G4VITStepModel * aModel,
G4double startingTime,
G4double endTime = DBL_MAX )

Definition at line 62 of file G4ITModelManager.cc.

65{
66 assert(pModel != nullptr);
68 {
69 G4ExceptionDescription exceptionDescription;
70 exceptionDescription
71 << "You are trying to insert a new model after initializing the model manager.";
72 G4Exception("G4ITModelManager::SetModel", "ITModelManager001",
73 FatalErrorInArgument, exceptionDescription);
74 }
75
76 fModelInfoList.emplace_back(ModelInfo({ startingTime, endTime, std::unique_ptr<G4VITStepModel>(pModel) }));
77}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription

Member Data Documentation

◆ fIsInitialized

G4bool G4ITModelManager::fIsInitialized {false}
protected

Definition at line 86 of file G4ITModelManager.hh.

86{false};

Referenced by Initialize(), and SetModel().

◆ fModelInfoList

std::vector<ModelInfo> G4ITModelManager::fModelInfoList
protected

Definition at line 85 of file G4ITModelManager.hh.

Referenced by GetActiveModels(), Initialize(), and SetModel().


The documentation for this class was generated from the following files: