Geant4  10.03
G4AllITFinder.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4AllITManager.hh 84670 2014-10-17 15:23:24Z matkara $
27 //
28 // Author: Mathieu Karamitros
29 
30 // The code is developed in the framework of the ESA AO7146
31 //
32 // We would be very happy hearing from you, send us your feedback! :)
33 //
34 // In order for Geant4-DNA to be maintained and still open-source,
35 // article citations are crucial.
36 // If you use Geant4-DNA chemistry and you publish papers about your software,
37 // in addition to the general paper on Geant4-DNA:
38 //
39 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
40 //
41 // we would be very happy if you could please also cite the following
42 // reference papers on chemistry:
43 //
44 // J. Comput. Phys. 274 (2014) 841-882
45 // Prog. Nucl. Sci. Tec. 2 (2011) 503-508
46 
47 #ifndef G4AllITManager_h
48 #define G4AllITManager_h 1
49 #include "globals.hh"
50 #include "G4ITType.hh"
51 #include "G4ThreeVector.hh"
52 #include "G4KDTreeResult.hh"
53 
54 #include <map>
55 #include <vector>
56 #include <memory>
57 
58 class G4IT;
59 class G4VITFinder;
60 class G4ITBox;
61 class G4Track;
62 template<typename T>
63  class G4ITFinder;
64 
72 {
73 public:
74  static G4AllITFinder* Instance();
75  static void DeleteInstance();
82 
84  G4ITBox* GetBox(const G4Track*);
85 
86  void RegisterManager(G4VITFinder* manager);
87  void Push(G4Track* track);
88 
93  void SetVerboseLevel(G4int level)
94  {
95  fVerbose = level;
96  }
98  {
99  return fVerbose;
100  }
101 
102  void UpdatePositionMap();
103 
104  template<typename T>
106  const T* it);
107  template<typename T>
108  inline G4KDTreeResultHandle FindNearest(const T* it0, const T* it);
109  template<typename T>
111  const T* it,
112  G4double range);
113  template<typename T>
114  inline G4KDTreeResultHandle FindNearestInRange(const T* it0,
115  const T* it,
116  G4double range);
117 
118 private:
119  G4AllITFinder();
121  std::map<G4ITType, G4VITFinder*> fITSubManager;
122 
123  int fVerbose;
124 };
125 
126 template<typename T>
128  const T* it)
129  {
130  return G4ITFinder<T>::Instance()->FindNearest(pos, it);
131  }
132 
133 template<typename T>
135  const T* it)
136  {
137  return G4ITFinder<T>::Instance()->FindNearest(it0, it);
138  }
139 
140 template<typename T>
142  const T* it,
143  G4double range)
144  {
145  return G4ITFinder<T>::Instance()->FindNearestInRange(pos, it, range);
146  }
147 
148 template<typename T>
150  const T* it,
151  G4double range)
152  {
153  return G4ITFinder<T>::Instance()->FindNearestInRange(it0, it, range);
154  }
155 
156 #endif
CLHEP::Hep3Vector G4ThreeVector
G4KDTreeResultHandle FindNearestInRange(const T *point, int key, G4double)
Tag the G4IT Should be automatically setup by G4IT using : ITDef(MyIT) and ITImp(MyIT) ...
Definition: G4ITType.hh:60
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
G4int GetVerboseLevel()
std::map< G4ITType, G4VITFinder * > fITSubManager
void SetVerboseLevel(G4int level)
Set General verbose for all IT Manager See ITManager builder.
static G4ThreadLocal G4AllITFinder * fpInstance
G4KDTreeResultHandle FindNearest(const G4ThreeVector &pos, const T *it)
Holds all IT Manager, and take care of deleting them when AllITManager is deleted Set general verbose...
static void DeleteInstance()
static G4AllITFinder * Instance()
void UpdatePositionMap()
G4ITBox behaves just like a stack for G4IT.
Definition: G4ITBox.hh:61
static G4ITFinder * Instance()
G4KDTreeResultHandle FindNearest(const G4ThreeVector &, int key)
G4ITBox * GetBox(const G4Track *)
~G4AllITFinder()
To delete the Instance you should use DeleteInstance() rather than the destructor.
Localize the nearest neighbor For now, G4KDTree is used.
G4VITFinder * GetInstance(G4ITType)
void RegisterManager(G4VITFinder *manager)
double G4double
Definition: G4Types.hh:76
G4KDTreeResultHandle FindNearestInRange(const G4ThreeVector &pos, const T *it, G4double range)
{ Class description:
static const G4double pos
void Push(G4Track *track)