Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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//
28
29//---------------------------------------------------------------------------
30//
31// ClassName: G4ExtendedMaterial
32//
33// Description: Contains extended material properties
34//
35// Class description:
36//
37// Is used to define the additional material information. This class
38// contains a map of G4VMaterialExtension associated with an integer key.
39//
40
41//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42
43#ifndef G4EXTENDEDMATERIAL_HH
44#define G4EXTENDEDMATERIAL_HH 1
45
46#include "G4Material.hh"
47#include <unordered_map>
48#include <memory>
49#include "G4VMaterialExtension.hh"//Needed for hash defintion
50
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
54
55// A map for material extensions based on the hash of the name.
56// Extensions are owned by the map
57using G4MaterialExtensionMap=std::unordered_map<G4String, //KEY
58 std::unique_ptr<G4VMaterialExtension>,//VALUE
59 G4MaterialExtensionHash>;//HASHING FUNCTOR
60
62{
63public: // with description
64 //
65 // Constructor to create an extended material from the base-class G4Material
66 //
67 G4ExtendedMaterial(const G4String& name, //its name
68 const G4Material* baseMaterial); //base material
69
70 //
71 // Constructor to create an extended material from single element
72 //
73 G4ExtendedMaterial(const G4String& name, //its name
74 G4double z, //atomic number
75 G4double a, //mass of mole
76 G4double density, //density
77 G4State state = kStateUndefined, //solid,gas
78 G4double temp = NTP_Temperature, //temperature
79 G4double pressure = CLHEP::STP_Pressure); //pressure
80
81 //
82 // Constructor to create an extended material from a combination of elements
83 // and/or materials subsequently added via AddElement and/or AddMaterial
84 //
85 G4ExtendedMaterial(const G4String& name, //its name
86 G4double density, //density
87 G4int nComponents, //nbOfComponents
88 G4State state = kStateUndefined, //solid,gas
89 G4double temp = NTP_Temperature, //temperature
90 G4double pressure = CLHEP::STP_Pressure); //pressure
91
92 //
93 // Constructor to create an extended material from the base extended material
94 //
95 G4ExtendedMaterial(const G4String& name, //its name
96 G4double density, //density
97 const G4ExtendedMaterial* baseMaterial, //base material
98 G4State state = kStateUndefined, //solid,gas
99 G4double temp = NTP_Temperature, //temperature
100 G4double pressure = CLHEP::STP_Pressure); //pressure
101
102public:
103 ~G4ExtendedMaterial() override = default;
104
105private:
106 G4MaterialExtensionMap fExtensionMap;
107public: // with description
108 //
109 // register G4VMaterialExtension
110 // This class owns extensions. Register with:
111 // RegisterExtension(std::unique_ptr<MyExtension>(new MyExtension("name")));
112 // or:
113 // RegisteerExtension(std::make_unique<MyExtension>("name"));
114 void RegisterExtension(std::unique_ptr<G4VMaterialExtension> extension);
115 //
116 // retrieve G4VMaterialExtension, null pointer is returned if model is not available
118
120 { return G4int(fExtensionMap.size()); }
121
122 // Retrieve iterators, proxyes to c++ methods. These are const for read-only
123 // access. Use Register/RetreiveExtension to modify map
124 G4MaterialExtensionMap::const_iterator begin() const { return fExtensionMap.begin(); }
125 G4MaterialExtensionMap::const_iterator cbegin() const { return fExtensionMap.cbegin(); }
126 G4MaterialExtensionMap::const_iterator end() const { return fExtensionMap.end(); }
127 G4MaterialExtensionMap::const_iterator cend() const { return fExtensionMap.cend(); }
128
129public:
130 G4bool IsExtended() const override;
131 void Print(std::ostream& flux) const;
132};
133
134//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135
136#endif
std::unordered_map< G4String, std::unique_ptr< G4VMaterialExtension >, G4MaterialExtensionHash > G4MaterialExtensionMap
G4State
Definition: G4Material.hh:110
@ kStateUndefined
Definition: G4Material.hh:110
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
std::hash< std::string > G4MaterialExtensionHash
void Print(std::ostream &flux) const
G4int GetNumberOfExtensions() const
void RegisterExtension(std::unique_ptr< G4VMaterialExtension > extension)
G4MaterialExtensionMap::const_iterator end() const
G4bool IsExtended() const override
G4MaterialExtensionMap::const_iterator begin() const
G4VMaterialExtension * RetrieveExtension(const G4String &name)
G4MaterialExtensionMap::const_iterator cbegin() const
G4MaterialExtensionMap::const_iterator cend() const
~G4ExtendedMaterial() override=default