Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // 7 // >> 8 // $Id: G4LogicalBorderSurface.cc,v 1.3 2000/04/25 16:15:05 gcosmo Exp $ >> 9 // GEANT4 tag $Name: geant4-02-00 $ >> 10 // >> 11 //////////////////////////////////////////////////////////////////////// 26 // G4LogicalBorderSurface Implementation 12 // G4LogicalBorderSurface Implementation >> 13 //////////////////////////////////////////////////////////////////////// 27 // 14 // 28 // A Logical Surface class for surfaces define << 15 // File: G4LogicalBorderSurface.cc 29 // of two physical volumes. << 16 // Description: A Logical Surface class for surfaces defined by the >> 17 // boundary of two physical volumes. >> 18 // Version: 1.0 >> 19 // Created: 1997-06-26 >> 20 // Author: John Apostolakis >> 21 // mail: John.Apostolakis@cern.ch >> 22 // Modified: 1997-06-26 John Apostolakis 30 // 23 // 31 // Author: John Apostolakis, CERN - 26-06-1997 << 24 // Id tag: 32 // ------------------------------------------- << 25 //////////////////////////////////////////////////////////////////////// 33 26 34 #include "G4LogicalBorderSurface.hh" 27 #include "G4LogicalBorderSurface.hh" 35 #include "G4VPhysicalVolume.hh" << 36 28 37 G4LogicalBorderSurfaceTable* << 38 G4LogicalBorderSurface::theBorderSurfaceTable << 39 29 40 // ------------------------------------------- << 30 G4LogicalBorderSurfaceTable G4LogicalBorderSurface::theBorderSurfaceTable; 41 // Constructor << 42 // << 43 G4LogicalBorderSurface:: << 44 G4LogicalBorderSurface(const G4String& name, << 45 G4VPhysicalVolume << 46 G4VPhysicalVolume << 47 G4SurfaceProperty << 48 : G4LogicalSurface(name, surfaceProperty), << 49 Volume1(vol1), Volume2(vol2), << 50 Index(theBorderSurfaceTable != nullptr ? t << 51 { << 52 if (theBorderSurfaceTable == nullptr) << 53 { << 54 theBorderSurfaceTable = new G4LogicalBorde << 55 } << 56 << 57 // Store in the table of Surfaces << 58 // << 59 theBorderSurfaceTable->insert(std::make_pair << 60 } << 61 31 62 // ------------------------------------------- << 32 ///////////////////////// 63 // Default destructor << 33 // Class Implementation 64 // << 34 ///////////////////////// 65 G4LogicalBorderSurface::~G4LogicalBorderSurfac << 35 >> 36 ///////////////// >> 37 // Constructors >> 38 ///////////////// 66 39 67 // ------------------------------------------- << 40 G4LogicalBorderSurface::G4LogicalBorderSurface(const G4String& name, 68 G4bool << 41 G4VPhysicalVolume* vol1, 69 G4LogicalBorderSurface::operator==(const G4Log << 42 G4VPhysicalVolume* vol2, >> 43 G4OpticalSurface* opticsSurface) >> 44 : G4LogicalSurface(name, opticsSurface), >> 45 Volume1(vol1), >> 46 Volume2(vol2) 70 { 47 { 71 return (this == (G4LogicalBorderSurface *) & << 48 // Store in the table of Surfaces >> 49 theBorderSurfaceTable.insert(this); >> 50 theIndexInTable = theBorderSurfaceTable.index(this); 72 } 51 } 73 52 74 // ------------------------------------------- << 53 G4LogicalBorderSurface::G4LogicalBorderSurface(const G4LogicalBorderSurface &right) 75 G4bool << 54 : G4LogicalSurface(right.GetName(), right.GetOpticalSurface()) 76 G4LogicalBorderSurface::operator!=(const G4Log << 77 { 55 { 78 return (this != (G4LogicalBorderSurface *) & << 56 *this = right; 79 } 57 } 80 58 81 // ------------------------------------------- << 59 G4LogicalBorderSurface::~G4LogicalBorderSurface(){} 82 const G4LogicalBorderSurfaceTable* G4LogicalBo << 60 >> 61 ////////////// >> 62 // Operators >> 63 ////////////// >> 64 >> 65 const G4LogicalBorderSurface& G4LogicalBorderSurface::operator=(const G4LogicalBorderSurface &right) 83 { 66 { 84 if (theBorderSurfaceTable == nullptr) << 67 return right; 85 { << 86 theBorderSurfaceTable = new G4LogicalBorde << 87 } << 88 return theBorderSurfaceTable; << 89 } 68 } 90 69 91 // ------------------------------------------- << 70 G4int G4LogicalBorderSurface::operator==(const G4LogicalBorderSurface &right) const 92 std::size_t G4LogicalBorderSurface::GetNumberO << 93 { 71 { 94 if (theBorderSurfaceTable != nullptr) << 72 return (this == (G4LogicalBorderSurface *) &right); 95 { << 96 return theBorderSurfaceTable->size(); << 97 } << 98 return 0; << 99 } 73 } 100 74 101 // ------------------------------------------- << 75 G4int G4LogicalBorderSurface::operator!=(const G4LogicalBorderSurface &right) const 102 G4LogicalBorderSurface* << 103 G4LogicalBorderSurface::GetSurface(const G4VPh << 104 const G4VPh << 105 { 76 { 106 if (theBorderSurfaceTable != nullptr) << 77 return (this != (G4LogicalBorderSurface *) &right); 107 { << 108 auto pos = theBorderSurfaceTable->find(std << 109 if(pos != theBorderSurfaceTable->cend()) r << 110 } << 111 return nullptr; << 112 } 78 } >> 79 //////////// >> 80 // Methods >> 81 //////////// 113 82 114 // ------------------------------------------- << 83 const G4RWTPtrOrderedVector<G4LogicalBorderSurface>* 115 // Dump info for known surfaces << 84 G4LogicalBorderSurface::GetSurfaceTable() 116 // << 117 void G4LogicalBorderSurface::DumpInfo() << 118 { 85 { 119 G4cout << "***** Surface Table : Nb of Surfa << 86 return &theBorderSurfaceTable; 120 << GetNumberOfBorderSurfaces() << " * << 87 } 121 88 122 if (theBorderSurfaceTable != nullptr) << 89 size_t G4LogicalBorderSurface::GetNumberOfBorderSurfaces() 123 { << 90 { 124 for(const auto & pos : *theBorderSurfaceTa << 91 return theBorderSurfaceTable.length(); 125 { << 92 } 126 G4LogicalBorderSurface* pSurf = pos.seco << 93 127 G4cout << pSurf->GetName() << " : " << G << 94 G4LogicalBorderSurface* G4LogicalBorderSurface::GetSurface(const G4VPhysicalVolume* vol1, 128 << " Border of volumes " << 95 const G4VPhysicalVolume* vol2) 129 << pSurf->GetVolume1()->GetName() << 96 { 130 << pSurf->GetVolume2()->GetName() << 97 for (int i=0; i<theBorderSurfaceTable.length(); i++) { 131 } << 98 if(theBorderSurfaceTable[i]->GetVolume1() == vol1 && 132 } << 99 theBorderSurfaceTable[i]->GetVolume2() == vol2 ) 133 G4cout << G4endl; << 100 return theBorderSurfaceTable[i]; >> 101 } >> 102 return NULL; 134 } 103 } 135 104 136 // ------------------------------------------- << 105 void G4LogicalBorderSurface::DumpInfo() // Class method (it is really const) 137 void G4LogicalBorderSurface::CleanSurfaceTable << 138 { 106 { 139 if (theBorderSurfaceTable != nullptr) << 107 140 { << 108 // Dump info for known surfaces 141 for(const auto & pos : *theBorderSurfaceTa << 109 142 { << 110 G4cout << "***** Surface Table : Nb of Surfaces = " << 143 delete pos.second; << 111 GetNumberOfBorderSurfaces() << " *****" << G4endl; >> 112 >> 113 for (int i=0; i<theBorderSurfaceTable.length(); i++) { >> 114 G4cout << theBorderSurfaceTable[i]->GetName() << " : " << G4endl << >> 115 " Surface type = " << theBorderSurfaceTable[i]->GetName() << G4endl; >> 116 #ifdef PRINT_INFO >> 117 " Surface type = " << theBorderSurfaceTable[i]->GetOpticalSurface()->GetType() << G4endl; >> 118 " Surface finish = " << theBorderSurfaceTable[i]->GetFinish() << G4endl << >> 119 " Surface model = " << theBorderSurfaceTable[i]->GetModel() << G4endl; >> 120 #endif 144 } 121 } 145 theBorderSurfaceTable->clear(); << 122 G4cout << G4endl; 146 } << 147 return; << 148 } 123 } 149 124