Geant4 11.1.1
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
 

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 ( )

Definition at line 41 of file G4ITModelManager.cc.

42 : fIsInitialized(false)
43{
44}

◆ ~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 80 of file G4ITModelManager.cc.

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

◆ Initialize()

void G4ITModelManager::Initialize ( )

Definition at line 48 of file G4ITModelManager.cc.

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

◆ operator=()

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

◆ SetModel()

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

Definition at line 63 of file G4ITModelManager.cc.

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

Member Data Documentation

◆ fIsInitialized

G4bool G4ITModelManager::fIsInitialized
protected

Definition at line 86 of file G4ITModelManager.hh.

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: