MCPcopy Create free account
hub / github.com/Geant4/geant4 / Insert

Method Insert

source/processes/management/src/G4ProcessTable.cc:120–181  ·  view source on GitHub ↗

--------------------------------------------------------------------

Source from the content-addressed store, hash-verified

118// --------------------------------------------------------------------
119//
120G4int G4ProcessTable::Insert(G4VProcess* aProcess,
121 G4ProcessManager* aProcMgr)
122{
123 if ( (aProcess == nullptr) || ( aProcMgr == nullptr ) || !fProcTblVector )
124 {
125#ifdef G4VERBOSE
126 if (verboseLevel>0)
127 {
128 G4cout << "G4ProcessTable::Insert() - arguments are null pointer "
129 << aProcess << "," << aProcMgr << G4endl;
130 }
131#endif
132 return -1;
133 }
134
135#ifdef G4VERBOSE
136 if (verboseLevel>1)
137 {
138 G4cout << "G4ProcessTable::Insert() -";
139 G4cout << " Process[" << aProcess->GetProcessName() << "]";
140 G4cout << " Particle[" << aProcMgr->GetParticleType()->GetParticleName()
141 << "]" << G4endl;
142 }
143#endif
144
145 G4int idxTbl = 0;
146 G4int nidx = (G4int)fProcTblVector->size();
147 G4ProcTblElement* anElement = nullptr;
148 // loop over all elements
149 for (; idxTbl < nidx; ++idxTbl)
150 {
151 anElement = (*fProcTblVector)[idxTbl];
152 if(!anElement) { continue; }
153 // check if this process is included
154 if (aProcess == anElement->GetProcess())
155 {
156 // add the process manager into the element
157 // unless this process manager is included
158 if (!anElement->Contains(aProcMgr))
159 {
160 anElement->Insert(aProcMgr);
161#ifdef G4VERBOSE
162 if (verboseLevel>2)
163 {
164 G4cout << " This Process Manager is registered !! " << G4endl;
165 }
166#endif
167 }
168 return idxTbl;
169 }
170 }
171 // add this process into the table by creating a new element
172 if (verboseLevel>2)
173 {
174 G4cout << " New element is created !! " << G4endl;
175 }
176 anElement = new G4ProcTblElement(aProcess);
177 anElement->Insert(aProcMgr);

Callers 4

LoadDecayTableMethod · 0.45
G4ProcessManagerMethod · 0.45
AddProcessMethod · 0.45

Calls 6

GetParticleNameMethod · 0.45
GetParticleTypeMethod · 0.45
sizeMethod · 0.45
GetProcessMethod · 0.45
ContainsMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected