Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
EqualStepCoorMesh< T > Class Template Reference

#include <tline.h>

+ Inheritance diagram for EqualStepCoorMesh< T >:

Public Member Functions

long get_qi (void) const
 
get_xmin (void) const
 
get_xmax (void) const
 
void get_scoor (long n, T &b) const
 
int get_interval (long n, T &b1, T &b2) const
 
virtual int get_interval (T x, long &n1) const
 
virtual int get_interval (T x, long &n1, T &b1, long &n2, T &b2) const
 
virtual int get_interval_extrap (T x, long &n1, T &b1, long &n2, T &b2) const
 
int get_step (long n, T &fstep) const
 
 EqualStepCoorMesh (void)
 
 EqualStepCoorMesh (long fq, T fxmin, T fxmax)
 
void print (std::ostream &file) const
 

Detailed Description

template<class T>
class EqualStepCoorMesh< T >

Definition at line 60 of file tline.h.

Constructor & Destructor Documentation

◆ EqualStepCoorMesh() [1/2]

template<class T >
EqualStepCoorMesh< T >::EqualStepCoorMesh ( void  )
inline

Definition at line 96 of file tline.h.

102: q(0), xmin(0), xmax(0), step(0) { ; }

◆ EqualStepCoorMesh() [2/2]

template<class T >
EqualStepCoorMesh< T >::EqualStepCoorMesh ( long  fq,
fxmin,
fxmax 
)

Definition at line 116 of file tline.h.

117 : q(fq), xmin(fxmin), xmax(fxmax) {
118 mfunname("template<class T> EqualStepCoorMesh<T>::EqualStepCoorMesh<T>(long "
119 "fq, T fxmin, T fxmax)");
120 check_econd11(q, < 0, mcerr);
121 check_econd24(q, ==, 0, &&, xmin, <, xmax, mcerr);
122 check_econd12(xmin, >, xmax, mcerr);
123 /*
124 if(q < 0)
125 {
126 mcerr<<"ERROR in EqualStepCoorMesh<T>::get_interval_extrap:\n"
127 <<"q < 0\n";
128 Iprintn(mcerr, q);
129 spexit(mcerr);
130 }
131 if(q <= 1 && xmin < xmax)
132 {
133 mcerr<<"ERROR in EqualStepCoorMesh<T>::get_interval_extrap:\n"
134 <<"q <= 1 && xmin < xmax\n";
135 Iprintn(mcerr, q);
136 spexit(mcerr);
137 }
138 if(xmin > xmax)
139 {
140 mcerr<<"ERROR in EqualStepCoorMesh<T>::get_interval_extrap:\n"
141 <<"xmin > xmax\n";
142 Iprint2n(mcout, xmin, xmax);
143 spexit(mcerr);
144 }
145 */
146 step = (fxmax - fxmin) / q;
147 check_econd11(step, == 0, mcerr);
148}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
#define check_econd24(a1, sign1, b1, sign0, a2, sign2, b2, stream)
Definition: FunNameStack.h:462
#define check_econd12(a, sign, b, stream)
Definition: FunNameStack.h:380
#define mfunname(string)
Definition: FunNameStack.h:67
#define mcerr
Definition: prstream.h:135

Member Function Documentation

◆ get_interval() [1/3]

template<class T >
int EqualStepCoorMesh< T >::get_interval ( long  n,
T &  b1,
T &  b2 
) const
inline

Definition at line 72 of file tline.h.

72 {
73 if (n < 0 || n >= q) return 0;
74 b1 = xmin + n * step;
75 b2 = b1 + step;
76 return 1;
77 }

Referenced by VirtEqualStepCoorMesh< T >::get_interval().

◆ get_interval() [2/3]

template<class T >
int EqualStepCoorMesh< T >::get_interval ( x,
long &  n1 
) const
virtual

Reimplemented in VirtEqualStepCoorMesh< T >.

Definition at line 150 of file tline.h.

150 {
151 if (x < xmin || x >= xmax) {
152 n1 = 0;
153 return 0;
154 }
155 n1 = long((x - xmin) / step);
156 if (n1 < 0) {
157 mcerr << "ERROR in EqualStepCoorMesh<T>::get_interval:\n"
158 << "n1 < 0 \n";
159 //if(n1 < 0 || n1 >= q || n2 < 0 || n2 > q ||
160 // b1 < xmin || b1 > xmax || b2 < xmin || b2 > xmax )
161 //{
162 //mcerr<<"ERROR in EqualStepCoorMesh<T>::get_interval:\n"
163 // <<"n1 < 0 || n1 >= q || n2 < 0 || n2 > q || b1 < xmin || b1 >
164 // xmax || b2 < xmin || b2 > xmax\n";
165 print(mcerr);
166 Iprintn(mcerr, x);
167 Iprintn(mcerr, n1);
168 spexit(mcerr);
169 }
170 return 1;
171}
#define spexit(stream)
Definition: FunNameStack.h:536
void print(std::ostream &file) const
Definition: tline.h:248
#define Iprintn(file, name)
Definition: prstream.h:216

◆ get_interval() [3/3]

template<class T >
int EqualStepCoorMesh< T >::get_interval ( x,
long &  n1,
T &  b1,
long &  n2,
T &  b2 
) const
virtual

Reimplemented in VirtEqualStepCoorMesh< T >.

Definition at line 174 of file tline.h.

175 {
176 if (x < xmin || x >= xmax) {
177 n1 = 0;
178 n2 = 0;
179 b1 = 0;
180 b2 = 0;
181 return 0;
182 }
183 n1 = long((x - xmin) / step);
184 n2 = n1 + 1;
185 b1 = xmin + step * n1;
186 b2 = b1 + step;
187 if (n1 < 0 || n2 > q || b2 > xmax) {
188 mcerr << "ERROR in EqualStepCoorMesh<T>::get_interval:\n"
189 << "n1 < 0 || n2 > q || b2 > xmax\n";
190 //if(n1 < 0 || n1 >= q || n2 < 0 || n2 > q ||
191 // b1 < xmin || b1 > xmax || b2 < xmin || b2 > xmax )
192 //{
193 //mcerr<<"ERROR in EqualStepCoorMesh<T>::get_interval:\n"
194 // <<"n1 < 0 || n1 >= q || n2 < 0 || n2 > q || b1 < xmin || b1 >
195 // xmax || b2 < xmin || b2 > xmax\n";
196 print(mcerr);
197 Iprintn(mcerr, x);
198 Iprint4n(mcerr, n1, n2, b1, b2);
199 spexit(mcerr);
200 }
201 return 1;
202}
#define Iprint4n(file, name1, name2, name3, name4)
Definition: prstream.h:260

◆ get_interval_extrap()

template<class T >
int EqualStepCoorMesh< T >::get_interval_extrap ( x,
long &  n1,
T &  b1,
long &  n2,
T &  b2 
) const
virtual

Reimplemented in VirtEqualStepCoorMesh< T >.

Definition at line 205 of file tline.h.

206 {
207 int i_ret = 1;
208
209 if (x < xmin) {
210 i_ret = 0;
211 n1 = 0;
212 n2 = 1;
213 b1 = xmin;
214 b2 = xmin + step;
215 } else if (x >= xmax) {
216 i_ret = 2;
217 n1 = q - 1;
218 n2 = q;
219 b1 = xmax - step;
220 b2 = xmax;
221 } else {
222 n1 = long((x - xmin) / step);
223 n2 = n1 + 1;
224 if (n2 == q) {
225 b2 = xmax;
226 b1 = b2 - step;
227 } else {
228 b1 = xmin + step * n1;
229 b2 = b1 + step;
230 if (n1 < 0 || n2 > q || b2 > xmax) {
231 mcerr << "ERROR in EqualStepCoorMesh<T>::get_interval_extrap:\n"
232 << "n1 < 0 || n2 > q || b2 > xmax\n";
233 //if(n1 < 0 || n1 >= q || n2 < 0 || n2 > q ||
234 // b1 < xmin || b1 > xmax || b2 < xmin || b2 > xmax )
235 //{
236 // mcerr<<"ERROR in EqualStepCoorMesh<T>::get_interval_extrap:\n"
237 // <<"n1 < 0 || n1 >= q || n2 < 0 || n2 > q || b1 < xmin || b1
238 // > xmax || b2 < xmin || b2 > xmax\n";
239 print(mcerr);
240 Iprint4n(mcerr, n1, n2, b1, b2);
241 spexit(mcerr);
242 }
243 }
244 }
245 return i_ret;
246}

Referenced by VirtEqualStepCoorMesh< T >::get_interval_extrap().

◆ get_qi()

template<class T >
long EqualStepCoorMesh< T >::get_qi ( void  ) const
inline

Definition at line 62 of file tline.h.

62 {
63 return q;
64 } // get number of intervals

Referenced by apeq_mant(), VirtEqualStepCoorMesh< T >::get_qi(), operator!=(), and operator==().

◆ get_scoor()

template<class T >
void EqualStepCoorMesh< T >::get_scoor ( long  n,
T &  b 
) const
inline

Definition at line 70 of file tline.h.

70{ b = xmin + n * step; }

Referenced by VirtEqualStepCoorMesh< T >::get_scoor().

◆ get_step()

template<class T >
int EqualStepCoorMesh< T >::get_step ( long  n,
T &  fstep 
) const
inline

Definition at line 96 of file tline.h.

96 {
97 if (n < 0 || n >= q) return 0;
98 fstep = step;
99 return 1;
100 }

Referenced by VirtEqualStepCoorMesh< T >::get_step().

◆ get_xmax()

template<class T >
T EqualStepCoorMesh< T >::get_xmax ( void  ) const
inline

Definition at line 66 of file tline.h.

66{ return xmax; }

Referenced by apeq_mant(), VirtEqualStepCoorMesh< T >::get_xmax(), operator!=(), and operator==().

◆ get_xmin()

template<class T >
T EqualStepCoorMesh< T >::get_xmin ( void  ) const
inline

Definition at line 65 of file tline.h.

65{ return xmin; }

Referenced by apeq_mant(), VirtEqualStepCoorMesh< T >::get_xmin(), operator!=(), and operator==().

◆ print()

template<class T >
void EqualStepCoorMesh< T >::print ( std::ostream &  file) const

Definition at line 248 of file tline.h.

248 {
249 Ifile << "EqualStepCoorMesh<T>:\n";
250 indn.n += 2;
251 Ifile << "Type of T is (in internal notations) " << typeid(T).name() << '\n';
252 Iprint4n(file, q, xmin, xmax, step);
253 indn.n -= 2;
254}
indentation indn
Definition: prstream.cpp:13
#define Ifile
Definition: prstream.h:207

Referenced by operator<<(), and VirtEqualStepCoorMesh< T >::print().


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