|
||||
File indexing completed on 2025-01-18 09:58:39
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 // class G4MaterialPropertiesTable 0029 // 0030 // Class description: 0031 // 0032 // A Material properties table is a hash table, with 0033 // key = property name, and value either G4double or 0034 // G4MaterialPropertyVector 0035 // 0036 // File: G4MaterialPropertiesTable.hh 0037 // Version: 1.0 0038 // Created: 1996-02-08 0039 // Author: Juliet Armstrong 0040 // Updated: 2005-05-12 add SetGROUPVEL() by P. Gumplinger 0041 // 2002-11-05 add named material constants by P. Gumplinger 0042 // 1999-11-05 Migration from G4RWTPtrHashDictionary to STL 0043 // by John Allison 0044 // 1999-10-29 add method and class descriptors 0045 // 1997-03-25 by Peter Gumplinger 0046 // > cosmetics (only) 0047 // 0048 //////////////////////////////////////////////////////////////////////// 0049 0050 #ifndef G4MaterialPropertiesTable_h 0051 #define G4MaterialPropertiesTable_h 1 0052 0053 #include "G4MaterialPropertiesIndex.hh" 0054 #include "G4MaterialPropertyVector.hh" 0055 #include "globals.hh" 0056 0057 #include <vector> 0058 0059 class G4MaterialPropertiesTable 0060 { 0061 public: 0062 G4MaterialPropertiesTable(); 0063 virtual ~G4MaterialPropertiesTable(); 0064 0065 // Add a new property to the table by giving a key-name and value 0066 void AddConstProperty(const G4String& key, G4double propertyValue, G4bool createNewKey = false); 0067 void AddConstProperty(const char* key, G4double propertyValue, G4bool createNewKey = false); 0068 0069 // Add a new property to the table by giving a key-name and 0070 // vectors of values 0071 G4MaterialPropertyVector* AddProperty(const G4String& key, 0072 const std::vector<G4double>& photonEnergies, const std::vector<G4double>& propertyValues, 0073 G4bool createNewKey = false, G4bool spline = false); 0074 0075 // Add a new property to the table by giving a key-name and the 0076 // arrays x and y of size NumEntries. 0077 G4MaterialPropertyVector* AddProperty(const char* key, G4double* photonEnergies, 0078 G4double* propertyValues, G4int numEntries, G4bool createNewKey = false, G4bool spline = false); 0079 0080 // Add a new property to the table by giving a key-name and an 0081 // already constructed G4MaterialPropertyVector. 0082 void AddProperty(const G4String& key, G4MaterialPropertyVector* opv, G4bool createNewKey = false); 0083 void AddProperty(const char* key, G4MaterialPropertyVector* opv, G4bool createNewKey = false); 0084 0085 // Add a new property to the table by giving a key name and a material 0086 // name. Properties are in namespace G4OpticalMaterialProperties 0087 // Not possible to create a new key with this method. 0088 void AddProperty(const G4String& key, const G4String& mat); 0089 0090 // Remove a constant property from the table. 0091 void RemoveConstProperty(const G4String& key); 0092 void RemoveConstProperty(const char* key); 0093 0094 // Remove a property from the table. 0095 void RemoveProperty(const G4String& key); 0096 void RemoveProperty(const char* key); 0097 0098 // Get a constant property from the table 0099 // It is an error to ask for a const property that the user has not defined. 0100 // Check if it has been defined with ConstPropertyExists() first. 0101 G4double GetConstProperty(const G4String& key) const; 0102 G4double GetConstProperty(const char* key) const; 0103 G4double GetConstProperty(const G4int index) const; 0104 0105 // Return true if a const property has been defined by the user. 0106 // Despite the name, this returns false for a const property in 0107 // GetMaterialConstPropertyNames() but not defined by user. 0108 // Use this method before calling GetConstProperty(). 0109 G4bool ConstPropertyExists(const G4String& key) const; 0110 G4bool ConstPropertyExists(const char* key) const; 0111 G4bool ConstPropertyExists(const G4int index) const; 0112 0113 // Get the property from the table corresponding to the key-index or index. 0114 // nullptr is returned if the property has not been defined by the user. 0115 G4MaterialPropertyVector* GetProperty(const char* key) const; 0116 G4MaterialPropertyVector* GetProperty(const G4String& key) const; 0117 G4MaterialPropertyVector* GetProperty(const G4int index) const; 0118 0119 // Add a new entry (pair of numbers) to the table for a given key. 0120 void AddEntry(const G4String& key, G4double aPhotonEnergy, G4double aPropertyValue); 0121 void AddEntry(const char* key, G4double aPhotonEnergy, G4double aPropertyValue); 0122 0123 // Get the constant property index from the key-name 0124 // It is an error to request the index of a non-existent key (key not 0125 // present in fMaterialConstPropertyNames()). 0126 G4int GetConstPropertyIndex(const G4String& key) const; 0127 0128 // Get the property index by the key-name. 0129 // It is an error to request the index of a non-existent key (key not 0130 // present in GetMaterialPropertyNames()). 0131 G4int GetPropertyIndex(const G4String& key) const; 0132 0133 // print the material properties and material constant properties 0134 void DumpTable() const; 0135 0136 // the next four methods are used in persistency/GDML: 0137 const std::vector<G4String>& GetMaterialPropertyNames() const { return fMatPropNames; } 0138 const std::vector<G4String>& GetMaterialConstPropertyNames() const { return fMatConstPropNames; } 0139 // return references to the vectors of material (constant) properties. 0140 const std::vector<G4MaterialPropertyVector*>& GetProperties() const { return fMP; } 0141 const std::vector<std::pair<G4double, G4bool>>& GetConstProperties() const { return fMCP; } 0142 0143 private: 0144 // Calculate the group velocity based on RINDEX 0145 G4MaterialPropertyVector* CalculateGROUPVEL(); 0146 0147 // Vector of pointer to material property vectors. 0148 // All entries are initialized to nullptr. Pointer is not null when mat.prop. vector defined. 0149 // Order of entries in MP defined by enum in G4MaterialPropertiesIndex. 0150 std::vector<G4MaterialPropertyVector*> fMP; 0151 0152 // Vector of energy-independent (i.e., "constant") material properties. We 0153 // need to keep track if a property is defined or not: the bool in the pair 0154 // is 'true' if the property is defined. 0155 // Order of entries in MCP defined by enum in G4MaterialPropertiesIndex. 0156 std::vector<std::pair<G4double, G4bool>> fMCP; 0157 0158 std::vector<G4String> fMatPropNames; // vector of strings of property names 0159 std::vector<G4String> fMatConstPropNames; // vector of strings of property names 0160 }; 0161 0162 #endif /* G4MaterialPropertiesTable_h */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |