Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4InterpolationManager Class Reference

#include <G4InterpolationManager.hh>

Public Member Functions

 G4InterpolationManager ()
 
 ~G4InterpolationManager ()
 
G4InterpolationManageroperator= (const G4InterpolationManager &aManager)
 
void Init (G4int aScheme, G4int aRange)
 
void Init (G4InterpolationScheme aScheme, G4int aRange)
 
void Init (std::istream &aDataFile)
 
G4InterpolationScheme MakeScheme (G4int it)
 
G4InterpolationScheme GetScheme (G4int index) const
 
void CleanUp ()
 
G4InterpolationScheme GetInverseScheme (G4int index)
 
void AppendScheme (G4int aPoint, const G4InterpolationScheme &aScheme)
 

Friends

class G4InterpolationIterator
 

Detailed Description

Definition at line 37 of file G4InterpolationManager.hh.

Constructor & Destructor Documentation

G4InterpolationManager::G4InterpolationManager ( )
inline

Definition at line 43 of file G4InterpolationManager.hh.

44  {
45  nRanges = 1;
46  start = new G4int[1];
47  start[0] = 0;
48  range = new G4int[1];
49  range [0] = 100000;
50  scheme = new G4InterpolationScheme[1];
51  scheme[0] = LINLIN;
52  nEntries = 0;
53  }
int G4int
Definition: G4Types.hh:78
G4InterpolationScheme
G4InterpolationManager::~G4InterpolationManager ( )
inline

Definition at line 55 of file G4InterpolationManager.hh.

56  {
57  if(start!=0) delete [] start;
58  if(range!=0) delete [] range;
59  if(scheme!=0) delete [] scheme;
60  }

Member Function Documentation

void G4InterpolationManager::AppendScheme ( G4int  aPoint,
const G4InterpolationScheme aScheme 
)

Definition at line 90 of file G4InterpolationManager.cc.

91  {
92  if(aPoint!=nEntries)
93  {
94  G4cout <<"G4InterpolationManager::AppendScheme - "<<aPoint<<" "<<nEntries<<G4endl;
95  throw G4HadronicException(__FILE__, __LINE__, "Wrong usage of G4InterpolationManager::AppendScheme");
96  }
97  if(nEntries==0)
98  {
99  nEntries = 1;
100  nRanges = 1;
101  start[0] = 0;
102  range [0] = 1;
103  scheme[0] = aScheme;
104  }
105  else if(aScheme==scheme[nRanges-1])
106  {
107  ++range[nRanges-1];
108  nEntries++;
109  }
110  else
111  {
112  nEntries++;
113  nRanges++;
114  G4int i;
115  G4int * buffer = new G4int[nRanges];
116  G4int * buffer1 = new G4int[nRanges];
117  G4InterpolationScheme* buff2 = new G4InterpolationScheme[nRanges];
118  for(i=0; i<nRanges-1; i++)
119  {
120  buffer[i] = start[i];
121  buffer1[i] = range[i];
122  buff2[i] = scheme[i];
123  }
124  delete [] start;
125  delete [] range;
126  delete [] scheme;
127  start = buffer;
128  range = buffer1;
129  scheme = buff2;
130  start[nRanges-1] = start[nRanges-2]+range[nRanges-2];
131  range[nRanges-1] = 1;
132  scheme[nRanges-1] = aScheme;
133  }
134  }
#define buffer
Definition: xmlparse.cc:628
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4InterpolationScheme
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:

void G4InterpolationManager::CleanUp ( )
inline

Definition at line 142 of file G4InterpolationManager.hh.

143  {
144  nRanges = 0;
145  nEntries = 0;
146  }

Here is the caller graph for this function:

G4InterpolationScheme G4InterpolationManager::GetInverseScheme ( G4int  index)
inline

Definition at line 148 of file G4InterpolationManager.hh.

149  {
151  if(result == HISTO)
152  {
153  result = RANDOM;
154  }
155  else if(result == LINLOG)
156  {
157  result = LOGLIN;
158  }
159  else if(result == LOGLIN)
160  {
161  result = LINLOG;
162  }
163  else if(result == CHISTO)
164  {
165  result = CRANDOM;
166  }
167  else if(result == CLINLOG)
168  {
169  result = CLOGLIN;
170  }
171  else if(result == CLOGLIN)
172  {
173  result = CLINLOG;
174  }
175  else if(result == UHISTO)
176  {
177  result = URANDOM;
178  }
179  else if(result == ULINLOG)
180  {
181  result = ULOGLIN;
182  }
183  else if(result == ULOGLIN)
184  {
185  result = ULINLOG;
186  }
187  return result;
188  }
G4double G4ParticleHPJENDLHEData::G4double result
G4InterpolationScheme GetScheme(G4int index) const
G4InterpolationScheme

Here is the call graph for this function:

