Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Types | Protected Attributes
G4ITModelManager Class Reference

#include <G4ITModelManager.hh>

Public Member Functions

 G4ITModelManager ()
 
 ~G4ITModelManager ()
 
void Initialize ()
 
 G4ITModelManager (const G4ITModelManager &other)
 
G4ITModelManageroperator= (const G4ITModelManager &rhs)
 
void SetModel (G4VITModel *aModel, G4double startingTime)
 
G4VITModelGetModel (const G4double globalTime)
 

Protected Types

typedef std::map< G4double,
G4VITModel * > 
mapModels
 

Protected Attributes

mapModels fModels
 
G4bool fIsInitialized
 

Detailed Description

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

Definition at line 50 of file G4ITModelManager.hh.

Member Typedef Documentation

typedef std::map<G4double , G4VITModel* > G4ITModelManager::mapModels
protected

Definition at line 63 of file G4ITModelManager.hh.

Constructor & Destructor Documentation

G4ITModelManager::G4ITModelManager ( )

Definition at line 42 of file G4ITModelManager.cc.

43 {;}
#define FALSE
Definition: globals.hh:52
G4ITModelManager::~G4ITModelManager ( )

Definition at line 45 of file G4ITModelManager.cc.

References fModels.

46 {
47  //dtor
48  mapModels::iterator it ;
49 
50  for(it = fModels.begin() ; it != fModels.end() ; it ++)
51  {
52  delete it->second;
53  }
54  fModels.clear();
55 }
G4ITModelManager::G4ITModelManager ( const G4ITModelManager other)

Definition at line 57 of file G4ITModelManager.cc.

References fIsInitialized, and fModels.

58 {
59  mapModels::const_iterator it = right.fModels.begin();
60 
61  for ( ; it != right.fModels.end() ; it++)
62  {
63  fModels[it->first] = it->second->Clone();
64  }
65 
66  fIsInitialized = right.fIsInitialized;
67 }

Member Function Documentation

G4VITModel * G4ITModelManager::GetModel ( const G4double  globalTime)

Definition at line 103 of file G4ITModelManager.cc.

References FatalErrorInArgument, fModels, G4BestUnit, and G4Exception().

104 {
105  if(!fModels.empty())
106  {
107  mapModels::reverse_iterator rit = fModels.rbegin();
108  if(rit != fModels.rend())
109  {
110  if(globalTime > rit->first)
111  {
112  return rit->second;
113  }
114  else
115  {
116  mapModels::iterator it = fModels.begin();
117 
118  if(globalTime < it->first)
119  {
120  G4ExceptionDescription exceptionDescription ;
121  exceptionDescription << "No model was found at time ";
122  exceptionDescription << G4BestUnit(globalTime,"Time");
123  exceptionDescription << ". The first model is registered at time : ";
124  exceptionDescription << G4BestUnit(it->first,"Time") << ". ";
125  G4Exception("G4ITModelManager::GetModel","ITModelManager003",
126  FatalErrorInArgument,exceptionDescription);
127  }
128 
129  it = fModels.lower_bound(globalTime);
130 
131  if(it != fModels.end()) return it->second;
132  }
133  }
134  }
135 
136  G4ExceptionDescription exceptionDescription ;
137  exceptionDescription << "No model was found.";
138  G4Exception("G4ITModelManager::GetModel","ITModelManager004",
139  FatalErrorInArgument,exceptionDescription);
140  return 0;
141 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void G4ITModelManager::Initialize ( )

Definition at line 76 of file G4ITModelManager.cc.

References fModels, and G4VITModel::Initialize().

Referenced by G4ITModelHandler::Initialize().

77 {
78  mapModels::iterator it = fModels.begin();
79 
80  for( ; it != fModels.end() ; it ++)
81  {
82  G4VITModel* model = it ->second;
83  if(model!=0)
84  {
85  model->Initialize();
86  }
87  }
88 }
const XML_Char XML_Content * model
virtual void Initialize()
Definition: G4VITModel.cc:95
G4ITModelManager & G4ITModelManager::operator= ( const G4ITModelManager rhs)

Definition at line 69 of file G4ITModelManager.cc.

70 {
71  if (this == &rhs) return *this; // handle self assignment
72  //assignment operator
73  return *this;
74 }
void G4ITModelManager::SetModel ( G4VITModel aModel,
G4double  startingTime 
)

Definition at line 90 of file G4ITModelManager.cc.

References assert, FALSE, FatalErrorInArgument, fIsInitialized, fModels, and G4Exception().

91 {
93  if(fIsInitialized == true)
94  {
95  G4ExceptionDescription exceptionDescription ;
96  exceptionDescription << "You are trying to insert a new model after initialization of th model manager.";
97  G4Exception("G4ITModelManager::SetModel","ITModelManager001",
98  FatalErrorInArgument,exceptionDescription);
99  }
100  fModels[startingTime] = aModel;
101 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
#define assert(x)
Definition: mymalloc.cc:1309
#define FALSE
Definition: globals.hh:52
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Field Documentation

G4bool G4ITModelManager::fIsInitialized
protected

Definition at line 65 of file G4ITModelManager.hh.

Referenced by G4ITModelManager(), and SetModel().

mapModels G4ITModelManager::fModels
protected

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