Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G3VolTableEntry Class Reference

#include <G3VolTableEntry.hh>

Public Member Functions

 G3VolTableEntry (G4String &vname, G4String &shape, G4double *rpar, G4int npar, G4int nmed, G4VSolid *solid, G4bool hasNegPars)
 
virtual ~G3VolTableEntry ()
 
G4bool operator== (const G3VolTableEntry &vte) const
 
void AddG3Pos (G3Pos *aG3Pos)
 
void AddDaughter (G3VolTableEntry *aDaughter)
 
void AddMother (G3VolTableEntry *aDaughter)
 
void AddClone (G3VolTableEntry *aDaughter)
 
void AddOverlap (G3VolTableEntry *aOverlap)
 
void ReplaceDaughter (G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
 
void ReplaceMother (G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
 
G3VolTableEntry * FindDaughter (const G4String &vname)
 
G3VolTableEntry * FindMother (const G4String &vname)
 
G3VolTableEntry * FindClone (const G4String &vname)
 
void PrintSolidInfo ()
 
void SetName (G4String name)
 
void SetLV (G4LogicalVolume *lv)
 
void SetSolid (G4VSolid *solid)
 
void SetNmed (G4int nmed)
 
void SetNRpar (G4int npar, G4double *Rpar)
 
void SetDivision (G3Division *division)
 
void SetHasNegPars (G4bool hasNegPars)
 
void SetHasMANY (G4bool hasMANY)
 
void ClearG3PosCopy (G4int copy)
 
void ClearDivision ()
 
G4String GetName ()
 
G4String GetShape ()
 
G4int GetNmed ()
 
G4int GetNpar ()
 
G4double * GetRpar ()
 
G4int NPCopies ()
 
G3Pos * GetG3PosCopy (G4int copy=0)
 
G3Division * GetDivision ()
 
G4bool HasNegPars ()
 
G4bool HasMANY ()
 
G4VSolid * GetSolid ()
 
G4LogicalVolume * GetLV ()
 
G4int GetNoDaughters ()
 
G4int GetNoMothers ()
 
G4int GetNoClones ()
 
G4int GetNoOverlaps ()
 
G3VolTableEntry * GetDaughter (G4int i)
 
G3VolTableEntry * GetMother (G4int i)
 
G3VolTableEntry * GetMother ()
 
G3VolTableEntry * GetClone (G4int i)
 
G3VolTableEntry * GetMasterClone ()
 
std::vector< G3VolTableEntry * > * GetOverlaps ()
 

Detailed Description

Definition at line 80 of file G3VolTableEntry.hh.

Constructor & Destructor Documentation

G3VolTableEntry::G3VolTableEntry ( G4String &  vname,
G4String &  shape,
G4double *  rpar,
G4int  npar,
G4int  nmed,
G4VSolid *  solid,
G4bool  hasNegPars 
)

Definition at line 40 of file G3VolTableEntry.cc.

43  : fVname(vname), fShape(shape), fRpar(0), fNpar(npar), fNmed(nmed),
44  fSolid(solid), fLV(0), fHasNegPars(hasNegPars), fHasMANY(false),
45  fDivision(0)
46 {
47  if (npar>0 && rpar!=0) {
48  fRpar = new G4double[npar];
49  for (G4int i=0; i<npar; i++) fRpar[i] = rpar[i];
50  }
51  fClones.push_back(this);
52 }
int G4int
Definition: G4Types.hh:78
double G4double
Definition: G4Types.hh:76
G3VolTableEntry::~G3VolTableEntry ( )
virtual

Definition at line 54 of file G3VolTableEntry.cc.

54  {
55  if (fRpar!=0) delete [] fRpar;
56  delete fDivision;
57 }

Member Function Documentation

void G3VolTableEntry::AddClone ( G3VolTableEntry *  aDaughter)

Definition at line 91 of file G3VolTableEntry.cc.

References FindClone(), and GetName().

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), and G4CreateCloneVTEWithDivision().

91  {
92  if (FindClone(itsClone->GetName()) == 0) {
93  fClones.push_back(itsClone);
94  }
95 }
G3VolTableEntry * FindClone(const G4String &vname)
void G3VolTableEntry::AddDaughter ( G3VolTableEntry *  aDaughter)

Definition at line 77 of file G3VolTableEntry.cc.

References FindDaughter(), and GetName().

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and G3Division::UpdateVTE().

77  {
78  if (FindDaughter(aDaughter->GetName()) == 0) {
79  fDaughters.push_back(aDaughter);
80  }
81 }
G3VolTableEntry * FindDaughter(const G4String &vname)
G4String GetName()
void G3VolTableEntry::AddG3Pos ( G3Pos *  aG3Pos)

Definition at line 65 of file G3VolTableEntry.cc.

References G3VolTable::CountG3Pos(), G3Vol, G3Pos::GetOnly(), and SetHasMANY().

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), and G4gspos().

