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

Last change on this file since 1289 was 1196, checked in by garnier, 16 years ago

update CVS release candidate geant4.9.3.01

File size: 5.4 KB
RevLine 
[822]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//
[1058]27// $Id: G4MaterialPropertyVector.hh,v 1.14 2009/04/24 09:35:14 gcosmo Exp $
[1196]28// GEANT4 tag $Name: materials-V09-02-18 $
[822]29//
30//
31////////////////////////////////////////////////////////////////////////
32//
[1058]33// class G4MaterialPropertyVector
34//
35// Class description:
36//
37// A one-to-one mapping from Photon Energy to some optical property
38
[822]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
[1058]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 };
[822]73
[1058]74 public: // Without description
[822]75
[1058]76 //////////////
77 // Operators
78 //////////////
[822]79
[1058]80 inline G4bool operator ++();
81 G4MaterialPropertyVector& operator =(const G4MaterialPropertyVector &right);
[822]82
[1058]83 /////////////////
84 // Constructors
85 /////////////////
[822]86
[1058]87 G4MaterialPropertyVector() : MPV(0)
88 {
89 CurrentEntry = -1;
90 NumEntries = 0;
91 };
[822]92
[1058]93 public: // With description
94
95 G4MaterialPropertyVector(G4double *PhotonEnergies,
96 G4double *PropertyValues,
97 G4int NumElements);
98 // Constructor of G4MaterialPropertyVector object.
[822]99
[1058]100 inline void ResetIterator();
101 inline G4int Entries() const;
[822]102
[1058]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.
[822]107
[1058]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.
[822]119
[1058]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
[822]128
[1058]129 G4MaterialPropertyVector(const G4MaterialPropertyVector &right);
130 ~G4MaterialPropertyVector();
[822]131
[1058]132 //////////
133 // Tests
134 //////////
[822]135
[1058]136 void DumpVector();
[822]137
[1058]138 /////////////////////
139 // Helper Functions
140 /////////////////////
[822]141
[1058]142 inline G4MPVEntry GetEntry(G4int i) const;
[822]143
[1058]144 private:
[822]145
[1058]146 void GetAdjacentBins(G4double aPhotonEnergy,
147 G4int *left, G4int *right) const;
[822]148
[1058]149 private:
[822]150
[1058]151 /////////////////////////
152 // Private Data Members
153 /////////////////////////
[822]154
[1058]155 std::vector<G4MPVEntry*> MPV;
156 G4int NumEntries;
157 G4int CurrentEntry;
[822]158};
159
160///////////////////
161// Inline methods
162///////////////////
163
[1058]164#include "G4MaterialPropertyVector.icc"
[822]165
166#endif /* G4MaterialPropertyVector_h */
Note: See TracBrowser for help on using the repository browser.