source: trunk/source/materials/include/G4MaterialPropertyVector.hh @ 1294

Last change on this file since 1294 was 1196, checked in by garnier, 15 years ago

update CVS release candidate geant4.9.3.01

File size: 5.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.hh,v 1.14 2009/04/24 09:35:14 gcosmo Exp $
28// GEANT4 tag $Name: materials-V09-02-18 $
29//
30//
31////////////////////////////////////////////////////////////////////////
32//
33// class G4MaterialPropertyVector
34//
35// Class description:
36//
37// A one-to-one mapping from Photon Energy to some optical property
38
39// File:        G4MaterialPropertyVector.hh
40//
41// Version:     1.0
42// Created:     1996-02-08
43// Author:      Juliet Armstrong
44// Updated:     1999-10-29 add method and class descriptors
45//              1997-03-25 by Peter Gumplinger
46//              > value.h -> templates.hh
47// mail:        gum@triumf.ca
48//
49////////////////////////////////////////////////////////////////////////
50
51#ifndef G4MaterialPropertyVector_h   
52#define G4MaterialPropertyVector_h 1
53
54/////////////
55// Includes
56/////////////
57
58#include "G4MPVEntry.hh"
59#include <vector>
60#include <functional>
61
62/////////////////////
63// Class Definition
64/////////////////////
65
66class G4MaterialPropertyVector
67{
68  struct MPVEntry_less
69    : public std::binary_function<G4MPVEntry*, G4MPVEntry*, G4bool>
70  {
71    G4bool operator()(G4MPVEntry* x, G4MPVEntry* y) { return *x < *y; }
72  };
73
74  public: // Without description
75
76    //////////////
77    // Operators
78    //////////////
79
80    inline G4bool operator ++();
81    G4MaterialPropertyVector& operator =(const G4MaterialPropertyVector &right);
82
83    /////////////////
84    // Constructors
85    /////////////////
86
87    G4MaterialPropertyVector() : MPV(0) 
88    {
89      CurrentEntry = -1;
90      NumEntries   = 0;
91    };
92
93  public: // With description
94 
95    G4MaterialPropertyVector(G4double *PhotonEnergies, 
96                             G4double *PropertyValues,
97                             G4int     NumElements);
98      // Constructor of G4MaterialPropertyVector object.
99
100    inline void ResetIterator();
101    inline G4int Entries() const;
102
103    inline void AddElement(G4double aPhotonEnergy, G4double aPropertyValue);
104      // Add a new element (pair of numbers) to the G4MaterialPropertyVector.
105    void RemoveElement(G4double aPhotonEnergy);
106      // Remove the element with given x-value.
107
108    G4double GetProperty(G4double aPhotonEnergy) const;
109      // Returns the y-value for given x-value (with interpolation).
110    G4double GetPhotonEnergy(G4double aProperty) const;
111      // Returns the x-value for given y-value (with interpolation).
112      // NOTE: Assumes that the y-value is an increasing function of
113      //       the x-value. Returns the x-value corresponding to the
114      //       y-value passed in. If several x-values correspond to
115      //       the y-value passed in, the method returns the first
116      //       x-value in the vector that corresponds to that value.
117      // For use with G4MaterialPropertyVector iterator: return
118      // property (or Photon Energy) at current point of iterator.
119
120    inline G4double GetProperty() const;
121    inline G4double GetPhotonEnergy() const;
122    inline G4double GetMaxProperty() const;
123    inline G4double GetMinProperty() const;
124    inline G4double GetMaxPhotonEnergy() const;
125    inline G4double GetMinPhotonEnergy() const;
126   
127  public: // Without description
128
129    G4MaterialPropertyVector(const G4MaterialPropertyVector &right);
130   ~G4MaterialPropertyVector();
131
132    //////////
133    // Tests
134    //////////
135
136    void DumpVector();
137
138    /////////////////////
139    // Helper Functions
140    /////////////////////
141
142    inline G4MPVEntry GetEntry(G4int i) const;
143
144  private:
145
146    void GetAdjacentBins(G4double aPhotonEnergy,
147                         G4int *left, G4int *right) const;
148
149  private:
150
151    /////////////////////////
152    // Private Data Members
153    /////////////////////////
154
155    std::vector<G4MPVEntry*> MPV;
156    G4int NumEntries;
157    G4int CurrentEntry;
158};
159
160///////////////////
161// Inline methods
162///////////////////
163
164#include "G4MaterialPropertyVector.icc"
165
166#endif /* G4MaterialPropertyVector_h */
Note: See TracBrowser for help on using the repository browser.