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.1.10.1 1999/12/07 20:48:43 gunter Exp $ >> 9 // GEANT4 tag $Name: geant4-01-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 << 66 35 67 // ------------------------------------------- << 36 ///////////////// 68 G4bool << 37 // Constructors 69 G4LogicalBorderSurface::operator==(const G4Log << 38 ///////////////// >> 39 >> 40 G4LogicalBorderSurface::G4LogicalBorderSurface(const G4String& name, >> 41 G4VPhysicalVolume* vol1, >> 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 G4LogicalBorderSurface* G4LogicalBorderSurface::GetSurface(const G4VPhysicalVolume* vol1, 115 // Dump info for known surfaces << 84 const G4VPhysicalVolume* vol2) 116 // << 117 void G4LogicalBorderSurface::DumpInfo() << 118 { 85 { 119 G4cout << "***** Surface Table : Nb of Surfa << 86 for (int i=0; i<theBorderSurfaceTable.length(); i++) { 120 << GetNumberOfBorderSurfaces() << " * << 87 if(theBorderSurfaceTable[i]->GetVolume1() == vol1 && 121 << 88 theBorderSurfaceTable[i]->GetVolume2() == vol2 ) 122 if (theBorderSurfaceTable != nullptr) << 89 return theBorderSurfaceTable[i]; 123 { << 90 } 124 for(const auto & pos : *theBorderSurfaceTa << 91 return NULL; 125 { << 126 G4LogicalBorderSurface* pSurf = pos.seco << 127 G4cout << pSurf->GetName() << " : " << G << 128 << " Border of volumes " << 129 << pSurf->GetVolume1()->GetName() << 130 << pSurf->GetVolume2()->GetName() << 131 } << 132 } << 133 G4cout << G4endl; << 134 } 92 } 135 93 136 // ------------------------------------------- << 94 void G4LogicalBorderSurface::DumpInfo() // Class method (it is really const) 137 void G4LogicalBorderSurface::CleanSurfaceTable << 138 { 95 { 139 if (theBorderSurfaceTable != nullptr) << 96 140 { << 97 // Dump info for known surfaces 141 for(const auto & pos : *theBorderSurfaceTa << 98 142 { << 99 G4cout << "***** Surface Table : Nb of Surfaces = " << 143 delete pos.second; << 100 GetNumberOfBorderSurfaces() << " *****" << endl; >> 101 >> 102 for (int i=0; i<theBorderSurfaceTable.length(); i++) { >> 103 G4cout << theBorderSurfaceTable[i]->GetName() << " : " << endl << >> 104 " Surface type = " << theBorderSurfaceTable[i]->GetName() << endl; >> 105 #ifdef PRINT_INFO >> 106 " Surface type = " << theBorderSurfaceTable[i]->GetOpticalSurface()->GetType() << endl; >> 107 " Surface finish = " << theBorderSurfaceTable[i]->GetFinish() << endl << >> 108 " Surface model = " << theBorderSurfaceTable[i]->GetModel() << endl; >> 109 #endif 144 } 110 } 145 theBorderSurfaceTable->clear(); << 111 G4cout << endl; 146 } << 147 return; << 148 } 112 } 149 113