Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // >> 23 // >> 24 // $Id: G4LogicalSkinSurface.cc,v 1.8 2002/08/06 08:23:38 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-05-02-patch-01 $ >> 26 // >> 27 // -------------------------------------------------------------------- 26 // G4LogicalSkinSurface Implementation 28 // G4LogicalSkinSurface Implementation >> 29 // -------------------------------------------------------------------- 27 // 30 // 28 // A Logical Surface class for the surface sur 31 // A Logical Surface class for the surface surrounding a single 29 // logical volume. 32 // logical volume. 30 // 33 // 31 // Author: John Apostolakis, CERN - 26-06-1997 << 34 // Created: 1997-06-26 32 // ------------------------------------------- << 35 // Author: John Apostolakis (John.Apostolakis@cern.ch) >> 36 // Modified: 1997-06-26 John Apostolakis >> 37 // >> 38 // ******************************************************************** 33 39 34 #include "G4LogicalSkinSurface.hh" 40 #include "G4LogicalSkinSurface.hh" 35 #include "G4LogicalVolume.hh" << 41 #include "G4ios.hh" 36 42 37 G4LogicalSkinSurfaceTable *G4LogicalSkinSurfac << 43 G4LogicalSkinSurfaceTable G4LogicalSkinSurface::theSurfaceTable; 38 44 39 // ------------------------------------------- << 40 // Constructor << 41 // 45 // 42 G4LogicalSkinSurface::G4LogicalSkinSurface(con << 46 // Constructors & destructor 43 G4L << 47 // 44 G4S << 48 45 : G4LogicalSurface(name, surfaceProperty), << 49 G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String& name, >> 50 G4LogicalVolume* logicalVolume, >> 51 G4OpticalSurface* opticalSurface) >> 52 : G4LogicalSurface(name, opticalSurface), 46 LogVolume(logicalVolume) 53 LogVolume(logicalVolume) 47 { 54 { 48 if (theSkinSurfaceTable == nullptr) << 49 { << 50 theSkinSurfaceTable = new G4LogicalSkinSur << 51 } << 52 // Store in the table of Surfaces 55 // Store in the table of Surfaces 53 // 56 // 54 theSkinSurfaceTable->insert(std::make_pair(l << 57 theSurfaceTable.push_back(this); >> 58 } >> 59 >> 60 G4LogicalSkinSurface::G4LogicalSkinSurface(const G4LogicalSkinSurface& right) >> 61 : G4LogicalSurface(right.GetName(), right.GetOpticalSurface()) >> 62 { >> 63 SetTransitionRadiationSurface(right.GetTransitionRadiationSurface()); >> 64 LogVolume = right.LogVolume; >> 65 theSurfaceTable = right.theSurfaceTable; >> 66 } >> 67 >> 68 G4LogicalSkinSurface::~G4LogicalSkinSurface() >> 69 { 55 } 70 } 56 71 57 // ------------------------------------------- << 58 // Default destructor << 59 // 72 // 60 G4LogicalSkinSurface::~G4LogicalSkinSurface() << 73 // Operators >> 74 // 61 75 62 // ------------------------------------------- << 76 const G4LogicalSkinSurface& 63 G4bool << 77 G4LogicalSkinSurface::operator=(const G4LogicalSkinSurface& right) >> 78 { >> 79 if (&right == this) return *this; >> 80 if (&right) >> 81 { >> 82 SetOpticalSurface(right.GetOpticalSurface()); >> 83 SetName(right.GetName()); >> 84 SetTransitionRadiationSurface(right.GetTransitionRadiationSurface()); >> 85 LogVolume = right.LogVolume; >> 86 theSurfaceTable = right.theSurfaceTable; >> 87 } >> 88 return *this; >> 89 } >> 90 >> 91 G4int 64 G4LogicalSkinSurface::operator==(const G4Logic 92 G4LogicalSkinSurface::operator==(const G4LogicalSkinSurface& right) const 65 { 93 { 66 return (this == (G4LogicalSkinSurface *) &ri 94 return (this == (G4LogicalSkinSurface *) &right); 67 } 95 } 68 96 69 // ------------------------------------------- << 97 G4int 70 G4bool << 71 G4LogicalSkinSurface::operator!=(const G4Logic 98 G4LogicalSkinSurface::operator!=(const G4LogicalSkinSurface& right) const 72 { 99 { 73 return (this != (G4LogicalSkinSurface *) &ri 100 return (this != (G4LogicalSkinSurface *) &right); 74 } 101 } 75 102 76 // ------------------------------------------- << 103 // 77 const G4LogicalSkinSurfaceTable* G4LogicalSkin << 104 // Methods 78 { << 105 // 79 if (theSkinSurfaceTable == nullptr) << 80 { << 81 theSkinSurfaceTable = new G4LogicalSkinSur << 82 } << 83 return theSkinSurfaceTable; << 84 } << 85 106 86 // ------------------------------------------- << 87 size_t G4LogicalSkinSurface::GetNumberOfSkinSu 107 size_t G4LogicalSkinSurface::GetNumberOfSkinSurfaces() 88 { 108 { 89 if (theSkinSurfaceTable != nullptr) << 109 return theSurfaceTable.size(); 90 { << 91 return theSkinSurfaceTable->size(); << 92 } << 93 return 0; << 94 } 110 } 95 111 96 // ------------------------------------------- << 97 G4LogicalSkinSurface* 112 G4LogicalSkinSurface* 98 G4LogicalSkinSurface::GetSurface(const G4Logic 113 G4LogicalSkinSurface::GetSurface(const G4LogicalVolume* vol) 99 { 114 { 100 if (theSkinSurfaceTable != nullptr) << 115 for (size_t i=0; i<theSurfaceTable.size(); i++) 101 { 116 { 102 auto pos = theSkinSurfaceTable->find(vol); << 117 if(theSurfaceTable[i]->GetLogicalVolume() == vol) 103 if(pos != theSkinSurfaceTable->cend()) ret << 118 return theSurfaceTable[i]; 104 } 119 } 105 return nullptr; << 120 return NULL; 106 } 121 } 107 122 108 // ------------------------------------------- << 109 // Dump info for known surfaces 123 // Dump info for known surfaces 110 // 124 // 111 void G4LogicalSkinSurface::DumpInfo() 125 void G4LogicalSkinSurface::DumpInfo() 112 { 126 { 113 G4cout << "***** Skin Surface Table : Nb of << 127 G4cout << "***** Surface Table : Nb of Surfaces = " 114 << GetNumberOfSkinSurfaces() << " *** << 128 << GetNumberOfSkinSurfaces() << " *****" << G4endl; 115 129 116 if (theSkinSurfaceTable != nullptr) << 130 for (size_t i=0; i<theSurfaceTable.size(); i++) 117 { << 118 for(const auto & pos : *theSkinSurfaceTabl << 119 { 131 { 120 G4LogicalSkinSurface* pSurf = pos.second << 132 G4LogicalSkinSurface* pSkinSurface = theSurfaceTable[i]; 121 G4cout << pSurf->GetName() << " : " << G << 133 G4cout << theSurfaceTable[i]->GetName() << " : " << G4endl 122 << " Skin of logical volume " 134 << " Skin of logical volume " 123 << pSurf->GetLogicalVolume()->Get << 135 << pSkinSurface->GetLogicalVolume()->GetName() 124 << G4endl; 136 << G4endl; 125 } 137 } 126 } << 138 G4cout << G4endl; 127 G4cout << G4endl; << 128 } << 129 << 130 // ------------------------------------------- << 131 void G4LogicalSkinSurface::CleanSurfaceTable() << 132 { << 133 if (theSkinSurfaceTable != nullptr) << 134 { << 135 for(const auto & pos : *theSkinSurfaceTabl << 136 { << 137 delete pos.second; << 138 } << 139 theSkinSurfaceTable->clear(); << 140 } << 141 return; << 142 } 139 } 143 140