Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ExtendedMaterial.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4ExtendedMaterial.hh 96776 2016-05-06 14:11:00Z vnivanch $
28 //
29 
30 //---------------------------------------------------------------------------
31 //
32 // ClassName: G4ExtendedMaterial
33 //
34 // Description: Contains extended material properties
35 //
36 // Class description:
37 //
38 // Is used to define the additional material information. This class
39 // contains a map of G4VMaterialExtension associated with an integer
40 // key of G4PhysicsModelCatalog index.
41 //
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
45 #ifndef G4EXTENDEDMATERIAL_HH
46 #define G4EXTENDEDMATERIAL_HH 1
47 
48 #include "G4Material.hh"
49 #include <unordered_map>
50 #include <memory>
51 #include "G4VMaterialExtension.hh"//Needed for hash defintion
52 
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
56 
57 // A map for material extensions based on the hash of the name.
58 // Extensions are owned by the map
59 using G4MaterialExtensionMap=std::unordered_map<G4String, //KEY
60  std::unique_ptr<G4VMaterialExtension>,//VALUE
61  G4MaterialExtensionHash>;//HASHING FUNCTOR
62 
64 {
65 public: // with description
66  //
67  // Constructor to create an extended material from the base-class G4Material
68  //
69  G4ExtendedMaterial(const G4String& name, //its name
70  const G4Material* baseMaterial); //base material
71 
72  //
73  // Constructor to create an extended material from single element
74  //
75  G4ExtendedMaterial(const G4String& name, //its name
76  G4double z, //atomic number
77  G4double a, //mass of mole
78  G4double density, //density
79  G4State state = kStateUndefined, //solid,gas
80  G4double temp = NTP_Temperature, //temperature
81  G4double pressure = CLHEP::STP_Pressure); //pressure
82 
83  //
84  // Constructor to create an extended material from a combination of elements
85  // and/or materials subsequently added via AddElement and/or AddMaterial
86  //
87  G4ExtendedMaterial(const G4String& name, //its name
88  G4double density, //density
89  G4int nComponents, //nbOfComponents
90  G4State state = kStateUndefined, //solid,gas
91  G4double temp = NTP_Temperature, //temperature
92  G4double pressure = CLHEP::STP_Pressure); //pressure
93 
94  //
95  // Constructor to create an extended material from the base extended material
96  //
97  G4ExtendedMaterial(const G4String& name, //its name
98  G4double density, //density
99  const G4ExtendedMaterial* baseMaterial, //base material
100  G4State state = kStateUndefined, //solid,gas
101  G4double temp = NTP_Temperature, //temperature
102  G4double pressure = CLHEP::STP_Pressure); //pressure
103 
104 public:
105  virtual ~G4ExtendedMaterial() {};
106 
107 private:
108  G4MaterialExtensionMap fExtensionMap;
109 public: // with description
110  //
111  // register G4VMaterialExtension
112  // This class owns extensions. Register with:
113  // RegisterExtension(std::unique_ptr<MyExtension>(new MyExtension("name")));
114  // or:
115  // RegisteerExtension(std::make_unique<MyExtension>("name"));
116  void RegisterExtension(std::unique_ptr<G4VMaterialExtension> extension);
117  //
118  // retrieve G4VMaterialExtension, null pointer is returned if model is not available
120 
122  { return fExtensionMap.size(); }
123 
124  // Retrieve iterators, proxyes to c++ methods. These are const for read-only
125  // access. Use Register/RetreiveExtension to modify map
126  G4MaterialExtensionMap::const_iterator begin() const { return fExtensionMap.begin(); }
127  G4MaterialExtensionMap::const_iterator cbegin() const { return fExtensionMap.cbegin(); }
128  G4MaterialExtensionMap::const_iterator end() const { return fExtensionMap.end(); }
129  G4MaterialExtensionMap::const_iterator cend() const { return fExtensionMap.cend(); }
130 
131 public:
132  virtual G4bool IsExtended() const;
133  void Print(std::ostream& flux) const;
134 };
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
138 #endif
void RegisterExtension(std::unique_ptr< G4VMaterialExtension > extension)
const XML_Char * name
Definition: expat.h:151
G4State
Definition: G4Material.hh:114
static constexpr double STP_Pressure
int G4int
Definition: G4Types.hh:78
G4MaterialExtensionMap::const_iterator cbegin() const
G4MaterialExtensionMap::const_iterator begin() const
void Print(std::ostream &flux) const
G4int GetNumberOfExtensions() const
std::unordered_map< G4String, std::unique_ptr< G4VMaterialExtension >, G4MaterialExtensionHash > G4MaterialExtensionMap
bool G4bool
Definition: G4Types.hh:79
G4VMaterialExtension * RetrieveExtension(const G4String &name)
G4MaterialExtensionMap::const_iterator end() const
G4MaterialExtensionMap::const_iterator cend() const
static const G4double NTP_Temperature
Definition: G4Material.hh:116
double G4double
Definition: G4Types.hh:76
std::hash< std::string > G4MaterialExtensionHash
virtual G4bool IsExtended() const
G4ExtendedMaterial(const G4String &name, const G4Material *baseMaterial)