65  {
66 
67  // insert this position to the vector
68  G3Vol.CountG3Pos();
69  fG3Pos.push_back(aG3Pos);
70 
71  // pass MANY info
72  G4String vonly = aG3Pos->GetOnly();
73  if (vonly == "MANY") SetHasMANY(true);
74 }
void SetHasMANY(G4bool hasMANY)
void CountG3Pos()
Definition: G3VolTable.cc:92
G4String & GetOnly()
Definition: G3Pos.cc:78
G3G4DLL_API G3VolTable G3Vol
Definition: clparse.cc:54
void G3VolTableEntry::AddMother ( G3VolTableEntry *  aDaughter)

Definition at line 84 of file G3VolTableEntry.cc.

References FindMother(), and GetName().

Referenced by G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and G3Division::UpdateVTE().

84  {
85  if (FindMother(itsMother->GetName()) == 0) {
86  fMothers.push_back(itsMother);
87  }
88 }
G3VolTableEntry * FindMother(const G4String &vname)
void G3VolTableEntry::AddOverlap ( G3VolTableEntry *  aOverlap)

Definition at line 98 of file G3VolTableEntry.cc.

Referenced by G4gsbool().

98  {
99  fOverlaps.push_back(overlap);
100 }
void G3VolTableEntry::ClearDivision ( )

Definition at line 223 of file G3VolTableEntry.cc.

Referenced by G3toG4BuildPVTree().

223  {
224  delete fDivision;
225  fDivision = 0;
226 }
void G3VolTableEntry::ClearG3PosCopy ( G4int  copy)

Definition at line 213 of file G3VolTableEntry.cc.

References copy().

Referenced by G3toG4BuildPVTree().

213  {
214  if (fG3Pos.size()>0 && copy>=0 && copy<G4int(fG3Pos.size())) {
215  std::vector<G3Pos*>::iterator it=fG3Pos.begin();
216  for(G4int j=0;j<copy;j++) it++;
217  if(it!=fG3Pos.end()) {
218  fG3Pos.erase(it);
219  }
220  }
221 }
int G4int
Definition: G4Types.hh:78
void copy(std::vector< T > &main, const std::vector< T > &data)
Definition: DicomRun.hh:91
G3VolTableEntry * G3VolTableEntry::FindClone ( const G4String &  vname)

Definition at line 156 of file G3VolTableEntry.cc.

References GetClone(), GetName(), and GetNoClones().

Referenced by AddClone().

156  {
157  for (G4int i=0; i<GetNoClones(); i++){
158  G3VolTableEntry* cvte = GetClone(i);
159  if (cvte->GetName() == Cname) return cvte;
160  }
161  return 0;
162 }
G3VolTableEntry * GetClone(G4int i)
int G4int
Definition: G4Types.hh:78
G4int GetNoClones()
G4String GetName()
G3VolTableEntry * G3VolTableEntry::FindDaughter ( const G4String &  vname)

Definition at line 139 of file G3VolTableEntry.cc.

References GetDaughter(), GetName(), and GetNoDaughters().

Referenced by AddDaughter().

139  {
140  for (G4int idau=0; idau<GetNoDaughters(); idau++){
141  if (GetDaughter(idau)->GetName() == Dname) return GetDaughter(idau);
142  }
143  return 0;
144 }
int G4int
Definition: G4Types.hh:78
G3VolTableEntry * GetDaughter(G4int i)
G4int GetNoDaughters()
G4String GetName()
G3VolTableEntry * G3VolTableEntry::FindMother ( const G4String &  vname)

