Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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::ifstream &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 38 of file G4InterpolationManager.hh.

Constructor & Destructor Documentation

◆ G4InterpolationManager()

G4InterpolationManager::G4InterpolationManager ( )
inline

Definition at line 44 of file G4InterpolationManager.hh.

45 {
46 nRanges = 1;
47 start = new G4int[1];
48 start[0] = 0;
49 range = new G4int[1];
50 range [0] = 100000;
51 scheme = new G4InterpolationScheme[1];
52 scheme[0] = LINLIN;
53 nEntries = 0;
54 }
G4InterpolationScheme
int G4int
Definition: G4Types.hh:66

◆ ~G4InterpolationManager()

G4InterpolationManager::~G4InterpolationManager ( )
inline

Definition at line 56 of file G4InterpolationManager.hh.

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

Member Function Documentation

◆ AppendScheme()

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 G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
#define buffer
Definition: xmlparse.cc:611

Referenced by G4NeutronHPVector::Merge(), and G4NeutronHPVector::SetScheme().

◆ CleanUp()

void G4InterpolationManager::CleanUp ( )
inline

Definition at line 143 of file G4InterpolationManager.hh.

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

Referenced by G4NeutronHPVector::CleanUp().

◆ GetInverseScheme()

G4InterpolationScheme G4InterpolationManager::GetInverseScheme ( G4int  index)
inline

Definition at line 149 of file G4InterpolationManager.hh.

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

Referenced by G4NeutronHPContAngularPar::Sample().

◆ GetScheme()

◆ Init() [1/3]

◆ Init() [2/3]

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

Definition at line 93 of file G4InterpolationManager.hh.

94 {
95 nRanges = 1;
96 start[0] = 0;
97 range [0] = aRange;
98 scheme[0] = aScheme;
99 nEntries = aRange;
100 }

◆ Init() [3/3]

void G4InterpolationManager::Init ( std::ifstream &  aDataFile)
inline

Definition at line 102 of file G4InterpolationManager.hh.

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

◆ MakeScheme()

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 }

Referenced by Init().

◆ operator=()

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

Definition at line 63 of file G4InterpolationManager.hh.

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

Friends And Related Function Documentation

◆ G4InterpolationIterator

friend class G4InterpolationIterator
friend

Definition at line 42 of file G4InterpolationManager.hh.


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