Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 << 25 // >> 26 // >> 27 // $Id: G4MaterialPropertiesTable.hh 108517 2018-02-16 08:18:55Z gcosmo $ >> 28 // 26 ////////////////////////////////////////////// 29 //////////////////////////////////////////////////////////////////////// 27 // 30 // 28 // class G4MaterialPropertiesTable 31 // class G4MaterialPropertiesTable 29 // 32 // 30 // Class description: 33 // Class description: 31 // 34 // 32 // A Material properties table is a hash table << 35 // A Material properties table is a hash table, with 33 // key = property name, and value either G4dou 36 // key = property name, and value either G4double or 34 // G4MaterialPropertyVector 37 // G4MaterialPropertyVector 35 // << 38 36 // File: G4MaterialPropertiesTable.hh 39 // File: G4MaterialPropertiesTable.hh 37 // Version: 1.0 40 // Version: 1.0 38 // Created: 1996-02-08 41 // Created: 1996-02-08 39 // Author: Juliet Armstrong 42 // Author: Juliet Armstrong 40 // Updated: 2005-05-12 add SetGROUPVEL() b 43 // Updated: 2005-05-12 add SetGROUPVEL() by P. Gumplinger 41 // 2002-11-05 add named material 44 // 2002-11-05 add named material constants by P. Gumplinger 42 // 1999-11-05 Migration from G4RW 45 // 1999-11-05 Migration from G4RWTPtrHashDictionary to STL 43 // by John Allison 46 // by John Allison 44 // 1999-10-29 add method and clas 47 // 1999-10-29 add method and class descriptors 45 // 1997-03-25 by Peter Gumplinger 48 // 1997-03-25 by Peter Gumplinger 46 // > cosmetics (only) 49 // > cosmetics (only) >> 50 // mail: gum@triumf.ca 47 // 51 // 48 ////////////////////////////////////////////// 52 //////////////////////////////////////////////////////////////////////// 49 53 50 #ifndef G4MaterialPropertiesTable_h 54 #ifndef G4MaterialPropertiesTable_h 51 #define G4MaterialPropertiesTable_h 1 55 #define G4MaterialPropertiesTable_h 1 52 56 >> 57 ///////////// >> 58 // Includes >> 59 ///////////// >> 60 >> 61 #include <cmath> >> 62 #include <map> >> 63 #include "globals.hh" 53 #include "G4MaterialPropertiesIndex.hh" 64 #include "G4MaterialPropertiesIndex.hh" 54 #include "G4MaterialPropertyVector.hh" 65 #include "G4MaterialPropertyVector.hh" 55 #include "globals.hh" << 56 66 57 #include <vector> << 67 ///////////////////// >> 68 // Class Definition >> 69 ///////////////////// 58 70 59 class G4MaterialPropertiesTable 71 class G4MaterialPropertiesTable 60 { 72 { 61 public: << 73 public: // Without description 62 G4MaterialPropertiesTable(); << 74 63 virtual ~G4MaterialPropertiesTable(); << 75 G4MaterialPropertiesTable(); 64 << 76 virtual ~G4MaterialPropertiesTable(); 65 // Add a new property to the table by giving << 77 66 void AddConstProperty(const G4String& key, G << 78 public: // With description 67 void AddConstProperty(const char* key, G4dou << 79 68 << 80 inline void AddConstProperty(const char *key, 69 // Add a new property to the table by giving << 81 G4double PropertyValue); 70 // vectors of values << 82 // Add a new property to the table by giving a key-name and value 71 G4MaterialPropertyVector* AddProperty(const << 83 72 const std::vector<G4double>& photonEnergie << 84 G4MaterialPropertyVector* AddProperty(const char *key, 73 G4bool createNewKey = false, G4bool spline << 85 G4double *PhotonEnergies, 74 << 86 G4double *PropertyValues, 75 // Add a new property to the table by giving << 87 G4int NumEntries); 76 // arrays x and y of size NumEntries. << 88 // Add a new property to the table by giving a key-name and the 77 G4MaterialPropertyVector* AddProperty(const << 89 // arrays x and y of size NumEntries. 78 G4double* propertyValues, G4int numEntries << 90 79 << 91 void AddProperty(const char *key, G4MaterialPropertyVector *opv); 80 // Add a new property to the table by giving << 92 // Add a new property to the table by giving a key-name and an 81 // already constructed G4MaterialPropertyVec << 93 // already constructed G4MaterialPropertyVector. 82 void AddProperty(const G4String& key, G4Mate << 94 83 void AddProperty(const char* key, G4Material << 95 inline void RemoveConstProperty(const char *key); 84 << 96 // Remove a constant property from the table. 85 // Add a new property to the table by giving << 97 86 // name. Properties are in namespace G4Optic << 98 inline void RemoveProperty(const char *key); 87 // Not possible to create a new key with thi << 99 // Remove a property from the table. 88 void AddProperty(const G4String& key, const << 100 89 << 101 G4double GetConstProperty(const char *key) const; 90 // Remove a constant property from the table << 102 // Get the constant property from the table corresponding to the key-name 91 void RemoveConstProperty(const G4String& key << 103 92 void RemoveConstProperty(const char* key); << 104 G4double GetConstProperty(const G4int index) const; 93 << 105 // Get the constant property from the table corresponding to the key-index 94 // Remove a property from the table. << 106 95 void RemoveProperty(const G4String& key); << 107 G4bool ConstPropertyExists(const char *key) const; 96 void RemoveProperty(const char* key); << 108 // Return true if a const property 'key' exists. 97 << 109 98 // Get a constant property from the table << 110 G4MaterialPropertyVector* GetProperty(const char *key, 99 // It is an error to ask for a const propert << 111 G4bool warning=false); 100 // Check if it has been defined with ConstP << 112 // Get the property from the table corresponding to the key-name. 101 G4double GetConstProperty(const G4String& ke << 113 102 G4double GetConstProperty(const char* key) c << 114 G4MaterialPropertyVector* GetProperty(const G4int index, 103 G4double GetConstProperty(const G4int index) << 115 G4bool warning=false); 104 << 116 // Get the property from the table corresponding to the key-index. 105 // Return true if a const property has been << 117 106 // Despite the name, this returns false for << 118 void AddEntry(const char *key, G4double aPhotonEnergy, 107 // GetMaterialConstPropertyNames() but not << 119 G4double aPropertyValue); 108 // Use this method before calling GetConstPr << 120 // Add a new entry (pair of numbers) to the table for a given key. 109 G4bool ConstPropertyExists(const G4String& k << 121 110 G4bool ConstPropertyExists(const char* key) << 122 G4int GetConstPropertyIndex(const G4String& key, 111 G4bool ConstPropertyExists(const G4int index << 123 G4bool warning=false) const; 112 << 124 // Get the constant property index from the key-name 113 // Get the property from the table correspon << 125 114 // nullptr is returned if the property has n << 126 G4int GetPropertyIndex(const G4String& key, G4bool warning=false) const; 115 G4MaterialPropertyVector* GetProperty(const << 127 // Get the property index by the key-name. 116 G4MaterialPropertyVector* GetProperty(const << 128 117 G4MaterialPropertyVector* GetProperty(const << 129 std::vector<G4String> GetMaterialPropertyNames() const; 118 << 130 std::vector<G4String> GetMaterialConstPropertyNames() const; 119 // Add a new entry (pair of numbers) to the << 131 120 void AddEntry(const G4String& key, G4double << 132 void DumpTable(); 121 void AddEntry(const char* key, G4double aPho << 133 122 << 134 public: // without description 123 // Get the constant property index from the << 135 124 // It is an error to request the index of a << 136 std::map< G4String, G4MaterialPropertyVector*, std::less<G4String> >* 125 // present in fMaterialConstPropertyNames() << 137 GetPropertiesMap(); 126 G4int GetConstPropertyIndex(const G4String& << 138 std::map< G4String, G4double, std::less<G4String> >* 127 << 139 GetPropertiesCMap(); 128 // Get the property index by the key-name. << 140 129 // It is an error to request the index of a << 141 const std::map<G4int, G4MaterialPropertyVector*, std::less<G4int> >* 130 // present in GetMaterialPropertyNames()). << 142 GetPropertyMap() const { return &MP; } 131 G4int GetPropertyIndex(const G4String& key) << 143 const std::map<G4int, G4double, std::less<G4int> >* 132 << 144 GetConstPropertyMap() const { return &MCP; } 133 // print the material properties and materia << 145 // Accessors required for persistency purposes 134 void DumpTable() const; << 146 135 << 147 private: 136 // the next four methods are used in persist << 148 137 const std::vector<G4String>& GetMaterialProp << 149 G4MaterialPropertyVector* CalculateGROUPVEL(); 138 const std::vector<G4String>& GetMaterialCons << 150 // Calculate the group velocity based on RINDEX 139 // return references to the vectors of mater << 151 140 const std::vector<G4MaterialPropertyVector*> << 152 G4MaterialPropertyVector* SetGROUPVEL(); 141 const std::vector<std::pair<G4double, G4bool << 153 // Dummy method: will be obsolete from the next (version 11) release 142 << 154 143 private: << 155 private: 144 // Calculate the group velocity based on RIN << 156 145 G4MaterialPropertyVector* CalculateGROUPVEL( << 157 std::map<G4String, G4MaterialPropertyVector*, std::less<G4String> > MPT; 146 << 158 typedef std::map< G4String, G4MaterialPropertyVector*, 147 // Vector of pointer to material property ve << 159 std::less<G4String> >::const_iterator MPTiterator; 148 // All entries are initialized to nullptr. << 160 149 // Order of entries in MP defined by enum in << 161 std::map< G4String, G4double, std::less<G4String> > MPTC; 150 std::vector<G4MaterialPropertyVector*> fMP; << 162 typedef std::map< G4String, G4double, 151 << 163 std::less<G4String> >::const_iterator MPTCiterator; 152 // Vector of energy-independent (i.e., "cons << 164 // MPT and MPTC will be obsolete when associate public interfaces, 153 // need to keep track if a property is defin << 165 // GetPropertiesMap and GetPropertiesCMap are removed from the version 11. 154 // is 'true' if the property is defined. << 166 155 // Order of entries in MCP defined by enum i << 167 std::map<G4int, G4MaterialPropertyVector*, std::less<G4int> > MP; 156 std::vector<std::pair<G4double, G4bool>> fMC << 168 typedef std::map< G4int, G4MaterialPropertyVector*, >> 169 std::less<G4int> >::const_iterator MPiterator; >> 170 >> 171 std::map< G4int, G4double, std::less<G4int> > MCP; >> 172 typedef std::map< G4int, G4double, >> 173 std::less<G4int> >::const_iterator MCPiterator; >> 174 //material property map and constant property map by index types >> 175 >> 176 std::vector<G4String> G4MaterialPropertyName; >> 177 std::vector<G4String> G4MaterialConstPropertyName; >> 178 // vectors of strings of property names 157 179 158 std::vector<G4String> fMatPropNames; // vec << 159 std::vector<G4String> fMatConstPropNames; / << 160 }; 180 }; >> 181 >> 182 ///////////////////// >> 183 // Inline definitions >> 184 ///////////////////// >> 185 >> 186 #include "G4MaterialPropertiesTable.icc" 161 187 162 #endif /* G4MaterialPropertiesTable_h */ 188 #endif /* G4MaterialPropertiesTable_h */ 163 189