Definition at line 147 of file G3VolTableEntry.cc.

References GetMother(), GetName(), and GetNoMothers().

Referenced by AddMother(), and G3toG4BuildPVTree().

147  {
148  for (G4int i=0; i<GetNoMothers(); i++){
149  G3VolTableEntry* mvte = GetMother(i);
150  if (mvte->GetName() == Mname) return mvte;
151  }
152  return 0;
153 }
G4int GetNoMothers()
G3VolTableEntry * GetMother()
int G4int
Definition: G4Types.hh:78
G4String GetName()
G3VolTableEntry * G3VolTableEntry::GetClone ( G4int  i)

Definition at line 332 of file G3VolTableEntry.cc.

Referenced by FindClone(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and MakeBooleanSolids().

332  {
333  if (i<G4int(fClones.size()) && i>=0)
334  return fClones[i];
335  else
336  return 0;
337 }
int G4int
Definition: G4Types.hh:78
G3VolTableEntry * G3VolTableEntry::GetDaughter ( G4int  i)

Definition at line 307 of file G3VolTableEntry.cc.

Referenced by FindDaughter(), G3toG4BuildLVTree(), G3toG4BuildPVTree(), G3toG4MANY(), G4CloneDaughters(), G4ProcessDaughters(), and SubstractSolids().

307  {
308  if (i<G4int(fDaughters.size()) && i>=0)
309  return fDaughters[i];
310  else
311  return 0;
312 }
int G4int
Definition: G4Types.hh:78
G3Division * G3VolTableEntry::GetDivision ( )
inline

Definition at line 165 of file G3VolTableEntry.hh.

Referenced by G3toG4BuildLVTree(), G3toG4BuildPVTree(), G4CloneDaughters(), and G4ProcessDaughters().

166 { return fDivision; }
G3Pos * G3VolTableEntry::GetG3PosCopy ( G4int  copy = 0)

Definition at line 259 of file G3VolTableEntry.cc.

Referenced by G3toG4BuildPVTree(), G3toG4MANY(), G4CloneDaughters(), and SubstractSolids().

259  {
260  if (fG3Pos.size()>0 && copy>=0)
261  return fG3Pos[copy];
262  else
263  return 0;
264 }
void copy(std::vector< T > &main, const std::vector< T > &data)
Definition: DicomRun.hh:91
G4LogicalVolume * G3VolTableEntry::GetLV ( )

Definition at line 282 of file G3VolTableEntry.cc.

Referenced by G3Division::CreatePVReplica(), G3toG4BuildLVTree(), G3toG4BuildPVTree(), and G4BuildGeom().

282  {
283  return fLV;
284 }
G3VolTableEntry * G3VolTableEntry::GetMasterClone ( )

Definition at line 340 of file G3VolTableEntry.cc.

References G4String::contains(), G4String::first(), G3Vol, G3VolTable::GetVTE(), and gSeparator.

Referenced by G3toG4BuildLVTree(), G3toG4BuildPVTree(), G4CloneDaughters(), and MakeBooleanSolids().

340  {
341  G3VolTableEntry* master;
342  G4String name = fVname;
343  if (name.contains(gSeparator)) {
344  name = name(0, name.first(gSeparator));
345  master = G3Vol.GetVTE(name);
346  }
347  else
348  master = this;
349 
350  return master;
351 }
G4int first(char) const
const XML_Char * name
G3VolTableEntry * GetVTE(const G4String &Vname)
Definition: G3VolTable.cc:54
G4bool contains(const std::string &) const
G3G4DLL_API char gSeparator
G3G4DLL_API G3VolTable G3Vol
Definition: clparse.cc:54
G3VolTableEntry * G3VolTableEntry::GetMother ( G4int  i)

Definition at line 315 of file G3VolTableEntry.cc.

Referenced by G3toG4BuildPVTree(), and G3VolTable::SetFirstVTE().

315  {
316  if (i<G4int(fMothers.size()) && i>=0)
317  return fMothers[i];
318  else
319  return 0;
320 }
int G4int
Definition: G4Types.hh:78
G3VolTableEntry * G3VolTableEntry::GetMother ( )

Definition at line 324 of file G3VolTableEntry.cc.

Referenced by FindMother().

324  {
325  if (fMothers.size()>0)
326  return fMothers[0];
327  else
328  return 0;
329 }
G4String G3VolTableEntry::GetName ( void  )
G4int G3VolTableEntry::GetNmed ( )

Definition at line 239 of file G3VolTableEntry.cc.

Referenced by G3toG4BuildLVTree(), G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), and G3Division::UpdateVTE().

239  {
240  return fNmed;
241 }
G4int G3VolTableEntry::GetNoClones ( )

Definition at line 297 of file G3VolTableEntry.cc.

Referenced by FindClone(), G3toG4BuildLVTree(), G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4gspos(), and MakeBooleanSolids().

297  {
298  return fClones.size();
299 }
G4int G3VolTableEntry::GetNoDaughters ( )
G4int G3VolTableEntry::GetNoMothers ( )

Definition at line 292 of file G3VolTableEntry.cc.

Referenced by FindMother(), G3toG4BuildPVTree(), and ReplaceMother().

292  {
293  return fMothers.size();
294 }
G4int G3VolTableEntry::GetNoOverlaps ( )

Definition at line 302 of file G3VolTableEntry.cc.

Referenced by G3toG4MANY().

302  {
303  return fOverlaps.size();
304 }
G4int G3VolTableEntry::GetNpar ( )

Definition at line 244 of file G3VolTableEntry.cc.

Referenced by G3NegVolPars(), G4CloneDaughters(), G4CreateCloneVTE(), G4gspos(), and G4ProcessDaughters().

244  {
245  return fNpar;
246 }
std::vector< G3VolTableEntry * > * G3VolTableEntry::GetOverlaps ( )

Definition at line 354 of file G3VolTableEntry.cc.

Referenced by G3toG4MANY().

354  {
355  return &fOverlaps;
356 }
G4double * G3VolTableEntry::GetRpar ( )

Definition at line 249 of file G3VolTableEntry.cc.

Referenced by G3NegVolPars(), G4CloneDaughters(), G4CreateCloneVTE(), G4gspos(), and G4ProcessDaughters().

249  {
250  return fRpar;
251 }
G4String G3VolTableEntry::GetShape ( )
G4VSolid * G3VolTableEntry::GetSolid ( )

Definition at line 277 of file G3VolTableEntry.cc.

Referenced by G3toG4BuildLVTree(), G3toG4BuildPVTree(), and SubstractSolids().

277  {
278  return fSolid;
279 }
G4bool G3VolTableEntry::HasMANY ( )

Definition at line 272 of file G3VolTableEntry.cc.

Referenced by G3toG4MANY().

272  {
273  return fHasMANY;
274 }
G4bool G3VolTableEntry::HasNegPars ( )

Definition at line 267 of file G3VolTableEntry.cc.

Referenced by G4CloneDaughters(), G4gspos(), G4ProcessDaughters(), and G3Division::UpdateVTE().

267  {
268  return fHasNegPars;
269 }
G4int G3VolTableEntry::NPCopies ( )

Definition at line 254 of file G3VolTableEntry.cc.

Referenced by G3toG4BuildPVTree(), G3toG4MANY(), G4CloneDaughters(), MakeBooleanSolids(), G3VolTable::SetFirstVTE(), and SubstractSolids().

254  {
255  return fG3Pos.size();
256 }
G4bool G3VolTableEntry::operator== ( const G3VolTableEntry &  vte) const
inline

Definition at line 60 of file G3VolTableEntry.cc.

60  {
61  return (this==&lv) ? true : false;
62 }
void G3VolTableEntry::PrintSolidInfo ( )

Definition at line 164 of file G3VolTableEntry.cc.

References G4cout, and G4endl.

