|
||||
File indexing completed on 2025-01-18 09:58:16
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 0026 //--------------------------------------------------------------------------- 0027 // 0028 // ClassName: G4ExtendedMaterial 0029 // 0030 // Description: Contains extended material properties 0031 // 0032 // Class description: 0033 // 0034 // Is used to define the additional material information. This class 0035 // contains a map of G4VMaterialExtension associated with an integer key. 0036 // 0037 0038 #ifndef G4EXTENDEDMATERIAL_HH 0039 #define G4EXTENDEDMATERIAL_HH 1 0040 0041 #include "G4Material.hh" 0042 #include "G4VMaterialExtension.hh" //Needed for hash defintion 0043 0044 #include <memory> 0045 #include <unordered_map> 0046 0047 // A map for material extensions based on the hash of the name. 0048 // Extensions are owned by the map 0049 using G4MaterialExtensionMap = std::unordered_map<G4String, // KEY 0050 std::unique_ptr<G4VMaterialExtension>, // VALUE 0051 G4MaterialExtensionHash>; // HASHING FUNCTOR 0052 0053 class G4ExtendedMaterial : public G4Material 0054 { 0055 public: // with description 0056 // Constructor to create an extended material from the base-class G4Material 0057 G4ExtendedMaterial(const G4String& name, // its name 0058 const G4Material* baseMaterial); // base material 0059 0060 // Constructor to create an extended material from single element 0061 G4ExtendedMaterial(const G4String& name, // its name 0062 G4double z, // atomic number 0063 G4double a, // mass of mole 0064 G4double density, // density 0065 G4State state = kStateUndefined, // solid,gas 0066 G4double temp = NTP_Temperature, // temperature 0067 G4double pressure = CLHEP::STP_Pressure); // pressure 0068 0069 // Constructor to create an extended material from a combination of elements 0070 // and/or materials subsequently added via AddElement and/or AddMaterial 0071 G4ExtendedMaterial(const G4String& name, // its name 0072 G4double density, // density 0073 G4int nComponents, // nbOfComponents 0074 G4State state = kStateUndefined, // solid,gas 0075 G4double temp = NTP_Temperature, // temperature 0076 G4double pressure = CLHEP::STP_Pressure); // pressure 0077 0078 // Constructor to create an extended material from the base extended material 0079 G4ExtendedMaterial(const G4String& name, // its name 0080 G4double density, // density 0081 const G4ExtendedMaterial* baseMaterial, // base material 0082 G4State state = kStateUndefined, // solid,gas 0083 G4double temp = NTP_Temperature, // temperature 0084 G4double pressure = CLHEP::STP_Pressure); // pressure 0085 0086 ~G4ExtendedMaterial() override = default; 0087 0088 // register G4VMaterialExtension 0089 // This class owns extensions. Register with: 0090 // RegisterExtension(std::unique_ptr<MyExtension>(new MyExtension("name"))); 0091 // or: 0092 // RegisteerExtension(std::make_unique<MyExtension>("name")); 0093 void RegisterExtension(std::unique_ptr<G4VMaterialExtension> extension); 0094 0095 // retrieve G4VMaterialExtension, null pointer is returned if model is not available 0096 G4VMaterialExtension* RetrieveExtension(const G4String& name); 0097 0098 inline G4int GetNumberOfExtensions() const { return G4int(fExtensionMap.size()); } 0099 0100 // Retrieve iterators, proxyes to c++ methods. These are const for read-only 0101 // access. Use Register/RetreiveExtension to modify map 0102 G4MaterialExtensionMap::const_iterator begin() const { return fExtensionMap.begin(); } 0103 G4MaterialExtensionMap::const_iterator cbegin() const { return fExtensionMap.cbegin(); } 0104 G4MaterialExtensionMap::const_iterator end() const { return fExtensionMap.end(); } 0105 G4MaterialExtensionMap::const_iterator cend() const { return fExtensionMap.cend(); } 0106 0107 G4bool IsExtended() const override; 0108 void Print(std::ostream& flux) const; 0109 0110 private: 0111 G4MaterialExtensionMap fExtensionMap; 0112 }; 0113 0114 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |