Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ITModelManager Class Reference

#include <G4ITModelManager.hh>

Public Member Functions

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

Protected Types

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

Protected Attributes

mapModels fModels
 
G4bool fIsInitialized
 

Detailed Description

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

Definition at line 58 of file G4ITModelManager.hh.

Member Typedef Documentation

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

Definition at line 71 of file G4ITModelManager.hh.

Constructor & Destructor Documentation

G4ITModelManager::G4ITModelManager ( )

Definition at line 42 of file G4ITModelManager.cc.

42  :
44 {
45  ;
46 }
#define FALSE
Definition: globals.hh:52
G4ITModelManager::~G4ITModelManager ( )

Definition at line 48 of file G4ITModelManager.cc.

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

Definition at line 60 of file G4ITModelManager.cc.

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

Member Function Documentation

G4VITStepModel * G4ITModelManager::GetModel ( const G4double  globalTime)

Definition at line 107 of file G4ITModelManager.cc.

108 {
109  if (!fModels.empty())
110  {
111  mapModels::reverse_iterator rit = fModels.rbegin();
112  if (rit != fModels.rend())
113  {
114  if (globalTime > rit->first)
115  {
116  return rit->second;
117  }
118  else
119  {
120  mapModels::iterator it = fModels.begin();
121 
122  if (globalTime < it->first)
123  {
124  G4ExceptionDescription exceptionDescription;
125  exceptionDescription << "No model was found at time ";
126  exceptionDescription << G4BestUnit(globalTime, "Time");
127  exceptionDescription << ". The first model is registered at time : ";
128  exceptionDescription << G4BestUnit(it->first, "Time") << ". ";
129  G4Exception("G4ITModelManager::GetModel", "ITModelManager003",
130  FatalErrorInArgument, exceptionDescription);
131  }
132 
133  it = fModels.lower_bound(globalTime);
134 
135  if (it != fModels.end()) return it->second;
136  }
137  }
138  }
139 
140  G4ExceptionDescription exceptionDescription;
141  exceptionDescription << "No model was found.";
142  G4Exception("G4ITModelManager::GetModel", "ITModelManager004",
143  FatalErrorInArgument, exceptionDescription);
144  return 0;
145 }
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

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ITModelManager::Initialize ( )

Definition at line 79 of file G4ITModelManager.cc.

80 {
81  mapModels::iterator it = fModels.begin();
82 
83  for (; it != fModels.end(); it++)
84  {
85  G4VITStepModel* model = it->second;
86  if (model != 0)
87  {
88  model->Initialize();
89  }
90  }
91 }
virtual void Initialize()
const XML_Char XML_Content * model
Definition: expat.h:151

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 72 of file G4ITModelManager.cc.

73 {
74  if (this == &rhs) return *this; // handle self assignment
75  //assignment operator
76  return *this;
77 }
void G4ITModelManager::SetModel ( G4VITStepModel aModel,
G4double  startingTime 
)

Definition at line 93 of file G4ITModelManager.cc.

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

Here is the call graph for this function:

Member Data Documentation

G4bool G4ITModelManager::fIsInitialized
protected

Definition at line 73 of file G4ITModelManager.hh.

mapModels G4ITModelManager::fModels
protected

Definition at line 72 of file G4ITModelManager.hh.


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