G4MaterialPropertiesTable.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4MaterialPropertiesTable.icc 67044 2013-01-30 08:50:06Z gcosmo $
00028 //
00030 //
00031 // G4MaterialPropertiesTable inline definitions
00032 //
00033 // File:        G4MaterialPropertiesTable.icc
00034 // Version:     1.0
00035 // Created:     1996-02-08
00036 // Author:      Juliet Armstrong
00037 // Updated:     moved to inline
00038 // mail:        gum@triumf.ca
00039 //
00041 
00042 inline
00043 void G4MaterialPropertiesTable::AddConstProperty(const char *key,
00044                                                  G4double PropertyValue)
00045 {
00046   // Provides a way of adding a constant property to the Material Properties
00047   // Table given a key
00048 
00049   MPTC [G4String(key)] = PropertyValue;
00050 }
00051 
00052 inline
00053 G4MaterialPropertyVector* G4MaterialPropertiesTable::AddProperty(
00054                                             const char *key,
00055                                             G4double   *PhotonEnergies,
00056                                             G4double   *PropertyValues,
00057                                             G4int      NumEntries)
00058 {
00059   // Provides a way of adding a property to the Material Properties
00060   // Table given a pair of numbers and a key
00061 
00062   G4MaterialPropertyVector *mpv = new G4MaterialPropertyVector(PhotonEnergies, 
00063                                                    PropertyValues, NumEntries);
00064   MPT [G4String(key)] = mpv;
00065 
00066   return mpv;
00067 }
00068 
00069 inline
00070 void G4MaterialPropertiesTable::
00071 AddProperty(const char *key, G4MaterialPropertyVector *mpv)
00072 {
00073   //  Provides a way of adding a property to the Material Properties
00074   //  Table given an G4MaterialPropertyVector Reference and a key
00075 
00076   MPT [G4String(key)] = mpv;
00077 } 
00078 
00079 inline
00080 void G4MaterialPropertiesTable::RemoveConstProperty(const char *key)
00081 {
00082   MPTC.erase(G4String(key));
00083 }
00084 
00085 inline
00086 void G4MaterialPropertiesTable::RemoveProperty(const char *key)
00087 {
00088   MPT.erase(G4String(key));
00089 }
00090 
00091 inline
00092 G4double G4MaterialPropertiesTable::GetConstProperty(const char *key)
00093 {
00094   // Returns the constant material property corresponding to a key
00095 
00096   MPTCiterator j;
00097   j = MPTC.find(G4String(key));
00098   if ( j != MPTC.end() ) return j->second;
00099   G4Exception("G4MaterialPropertiesTable::GetConstProperty()","mat202",
00100               FatalException, "Constant Material Property not found.");
00101   return 0.;
00102 }
00103 
00104 inline
00105 G4bool G4MaterialPropertiesTable::ConstPropertyExists(const char *key)
00106 {
00107   // Returns true if a const property 'key' exists
00108 
00109   MPTCiterator j;
00110   j = MPTC.find(G4String(key));
00111   if ( j != MPTC.end() ) return true;
00112   return false;
00113 }
00114 
00115 inline G4MaterialPropertyVector*
00116 G4MaterialPropertiesTable::GetProperty(const char *key)
00117 {
00118   // Returns a Material Property Vector corresponding to a key
00119 
00120   MPTiterator i;
00121   i = MPT.find(G4String(key));
00122   if ( i != MPT.end() ) return i->second;
00123   if (G4String(key) == "GROUPVEL") return SetGROUPVEL();
00124   return NULL;
00125 }
00126 
00127 inline
00128 void G4MaterialPropertiesTable::AddEntry(const char *key,
00129                                          G4double    aPhotonEnergy,
00130                                          G4double    aPropertyValue)
00131 {
00132   // Allows to add an entry pair directly to the Material Property Vector
00133   // given a key
00134 
00135   G4MaterialPropertyVector *targetVector=MPT [G4String(key)];
00136   if (targetVector != 0)
00137   {
00138     targetVector->InsertValues(aPhotonEnergy, aPropertyValue);
00139   }
00140   else
00141   {
00142     G4Exception("G4MaterialPropertiesTable::AddEntry()", "mat203",
00143                 FatalException, "Material Property Vector not found.");
00144   }
00145 }

Generated on Mon May 27 17:48:51 2013 for Geant4 by  doxygen 1.4.7