source: trunk/source/materials/include/G4MaterialPropertiesTable.icc

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 5.6 KB
Line 
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// $Id: G4MaterialPropertiesTable.icc,v 1.1 2009/04/21 15:35:45 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30////////////////////////////////////////////////////////////////////////
31//
32// G4MaterialPropertiesTable inline definitions
33//
34// File:        G4MaterialPropertiesTable.icc
35// Version:     1.0
36// Created:     1996-02-08
37// Author:      Juliet Armstrong
38// Updated:     moved to inline
39// mail:        gum@triumf.ca
40//
41////////////////////////////////////////////////////////////////////////
42
43inline
44void G4MaterialPropertiesTable::AddConstProperty(const char *key,
45                                                 G4double PropertyValue)
46{
47  // Provides a way of adding a constant property to the Material Properties
48  // Table given a key
49
50  MPTC [G4String(key)] = PropertyValue;
51}
52
53inline
54void G4MaterialPropertiesTable::AddProperty(const char *key,
55                                            G4double   *PhotonEnergies,
56                                            G4double   *PropertyValues,
57                                            G4int      NumEntries)
58{
59  // Provides a way of adding a property to the Material Properties
60  // Table given a pair of numbers and a key
61
62  G4MaterialPropertyVector *mpv = new G4MaterialPropertyVector(PhotonEnergies,
63                                                   PropertyValues, NumEntries);
64  MPT [G4String(key)] = mpv;
65}
66
67inline
68void G4MaterialPropertiesTable::
69AddProperty(const char *key, G4MaterialPropertyVector *mpv)
70{
71  //  Provides a way of adding a property to the Material Properties
72  //  Table given an G4MaterialPropertyVector Reference and a key
73
74  MPT [G4String(key)] = mpv;
75}
76
77inline
78void G4MaterialPropertiesTable::RemoveConstProperty(const char *key)
79{
80  MPTC.erase(G4String(key));
81}
82
83inline
84void G4MaterialPropertiesTable::RemoveProperty(const char *key)
85{
86  MPT.erase(G4String(key));
87}
88
89inline
90G4double G4MaterialPropertiesTable::GetConstProperty(const char *key)
91{
92  // Returns the constant material property corresponding to a key
93
94  MPTCiterator j;
95  j = MPTC.find(G4String(key));
96  G4double val = 0.0;
97  if ( j != MPTC.end() )
98  {
99    val = j->second;
100  }
101  else
102  {
103    G4Exception("G4MaterialPropertiesTable::GetConstProperty()", "NotFound",
104                FatalException, "Constant Material Property not found.");
105  }
106  return val;
107}
108
109inline
110G4bool G4MaterialPropertiesTable::ConstPropertyExists(const char *key)
111{
112  // Returns true if a const property 'key' exists
113
114  MPTCiterator j;
115  j = MPTC.find(G4String(key));
116  G4bool exists = false;
117  if ( j != MPTC.end() )
118  {
119    exists = true;
120  }
121  return exists;
122}
123
124inline G4MaterialPropertyVector*
125G4MaterialPropertiesTable::GetProperty(const char *key)
126{
127  // Returns a Material Property Vector corresponding to a key
128
129  G4MaterialPropertyVector* pvec = MPT[G4String(key)];
130  if ((!pvec) && (G4String(key) == "GROUPVEL"))
131  {
132    pvec = SetGROUPVEL();
133  }
134  return pvec;
135}
136
137inline
138void G4MaterialPropertiesTable::AddEntry(const char *key,
139                                         G4double    aPhotonEnergy,
140                                         G4double    aPropertyValue)
141{
142  // Allows to add an entry pair directly to the Material Property Vector
143  // given a key
144
145  G4MaterialPropertyVector *targetVector=MPT [G4String(key)];
146  if (targetVector != 0)
147  {
148    targetVector->AddElement(aPhotonEnergy, aPropertyValue);
149  }
150  else
151  {
152    G4Exception("G4MaterialPropertiesTable::AddEntry()", "NotFound",
153                FatalException, "Material Property Vector not found.");
154  }
155}
156
157inline
158void G4MaterialPropertiesTable::RemoveEntry(const char *key, 
159                                            G4double    aPhotonEnergy)
160{
161  // Allows to remove an entry pair directly from the Material Property Vector
162  // given a key
163
164  G4MaterialPropertyVector* targetVector = MPT [G4String(key)];
165  if (targetVector)
166  {
167    targetVector->RemoveElement(aPhotonEnergy);
168  }
169  else
170  {
171    G4Exception("G4MaterialPropertiesTable::RemoveEntry()", "NotFound",
172                FatalException, "Material Property Vector not found.");
173  }
174}
Note: See TracBrowser for help on using the repository browser.