164  {
165 // only parameters related to solid definition
166 // are printed
167  G4cout << "VTE: " << fVname << " " << this << G4endl;
168  G4cout << "Solid: " << fSolid << G4endl;
169  G4cout << "Parameters (npar = " << fNpar << ") fRpar: ";
170  for (G4int i=0; i<fNpar; i++) G4cout << fRpar[i] << " ";
171  G4cout << G4endl;
172  G4cout << "HasNegPars: " << fHasNegPars << G4endl;
173  G4cout << "HasMANY: " << fHasMANY << G4endl;
174  G4cout << "================================= " << G4endl;
175 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G3VolTableEntry::ReplaceDaughter ( G3VolTableEntry *  vteOld,
G3VolTableEntry *  vteNew 
)

Definition at line 103 of file G3VolTableEntry.cc.

References FatalException, G4Exception(), GetName(), and GetNoDaughters().

Referenced by G3Division::UpdateVTE().

105 {
106  G4int index = -1;
107  for (G4int i=0; i<GetNoDaughters(); i++){
108  if (fDaughters[i]->GetName() == vteOld->GetName()) index = i;
109  }
110  if (index<0) {
111  G4String err_message = "Old daughter " + vteOld->GetName()
112  + " does not exist.";
113  G4Exception("G3VolTableEntry::ReplaceDaughter()", "G3toG40007",
114  FatalException, err_message);
115  return;
116  }
117  fDaughters[index] = vteNew;
118 }
int G4int
Definition: G4Types.hh:78
G4int GetNoDaughters()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4String GetName()
void G3VolTableEntry::ReplaceMother ( G3VolTableEntry *  vteOld,
G3VolTableEntry *  vteNew 
)

Definition at line 121 of file G3VolTableEntry.cc.

References FatalException, G4Exception(), GetName(), and GetNoMothers().

Referenced by G3Division::UpdateVTE().

123 {
124  G4int index = -1;
125  for (G4int i=0; i<GetNoMothers(); i++){
126  if (fMothers[i]->GetName() == vteOld->GetName()) index = i;
127  }
128  if (index<0) {
129  G4String err_message = "Old mother " + vteOld->GetName()
130  + " does not exist.";
131  G4Exception("G3VolTableEntry::ReplaceMother()", "G3toG40008",
132  FatalException, err_message);
133  return;
134  }
135  fMothers[index] = vteNew;
136 }
G4int GetNoMothers()
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4String GetName()
void G3VolTableEntry::SetDivision ( G3Division *  division)
inline

Definition at line 162 of file G3VolTableEntry.hh.

Referenced by G4CloneDaughters(), and G4CreateCloneVTEWithDivision().

163 { fDivision = division; }
void G3VolTableEntry::SetHasMANY ( G4bool  hasMANY)

Definition at line 209 of file G3VolTableEntry.cc.

Referenced by AddG3Pos().

209  {
210  fHasMANY = hasMANY;
211 }
void G3VolTableEntry::SetHasNegPars ( G4bool  hasNegPars)

Definition at line 205 of file G3VolTableEntry.cc.

Referenced by G3Division::G3Division(), G4CreateCloneVTE(), and G4ProcessDaughters().

205  {
206  fHasNegPars = hasNegPars;
207 }
void G3VolTableEntry::SetLV ( G4LogicalVolume *  lv)

Definition at line 183 of file G3VolTableEntry.cc.

Referenced by G3toG4BuildLVTree().

183  {
184  fLV = lv;
185 }
void G3VolTableEntry::SetName ( G4String  name)

Definition at line 178 of file G3VolTableEntry.cc.

Referenced by G4CreateCloneVTE().

178  {
179  fVname = name;
180 }
const XML_Char * name
void G3VolTableEntry::SetNmed ( G4int  nmed)

Definition at line 192 of file G3VolTableEntry.cc.

Referenced by G3Division::UpdateVTE().

192  {
193  fNmed = nmed;
194 }
void G3VolTableEntry::SetNRpar ( G4int  npar,
G4double *  Rpar 
)

Definition at line 196 of file G3VolTableEntry.cc.

Referenced by G4ProcessDaughters().

196  {
197  if (npar != fNpar) {
198  fNpar = npar;
199  delete [] fRpar;
200  fRpar = new G4double[fNpar];
201  }
202  for (G4int i=0; i<fNpar; i++) fRpar[i] = rpar[i];
203 }
int G4int
Definition: G4Types.hh:78
double G4double
Definition: G4Types.hh:76
void G3VolTableEntry::SetSolid ( G4VSolid *  solid)

Definition at line 188 of file G3VolTableEntry.cc.

Referenced by G4CreateCloneVTE(), G4ProcessDaughters(), and SubstractSolids().

188  {
189  fSolid = solid;
190 }

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