Here is the caller graph for this function:

G4InterpolationScheme G4InterpolationManager::GetScheme ( G4int  index) const
inline

Definition at line 131 of file G4InterpolationManager.hh.

132  {
133  G4int it = 0;
134  for(G4int i=1; i<nRanges; i++)
135  {
136  if(index<start[i]) break;
137  it = i;
138  }
139  return scheme[it];
140  }
int G4int
Definition: G4Types.hh:78

Here is the caller graph for this function:

void G4InterpolationManager::Init ( G4int  aScheme,
G4int  aRange 
)
inline

Definition at line 84 of file G4InterpolationManager.hh.

85  {
86  nRanges = 1;
87  start[0] = 0;
88  range [0] = aRange;
89  scheme[0] = MakeScheme(aScheme);
90  nEntries = aRange;
91  }
G4InterpolationScheme MakeScheme(G4int it)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4InterpolationManager::Init ( G4InterpolationScheme  aScheme,
G4int  aRange 
)
inline

Definition at line 92 of file G4InterpolationManager.hh.

93  {
94  nRanges = 1;
95  start[0] = 0;
96  range [0] = aRange;
97  scheme[0] = aScheme;
98  nEntries = aRange;
99  }
void G4InterpolationManager::Init ( std::istream &  aDataFile)
inline

Definition at line 101 of file G4InterpolationManager.hh.

102  {
103  delete [] start;
104  delete [] range;
105  delete [] scheme;
106  aDataFile >> nRanges;
107  start = new G4int[nRanges];
108  range = new G4int[nRanges];
109  scheme = new G4InterpolationScheme[nRanges];
110  start[0] = 0;
111  G4int it;
112  for(G4int i=0; i<nRanges; i++)
113  {
114  aDataFile>>range[i];
115  //***************************************************************
116  //EMendoza -> there is a bug here.
117  /*
118  if(i!=0) start[i] = start[i-1]+range[i-1];
119  */
120  //***************************************************************
121  if(i!=0) start[i] = range[i-1];
122  //***************************************************************
123  aDataFile>>it;
124  scheme[i] = MakeScheme(it);
125  }
126  nEntries = start[nRanges-1]+range[nRanges-1];
127  }
int G4int
Definition: G4Types.hh:78
G4InterpolationScheme
G4InterpolationScheme MakeScheme(G4int it)

Here is the call graph for this function:

G4InterpolationScheme G4InterpolationManager::MakeScheme ( G4int  it)

Definition at line 33 of file G4InterpolationManager.cc.

34  {
36  switch(it)
37  {
38  case 1:
39  result = HISTO;
40  break;
41  case 2:
42  result = LINLIN;
43  break;
44  case 3:
45  result = LINLOG;
46  break;
47  case 4:
48  result = LOGLIN;
49  break;
50  case 5:
51  result = LOGLOG;
52  break;
53  case 11:
54  result = CHISTO;
55  break;
56  case 12:
57  result = CLINLIN;
58  break;
59  case 13:
60  result = CLINLOG;
61  break;
62  case 14:
63  result = CLOGLIN;
64  break;
65  case 15:
66  result = CLOGLOG;
67  break;
68  case 21:
69  result = UHISTO;
70  break;
71  case 22:
72  result = ULINLIN;
73  break;
74  case 23:
75  result = ULINLOG;
76  break;
77  case 24:
78  result = ULOGLIN;
79  break;
80  case 25:
81  result = ULOGLOG;
82  break;
83  default:
84  throw G4HadronicException(__FILE__, __LINE__, "G4InterpolationManager: unknown interpolation scheme");
85  break;
86  }
87  return result;
88  }
G4double G4ParticleHPJENDLHEData::G4double result
G4InterpolationScheme

Here is the caller graph for this function:

G4InterpolationManager& G4InterpolationManager::operator= ( const G4InterpolationManager aManager)
inline

Definition at line 62 of file G4InterpolationManager.hh.

63  {
64  if(this != &aManager)
65  {
66  nRanges = aManager.nRanges;
67  nEntries = aManager.nEntries;
68  if(scheme!=0) delete [] scheme;
69  if(start!=0) delete [] start;
70  if(range!=0) delete [] range;
71  scheme = new G4InterpolationScheme[nRanges];
72  start = new G4int[nRanges];
73  range = new G4int[nRanges];
74  for(G4int i=0; i<nRanges; i++)
75  {
76  scheme[i]=aManager.scheme[i];
77  start[i]=aManager.start[i];
78  range[i]=aManager.range[i];
79  }
80  }
81  return *this;
82  }
int G4int
Definition: G4Types.hh:78
G4InterpolationScheme

Friends And Related Function Documentation

friend class G4InterpolationIterator
friend

Definition at line 41 of file G4InterpolationManager.hh.


The documentation for this class was generated from the following files: