source: trunk/source/materials/include/G4MaterialPropertyVector.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: 4.4 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: G4MaterialPropertyVector.icc,v 1.2 2009/04/21 15:41:20 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31////////////////////////////////////////////////////////////////////////
32// G4MaterialPropertyVector inline definitions
33////////////////////////////////////////////////////////////////////////
34//
35// File:        G4MaterialPropertyVector.icc
36//
37// Version:     1.0
38// Created:     1996-02-08
39// Author:      Juliet Armstrong
40// Updated:     1999-10-29 add method and class descriptors
41//              1997-03-25 by Peter Gumplinger
42//              > value.h -> templates.hh
43// mail:        gum@triumf.ca
44//
45////////////////////////////////////////////////////////////////////////
46
47inline
48G4bool G4MaterialPropertyVector::operator ++()
49{
50  CurrentEntry++;
51  G4bool last = false;
52  if (CurrentEntry < NumEntries) { last = true; }
53  return last;
54}
55
56inline
57void G4MaterialPropertyVector::ResetIterator()
58{
59  CurrentEntry = -1;
60}
61
62inline
63G4int G4MaterialPropertyVector::Entries() const
64{
65  return NumEntries;
66}
67
68inline
69G4double G4MaterialPropertyVector::GetMaxProperty() const
70{
71  return MPV.back()->GetProperty();
72}
73
74inline
75G4double G4MaterialPropertyVector::GetMinProperty() const
76{
77  return MPV.front()->GetProperty();
78}
79
80inline
81G4double G4MaterialPropertyVector::GetMaxPhotonEnergy() const
82{
83  return MPV.back()->GetPhotonEnergy();
84}
85
86inline
87G4double G4MaterialPropertyVector::GetMinPhotonEnergy() const
88{
89  return MPV.front()->GetPhotonEnergy();
90}
91
92inline
93G4MPVEntry G4MaterialPropertyVector::GetEntry(G4int i) const
94{
95  return *MPV[i];
96}
97
98inline
99void G4MaterialPropertyVector::AddElement(G4double aPhotonEnergy,
100                                          G4double aPropertyValue)
101{
102  G4MPVEntry *newElement;
103  newElement = new G4MPVEntry(aPhotonEnergy, aPropertyValue);
104  MPV.push_back(newElement);
105  std::sort(MPV.begin(), MPV.end(), MPVEntry_less());
106  NumEntries++;
107}
108
109inline
110G4double G4MaterialPropertyVector::GetProperty() const
111{
112  //   For use with G4MaterialPropertyVector iterator
113
114  G4double prop = DBL_MAX;
115  if ((CurrentEntry == -1) || (CurrentEntry >= NumEntries))
116  {
117    G4Exception("G4MaterialPropertyVector::GetProperty()",
118                "OutOfRange", FatalException,
119                "Iterator attempted to retrieve property out of range");
120  }
121  else
122  {
123    prop = MPV[CurrentEntry]->GetProperty();
124  }
125  return prop;
126}
127
128inline
129G4double G4MaterialPropertyVector::GetPhotonEnergy() const
130{
131  //   For use with G4MaterialPropertyVector iterator
132
133  G4double energy = DBL_MAX;
134  if ((CurrentEntry == -1) || (CurrentEntry >= NumEntries))
135  {
136    G4Exception("G4MaterialPropertyVector::GetPhotonEnergy()",
137                "OutOfRange", FatalException,
138                "Iterator attempted to retrieve photon energy out of range");
139  }
140  else
141  {
142    energy = MPV[CurrentEntry]->GetPhotonEnergy();
143  }
144  return energy;
145}
Note: See TracBrowser for help on using the repository browser.