Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G3VolTable.cc
이 파일의 문서화 페이지로 가기
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 //
27 // $Id: G3VolTable.cc 67982 2013-03-13 10:36:03Z gcosmo $
28 //
29 // modified by I.Hrivnacova, 13.10.99
30 
31 #include <iomanip>
32 #include "globals.hh"
33 #include "G3VolTable.hh"
34 #include "G3Pos.hh"
35 
36 typedef std::map<G4String, G3VolTableEntry*, std::less<G4String> >
37 ::iterator VTDiterator;
38 
40  : G3toG4TopVTE(0), _FirstKey("UnDefined"), _NG3Pos(0){
41 }
42 
44  if (VTD.size()>0){
45  // G4cout << "Deleting VTD" << G4endl;
46  for (VTDiterator i=VTD.begin(); i != VTD.end(); i++) {
47  delete (*i).second;
48  }
49  VTD.clear();
50  }
51 }
52 
55  VTDiterator i = VTD.find(Vname);
56  if (i == VTD.end()) return 0;
57  else return (*i).second;
58 }
59 
60 void
62  if (VTD.size()){
63  G4int i=0;
64  G4cout << "Dump of VTD - " << VTD.size() << " entries:" << G4endl;
65  VTEStat();
66  for (VTDiterator v=VTD.begin(); v != VTD.end(); v++){
67  G3VolTableEntry* VTE = (*v).second;
68  G4cout << "G3VolTable element " << std::setw(3) << i++ << " name "
69  << VTE->GetName() << " has " << VTE->GetNoDaughters()
70  << " daughters" << G4endl;
71  }
72  }
73 }
74 
77 
78  if (GetVTE(aG3VolTableEntry->GetName()) == 0 ){
79 
80  // create a hash key
81  G4String HashID = aG3VolTableEntry->GetName();
82 
83  if (_FirstKey == "UnDefined") _FirstKey = HashID;
84 
85  // insert into dictionary
86  VTD[HashID] = aG3VolTableEntry;
87  }
88  return GetVTE(aG3VolTableEntry->GetName());
89 }
90 
91 void
93  _NG3Pos++;
94 }
95 
96 void
99 
100  if (G3toG4TopVTE->NPCopies() > 0) {
102  SetFirstVTE();
103  }
104 }
105 
108  return G3toG4TopVTE;
109 }
110 
111 void
113  G4cout << "Instantiated " << VTD.size() <<
114  " volume table entries \n"
115  << " " << _NG3Pos << " positions." << G4endl;
116 }
117 
118 void
120  if (VTD.size()>0){
121  for (VTDiterator i=VTD.begin(); i != VTD.end(); i++) {
122  delete (*i).second;
123  }
124  VTD.clear();
125  }
126  G3toG4TopVTE = 0;
127  _FirstKey = "UnDefined";
128  _NG3Pos = 0;
129 }
virtual ~G3VolTable()
Definition: G3VolTable.cc:43
void VTEStat()
Definition: G3VolTable.cc:112
#define G4endl
Definition: G4ios.hh:61
G4String _FirstKey
Definition: G3VolTable.hh:80
G3VolTableEntry * GetFirstVTE()
Definition: G3VolTable.cc:107
std::map< G4String, G3VolTableEntry *, std::less< G4String > > VTD
Definition: G3VolTable.hh:81
G3VolTableEntry * G3toG4TopVTE
Definition: G3VolTable.hh:79
std::map< G4String, G3VolTableEntry *, std::less< G4String > >::iterator VTDiterator
Definition: G3VolTable.cc:37
G4int _NG3Pos
Definition: G3VolTable.hh:82
void CountG3Pos()
Definition: G3VolTable.cc:92
int G4int
Definition: G4Types.hh:78
G3VolTableEntry * PutVTE(G3VolTableEntry *aVTE)
Definition: G3VolTable.cc:76
void Clear()
Definition: G3VolTable.cc:119
G3VolTableEntry * GetMother(G4int i)
G4GLOB_DLL std::ostream G4cout
G3VolTableEntry * GetVTE(const G4String &Vname)
Definition: G3VolTable.cc:54
void PrintAll()
Definition: G3VolTable.cc:61
void SetFirstVTE()
Definition: G3VolTable.cc:97