Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ManyFastLists< OBJECT > Class Template Reference

#include <G4ManyFastLists.hh>

+ Inheritance diagram for G4ManyFastLists< OBJECT >:

Public Types

typedef G4ManyFastLists_iterator< OBJECT > iterator
 
- Public Types inherited from G4FastList< OBJECT >::Watcher
enum  Priority {
  eExtreme , eHigh , eNormal , eLow ,
  eVeryLow
}
 
typedef G4FastList< OBJECT > list
 

Public Member Functions

 G4ManyFastLists ()
 
virtual ~G4ManyFastLists ()=default
 
virtual void NotifyDeletingList (G4FastList< OBJECT > *__list)
 
void AddGlobalWatcher (typename G4FastList< OBJECT >::Watcher *watcher)
 
void Add (G4FastList< OBJECT > *__list)
 
void Remove (G4FastList< OBJECT > *__list)
 
bool Holds (OBJECT *__track) const
 
size_t size () const
 
void RemoveLists ()
 
void ClearLists ()
 
iterator begin ()
 
iterator end ()
 
void pop (OBJECT *)
 
- Public Member Functions inherited from G4FastList< OBJECT >::Watcher
 Watcher ()
 
virtual ~Watcher ()
 
virtual G4String GetWatcherName ()
 
Priority GetPriority () const
 
void NotifyDeletingList (G4FastList< OBJECT > *)
 
virtual void NotifyAddObject (OBJECT *, G4FastList< OBJECT > *)
 
virtual void NotifyRemoveObject (OBJECT *, G4FastList< OBJECT > *)
 
void Watch (G4FastList< OBJECT > *fastList)
 
void StopWatching (G4FastList< OBJECT > *fastList, bool removeWatcher=true)
 

Protected Types

typedef G4FastList< G4FastList< OBJECT > > ManyLists
 
typedef std::set< typename G4FastList< OBJECT >::Watcher *, sortWatcher< OBJECT > > WatcherSet
 

Protected Attributes

ManyLists fAssociatedLists
 
WatcherSetfMainListWatchers
 
- Protected Attributes inherited from G4FastList< OBJECT >::Watcher
Priority fPriority
 

Detailed Description

template<class OBJECT>
class G4ManyFastLists< OBJECT >

Definition at line 45 of file G4ManyFastLists.hh.

Member Typedef Documentation

◆ iterator

template<class OBJECT >
typedef G4ManyFastLists_iterator<OBJECT> G4ManyFastLists< OBJECT >::iterator

Definition at line 57 of file G4ManyFastLists.hh.

◆ ManyLists

template<class OBJECT >
typedef G4FastList<G4FastList<OBJECT> > G4ManyFastLists< OBJECT >::ManyLists
protected

Definition at line 48 of file G4ManyFastLists.hh.

◆ WatcherSet

template<class OBJECT >
typedef std::set<typename G4FastList<OBJECT>::Watcher*, sortWatcher<OBJECT> > G4ManyFastLists< OBJECT >::WatcherSet
protected

Definition at line 53 of file G4ManyFastLists.hh.

Constructor & Destructor Documentation

◆ G4ManyFastLists()

template<class OBJECT >
G4ManyFastLists< OBJECT >::G4ManyFastLists ( )
inline

Definition at line 59 of file G4ManyFastLists.hh.

◆ ~G4ManyFastLists()

template<class OBJECT >
virtual G4ManyFastLists< OBJECT >::~G4ManyFastLists ( )
virtualdefault

Member Function Documentation

◆ Add()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::Add ( G4FastList< OBJECT > *  __list)
inline

Definition at line 91 of file G4ManyFastLists.hh.

92 {
93 if (__list == 0) return;
94 fAssociatedLists.push_back(__list); // TODO use the table doubling tech
95 //__list->AddWatcher(this);
96 this->Watch(__list);
97
98 if(fMainListWatchers == 0) return;
99
100 typename WatcherSet::iterator it_watcher = fMainListWatchers->begin();
101 typename WatcherSet::iterator end_watcher = fMainListWatchers->end();
102
103// G4cout << "G4ManyFastLists::Add -- N watchers ="
104// << fMainListWatchers->size()
105// << G4endl;
106
107 for(;it_watcher != end_watcher ;++it_watcher)
108 {
109// G4cout << " *** *** *** WATCH --- "
110// << (*it_watcher)->GetWatcherName()
111// << G4endl;
112 (*it_watcher)->Watch(__list);
113 }
114
115 if(__list->empty() == false)
116 {
117 it_watcher = fMainListWatchers->begin();
118
119 for(;it_watcher != end_watcher ;++it_watcher)
120 {
121 typename G4FastList<OBJECT>::iterator it_obj = __list->begin();
122 for(;it_obj != __list->end() ;++it_obj)
123 {
124// G4cout << " *** *** *** NOTIFY ADD OBJ --- "
125// << (*it_watcher)->GetWatcherName()
126// << G4endl;
127
128 (*it_watcher)->NotifyAddObject(*it_obj,__list);
129 }
130 }
131 }
132// else
133// {
134// G4cout << "__list->empty() == true" << G4endl;
135// }
136
137 /*
138 typename ManyLists::const_iterator __it = fAssociatedLists
139 .begin();
140 typename ManyLists::const_iterator __end = fAssociatedLists
141 .end();
142 for (; __it != __end; __it++)
143 {
144 assert(*__it);
145 }
146 */
147 }
void Watch(G4FastList< OBJECT > *fastList)
Definition: G4FastList.hh:280
iterator begin()
bool empty() const
iterator end()
void push_back(OBJECT *__track)

Referenced by PriorityList::NewMainList(), and PriorityList::PushToListOfSecondaries().

◆ AddGlobalWatcher()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::AddGlobalWatcher ( typename G4FastList< OBJECT >::Watcher watcher)
inline

Definition at line 71 of file G4ManyFastLists.hh.

72 {
73 if(fMainListWatchers == nullptr)
74 {
76 }
77
78 fMainListWatchers->insert(watcher);
79
82
83 for(;it != _end ;++it)
84 {
85 watcher->Watch(*it);
86// (*it)->AddWatcher(watcher);
87// (*it)->AddWatcher(watcher);
88 }
89 }
G4FastList_iterator< G4FastList< OBJECT > > iterator
Definition: G4FastList.hh:321
std::set< typename G4FastList< OBJECT >::Watcher *, sortWatcher< OBJECT > > WatcherSet

Referenced by G4ITTrackHolder::AddWatcherForMainList().

◆ begin()

template<class OBJECT >
G4ManyFastLists< OBJECT >::iterator G4ManyFastLists< OBJECT >::begin
inline

Definition at line 371 of file G4ManyFastLists.hh.

372 {
374 {
378 }
379
380 typename G4FastList<OBJECT>::iterator trackList_it;
381 int i = 0;
382
384 typename ManyLists::iterator _end = fAssociatedLists.end();
385
386 while (it != _end)
387 {
388 if (*it && (*it)->empty() == false)
389 {
390 trackList_it = (*it)->begin();
391 break;
392 }
393 i++;
394 it++;
395 };
396
397 if (i == fAssociatedLists.size() || it == _end)
398 {
399 return end();
400 }
401
402 return G4ManyFastLists_iterator<OBJECT>(trackList_it,
403// fAssociatedLists.begin(),
404 it,
406 }
G4int size() const
Definition: G4FastList.hh:357

Referenced by G4ITStepProcessor::ComputeInteractionLength(), and G4Scheduler::EndTracking().

◆ ClearLists()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::ClearLists ( )
inline

Definition at line 217 of file G4ManyFastLists.hh.

218 {
220 typename ManyLists::iterator __end = fAssociatedLists.end();
221 for (; __it != __end; __it++)
222 if (*__it) (*__it)->clear();
223 }

Referenced by G4ITTrackHolder::Clear().

◆ end()

◆ Holds()

template<class OBJECT >
bool G4ManyFastLists< OBJECT >::Holds ( OBJECT *  __track) const
inline

Definition at line 172 of file G4ManyFastLists.hh.

173 {
176 for (; __it != __end; __it++)
177 if ((*__it)->Holds(__track)) return true;
178 return false;
179 }
G4FastList_const_iterator< G4FastList< OBJECT > > const_iterator
Definition: G4FastList.hh:322

◆ NotifyDeletingList()

template<class OBJECT >
virtual void G4ManyFastLists< OBJECT >::NotifyDeletingList ( G4FastList< OBJECT > *  __list)
inlinevirtual

Definition at line 66 of file G4ManyFastLists.hh.

67 {
68 fAssociatedLists.pop(__list);
69 }
iterator pop(OBJECT *)

◆ pop()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::pop ( OBJECT *  )

◆ Remove()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::Remove ( G4FastList< OBJECT > *  __list)
inline

Definition at line 149 of file G4ManyFastLists.hh.

150 {
151 if (__list == 0) return;
152 fAssociatedLists.pop(__list); // TODO use the table doubling tech
153 __list->RemoveWatcher(this);
154 this->StopWatching(__list);
155
156 typename WatcherSet::iterator it = fMainListWatchers->begin();
157 typename WatcherSet::iterator _end = fMainListWatchers->end();
158
159 for(;it != _end ;++it)
160 {
161 (*it)->StopWatching(__list);
162 }
163
164// typename ManyLists::node* __node = __list->GetListNode();
165// if(__node)
166// {
167// __list->SetListNode(0);
168// delete __node;
169// }
170 }
void StopWatching(G4FastList< OBJECT > *fastList, bool removeWatcher=true)
Definition: G4FastList.hh:286
void RemoveWatcher(Watcher *watcher)
Definition: G4FastList.hh:343

Referenced by G4ManyFastLists< OBJECT >::RemoveLists().

◆ RemoveLists()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::RemoveLists ( )
inline

Definition at line 191 of file G4ManyFastLists.hh.

192 {
194 typename ManyLists::iterator __end = fAssociatedLists.end();
195 for (; __it != __end; __it++)
196 {
197 if (*__it)
198 {
199 (*__it)->clear();
200 typename ManyLists::iterator next = __it;
201 next++;
202 Remove(*__it);
203 typename ManyLists::node* __node = __it.GetNode();
204 if(__node)
205 {
206 __node->GetObject()->SetListNode(0);
207 delete __node;
208 }
209// delete (*__it);
210
211 __it = next;
212 }
213 }
215 }
OBJECT * GetObject()
Definition: G4FastList.hh:152
void clear()
G4FastListNode< G4FastList< OBJECT > > node
Definition: G4FastList.hh:323
void Remove(G4FastList< OBJECT > *__list)

Referenced by G4ITTrackHolder::Clear(), G4ITTrackHolder::MoveMainToWaitingList(), and G4ITTrackHolder::~G4ITTrackHolder().

◆ size()

template<class OBJECT >
size_t G4ManyFastLists< OBJECT >::size ( ) const
inline

Definition at line 181 of file G4ManyFastLists.hh.

182 {
183 size_t __size(0);
184 for (auto __it : fAssociatedLists)
185 {
186 __size += __it->size();
187 }
188 return __size;
189 }

Referenced by G4ITStepProcessor::DoIt(), and G4ITTrackHolder::GetNTracks().

Member Data Documentation

◆ fAssociatedLists

◆ fMainListWatchers

template<class OBJECT >
WatcherSet* G4ManyFastLists< OBJECT >::fMainListWatchers
protected

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