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